termdock 1.4.356 → 1.4.358

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 (490) hide show
  1. package/README.md +22 -4
  2. package/dist/client/assets/AndroidMirrorView-COoPljXi.js +3 -0
  3. package/dist/client/assets/AndroidMirrorView-COoPljXi.js.br +0 -0
  4. package/dist/client/assets/AndroidMirrorView-COoPljXi.js.gz +0 -0
  5. package/dist/client/assets/App-7BA7Jt-V.js +178 -0
  6. package/dist/client/assets/App-7BA7Jt-V.js.br +0 -0
  7. package/dist/client/assets/App-7BA7Jt-V.js.gz +0 -0
  8. package/dist/client/assets/ArchitecturePanel-B51eVL3I.js +9 -0
  9. package/dist/client/assets/ArchitecturePanel-B51eVL3I.js.br +0 -0
  10. package/dist/client/assets/ArchitecturePanel-B51eVL3I.js.gz +0 -0
  11. package/dist/client/assets/{ChangeWalkthroughPanel-DO_zJfZr.js → ChangeWalkthroughPanel-ZGMybE0m.js} +2 -2
  12. package/dist/client/assets/ChangeWalkthroughPanel-ZGMybE0m.js.br +0 -0
  13. package/dist/client/assets/ChangeWalkthroughPanel-ZGMybE0m.js.gz +0 -0
  14. package/dist/client/assets/{ChatRichContent-Cu1E1cJ8.js → ChatRichContent-KkN7aIGv.js} +29 -29
  15. package/dist/client/assets/ChatRichContent-KkN7aIGv.js.br +0 -0
  16. package/dist/client/assets/ChatRichContent-KkN7aIGv.js.gz +0 -0
  17. package/dist/client/assets/CollaborationMainWorkspace-BVeBgGMT.js +1 -0
  18. package/dist/client/assets/CollaborationMainWorkspace-BVeBgGMT.js.br +0 -0
  19. package/dist/client/assets/CollaborationMainWorkspace-BVeBgGMT.js.gz +0 -0
  20. package/dist/client/assets/CollaborationTaskContent-C3Od6xQy.js +1 -0
  21. package/dist/client/assets/ComputerControlView-CnaeZBuh.js +6 -0
  22. package/dist/client/assets/ComputerControlView-CnaeZBuh.js.br +0 -0
  23. package/dist/client/assets/ComputerControlView-CnaeZBuh.js.gz +0 -0
  24. package/dist/client/assets/{DagPlayground-CPYwfryM.js → DagPlayground-E7wKGgTF.js} +1 -1
  25. package/dist/client/assets/DagPlayground-E7wKGgTF.js.br +0 -0
  26. package/dist/client/assets/DagPlayground-E7wKGgTF.js.gz +0 -0
  27. package/dist/client/assets/{DiffLab-ptw96Q_4.js → DiffLab-BMXY4mRl.js} +1 -1
  28. package/dist/client/assets/DiffLab-BMXY4mRl.js.br +0 -0
  29. package/dist/client/assets/DiffLab-BMXY4mRl.js.gz +0 -0
  30. package/dist/client/assets/DiffReview-DHi_V-SX.js +1 -0
  31. package/dist/client/assets/DiffReview-DHi_V-SX.js.br +0 -0
  32. package/dist/client/assets/DiffReview-DHi_V-SX.js.gz +0 -0
  33. package/dist/client/assets/{DiffReviewLab-eEi3y-0G.js → DiffReviewLab-nhoosNZM.js} +1 -1
  34. package/dist/client/assets/DiffReviewLab-nhoosNZM.js.br +0 -0
  35. package/dist/client/assets/DiffReviewLab-nhoosNZM.js.gz +0 -0
  36. package/dist/client/assets/{DiffViewer-DqcQxp4Q.js → DiffViewer-CyDc8WOB.js} +1 -1
  37. package/dist/client/assets/DiffViewer-CyDc8WOB.js.br +0 -0
  38. package/dist/client/assets/DiffViewer-CyDc8WOB.js.gz +0 -0
  39. package/dist/client/assets/{GitLoadingSkeleton-DYrDIDF1.js → GitLoadingSkeleton-RRbTeMuA.js} +1 -1
  40. package/dist/client/assets/GitLoadingSkeleton-RRbTeMuA.js.br +0 -0
  41. package/dist/client/assets/GitLoadingSkeleton-RRbTeMuA.js.gz +0 -0
  42. package/dist/client/assets/Markdown-DKQhs57e.css +1 -0
  43. package/dist/client/assets/Markdown-DKQhs57e.css.br +0 -0
  44. package/dist/client/assets/Markdown-DKQhs57e.css.gz +0 -0
  45. package/dist/client/assets/Markdown-Ip0FYCJ1.js +23 -0
  46. package/dist/client/assets/Markdown-Ip0FYCJ1.js.br +0 -0
  47. package/dist/client/assets/Markdown-Ip0FYCJ1.js.gz +0 -0
  48. package/dist/client/assets/{ModelPreview-DjtHLlqP.js → ModelPreview-DuwBl4st.js} +3 -3
  49. package/dist/client/assets/ModelPreview-DuwBl4st.js.br +0 -0
  50. package/dist/client/assets/ModelPreview-DuwBl4st.js.gz +0 -0
  51. package/dist/client/assets/RecordingSaveDialog-Czkjuaeu.js +1 -0
  52. package/dist/client/assets/RecordingSaveDialog-Czkjuaeu.js.br +0 -0
  53. package/dist/client/assets/RecordingSaveDialog-Czkjuaeu.js.gz +0 -0
  54. package/dist/client/assets/RightSidebar-BvYh2_n2.js +1662 -0
  55. package/dist/client/assets/RightSidebar-BvYh2_n2.js.br +0 -0
  56. package/dist/client/assets/RightSidebar-BvYh2_n2.js.gz +0 -0
  57. package/dist/client/assets/SessionChatView-hFOVLdHC.js +13 -0
  58. package/dist/client/assets/SessionChatView-hFOVLdHC.js.br +0 -0
  59. package/dist/client/assets/SessionChatView-hFOVLdHC.js.gz +0 -0
  60. package/dist/client/assets/SessionResourceSidebar-D-VXNdmE.js +2 -0
  61. package/dist/client/assets/SessionResourceSidebar-D-VXNdmE.js.br +0 -0
  62. package/dist/client/assets/SessionResourceSidebar-D-VXNdmE.js.gz +0 -0
  63. package/dist/client/assets/TodoWorkspace-CCL-wZTu.js +1 -0
  64. package/dist/client/assets/TodoWorkspace-CCL-wZTu.js.br +0 -0
  65. package/dist/client/assets/TodoWorkspace-CCL-wZTu.js.gz +0 -0
  66. package/dist/client/assets/{abnfDiagram-VCTEODGH-Cvf_KWZ0.js → abnfDiagram-VCTEODGH-CdEUK_s_.js} +1 -1
  67. package/dist/client/assets/abnfDiagram-VCTEODGH-CdEUK_s_.js.br +0 -0
  68. package/dist/client/assets/abnfDiagram-VCTEODGH-CdEUK_s_.js.gz +0 -0
  69. package/dist/client/assets/app-DZ6mCJiW.js +37 -0
  70. package/dist/client/assets/app-DZ6mCJiW.js.br +0 -0
  71. package/dist/client/assets/app-DZ6mCJiW.js.gz +0 -0
  72. package/dist/client/assets/{arc-UvdowQOf.js → arc-Dmbeqzc-.js} +1 -1
  73. package/dist/client/assets/arc-Dmbeqzc-.js.br +0 -0
  74. package/dist/client/assets/arc-Dmbeqzc-.js.gz +0 -0
  75. package/dist/client/assets/{architectureDiagram-5GKGNRK7-DotsbCCA.js → architectureDiagram-5GKGNRK7-CZcdXQrP.js} +1 -1
  76. package/dist/client/assets/architectureDiagram-5GKGNRK7-CZcdXQrP.js.br +0 -0
  77. package/dist/client/assets/{architectureDiagram-5GKGNRK7-DotsbCCA.js.gz → architectureDiagram-5GKGNRK7-CZcdXQrP.js.gz} +0 -0
  78. package/dist/client/assets/{arrow-down-FGzRy9D-.js → arrow-down-Ty3zwcgl.js} +1 -1
  79. package/dist/client/assets/{blockDiagram-I7D4REHJ-CoOfSG4k.js → blockDiagram-I7D4REHJ-D9jFhXcb.js} +1 -1
  80. package/dist/client/assets/blockDiagram-I7D4REHJ-D9jFhXcb.js.br +0 -0
  81. package/dist/client/assets/blockDiagram-I7D4REHJ-D9jFhXcb.js.gz +0 -0
  82. package/dist/client/assets/{c4Diagram-7LVT6UL2-BAfjgs8B.js → c4Diagram-7LVT6UL2-c9o0rNTP.js} +1 -1
  83. package/dist/client/assets/c4Diagram-7LVT6UL2-c9o0rNTP.js.br +0 -0
  84. package/dist/client/assets/c4Diagram-7LVT6UL2-c9o0rNTP.js.gz +0 -0
  85. package/dist/client/assets/channel-BzD84hIE.js +1 -0
  86. package/dist/client/assets/{chevron-left-xqARwD-7.js → chevron-left-CVjGQZf0.js} +1 -1
  87. package/dist/client/assets/{chunk-2Q5K7J3B-DiiQ7BvG.js → chunk-2Q5K7J3B-Bl_5wWZ4.js} +1 -1
  88. package/dist/client/assets/{chunk-5VM5RSS4-CczSK8wW.js → chunk-5VM5RSS4-D9XQn27m.js} +1 -1
  89. package/dist/client/assets/{chunk-F27PBJKO-BI3Di4Ve.js → chunk-F27PBJKO-DWyskKWD.js} +1 -1
  90. package/dist/client/assets/chunk-F27PBJKO-DWyskKWD.js.br +0 -0
  91. package/dist/client/assets/chunk-F27PBJKO-DWyskKWD.js.gz +0 -0
  92. package/dist/client/assets/{chunk-IMKFNOWR-Cvvs1wmn.js → chunk-IMKFNOWR-DrWbExPc.js} +1 -1
  93. package/dist/client/assets/chunk-IMKFNOWR-DrWbExPc.js.br +0 -0
  94. package/dist/client/assets/chunk-IMKFNOWR-DrWbExPc.js.gz +0 -0
  95. package/dist/client/assets/{chunk-JWPE2WC7-lrJRD9WA.js → chunk-JWPE2WC7-B7O1zrh6.js} +1 -1
  96. package/dist/client/assets/{chunk-POPQ4Y6H-CnPC9D8B.js → chunk-POPQ4Y6H-D7TlizKK.js} +1 -1
  97. package/dist/client/assets/{chunk-SVP7TREG-BZfMhm64.js → chunk-SVP7TREG-DNK10F6v.js} +1 -1
  98. package/dist/client/assets/chunk-SVP7TREG-DNK10F6v.js.br +0 -0
  99. package/dist/client/assets/chunk-SVP7TREG-DNK10F6v.js.gz +0 -0
  100. package/dist/client/assets/{chunk-TICWLB2K-DmkEaRK3.js → chunk-TICWLB2K-zVD9YIYY.js} +1 -1
  101. package/dist/client/assets/chunk-TICWLB2K-zVD9YIYY.js.br +0 -0
  102. package/dist/client/assets/chunk-TICWLB2K-zVD9YIYY.js.gz +0 -0
  103. package/dist/client/assets/{chunk-XXDRQBXY-BP9Lccpe.js → chunk-XXDRQBXY-bRScHSGz.js} +1 -1
  104. package/dist/client/assets/{circle-DGZOpG8V.js → circle-BIJQEbCa.js} +1 -1
  105. package/dist/client/assets/classDiagram-ZZMXUADV-DNwfONVW.js +1 -0
  106. package/dist/client/assets/classDiagram-v2-VYDZK3BY-DNwfONVW.js +1 -0
  107. package/dist/client/assets/{clipboard-rLx5CzbY.js → clipboard-DV8t7tww.js} +1 -1
  108. package/dist/client/assets/clipboardText-C4QKbGHg.css +1 -0
  109. package/dist/client/assets/clipboardText-C4QKbGHg.css.br +0 -0
  110. package/dist/client/assets/clipboardText-C4QKbGHg.css.gz +0 -0
  111. package/dist/client/assets/clipboardText-DoB9NjH8.js +1 -0
  112. package/dist/client/assets/clipboardText-DoB9NjH8.js.br +0 -0
  113. package/dist/client/assets/clipboardText-DoB9NjH8.js.gz +0 -0
  114. package/dist/client/assets/{cose-bilkent-JH36ORCC-0xPYMc2z.js → cose-bilkent-JH36ORCC-Bf6IObhf.js} +1 -1
  115. package/dist/client/assets/cose-bilkent-JH36ORCC-Bf6IObhf.js.br +0 -0
  116. package/dist/client/assets/cose-bilkent-JH36ORCC-Bf6IObhf.js.gz +0 -0
  117. package/dist/client/assets/{cynefin-OW5HDTMX-BQ7-lCHm.js → cynefin-OW5HDTMX-DAtjde93.js} +1 -1
  118. package/dist/client/assets/cynefin-OW5HDTMX-DAtjde93.js.br +0 -0
  119. package/dist/client/assets/cynefin-OW5HDTMX-DAtjde93.js.gz +0 -0
  120. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-CazHuSj1.js → cynefinDiagram-5FMLGOSQ-Bwoin99V.js} +1 -1
  121. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-Bwoin99V.js.br +0 -0
  122. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-Bwoin99V.js.gz +0 -0
  123. package/dist/client/assets/{dagre-GXQ25YYZ-CJNgsyHQ.js → dagre-GXQ25YYZ-dxPzSob9.js} +1 -1
  124. package/dist/client/assets/dagre-GXQ25YYZ-dxPzSob9.js.br +0 -0
  125. package/dist/client/assets/dagre-GXQ25YYZ-dxPzSob9.js.gz +0 -0
  126. package/dist/client/assets/{diagram-S7CK7UJ4-D4xXIj1P.js → diagram-S7CK7UJ4-BXdiLivz.js} +1 -1
  127. package/dist/client/assets/diagram-S7CK7UJ4-BXdiLivz.js.br +0 -0
  128. package/dist/client/assets/diagram-S7CK7UJ4-BXdiLivz.js.gz +0 -0
  129. package/dist/client/assets/{diagram-UQ7AKVKN-BWhpL-35.js → diagram-UQ7AKVKN-DXveP3fg.js} +1 -1
  130. package/dist/client/assets/diagram-UQ7AKVKN-DXveP3fg.js.br +0 -0
  131. package/dist/client/assets/diagram-UQ7AKVKN-DXveP3fg.js.gz +0 -0
  132. package/dist/client/assets/{diagram-VSXAHHWV-DG9A7EgJ.js → diagram-VSXAHHWV-BAZtoQue.js} +1 -1
  133. package/dist/client/assets/diagram-VSXAHHWV-BAZtoQue.js.br +0 -0
  134. package/dist/client/assets/diagram-VSXAHHWV-BAZtoQue.js.gz +0 -0
  135. package/dist/client/assets/{diagram-VX7I27RA-L5PSvynM.js → diagram-VX7I27RA-Bhc7cKpk.js} +1 -1
  136. package/dist/client/assets/diagram-VX7I27RA-Bhc7cKpk.js.br +0 -0
  137. package/dist/client/assets/diagram-VX7I27RA-Bhc7cKpk.js.gz +0 -0
  138. package/dist/client/assets/{diagram-Z3DM3KII-moBH7ruR.js → diagram-Z3DM3KII-DWIa_F-y.js} +1 -1
  139. package/dist/client/assets/diagram-Z3DM3KII-DWIa_F-y.js.br +0 -0
  140. package/dist/client/assets/diagram-Z3DM3KII-DWIa_F-y.js.gz +0 -0
  141. package/dist/client/assets/{ebnfDiagram-PWID7BFC-DEiGgcRP.js → ebnfDiagram-PWID7BFC-B3LDILSm.js} +1 -1
  142. package/dist/client/assets/ebnfDiagram-PWID7BFC-B3LDILSm.js.br +0 -0
  143. package/dist/client/assets/ebnfDiagram-PWID7BFC-B3LDILSm.js.gz +0 -0
  144. package/dist/client/assets/{erDiagram-RLTQ6QDP-BboIleYi.js → erDiagram-RLTQ6QDP-Cfu95bMX.js} +1 -1
  145. package/dist/client/assets/erDiagram-RLTQ6QDP-Cfu95bMX.js.br +0 -0
  146. package/dist/client/assets/erDiagram-RLTQ6QDP-Cfu95bMX.js.gz +0 -0
  147. package/dist/client/assets/{external-link-AZ3wjUg5.js → external-link-DodqgrCc.js} +1 -1
  148. package/dist/client/assets/{flowDiagram-HODETNUW-COxz7Rda.js → flowDiagram-HODETNUW-DVtO6aQE.js} +1 -1
  149. package/dist/client/assets/flowDiagram-HODETNUW-DVtO6aQE.js.br +0 -0
  150. package/dist/client/assets/flowDiagram-HODETNUW-DVtO6aQE.js.gz +0 -0
  151. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-_XdRvgyZ.js → ganttDiagram-EL5Y4UJY-Bh1TvYzb.js} +1 -1
  152. package/dist/client/assets/ganttDiagram-EL5Y4UJY-Bh1TvYzb.js.br +0 -0
  153. package/dist/client/assets/ganttDiagram-EL5Y4UJY-Bh1TvYzb.js.gz +0 -0
  154. package/dist/client/assets/{git-compare-90v75Jal.js → git-compare-KkbucDhN.js} +1 -1
  155. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-CBb9xBNW.js → gitGraphDiagram-WWUBYQGX-BKbRxPsF.js} +1 -1
  156. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BKbRxPsF.js.br +0 -0
  157. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BKbRxPsF.js.gz +0 -0
  158. package/dist/client/assets/index-DEAMSl55.css +1 -0
  159. package/dist/client/assets/index-DEAMSl55.css.br +0 -0
  160. package/dist/client/assets/index-DEAMSl55.css.gz +0 -0
  161. package/dist/client/assets/{infoDiagram-27XIBGKW-DjLdeNZi.js → infoDiagram-27XIBGKW-CLhO8B16.js} +1 -1
  162. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-Bcr-lhIE.js → ishikawaDiagram-5VMMS53U-BwchGTP9.js} +1 -1
  163. package/dist/client/assets/ishikawaDiagram-5VMMS53U-BwchGTP9.js.br +0 -0
  164. package/dist/client/assets/ishikawaDiagram-5VMMS53U-BwchGTP9.js.gz +0 -0
  165. package/dist/client/assets/{journeyDiagram-3NMN7TZE-3vK6s9Pq.js → journeyDiagram-3NMN7TZE-eWBpuyMm.js} +1 -1
  166. package/dist/client/assets/journeyDiagram-3NMN7TZE-eWBpuyMm.js.br +0 -0
  167. package/dist/client/assets/journeyDiagram-3NMN7TZE-eWBpuyMm.js.gz +0 -0
  168. package/dist/client/assets/{kanban-definition-UXKFOSKX-DqDYDca0.js → kanban-definition-UXKFOSKX-Sik-RHYc.js} +1 -1
  169. package/dist/client/assets/kanban-definition-UXKFOSKX-Sik-RHYc.js.br +0 -0
  170. package/dist/client/assets/kanban-definition-UXKFOSKX-Sik-RHYc.js.gz +0 -0
  171. package/dist/client/assets/{layout-C7_WwzCP.js → layout-BJX2CDWF.js} +1 -1
  172. package/dist/client/assets/layout-BJX2CDWF.js.br +0 -0
  173. package/dist/client/assets/layout-BJX2CDWF.js.gz +0 -0
  174. package/dist/client/assets/{linear-BQCRhl6P.js → linear-0FKHr918.js} +1 -1
  175. package/dist/client/assets/{linear-BQCRhl6P.js.br → linear-0FKHr918.js.br} +0 -0
  176. package/dist/client/assets/linear-0FKHr918.js.gz +0 -0
  177. package/dist/client/assets/{link-Cq14tNBm.js → link-DWUQqMDL.js} +3 -3
  178. package/dist/client/assets/link-DWUQqMDL.js.br +0 -0
  179. package/dist/client/assets/link-DWUQqMDL.js.gz +0 -0
  180. package/dist/client/assets/{list-tree-C281zrdg.js → list-tree-DxdLnXUB.js} +1 -1
  181. package/dist/client/assets/{maximize-2-CovPxWdw.js → maximize-2-Clx4ktqB.js} +1 -1
  182. package/dist/client/assets/{mermaid.core-DGsccxt-.js → mermaid.core-DWoaNsig.js} +5 -5
  183. package/dist/client/assets/mermaid.core-DWoaNsig.js.br +0 -0
  184. package/dist/client/assets/mermaid.core-DWoaNsig.js.gz +0 -0
  185. package/dist/client/assets/{mindmap-definition-YA3MSWOX-l0eF1PQE.js → mindmap-definition-YA3MSWOX-kFqW8-1C.js} +1 -1
  186. package/dist/client/assets/mindmap-definition-YA3MSWOX-kFqW8-1C.js.br +0 -0
  187. package/dist/client/assets/mindmap-definition-YA3MSWOX-kFqW8-1C.js.gz +0 -0
  188. package/dist/client/assets/{passwordBootstrap-B5VzheZz.js → passwordBootstrap-ZDVK8UPE.js} +1 -1
  189. package/dist/client/assets/passwordBootstrap-ZDVK8UPE.js.br +0 -0
  190. package/dist/client/assets/passwordBootstrap-ZDVK8UPE.js.gz +0 -0
  191. package/dist/client/assets/{pegDiagram-XKGWAZYB-fRrxGIDM.js → pegDiagram-XKGWAZYB-CndGmUtZ.js} +1 -1
  192. package/dist/client/assets/pegDiagram-XKGWAZYB-CndGmUtZ.js.br +0 -0
  193. package/dist/client/assets/pegDiagram-XKGWAZYB-CndGmUtZ.js.gz +0 -0
  194. package/dist/client/assets/{pieDiagram-E7YTZNPT-B-EBa3qN.js → pieDiagram-E7YTZNPT-Q550203T.js} +1 -1
  195. package/dist/client/assets/pieDiagram-E7YTZNPT-Q550203T.js.br +0 -0
  196. package/dist/client/assets/pieDiagram-E7YTZNPT-Q550203T.js.gz +0 -0
  197. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-Dj4e6f4h.js → quadrantDiagram-AXDQQJYC-BrjlUGzZ.js} +1 -1
  198. package/dist/client/assets/quadrantDiagram-AXDQQJYC-BrjlUGzZ.js.br +0 -0
  199. package/dist/client/assets/quadrantDiagram-AXDQQJYC-BrjlUGzZ.js.gz +0 -0
  200. package/dist/client/assets/{quote-COQfrXhi.js → quote-B9G-yF_k.js} +1 -1
  201. package/dist/client/assets/{railroadDiagram-O6MQD6OU-CEMppxTC.js → railroadDiagram-O6MQD6OU-CSqOaX_w.js} +1 -1
  202. package/dist/client/assets/railroadDiagram-O6MQD6OU-CSqOaX_w.js.br +0 -0
  203. package/dist/client/assets/railroadDiagram-O6MQD6OU-CSqOaX_w.js.gz +0 -0
  204. package/dist/client/assets/rdpSession-DdqSmi-Z.js +1 -0
  205. package/dist/client/assets/rdpSession-DdqSmi-Z.js.br +0 -0
  206. package/dist/client/assets/rdpSession-DdqSmi-Z.js.gz +0 -0
  207. package/dist/client/assets/referenceSelection-0uCpJjt2.js +4 -0
  208. package/dist/client/assets/referenceSelection-0uCpJjt2.js.br +0 -0
  209. package/dist/client/assets/referenceSelection-0uCpJjt2.js.gz +0 -0
  210. package/dist/client/assets/{requirementDiagram-BXWQKSXE-Dri1k4_x.js → requirementDiagram-BXWQKSXE-NGPth3Pf.js} +1 -1
  211. package/dist/client/assets/requirementDiagram-BXWQKSXE-NGPth3Pf.js.br +0 -0
  212. package/dist/client/assets/requirementDiagram-BXWQKSXE-NGPth3Pf.js.gz +0 -0
  213. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-CMsL_tYL.js → sankeyDiagram-P5KCCOFB-CbxpJ6iI.js} +1 -1
  214. package/dist/client/assets/sankeyDiagram-P5KCCOFB-CbxpJ6iI.js.br +0 -0
  215. package/dist/client/assets/sankeyDiagram-P5KCCOFB-CbxpJ6iI.js.gz +0 -0
  216. package/dist/client/assets/{search-Dg6HWygj.js → search-DAQ_AOVP.js} +1 -1
  217. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-4_4hZtOd.js → sequenceDiagram-WJ2MYXX4-D3gJOK25.js} +1 -1
  218. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-D3gJOK25.js.br +0 -0
  219. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-D3gJOK25.js.gz +0 -0
  220. package/dist/client/assets/{sizeCapture-INFHLROL-3QA6qj2j.js → sizeCapture-INFHLROL-D4D1KI0n.js} +1 -1
  221. package/dist/client/assets/sizeCapture-INFHLROL-D4D1KI0n.js.br +0 -0
  222. package/dist/client/assets/sizeCapture-INFHLROL-D4D1KI0n.js.gz +0 -0
  223. package/dist/client/assets/{stateDiagram-D77RDMKH-90IFPhD9.js → stateDiagram-D77RDMKH-BjtgjBg5.js} +1 -1
  224. package/dist/client/assets/stateDiagram-D77RDMKH-BjtgjBg5.js.br +0 -0
  225. package/dist/client/assets/stateDiagram-D77RDMKH-BjtgjBg5.js.gz +0 -0
  226. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BkFsvhZ0.js +1 -0
  227. package/dist/client/assets/{sun-BAMMjiA8.js → sun-DvwMJkda.js} +1 -1
  228. package/dist/client/assets/{swimlanes-42K2YHIH-BuHieVWC.js → swimlanes-42K2YHIH-C17jwdFo.js} +1 -1
  229. package/dist/client/assets/swimlanes-42K2YHIH-C17jwdFo.js.br +0 -0
  230. package/dist/client/assets/swimlanes-42K2YHIH-C17jwdFo.js.gz +0 -0
  231. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Bcw2hbFj.js +8 -0
  232. package/dist/client/assets/swiper-BaumVgFd.js +1 -0
  233. package/dist/client/assets/swiper-BaumVgFd.js.br +0 -0
  234. package/dist/client/assets/swiper-BaumVgFd.js.gz +0 -0
  235. package/dist/client/assets/{terminal-Dea8wJF3.js → terminal-DaiFCKy_.js} +7 -7
  236. package/dist/client/assets/terminal-DaiFCKy_.js.br +0 -0
  237. package/dist/client/assets/terminal-DaiFCKy_.js.gz +0 -0
  238. package/dist/client/assets/{timeline-definition-24CTP7MA-C7FpaNwf.js → timeline-definition-24CTP7MA-CtdHmPoC.js} +1 -1
  239. package/dist/client/assets/timeline-definition-24CTP7MA-CtdHmPoC.js.br +0 -0
  240. package/dist/client/assets/timeline-definition-24CTP7MA-CtdHmPoC.js.gz +0 -0
  241. package/dist/client/assets/triangle-alert-D-tt7pA2.js +1 -0
  242. package/dist/client/assets/{unplug-DN2SNXUL.js → unplug-BQxOculv.js} +1 -1
  243. package/dist/client/assets/use-gesture-react.esm-CM42s15B.js +1 -0
  244. package/dist/client/assets/use-gesture-react.esm-CM42s15B.js.br +0 -0
  245. package/dist/client/assets/use-gesture-react.esm-CM42s15B.js.gz +0 -0
  246. package/dist/client/assets/{vennDiagram-4TSXK5OY-CxoHHVcs.js → vennDiagram-4TSXK5OY-DhwCFaVe.js} +1 -1
  247. package/dist/client/assets/vennDiagram-4TSXK5OY-DhwCFaVe.js.br +0 -0
  248. package/dist/client/assets/vennDiagram-4TSXK5OY-DhwCFaVe.js.gz +0 -0
  249. package/dist/client/assets/{videoCompression-rr2lu3uy.js → videoCompression-BFhMaMl7.js} +1 -1
  250. package/dist/client/assets/videoCompression-BFhMaMl7.js.br +0 -0
  251. package/dist/client/assets/videoCompression-BFhMaMl7.js.gz +0 -0
  252. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-B4Hsh-Ad.js → wardleyDiagram-VM6X3IG4-BP4Z-QQ4.js} +1 -1
  253. package/dist/client/assets/wardleyDiagram-VM6X3IG4-BP4Z-QQ4.js.br +0 -0
  254. package/dist/client/assets/wardleyDiagram-VM6X3IG4-BP4Z-QQ4.js.gz +0 -0
  255. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-CghzsxQv.js → xychartDiagram-S5SC5T6Z-CEPWf1tk.js} +1 -1
  256. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CEPWf1tk.js.br +0 -0
  257. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CEPWf1tk.js.gz +0 -0
  258. package/dist/client/index.html +3 -3
  259. package/dist/client/index.html.br +0 -0
  260. package/dist/client/index.html.gz +0 -0
  261. package/dist/client/sw-encrypted-background.js +1 -1
  262. package/dist/client/sw-encrypted-background.js.br +0 -0
  263. package/dist/client/sw-encrypted-background.js.gz +0 -0
  264. package/dist/client/sw.js +1 -1
  265. package/dist/client/sw.js.br +0 -0
  266. package/dist/client/sw.js.gz +0 -0
  267. package/dist/server/agent/collaborationPeerTransport.js +14 -69
  268. package/dist/server/agent/collaborationStore.js +5 -0
  269. package/dist/server/agent/installers.js +89 -33
  270. package/dist/server/agent/integrationServer.js +31 -2
  271. package/dist/server/agent/pluginPackages.js +51 -22
  272. package/dist/server/agent/sessionChatRoutes.js +45 -7
  273. package/dist/server/agentHook.js +56 -12
  274. package/dist/server/android/adb.js +24 -31
  275. package/dist/server/cli.js +52 -110
  276. package/dist/server/entry.js +17 -23
  277. package/dist/server/federation/cli.js +13 -47
  278. package/dist/server/federation/connectionErrors.js +37 -0
  279. package/dist/server/federation/connectionModel.js +83 -0
  280. package/dist/server/federation/desktopTargets.js +35 -13
  281. package/dist/server/federation/directRoutes.js +28 -36
  282. package/dist/server/federation/directTargetRegistry.js +106 -0
  283. package/dist/server/federation/httpUploadLimit.js +8 -0
  284. package/dist/server/federation/relay.js +13 -6
  285. package/dist/server/federation/relayTransport.js +147 -0
  286. package/dist/server/federation/routeAccess.js +5 -3
  287. package/dist/server/federation/runtime.js +4 -2
  288. package/dist/server/federation/selfRelay.js +10 -59
  289. package/dist/server/federation/serviceTransport.js +123 -0
  290. package/dist/server/federation/streamLimits.js +3 -0
  291. package/dist/server/federation/trustedCa.js +61 -0
  292. package/dist/server/routes/android.js +5 -7
  293. package/dist/server/routes/terminal.js +149 -111
  294. package/dist/server/shared/androidDevices.js +64 -0
  295. package/dist/server/shared/programStatus.js +174 -0
  296. package/dist/server/shared/shareResources.js +3 -2
  297. package/dist/server/todos/routes.js +36 -0
  298. package/dist/server/todos/store.js +31 -1
  299. package/dist/server/utils/bootCheck.js +41 -271
  300. package/dist/server/utils/localHttpsSetup.js +257 -0
  301. package/dist/server/utils/oscBuffer.js +9 -0
  302. package/dist/server/utils/sessionDisplayName.js +11 -9
  303. package/dist/server/utils/settings.js +6 -3
  304. package/dist/server/utils/tmuxDisplayGeometry.js +54 -0
  305. package/dist/server/utils/tmuxObserverSize.js +26 -0
  306. package/docs/integrations.md +2 -1
  307. package/package.json +6 -1
  308. package/runtime-manifest.json +3 -3
  309. package/scripts/install-utils.cjs +81 -0
  310. package/scripts/postinstall.mjs +19 -106
  311. package/dist/client/assets/AndroidMirrorView-DW9oRr0w.js +0 -3
  312. package/dist/client/assets/AndroidMirrorView-DW9oRr0w.js.br +0 -0
  313. package/dist/client/assets/AndroidMirrorView-DW9oRr0w.js.gz +0 -0
  314. package/dist/client/assets/App-DEZ2i9ZZ.js +0 -178
  315. package/dist/client/assets/App-DEZ2i9ZZ.js.br +0 -0
  316. package/dist/client/assets/App-DEZ2i9ZZ.js.gz +0 -0
  317. package/dist/client/assets/ArchitecturePanel-Bf4b-6An.js +0 -9
  318. package/dist/client/assets/ArchitecturePanel-Bf4b-6An.js.br +0 -0
  319. package/dist/client/assets/ArchitecturePanel-Bf4b-6An.js.gz +0 -0
  320. package/dist/client/assets/ChangeWalkthroughPanel-DO_zJfZr.js.br +0 -0
  321. package/dist/client/assets/ChangeWalkthroughPanel-DO_zJfZr.js.gz +0 -0
  322. package/dist/client/assets/ChatRichContent-Cu1E1cJ8.js.br +0 -0
  323. package/dist/client/assets/ChatRichContent-Cu1E1cJ8.js.gz +0 -0
  324. package/dist/client/assets/CollaborationMainWorkspace-BhmpSEbf.js +0 -1
  325. package/dist/client/assets/CollaborationMainWorkspace-BhmpSEbf.js.br +0 -0
  326. package/dist/client/assets/CollaborationMainWorkspace-BhmpSEbf.js.gz +0 -0
  327. package/dist/client/assets/CollaborationTaskContent-CX0Aqdi2.js +0 -2
  328. package/dist/client/assets/ComputerControlView-DjQLzn10.js +0 -6
  329. package/dist/client/assets/ComputerControlView-DjQLzn10.js.br +0 -0
  330. package/dist/client/assets/ComputerControlView-DjQLzn10.js.gz +0 -0
  331. package/dist/client/assets/DagPlayground-CPYwfryM.js.br +0 -0
  332. package/dist/client/assets/DagPlayground-CPYwfryM.js.gz +0 -0
  333. package/dist/client/assets/DiffLab-ptw96Q_4.js.br +0 -0
  334. package/dist/client/assets/DiffLab-ptw96Q_4.js.gz +0 -0
  335. package/dist/client/assets/DiffReview-12E2zWyL.js +0 -1
  336. package/dist/client/assets/DiffReview-12E2zWyL.js.br +0 -0
  337. package/dist/client/assets/DiffReview-12E2zWyL.js.gz +0 -0
  338. package/dist/client/assets/DiffReviewLab-eEi3y-0G.js.br +0 -0
  339. package/dist/client/assets/DiffReviewLab-eEi3y-0G.js.gz +0 -0
  340. package/dist/client/assets/DiffViewer-DqcQxp4Q.js.br +0 -0
  341. package/dist/client/assets/DiffViewer-DqcQxp4Q.js.gz +0 -0
  342. package/dist/client/assets/GitLoadingSkeleton-DYrDIDF1.js.br +0 -0
  343. package/dist/client/assets/GitLoadingSkeleton-DYrDIDF1.js.gz +0 -0
  344. package/dist/client/assets/MarkdownPreview-CsJGsDRL.js +0 -19
  345. package/dist/client/assets/MarkdownPreview-CsJGsDRL.js.br +0 -0
  346. package/dist/client/assets/MarkdownPreview-CsJGsDRL.js.gz +0 -0
  347. package/dist/client/assets/ModelPreview-DjtHLlqP.js.br +0 -0
  348. package/dist/client/assets/ModelPreview-DjtHLlqP.js.gz +0 -0
  349. package/dist/client/assets/RecordingSaveDialog-DUtwgIME.js +0 -1
  350. package/dist/client/assets/RecordingSaveDialog-DUtwgIME.js.br +0 -0
  351. package/dist/client/assets/RecordingSaveDialog-DUtwgIME.js.gz +0 -0
  352. package/dist/client/assets/RightSidebar-BltjUFwI.js +0 -1662
  353. package/dist/client/assets/RightSidebar-BltjUFwI.js.br +0 -0
  354. package/dist/client/assets/RightSidebar-BltjUFwI.js.gz +0 -0
  355. package/dist/client/assets/SessionChatView-CdKfHRp8.js +0 -13
  356. package/dist/client/assets/SessionChatView-CdKfHRp8.js.br +0 -0
  357. package/dist/client/assets/SessionChatView-CdKfHRp8.js.gz +0 -0
  358. package/dist/client/assets/SessionChatView-D8GoESjb.css +0 -1
  359. package/dist/client/assets/SessionChatView-D8GoESjb.css.br +0 -0
  360. package/dist/client/assets/SessionChatView-D8GoESjb.css.gz +0 -0
  361. package/dist/client/assets/SessionResourceSidebar-DmQOydhf.js +0 -2
  362. package/dist/client/assets/SessionResourceSidebar-DmQOydhf.js.br +0 -0
  363. package/dist/client/assets/SessionResourceSidebar-DmQOydhf.js.gz +0 -0
  364. package/dist/client/assets/TodoWorkspace-Bh1C035B.js +0 -1
  365. package/dist/client/assets/TodoWorkspace-Bh1C035B.js.br +0 -0
  366. package/dist/client/assets/TodoWorkspace-Bh1C035B.js.gz +0 -0
  367. package/dist/client/assets/abnfDiagram-VCTEODGH-Cvf_KWZ0.js.br +0 -0
  368. package/dist/client/assets/abnfDiagram-VCTEODGH-Cvf_KWZ0.js.gz +0 -0
  369. package/dist/client/assets/app-DuUnqxq-.js +0 -37
  370. package/dist/client/assets/app-DuUnqxq-.js.br +0 -0
  371. package/dist/client/assets/app-DuUnqxq-.js.gz +0 -0
  372. package/dist/client/assets/arc-UvdowQOf.js.br +0 -0
  373. package/dist/client/assets/arc-UvdowQOf.js.gz +0 -0
  374. package/dist/client/assets/architectureDiagram-5GKGNRK7-DotsbCCA.js.br +0 -0
  375. package/dist/client/assets/arrow-up-DNkfesW0.js +0 -1
  376. package/dist/client/assets/blockDiagram-I7D4REHJ-CoOfSG4k.js.br +0 -0
  377. package/dist/client/assets/blockDiagram-I7D4REHJ-CoOfSG4k.js.gz +0 -0
  378. package/dist/client/assets/c4Diagram-7LVT6UL2-BAfjgs8B.js.br +0 -0
  379. package/dist/client/assets/c4Diagram-7LVT6UL2-BAfjgs8B.js.gz +0 -0
  380. package/dist/client/assets/channel-BzMU9Wks.js +0 -1
  381. package/dist/client/assets/chunk-F27PBJKO-BI3Di4Ve.js.br +0 -0
  382. package/dist/client/assets/chunk-F27PBJKO-BI3Di4Ve.js.gz +0 -0
  383. package/dist/client/assets/chunk-IMKFNOWR-Cvvs1wmn.js.br +0 -0
  384. package/dist/client/assets/chunk-IMKFNOWR-Cvvs1wmn.js.gz +0 -0
  385. package/dist/client/assets/chunk-SVP7TREG-BZfMhm64.js.br +0 -0
  386. package/dist/client/assets/chunk-SVP7TREG-BZfMhm64.js.gz +0 -0
  387. package/dist/client/assets/chunk-TICWLB2K-DmkEaRK3.js.br +0 -0
  388. package/dist/client/assets/chunk-TICWLB2K-DmkEaRK3.js.gz +0 -0
  389. package/dist/client/assets/classDiagram-ZZMXUADV-DtAtEoWU.js +0 -1
  390. package/dist/client/assets/classDiagram-v2-VYDZK3BY-DtAtEoWU.js +0 -1
  391. package/dist/client/assets/clipboardText-cZXParp1.js +0 -1
  392. package/dist/client/assets/clipboardText-cZXParp1.js.br +0 -0
  393. package/dist/client/assets/clipboardText-cZXParp1.js.gz +0 -0
  394. package/dist/client/assets/cose-bilkent-JH36ORCC-0xPYMc2z.js.br +0 -0
  395. package/dist/client/assets/cose-bilkent-JH36ORCC-0xPYMc2z.js.gz +0 -0
  396. package/dist/client/assets/cynefin-OW5HDTMX-BQ7-lCHm.js.br +0 -0
  397. package/dist/client/assets/cynefin-OW5HDTMX-BQ7-lCHm.js.gz +0 -0
  398. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CazHuSj1.js.br +0 -0
  399. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CazHuSj1.js.gz +0 -0
  400. package/dist/client/assets/dagre-GXQ25YYZ-CJNgsyHQ.js.br +0 -0
  401. package/dist/client/assets/dagre-GXQ25YYZ-CJNgsyHQ.js.gz +0 -0
  402. package/dist/client/assets/diagram-S7CK7UJ4-D4xXIj1P.js.br +0 -0
  403. package/dist/client/assets/diagram-S7CK7UJ4-D4xXIj1P.js.gz +0 -0
  404. package/dist/client/assets/diagram-UQ7AKVKN-BWhpL-35.js.br +0 -0
  405. package/dist/client/assets/diagram-UQ7AKVKN-BWhpL-35.js.gz +0 -0
  406. package/dist/client/assets/diagram-VSXAHHWV-DG9A7EgJ.js.br +0 -0
  407. package/dist/client/assets/diagram-VSXAHHWV-DG9A7EgJ.js.gz +0 -0
  408. package/dist/client/assets/diagram-VX7I27RA-L5PSvynM.js.br +0 -0
  409. package/dist/client/assets/diagram-VX7I27RA-L5PSvynM.js.gz +0 -0
  410. package/dist/client/assets/diagram-Z3DM3KII-moBH7ruR.js.br +0 -0
  411. package/dist/client/assets/diagram-Z3DM3KII-moBH7ruR.js.gz +0 -0
  412. package/dist/client/assets/ebnfDiagram-PWID7BFC-DEiGgcRP.js.br +0 -0
  413. package/dist/client/assets/ebnfDiagram-PWID7BFC-DEiGgcRP.js.gz +0 -0
  414. package/dist/client/assets/erDiagram-RLTQ6QDP-BboIleYi.js.br +0 -0
  415. package/dist/client/assets/erDiagram-RLTQ6QDP-BboIleYi.js.gz +0 -0
  416. package/dist/client/assets/flowDiagram-HODETNUW-COxz7Rda.js.br +0 -0
  417. package/dist/client/assets/flowDiagram-HODETNUW-COxz7Rda.js.gz +0 -0
  418. package/dist/client/assets/ganttDiagram-EL5Y4UJY-_XdRvgyZ.js.br +0 -0
  419. package/dist/client/assets/ganttDiagram-EL5Y4UJY-_XdRvgyZ.js.gz +0 -0
  420. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CBb9xBNW.js.br +0 -0
  421. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CBb9xBNW.js.gz +0 -0
  422. package/dist/client/assets/index-nIgxJ6I3.css +0 -1
  423. package/dist/client/assets/index-nIgxJ6I3.css.br +0 -0
  424. package/dist/client/assets/index-nIgxJ6I3.css.gz +0 -0
  425. package/dist/client/assets/ishikawaDiagram-5VMMS53U-Bcr-lhIE.js.br +0 -0
  426. package/dist/client/assets/ishikawaDiagram-5VMMS53U-Bcr-lhIE.js.gz +0 -0
  427. package/dist/client/assets/journeyDiagram-3NMN7TZE-3vK6s9Pq.js.br +0 -0
  428. package/dist/client/assets/journeyDiagram-3NMN7TZE-3vK6s9Pq.js.gz +0 -0
  429. package/dist/client/assets/kanban-definition-UXKFOSKX-DqDYDca0.js.br +0 -0
  430. package/dist/client/assets/kanban-definition-UXKFOSKX-DqDYDca0.js.gz +0 -0
  431. package/dist/client/assets/layout-C7_WwzCP.js.br +0 -0
  432. package/dist/client/assets/layout-C7_WwzCP.js.gz +0 -0
  433. package/dist/client/assets/linear-BQCRhl6P.js.gz +0 -0
  434. package/dist/client/assets/link-Cq14tNBm.js.br +0 -0
  435. package/dist/client/assets/link-Cq14tNBm.js.gz +0 -0
  436. package/dist/client/assets/loader-circle-Df0zpx5N.js +0 -1
  437. package/dist/client/assets/mermaid.core-DGsccxt-.js.br +0 -0
  438. package/dist/client/assets/mermaid.core-DGsccxt-.js.gz +0 -0
  439. package/dist/client/assets/mindmap-definition-YA3MSWOX-l0eF1PQE.js.br +0 -0
  440. package/dist/client/assets/mindmap-definition-YA3MSWOX-l0eF1PQE.js.gz +0 -0
  441. package/dist/client/assets/passwordBootstrap-B5VzheZz.js.br +0 -0
  442. package/dist/client/assets/passwordBootstrap-B5VzheZz.js.gz +0 -0
  443. package/dist/client/assets/pegDiagram-XKGWAZYB-fRrxGIDM.js.br +0 -0
  444. package/dist/client/assets/pegDiagram-XKGWAZYB-fRrxGIDM.js.gz +0 -0
  445. package/dist/client/assets/pieDiagram-E7YTZNPT-B-EBa3qN.js.br +0 -0
  446. package/dist/client/assets/pieDiagram-E7YTZNPT-B-EBa3qN.js.gz +0 -0
  447. package/dist/client/assets/quadrantDiagram-AXDQQJYC-Dj4e6f4h.js.br +0 -0
  448. package/dist/client/assets/quadrantDiagram-AXDQQJYC-Dj4e6f4h.js.gz +0 -0
  449. package/dist/client/assets/railroadDiagram-O6MQD6OU-CEMppxTC.js.br +0 -0
  450. package/dist/client/assets/railroadDiagram-O6MQD6OU-CEMppxTC.js.gz +0 -0
  451. package/dist/client/assets/rdpSession-C5rS-ImV.js +0 -1
  452. package/dist/client/assets/rdpSession-C5rS-ImV.js.br +0 -0
  453. package/dist/client/assets/rdpSession-C5rS-ImV.js.gz +0 -0
  454. package/dist/client/assets/requirementDiagram-BXWQKSXE-Dri1k4_x.js.br +0 -0
  455. package/dist/client/assets/requirementDiagram-BXWQKSXE-Dri1k4_x.js.gz +0 -0
  456. package/dist/client/assets/sankeyDiagram-P5KCCOFB-CMsL_tYL.js.br +0 -0
  457. package/dist/client/assets/sankeyDiagram-P5KCCOFB-CMsL_tYL.js.gz +0 -0
  458. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-4_4hZtOd.js.br +0 -0
  459. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-4_4hZtOd.js.gz +0 -0
  460. package/dist/client/assets/settings-2-iGqzPez0.js +0 -1
  461. package/dist/client/assets/sizeCapture-INFHLROL-3QA6qj2j.js.br +0 -0
  462. package/dist/client/assets/sizeCapture-INFHLROL-3QA6qj2j.js.gz +0 -0
  463. package/dist/client/assets/stateDiagram-D77RDMKH-90IFPhD9.js.br +0 -0
  464. package/dist/client/assets/stateDiagram-D77RDMKH-90IFPhD9.js.gz +0 -0
  465. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CH-yvmL4.js +0 -1
  466. package/dist/client/assets/swimlanes-42K2YHIH-BuHieVWC.js.br +0 -0
  467. package/dist/client/assets/swimlanes-42K2YHIH-BuHieVWC.js.gz +0 -0
  468. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-P_rDqbtg.js +0 -8
  469. package/dist/client/assets/swiper-DJjq1TYT.js +0 -1
  470. package/dist/client/assets/swiper-DJjq1TYT.js.br +0 -0
  471. package/dist/client/assets/swiper-DJjq1TYT.js.gz +0 -0
  472. package/dist/client/assets/syntaxHighlight-Cz6TPDW9.js +0 -4
  473. package/dist/client/assets/syntaxHighlight-Cz6TPDW9.js.br +0 -0
  474. package/dist/client/assets/syntaxHighlight-Cz6TPDW9.js.gz +0 -0
  475. package/dist/client/assets/terminal-Dea8wJF3.js.br +0 -0
  476. package/dist/client/assets/terminal-Dea8wJF3.js.gz +0 -0
  477. package/dist/client/assets/timeline-definition-24CTP7MA-C7FpaNwf.js.br +0 -0
  478. package/dist/client/assets/timeline-definition-24CTP7MA-C7FpaNwf.js.gz +0 -0
  479. package/dist/client/assets/triangle-alert-Oj-OsZDw.js +0 -1
  480. package/dist/client/assets/use-gesture-react.esm-DYpdiE_k.js +0 -1
  481. package/dist/client/assets/use-gesture-react.esm-DYpdiE_k.js.br +0 -0
  482. package/dist/client/assets/use-gesture-react.esm-DYpdiE_k.js.gz +0 -0
  483. package/dist/client/assets/vennDiagram-4TSXK5OY-CxoHHVcs.js.br +0 -0
  484. package/dist/client/assets/vennDiagram-4TSXK5OY-CxoHHVcs.js.gz +0 -0
  485. package/dist/client/assets/videoCompression-rr2lu3uy.js.br +0 -0
  486. package/dist/client/assets/videoCompression-rr2lu3uy.js.gz +0 -0
  487. package/dist/client/assets/wardleyDiagram-VM6X3IG4-B4Hsh-Ad.js.br +0 -0
  488. package/dist/client/assets/wardleyDiagram-VM6X3IG4-B4Hsh-Ad.js.gz +0 -0
  489. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CghzsxQv.js.br +0 -0
  490. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CghzsxQv.js.gz +0 -0
@@ -0,0 +1,178 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionChatView-hFOVLdHC.js","assets/app-DZ6mCJiW.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-DaiFCKy_.js","assets/index-DEAMSl55.css","assets/clipboardText-DoB9NjH8.js","assets/clipboardText-C4QKbGHg.css","assets/Markdown-Ip0FYCJ1.js","assets/swiper-BaumVgFd.js","assets/swiper-C2J0D0kV.css","assets/use-gesture-react.esm-CM42s15B.js","assets/referenceSelection-0uCpJjt2.js","assets/list-tree-DxdLnXUB.js","assets/Markdown-DKQhs57e.css","assets/quote-B9G-yF_k.js","assets/arrow-down-Ty3zwcgl.js","assets/videoCompression-BFhMaMl7.js","assets/RecordingSaveDialog-Czkjuaeu.js","assets/gestureArbiter-DszagC-d.js","assets/CollaborationTaskContent-C3Od6xQy.js","assets/RightSidebar-BvYh2_n2.js","assets/GitLoadingSkeleton-RRbTeMuA.js","assets/DiffReview-DHi_V-SX.js","assets/DiffViewer-CyDc8WOB.js","assets/git-compare-KkbucDhN.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-D-tt7pA2.js","assets/ChangeWalkthroughPanel-ZGMybE0m.js","assets/chevron-left-CVjGQZf0.js","assets/maximize-2-Clx4ktqB.js","assets/AndroidMirrorView-COoPljXi.js","assets/v4-EwEgHOG0.js","assets/unplug-BQxOculv.js","assets/circle-BIJQEbCa.js","assets/search-DAQ_AOVP.js","assets/RightSidebar-DW-JEgm2.css","assets/CollaborationMainWorkspace-BVeBgGMT.js","assets/link-DWUQqMDL.js","assets/clipboard-DV8t7tww.js","assets/external-link-DodqgrCc.js","assets/sun-DvwMJkda.js","assets/TodoWorkspace-CCL-wZTu.js"])))=>i.map(i=>d[i]);
2
+ import{a$ as os,bA as yd,cQ as P4,cH as q5,cq as s,S as Co,cb as id,aW as wd,ez as Xr,R as sn,dD as as,dB as ml,b2 as Ki,cM as s1,T as pl,am as O4,eO as F4,eE as V5,eI as Af,e1 as $4,a9 as Pl,eq as Ka,et as jl,bR as V0,eu as Hs,aL as Wd,dX as U4,w as z4,C as Ba,a8 as zn,an as vg,y as i1,a_ as ad,dv as sp,ec as H4,be as L0,cp as El,e4 as W4,e3 as G4,m as q4,b5 as V4,dG as fm,aY as Z4,a1 as Y4,bP as zh,aD as K4,dR as Th,e2 as X4,ei as J4,aB as e7,b$ as pm,cC as mm,dM as t7,bj as r7,dn as n7,aJ as Z5,dj as s7,dK as Y5,aT as i7,b0 as a7,x as Ti,i as o7,g as O0,eB as l7,eL as Mr,cA as c7,eK as Sr,bq as u7,eT as d7,aa as h7,cK as f7,d2 as p7,aI as Da,cS as m7,dI as yg,dJ as wg,dL as Ag,a6 as Tg,d1 as g7,dY as x7,a0 as Xu,aU as b7,ce as a1,ep as v7,dg as gm,as as Cg,bZ as y7,q as w7,eN as K5,bk as A7,cg as T7,ak as C7,er as X5,bW as Nl,bO as cl,$ as Go,I as J5,eA as xc,eH as S7,dp as L7,dZ as _7,b9 as k7,bL as I7,c$ as E7,d0 as N7,P as eb,a4 as Sg,cO as Lg,cs as tb,Q as rb,O as ui,t as od,aC as Ch,ed as ip,Z as nb,G as wc,cL as R7,bm as M7,bX as j7,ea as xm,cB as D7,dr as Q7,cz as sb,eG as B7,c3 as zo,eQ as P7,B as Ol,h as Ci,a7 as O7,j as F7,f as Ad,a2 as Js,p as Ac,N as $7,K as U7,bo as ib,aK as _0,J as M0,k as ld,d4 as ab,bi as Ju,e as Sh,ev as ob,bw as z7,cf as H7,c as W7,bd as G7,aZ as q7,dC as V7,ex as Z7,o as Y7,en as K7,d6 as F0,aN as Fl,cy as _g,dH as X7,da as lb,e7 as J7,eb as cb,ct as e8,cx as o1,L as t8,l as l1,dP as r8,dQ as n8,d7 as s8,dN as i8,dw as a8,dt as o8,u as ub,dq as l8,d9 as c8,dE as u8,cR as d8,cP as db,dz as h8,dO as f8,cU as cc,eS as p8,bh as m8,eF as hb,cu as kg,bQ as g8,bu as x8,bt as Ig,cE as b8,U as v8,cJ as y8,V as w8,ai as A8,aM as T8,d8 as C8,H as S8,d3 as L8,bg as _8,bn as k8,bp as I8,b_ as fu,n as Eg,c9 as E8,ek as N8,ca as R8,ba as M8,em as j8,ay as D8,b4 as Q8,aX as B8,a as P8,bY as O8,bc as F8,M as $8,eM as U8,bV as z8,bS as H8,bT as W8,bU as G8,bJ as ap,cV as q8,de as V8,ds as Z8,bM as Y8,b8 as K8,e5 as Ng,aA as X8,dx as fb,aQ as J8,eh as ew,eR as Bn,cT as tw,ab as rw,al as nw,d$ as sw,bI as iw,dS as Gd,c0 as Rg,dd as aw,dW as qd,eg as pu,el as ow,df as lw,e6 as cw,dT as uw,ef as op,dU as dw,dV as hw,eD as fw,b7 as pw,cD as mw,cn as Vd,cm as gw,db as Mg,dh as xw,dc as p0,di as bw,aH as vw,aV as yw,aR as ww,_ as Aw}from"./app-DZ6mCJiW.js";import{b as v,R as L,a as Tw,r as Wi}from"./dnd-BCFAPC0L.js";import{r as Cw}from"./react-XDCjal2T.js";import{H as j0,m as Sw,j as Lw,q as _w}from"./link-DWUQqMDL.js";import{p as kw,C as Iw,w as Lh,b as Ew,h as pb,u as mb,f as gb,a as xb,i as bb,g as vb,P as Nw}from"./clipboardText-DoB9NjH8.js";import{u as $0,S as Rw,a as Mw}from"./swiper-BaumVgFd.js";import{G as yb,C as Uc,S as _h,e as jw,B as Dw,L as Qw,a as jg}from"./AndroidMirrorView-COoPljXi.js";import{U as Bw,D as wb,S as Ab}from"./RecordingSaveDialog-Czkjuaeu.js";import{l as Pw}from"./terminal-DaiFCKy_.js";import{a as Ow,A as Hh,d as Wh,S as bm,P as Fw,c as $w,N as Uw,G as zw,C as Hw,b as Ww}from"./GitLoadingSkeleton-RRbTeMuA.js";import{C as Tb}from"./clipboard-DV8t7tww.js";import{v as Gw}from"./v4-EwEgHOG0.js";import{T as c1,G as qw}from"./triangle-alert-D-tt7pA2.js";import{S as $l}from"./search-DAQ_AOVP.js";import{C as Tf}from"./circle-BIJQEbCa.js";import{E as Hc}from"./external-link-DodqgrCc.js";import{M as Vw}from"./maximize-2-Clx4ktqB.js";import{G as Zw}from"./git-compare-KkbucDhN.js";import{A as Yw}from"./use-gesture-react.esm-CM42s15B.js";import{A as Kw}from"./arrow-down-Ty3zwcgl.js";import{M as Xw,S as Jw}from"./sun-DvwMJkda.js";import{K as e9,U as t9}from"./unplug-BQxOculv.js";const r9=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],n9=os("cable",r9);const s9=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],i9=os("calendar-clock",s9);const a9=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]],o9=os("chart-bar",a9);const l9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],c9=os("circle-dot",l9);const u9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Gh=os("circle-question-mark",u9);const d9=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],h9=os("clipboard-paste",d9);const f9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],p9=os("clock",f9);const m9=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],g9=os("code",m9);const x9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],b9=os("file-up",x9);const v9=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],Dg=os("grid-2x2",v9);const y9=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],w9=os("hash",y9);const A9=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],T9=os("layout-dashboard",A9);const C9=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],bc=os("layout-grid",C9);const S9=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Cb=os("list-todo",S9);const L9=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],_9=os("log-out",L9);const k9=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],I9=os("move",k9);const E9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],N9=os("panel-left",E9);const R9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],Qg=os("rows-2",R9);const M9=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Sb=os("settings",M9);const j9=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Lb=os("share-2",j9);const D9=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Q9=os("shield-alert",D9);const B9=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],P9=os("shield-check",B9);const O9=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],F9=os("stethoscope",O9);const $9=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],U9=os("type",$9);const z9=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],H9=os("unlink",z9);const W9=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],G9=os("wand-sparkles",W9);const q9=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],lp=os("workflow",q9);function _b(e,t,r){const n=[],a=new Map;for(const l of e){const c=t(l),h=c&&c.trim().length>0?c:"";let p=a.get(h);p||(p={key:h,label:h?yd(h)??h:r,sessions:[]},a.set(h,p),n.push(p)),p.sessions.push(l)}return n.sort((l,c)=>(l.key===""?1:0)-(c.key===""?1:0))}function V9(e){return e&&e.trim().length>0?e:""}function kb(e,t,r){const n=[...e],[a]=n.splice(t,1);return a?(n.splice(r,0,a),n.flatMap(l=>l.sessions.map(c=>c.id))):e.flatMap(l=>l.sessions.map(c=>c.id))}function u1(e,t){const r=new Set;return e.flatMap(n=>{const a=[...new Set(n.sessionIds)].filter(l=>t.has(l)&&!r.has(l));return!n.federated&&n.sessionIds.length>0&&a.length===0?[]:(a.forEach(l=>r.add(l)),[{...n,sessionIds:a}])})}function qh(e,t,r,n,a=[],l=[]){const c=new Map(e.map(C=>[C.id,C])),h=u1(l,new Set(c.keys())),p=new Map,m=new Map,x=a.filter(C=>C.sessionIds.length>=2&&C.sessionIds.every(S=>c.has(S))),b=(C,S)=>{const I=c.get(S);C.forEach(N=>{p.set(N,C),m.set(N,I)})};for(const C of h){const S=new Set(C.sessionIds),I=new Map;for(const W of x)W.sessionIds.every(B=>S.has(B))&&W.sessionIds.forEach(B=>I.set(B,W.sessionIds));const N=new Set,Q=C.sessionIds.flatMap(W=>{if(N.has(W))return[];const B=I.get(W)??[W];return B.forEach(U=>N.add(U)),B});b(Q,C.sessionIds[0])}for(const C of x)C.sessionIds.some(S=>p.has(S))||b(C.sessionIds,C.sessionIds[0]);const y=C=>{const S=new Set;return C.flatMap(I=>{if(S.has(I.id))return[];const N=p.get(I.id)??[I.id];return N.forEach(Q=>S.add(Q)),N.map(Q=>c.get(Q))})};if(!r)return{arranged:y(e),groups:[]};const w=_b(e,C=>t(m.get(C.id)??C),n).map(C=>({...C,sessions:y(C.sessions)}));return{arranged:w.flatMap(C=>C.sessions),groups:w}}function Z9(e,t){return e==="webgl"&&t}function Y9(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function K9(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function X9(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function J9(e,t){return!e&&t}function ba(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var eA=typeof Symbol=="function"&&Symbol.observable||"@@observable",Bg=eA,Pg=()=>Math.random().toString(36).substring(7).split("").join("."),tA={INIT:`@@redux/INIT${Pg()}`,REPLACE:`@@redux/REPLACE${Pg()}`},Og=tA;function rA(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Ib(e,t,r){if(typeof e!="function")throw new Error(ba(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(ba(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(ba(1));return r(Ib)(e,t)}let n=e,a=t,l=new Map,c=l,h=0,p=!1;function m(){c===l&&(c=new Map,l.forEach((I,N)=>{c.set(N,I)}))}function x(){if(p)throw new Error(ba(3));return a}function b(I){if(typeof I!="function")throw new Error(ba(4));if(p)throw new Error(ba(5));let N=!0;m();const Q=h++;return c.set(Q,I),function(){if(N){if(p)throw new Error(ba(6));N=!1,m(),c.delete(Q),l=null}}}function y(I){if(!rA(I))throw new Error(ba(7));if(typeof I.type>"u")throw new Error(ba(8));if(typeof I.type!="string")throw new Error(ba(17));if(p)throw new Error(ba(9));try{p=!0,a=n(a,I)}finally{p=!1}return(l=c).forEach(Q=>{Q()}),I}function w(I){if(typeof I!="function")throw new Error(ba(10));n=I,y({type:Og.REPLACE})}function C(){const I=b;return{subscribe(N){if(typeof N!="object"||N===null)throw new Error(ba(11));function Q(){const B=N;B.next&&B.next(x())}return Q(),{unsubscribe:I(Q)}},[Bg](){return this}}}return y({type:Og.INIT}),{dispatch:y,subscribe:b,getState:x,replaceReducer:w,[Bg]:C}}function Fg(e,t){return function(...r){return t(e.apply(this,r))}}function $g(e,t){if(typeof e=="function")return Fg(e,t);if(typeof e!="object"||e===null)throw new Error(ba(16));const r={};for(const n in e){const a=e[n];typeof a=="function"&&(r[n]=Fg(a,t))}return r}function Eb(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function nA(...e){return t=>(r,n)=>{const a=t(r,n);let l=()=>{throw new Error(ba(15))};const c={getState:a.getState,dispatch:(p,...m)=>l(p,...m)},h=e.map(p=>p(c));return l=Eb(...h)(a.dispatch),{...a,dispatch:l}}}var cp={exports:{}},up={};var Ug;function sA(){if(Ug)return up;Ug=1;var e=Cw();function t(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,a=e.useRef,l=e.useEffect,c=e.useMemo,h=e.useDebugValue;return up.useSyncExternalStoreWithSelector=function(p,m,x,b,y){var w=a(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=c(function(){function I(U){if(!N){if(N=!0,Q=U,U=b(U),y!==void 0&&C.hasValue){var K=C.value;if(y(K,U))return W=K}return W=U}if(K=W,r(Q,U))return K;var re=b(U);return y!==void 0&&y(K,re)?(Q=U,K):(Q=U,W=re)}var N=!1,Q,W,B=x===void 0?null:x;return[function(){return I(m())},B===null?void 0:function(){return I(B())}]},[m,x,b,y]);var S=n(p,w[0],w[1]);return l(function(){C.hasValue=!0,C.value=S},[S]),h(S),S},up}var zg;function iA(){return zg||(zg=1,cp.exports=sA()),cp.exports}iA();var aA=v.version.startsWith("19"),oA=Symbol.for(aA?"react.transitional.element":"react.element"),lA=Symbol.for("react.portal"),cA=Symbol.for("react.fragment"),uA=Symbol.for("react.strict_mode"),dA=Symbol.for("react.profiler"),hA=Symbol.for("react.consumer"),fA=Symbol.for("react.context"),Nb=Symbol.for("react.forward_ref"),pA=Symbol.for("react.suspense"),mA=Symbol.for("react.suspense_list"),d1=Symbol.for("react.memo"),gA=Symbol.for("react.lazy"),xA=Nb,bA=d1;function vA(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case oA:switch(e=e.type,e){case cA:case dA:case uA:case pA:case mA:return e;default:switch(e=e&&e.$$typeof,e){case fA:case Nb:case gA:case d1:return e;case hA:return e;default:return t}}case lA:return t}}}function yA(e){return vA(e)===d1}function wA(e,t,r,n,{areStatesEqual:a,areOwnPropsEqual:l,areStatePropsEqual:c}){let h=!1,p,m,x,b,y;function w(Q,W){return p=Q,m=W,x=e(p,m),b=t(n,m),y=r(x,b,m),h=!0,y}function C(){return x=e(p,m),t.dependsOnOwnProps&&(b=t(n,m)),y=r(x,b,m),y}function S(){return e.dependsOnOwnProps&&(x=e(p,m)),t.dependsOnOwnProps&&(b=t(n,m)),y=r(x,b,m),y}function I(){const Q=e(p,m),W=!c(Q,x);return x=Q,W&&(y=r(x,b,m)),y}function N(Q,W){const B=!l(W,m),U=!a(Q,p,W,m);return p=Q,m=W,B&&U?C():B?S():U?I():y}return function(W,B){return h?N(W,B):w(W,B)}}function AA(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:n,...a}){const l=t(e,a),c=r(e,a),h=n(e,a);return wA(l,c,h,e,a)}function TA(e,t){const r={};for(const n in e){const a=e[n];typeof a=="function"&&(r[n]=(...l)=>t(a(...l)))}return r}function vm(e){return function(r){const n=e(r);function a(){return n}return a.dependsOnOwnProps=!1,a}}function Hg(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function Rb(e,t){return function(n,{displayName:a}){const l=function(h,p){return l.dependsOnOwnProps?l.mapToProps(h,p):l.mapToProps(h,void 0)};return l.dependsOnOwnProps=!0,l.mapToProps=function(h,p){l.mapToProps=e,l.dependsOnOwnProps=Hg(e);let m=l(h,p);return typeof m=="function"&&(l.mapToProps=m,l.dependsOnOwnProps=Hg(m),m=l(h,p)),m},l}}function h1(e,t){return(r,n)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${n.wrappedComponentName}.`)}}function CA(e){return e&&typeof e=="object"?vm(t=>TA(e,t)):e?typeof e=="function"?Rb(e):h1(e,"mapDispatchToProps"):vm(t=>({dispatch:t}))}function SA(e){return e?typeof e=="function"?Rb(e):h1(e,"mapStateToProps"):vm(()=>({}))}function LA(e,t,r){return{...r,...e,...t}}function _A(e){return function(r,{displayName:n,areMergedPropsEqual:a}){let l=!1,c;return function(p,m,x){const b=e(p,m,x);return l?a(b,c)||(c=b):(l=!0,c=b),c}}}function kA(e){return e?typeof e=="function"?_A(e):h1(e,"mergeProps"):()=>LA}function IA(e){e()}function EA(){let e=null,t=null;return{clear(){e=null,t=null},notify(){IA(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const a=t={callback:r,next:null,prev:t};return a.prev?a.prev.next=a:e=a,function(){!n||e===null||(n=!1,a.next?a.next.prev=a.prev:t=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}var Wg={notify(){},get:()=>[]};function Mb(e,t){let r,n=Wg,a=0,l=!1;function c(S){x();const I=n.subscribe(S);let N=!1;return()=>{N||(N=!0,I(),b())}}function h(){n.notify()}function p(){C.onStateChange&&C.onStateChange()}function m(){return l}function x(){a++,r||(r=t?t.addNestedSub(p):e.subscribe(p),n=EA())}function b(){a--,r&&a===0&&(r(),r=void 0,n.clear(),n=Wg)}function y(){l||(l=!0,x())}function w(){l&&(l=!1,b())}const C={addNestedSub:c,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:m,trySubscribe:y,tryUnsubscribe:w,getListeners:()=>n};return C}var NA=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",RA=NA(),MA=()=>typeof navigator<"u"&&navigator.product==="ReactNative",jA=MA(),DA=()=>RA||jA?v.useLayoutEffect:v.useEffect,Vh=DA();function Gg(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function dp(e,t){if(Gg(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let a=0;a<r.length;a++)if(!Object.prototype.hasOwnProperty.call(t,r[a])||!Gg(e[r[a]],t[r[a]]))return!1;return!0}var QA={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},BA={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},PA={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},jb={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},OA={[xA]:PA,[bA]:jb};function qg(e){return yA(e)?jb:OA[e.$$typeof]||QA}var FA=Object.defineProperty,$A=Object.getOwnPropertyNames,Vg=Object.getOwnPropertySymbols,UA=Object.getOwnPropertyDescriptor,zA=Object.getPrototypeOf,Zg=Object.prototype;function ym(e,t){if(typeof t!="string"){if(Zg){const l=zA(t);l&&l!==Zg&&ym(e,l)}let r=$A(t);Vg&&(r=r.concat(Vg(t)));const n=qg(e),a=qg(t);for(let l=0;l<r.length;++l){const c=r[l];if(!BA[c]&&!(a&&a[c])&&!(n&&n[c])){const h=UA(t,c);try{FA(e,c,h)}catch{}}}}return e}var HA=Symbol.for("react-redux-context"),WA=typeof globalThis<"u"?globalThis:{};function GA(){if(!v.createContext)return{};const e=WA[HA]??=new Map;let t=e.get(v.createContext);return t||(t=v.createContext(null),e.set(v.createContext,t)),t}var Db=GA(),qA=[null,null];function VA(e,t,r){Vh(()=>e(...t),r)}function ZA(e,t,r,n,a,l){e.current=n,r.current=!1,a.current&&(a.current=null,l())}function YA(e,t,r,n,a,l,c,h,p,m,x){if(!e)return()=>{};let b=!1,y=null;const w=()=>{if(b||!h.current)return;const S=t.getState();let I,N;try{I=n(S,a.current)}catch(Q){N=Q,y=Q}N||(y=null),I===l.current?c.current||m():(l.current=I,p.current=I,c.current=!0,x())};return r.onStateChange=w,r.trySubscribe(),w(),()=>{if(b=!0,r.tryUnsubscribe(),r.onStateChange=null,y)throw y}}function KA(e,t){return e===t}function XA(e,t,r,{pure:n,areStatesEqual:a=KA,areOwnPropsEqual:l=dp,areStatePropsEqual:c=dp,areMergedPropsEqual:h=dp,forwardRef:p=!1,context:m=Db}={}){const x=m,b=SA(e),y=CA(t),w=kA(r),C=!!e;return I=>{const N=I.displayName||I.name||"Component",Q=`Connect(${N})`,W={shouldHandleStateChanges:C,displayName:Q,wrappedComponentName:N,WrappedComponent:I,initMapStateToProps:b,initMapDispatchToProps:y,initMergeProps:w,areStatesEqual:a,areStatePropsEqual:c,areOwnPropsEqual:l,areMergedPropsEqual:h};function B(re){const[H,Oe,ne]=v.useMemo(()=>{const{reactReduxForwardedRef:mt,...It}=re;return[re.context,mt,It]},[re]),ce=v.useMemo(()=>{let mt=x;return H?.Consumer,mt},[H,x]),Ne=v.useContext(ce),Me=!!re.store&&!!re.store.getState&&!!re.store.dispatch,be=!!Ne&&!!Ne.store,V=Me?re.store:Ne.store,Ke=be?Ne.getServerState:V.getState,he=v.useMemo(()=>AA(V.dispatch,W),[V]),[Be,ae]=v.useMemo(()=>{if(!C)return qA;const mt=Mb(V,Me?void 0:Ne.subscription),It=mt.notifyNestedSubs.bind(mt);return[mt,It]},[V,Me,Ne]),X=v.useMemo(()=>Me?Ne:{...Ne,subscription:Be},[Me,Ne,Be]),He=v.useRef(void 0),je=v.useRef(ne),ve=v.useRef(void 0),Fe=v.useRef(!1),lt=v.useRef(!1),ye=v.useRef(void 0);Vh(()=>(lt.current=!0,()=>{lt.current=!1}),[]);const de=v.useMemo(()=>()=>ve.current&&ne===je.current?ve.current:he(V.getState(),ne),[V,ne]),nt=v.useMemo(()=>It=>Be?YA(C,V,Be,he,je,He,Fe,lt,ve,ae,It):()=>{},[Be]);VA(ZA,[je,He,Fe,ne,ve,ae]);let Xe;try{Xe=v.useSyncExternalStore(nt,de,Ke?()=>he(Ke(),ne):de)}catch(mt){throw ye.current&&(mt.message+=`
3
+ The error may be correlated with this previous error:
4
+ ${ye.current.stack}
5
+
6
+ `),mt}Vh(()=>{ye.current=void 0,ve.current=void 0,He.current=Xe});const pt=v.useMemo(()=>v.createElement(I,{...Xe,ref:Oe}),[Oe,I,Xe]);return v.useMemo(()=>C?v.createElement(ce.Provider,{value:X},pt):pt,[ce,pt,X])}const K=v.memo(B);if(K.WrappedComponent=I,K.displayName=B.displayName=Q,p){const H=v.forwardRef(function(ne,ce){return v.createElement(K,{...ne,reactReduxForwardedRef:ce})});return H.displayName=Q,H.WrappedComponent=I,ym(H,I)}return ym(K,I)}}var Qb=XA;function JA(e){const{children:t,context:r,serverState:n,store:a}=e,l=v.useMemo(()=>{const p=Mb(a);return{store:a,subscription:p,getServerState:n?()=>n:void 0}},[a,n]),c=v.useMemo(()=>a.getState(),[a]);Vh(()=>{const{subscription:p}=l;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),c!==a.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[l,c]);const h=r||Db;return v.createElement(h.Provider,{value:l},t)}var eT=JA,tT="Invariant failed";function rT(e,t){throw new Error(tT)}var Wo=function(t){var r=t.top,n=t.right,a=t.bottom,l=t.left,c=n-l,h=a-r,p={top:r,right:n,bottom:a,left:l,width:c,height:h,x:l,y:r,center:{x:(n+l)/2,y:(a+r)/2}};return p},f1=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},Yg=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},nT=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},hp={top:0,right:0,bottom:0,left:0},p1=function(t){var r=t.borderBox,n=t.margin,a=n===void 0?hp:n,l=t.border,c=l===void 0?hp:l,h=t.padding,p=h===void 0?hp:h,m=Wo(f1(r,a)),x=Wo(Yg(r,c)),b=Wo(Yg(x,p));return{marginBox:m,borderBox:Wo(r),paddingBox:x,contentBox:b,margin:a,border:c,padding:p}},fo=function(t){var r=t.slice(0,-2),n=t.slice(-2);if(n!=="px")return 0;var a=Number(r);return isNaN(a)&&rT(),a},sT=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Zh=function(t,r){var n=t.borderBox,a=t.border,l=t.margin,c=t.padding,h=nT(n,r);return p1({borderBox:h,border:a,margin:l,padding:c})},Yh=function(t,r){return r===void 0&&(r=sT()),Zh(t,r)},Bb=function(t,r){var n={top:fo(r.marginTop),right:fo(r.marginRight),bottom:fo(r.marginBottom),left:fo(r.marginLeft)},a={top:fo(r.paddingTop),right:fo(r.paddingRight),bottom:fo(r.paddingBottom),left:fo(r.paddingLeft)},l={top:fo(r.borderTopWidth),right:fo(r.borderRightWidth),bottom:fo(r.borderBottomWidth),left:fo(r.borderLeftWidth)};return p1({borderBox:t,margin:n,padding:a,border:l})},Pb=function(t){var r=t.getBoundingClientRect(),n=window.getComputedStyle(t);return Bb(r,n)},cd=function(t){var r=[],n=null,a=function(){for(var c=arguments.length,h=new Array(c),p=0;p<c;p++)h[p]=arguments[p];r=h,!n&&(n=requestAnimationFrame(function(){n=null,t.apply(void 0,r)}))};return a.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},a};function Kh(){return Kh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kh.apply(null,arguments)}function Ob(e,t){}Ob.bind(null,"warn");Ob.bind(null,"error");function mc(){}function iT(e,t){return{...e,...t}}function So(e,t,r){const n=t.map(a=>{const l=iT(r,a.options);return e.addEventListener(a.eventName,a.fn,l),function(){e.removeEventListener(a.eventName,a.fn,l)}});return function(){n.forEach(l=>{l()})}}const aT="Invariant failed";class Xh extends Error{}Xh.prototype.toString=function(){return this.message};function jt(e,t){throw new Xh(aT)}class oT extends L.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=mc,this.onWindowError=r=>{const n=this.getCallbacks();n.isDragging()&&n.tryAbort(),r.error instanceof Xh&&r.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=r=>{this.callbacks=r}}componentDidMount(){this.unbind=So(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Xh){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const lT=`
7
+ Press space bar to start a drag.
8
+ When dragging you can use the arrow keys to move the item around and escape to cancel.
9
+ Some screen readers may require you to be in focus mode or to use your pass through key
10
+ `,Jh=e=>e+1,cT=e=>`
11
+ You have lifted an item in position ${Jh(e.source.index)}
12
+ `,Fb=(e,t)=>{const r=e.droppableId===t.droppableId,n=Jh(e.index),a=Jh(t.index);return r?`
13
+ You have moved the item from position ${n}
14
+ to position ${a}
15
+ `:`
16
+ You have moved the item from position ${n}
17
+ in list ${e.droppableId}
18
+ to list ${t.droppableId}
19
+ in position ${a}
20
+ `},$b=(e,t,r)=>t.droppableId===r.droppableId?`
21
+ The item ${e}
22
+ has been combined with ${r.draggableId}`:`
23
+ The item ${e}
24
+ in list ${t.droppableId}
25
+ has been combined with ${r.draggableId}
26
+ in list ${r.droppableId}
27
+ `,uT=e=>{const t=e.destination;if(t)return Fb(e.source,t);const r=e.combine;return r?$b(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},Kg=e=>`
28
+ The item has returned to its starting position
29
+ of ${Jh(e.index)}
30
+ `,dT=e=>{if(e.reason==="CANCEL")return`
31
+ Movement cancelled.
32
+ ${Kg(e.source)}
33
+ `;const t=e.destination,r=e.combine;return t?`
34
+ You have dropped the item.
35
+ ${Fb(e.source,t)}
36
+ `:r?`
37
+ You have dropped the item.
38
+ ${$b(e.draggableId,e.source,r)}
39
+ `:`
40
+ The item has been dropped while not over a drop area.
41
+ ${Kg(e.source)}
42
+ `},kh={dragHandleUsageInstructions:lT,onDragStart:cT,onDragUpdate:uT,onDragEnd:dT};function hT(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function Ub(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!hT(e[r],t[r]))return!1;return!0}function vn(e,t){const r=v.useState(()=>({inputs:t,result:e()}))[0],n=v.useRef(!0),a=v.useRef(r),c=n.current||!!(t&&a.current.inputs&&Ub(t,a.current.inputs))?a.current:{inputs:t,result:e()};return v.useEffect(()=>{n.current=!1,a.current=c},[c]),c.result}function vr(e,t){return vn(()=>e,t)}const Li={x:0,y:0},Hi=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Xa=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),gc=(e,t)=>e.x===t.x&&e.y===t.y,Z0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Yc=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},ud=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Xg=(e,t)=>Math.min(...t.map(r=>ud(e,r))),zb=e=>t=>({x:e(t.x),y:e(t.y)});var fT=(e,t)=>{const r=Wo({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return r.width<=0||r.height<=0?null:r};const Td=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Jg=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],pT={top:0,right:0,bottom:0,left:0},mT=(e,t)=>t?Td(e,t.scroll.diff.displacement):e,gT=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,xT=(e,t)=>t&&t.shouldClipSubject?fT(t.pageMarginBox,e):Wo(e);var U0=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const a=mT(e.marginBox,n),l=gT(a,r,t),c=xT(l,n);return{page:e,withPlaceholder:t,active:c}},m1=(e,t)=>{e.frame||jt();const r=e.frame,n=Xa(t,r.scroll.initial),a=Z0(n),l={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:a},max:r.scroll.max}},c=U0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:l});return{...e,frame:l,subject:c}};function Si(e,t=Ub){let r=null;function n(...a){if(r&&r.lastThis===this&&t(a,r.lastArgs))return r.lastResult;const l=e.apply(this,a);return r={lastResult:l,lastArgs:a,lastThis:this},l}return n.clear=function(){r=null},n}const Hb=Si(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Wb=Si(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Cf=Si(e=>Object.values(e)),bT=Si(e=>Object.values(e));var Y0=Si((e,t)=>bT(t).filter(n=>e===n.descriptor.droppableId).sort((n,a)=>n.descriptor.index-a.descriptor.index));function g1(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Sf(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Lf=Si((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),vT=({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:a})=>{if(!r.isCombineEnabled||!g1(a))return null;function c(w){const C={type:"COMBINE",combine:{draggableId:w,droppableId:r.descriptor.id}};return{...a,at:C}}const h=a.displaced.all,p=h.length?h[0]:null;if(e)return p?c(p):null;const m=Lf(t,n);if(!p){if(!m.length)return null;const w=m[m.length-1];return c(w.descriptor.id)}const x=m.findIndex(w=>w.descriptor.id===p);x===-1&&jt();const b=x-1;if(b<0)return null;const y=m[b];return c(y.descriptor.id)},K0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const Gb={point:Li,value:0},dd={invisible:{},visible:{},all:[]},yT={displaced:dd,displacedBy:Gb,at:null};var Lo=(e,t)=>r=>e<=r&&r<=t,qb=e=>{const t=Lo(e.top,e.bottom),r=Lo(e.left,e.right);return n=>{if(t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right))return!0;const l=t(n.top)||t(n.bottom),c=r(n.left)||r(n.right);if(l&&c)return!0;const p=n.top<e.top&&n.bottom>e.bottom,m=n.left<e.left&&n.right>e.right;return p&&m?!0:p&&c||m&&l}},wT=e=>{const t=Lo(e.top,e.bottom),r=Lo(e.left,e.right);return n=>t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right)};const x1={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Vb={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var AT=e=>t=>{const r=Lo(t.top,t.bottom),n=Lo(t.left,t.right);return a=>e===x1?r(a.top)&&r(a.bottom):n(a.left)&&n(a.right)};const TT=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:Li;return Td(e,r)},CT=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,ST=(e,t,r)=>r(t)(e),b1=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:a})=>{const l=n?TT(e,t):e;return CT(l,t,a)&&ST(l,r,a)},LT=e=>b1({...e,isVisibleThroughFrameFn:qb}),Zb=e=>b1({...e,isVisibleThroughFrameFn:wT}),_T=e=>b1({...e,isVisibleThroughFrameFn:AT(e.destination.axis)}),kT=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:n,visible:a}=t;if(n[e])return!1;const l=a[e];return l?l.shouldAnimate:!0};function IT(e,t){const r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return Wo(f1(r,n))}function hd({afterDragging:e,destination:t,displacedBy:r,viewport:n,forceShouldAnimate:a,last:l}){return e.reduce(function(h,p){const m=IT(p,r),x=p.descriptor.id;if(h.all.push(x),!LT({target:m,destination:t,viewport:n,withDroppableDisplacement:!0}))return h.invisible[p.descriptor.id]=!0,h;const y=kT(x,l,a),w={draggableId:x,shouldAnimate:y};return h.visible[x]=w,h},{all:[],visible:{},invisible:{}})}function ET(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function e2({insideDestination:e,inHomeList:t,displacedBy:r,destination:n}){const a=ET(e,{inHomeList:t});return{displaced:dd,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}function ef({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:a,last:l,index:c,forceShouldAnimate:h}){const p=K0(e,r);if(c==null)return e2({insideDestination:t,inHomeList:p,displacedBy:a,destination:r});const m=t.find(C=>C.descriptor.index===c);if(!m)return e2({insideDestination:t,inHomeList:p,displacedBy:a,destination:r});const x=Lf(e,t),b=t.indexOf(m),y=x.slice(b);return{displaced:hd({afterDragging:y,destination:r,displacedBy:a,last:l,viewport:n.frame,forceShouldAnimate:h}),displacedBy:a,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:c}}}}function vc(e,t){return!!t.effected[e]}var NT=({isMovingForward:e,destination:t,draggables:r,combine:n,afterCritical:a})=>{if(!t.isCombineEnabled)return null;const l=n.draggableId,h=r[l].descriptor.index;return vc(l,a)?e?h:h-1:e?h+1:h},RT=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:n})=>{if(!r.length)return null;const a=n.index,l=e?a+1:a-1,c=r[0].descriptor.index,h=r[r.length-1].descriptor.index,p=t?h:h+1;return l<c||l>p?null:l},MT=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:a,insideDestination:l,previousImpact:c,viewport:h,afterCritical:p})=>{const m=c.at;if(m||jt(),m.type==="REORDER"){const b=RT({isMovingForward:e,isInHomeList:t,location:m.destination,insideDestination:l});return b==null?null:ef({draggable:r,insideDestination:l,destination:a,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:b})}const x=NT({isMovingForward:e,destination:a,displaced:c.displaced,draggables:n,combine:m.combine,afterCritical:p});return x==null?null:ef({draggable:r,insideDestination:l,destination:a,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:x})},jT=({displaced:e,afterCritical:t,combineWith:r,displacedBy:n})=>{const a=!!(e.visible[r]||e.invisible[r]);return vc(r,t)?a?Li:Z0(n.point):a?n.point:Li},DT=({afterCritical:e,impact:t,draggables:r})=>{const n=Sf(t);n||jt();const a=n.draggableId,l=r[a].page.borderBox.center,c=jT({displaced:t.displaced,afterCritical:e,combineWith:a,displacedBy:t.displacedBy});return Hi(l,c)};const Yb=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,QT=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,v1=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,t2=({axis:e,moveRelativeTo:t,isMoving:r})=>Yc(e.line,t.marginBox[e.end]+Yb(e,r),v1(e,t.marginBox,r)),r2=({axis:e,moveRelativeTo:t,isMoving:r})=>Yc(e.line,t.marginBox[e.start]-QT(e,r),v1(e,t.marginBox,r)),BT=({axis:e,moveInto:t,isMoving:r})=>Yc(e.line,t.contentBox[e.start]+Yb(e,r),v1(e,t.contentBox,r));var PT=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:a})=>{const l=Y0(n.descriptor.id,r),c=t.page,h=n.axis;if(!l.length)return BT({axis:h,moveInto:n.page,isMoving:c});const{displaced:p,displacedBy:m}=e,x=p.all[0];if(x){const y=r[x];if(vc(x,a))return r2({axis:h,moveRelativeTo:y.page,isMoving:c});const w=Zh(y.page,m.point);return r2({axis:h,moveRelativeTo:w,isMoving:c})}const b=l[l.length-1];if(b.descriptor.id===t.descriptor.id)return c.borderBox.center;if(vc(b.descriptor.id,a)){const y=Zh(b.page,Z0(a.displacedBy.point));return t2({axis:h,moveRelativeTo:y,isMoving:c})}return t2({axis:h,moveRelativeTo:b.page,isMoving:c})},wm=(e,t)=>{const r=e.frame;return r?Hi(t,r.scroll.diff.displacement):t};const OT=({impact:e,draggable:t,droppable:r,draggables:n,afterCritical:a})=>{const l=t.page.borderBox.center,c=e.at;return!r||!c?l:c.type==="REORDER"?PT({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:a}):DT({impact:e,draggables:n,afterCritical:a})};var _f=e=>{const t=OT(e),r=e.droppable;return r?wm(r,t):t},Kb=(e,t)=>{const r=Xa(t,e.scroll.initial),n=Z0(r);return{frame:Wo({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:r,displacement:n}}}};function n2(e,t){return e.map(r=>t[r])}function FT(e,t){for(let r=0;r<t.length;r++){const n=t[r].visible[e];if(n)return n}return null}var $T=({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:a})=>{const l=Kb(t,Hi(t.scroll.current,a)),c=r.frame?m1(r,Hi(r.frame.scroll.current,a)):r,h=e.displaced,p=hd({afterDragging:n2(h.all,n),destination:r,displacedBy:e.displacedBy,viewport:l.frame,last:h,forceShouldAnimate:!1}),m=hd({afterDragging:n2(h.all,n),destination:c,displacedBy:e.displacedBy,viewport:t.frame,last:h,forceShouldAnimate:!1}),x={},b={},y=[h,p,m];return h.all.forEach(C=>{const S=FT(C,y);if(S){b[C]=S;return}x[C]=!0}),{...e,displaced:{all:h.all,invisible:x,visible:b}}},UT=(e,t)=>Hi(e.scroll.diff.displacement,t),y1=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=UT(r,e),a=Xa(n,t.page.borderBox.center);return Hi(t.client.borderBox.center,a)},Xb=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:a,onlyOnMainAxis:l=!1})=>{const c=Xa(r,e.page.borderBox.center),p={target:Td(e.page.borderBox,c),destination:t,withDroppableDisplacement:a,viewport:n};return l?_T(p):Zb(p)},zT=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:a,viewport:l,previousPageBorderBoxCenter:c,previousClientSelection:h,afterCritical:p})=>{if(!r.isEnabled)return null;const m=Y0(r.descriptor.id,n),x=K0(t,r),b=vT({isMovingForward:e,draggable:t,destination:r,insideDestination:m,previousImpact:a})||MT({isMovingForward:e,isInHomeList:x,draggable:t,draggables:n,destination:r,insideDestination:m,previousImpact:a,viewport:l,afterCritical:p});if(!b)return null;const y=_f({impact:b,draggable:t,droppable:r,draggables:n,afterCritical:p});if(Xb({draggable:t,destination:r,newPageBorderBoxCenter:y,viewport:l.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:y1({pageBorderBoxCenter:y,draggable:t,viewport:l}),impact:b,scrollJumpRequest:null};const C=Xa(y,c),S=$T({impact:b,viewport:l,destination:r,draggables:n,maxScrollChange:C});return{clientSelection:h,impact:S,scrollJumpRequest:C}};const fa=e=>{const t=e.subject.active;return t||jt(),t};var HT=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:n,viewport:a})=>{const l=r.subject.active;if(!l)return null;const c=r.axis,h=Lo(l[c.start],l[c.end]),p=Cf(n).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>qb(a.frame)(fa(x))).filter(x=>{const b=fa(x);return e?l[c.crossAxisEnd]<b[c.crossAxisEnd]:b[c.crossAxisStart]<l[c.crossAxisStart]}).filter(x=>{const b=fa(x),y=Lo(b[c.start],b[c.end]);return h(b[c.start])||h(b[c.end])||y(l[c.start])||y(l[c.end])}).sort((x,b)=>{const y=fa(x)[c.crossAxisStart],w=fa(b)[c.crossAxisStart];return e?y-w:w-y}).filter((x,b,y)=>fa(x)[c.crossAxisStart]===fa(y[0])[c.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const m=p.filter(x=>Lo(fa(x)[c.start],fa(x)[c.end])(t[c.line]));return m.length===1?m[0]:m.length>1?m.sort((x,b)=>fa(x)[c.start]-fa(b)[c.start])[0]:p.sort((x,b)=>{const y=Xg(t,Jg(fa(x))),w=Xg(t,Jg(fa(b)));return y!==w?y-w:fa(x)[c.start]-fa(b)[c.start]})[0]};const s2=(e,t)=>{const r=e.page.borderBox.center;return vc(e.descriptor.id,t)?Xa(r,t.displacedBy.point):r},WT=(e,t)=>{const r=e.page.borderBox;return vc(e.descriptor.id,t)?Td(r,Z0(t.displacedBy.point)):r};var GT=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:a})=>n.filter(c=>Zb({target:WT(c,a),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((c,h)=>{const p=ud(e,wm(r,s2(c,a))),m=ud(e,wm(r,s2(h,a)));return p<m?-1:m<p?1:c.descriptor.index-h.descriptor.index})[0]||null,Cd=Si(function(t,r){const n=r[t.line];return{value:n,point:Yc(t.line,n)}});const qT=(e,t,r)=>{const n=e.axis;if(e.descriptor.mode==="virtual")return Yc(n.line,t[n.line]);const a=e.subject.page.contentBox[n.size],p=Y0(e.descriptor.id,r).reduce((m,x)=>m+x.client.marginBox[n.size],0)+t[n.line]-a;return p<=0?null:Yc(n.line,p)},Jb=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),e3=(e,t,r)=>{const n=e.frame;K0(t,e)&&jt(),e.subject.withPlaceholder&&jt();const a=Cd(e.axis,t.displaceBy).point,l=qT(e,a,r),c={placeholderSize:a,increasedBy:l,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const x=U0({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:e.frame});return{...e,subject:x}}const h=l?Hi(n.scroll.max,l):n.scroll.max,p=Jb(n,h),m=U0({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:p});return{...e,subject:m,frame:p}},VT=e=>{const t=e.subject.withPlaceholder;t||jt();const r=e.frame;if(!r){const c=U0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:c}}const n=t.oldFrameMaxScroll;n||jt();const a=Jb(r,n),l=U0({page:e.subject.page,axis:e.axis,frame:a,withPlaceholder:null});return{...e,subject:l,frame:a}};var ZT=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:n,draggables:a,destination:l,viewport:c,afterCritical:h})=>{if(!t){if(r.length)return null;const b={displaced:dd,displacedBy:Gb,at:{type:"REORDER",destination:{droppableId:l.descriptor.id,index:0}}},y=_f({impact:b,draggable:n,droppable:l,draggables:a,afterCritical:h}),w=K0(n,l)?l:e3(l,n,a);return Xb({draggable:n,destination:w,newPageBorderBoxCenter:y,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?b:null}const p=e[l.axis.line]<=t.page.borderBox.center[l.axis.line],m=(()=>{const b=t.descriptor.index;return t.descriptor.id===n.descriptor.id||p?b:b+1})(),x=Cd(l.axis,n.displaceBy);return ef({draggable:n,insideDestination:r,destination:l,viewport:c,displacedBy:x,last:dd,index:m})},YT=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:n,draggables:a,droppables:l,viewport:c,afterCritical:h})=>{const p=HT({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:l,viewport:c});if(!p)return null;const m=Y0(p.descriptor.id,a),x=GT({pageBorderBoxCenter:t,viewport:c,destination:p,insideDestination:m,afterCritical:h}),b=ZT({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:a,moveRelativeTo:x,insideDestination:m,viewport:c,afterCritical:h});if(!b)return null;const y=_f({impact:b,draggable:r,droppable:p,draggables:a,afterCritical:h});return{clientSelection:y1({pageBorderBoxCenter:y,draggable:r,viewport:c}),impact:b,scrollJumpRequest:null}},eo=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const KT=(e,t)=>{const r=eo(e);return r?t[r]:null};var XT=({state:e,type:t})=>{const r=KT(e.impact,e.dimensions.droppables),n=!!r,a=e.dimensions.droppables[e.critical.droppable.id],l=r||a,c=l.axis.direction,h=c==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||c==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(h&&!n)return null;const p=t==="MOVE_DOWN"||t==="MOVE_RIGHT",m=e.dimensions.draggables[e.critical.draggable.id],x=e.current.page.borderBoxCenter,{draggables:b,droppables:y}=e.dimensions;return h?zT({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:m,destination:l,draggables:b,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):YT({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:m,isOver:l,draggables:b,droppables:y,viewport:e.viewport,afterCritical:e.afterCritical})};function Oc(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function t3(e){const t=Lo(e.top,e.bottom),r=Lo(e.left,e.right);return function(a){return t(a.y)&&r(a.x)}}function JT(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function eC({pageBorderBox:e,draggable:t,candidates:r}){const n=t.page.borderBox.center,a=r.map(l=>{const c=l.axis,h=Yc(l.axis.line,e.center[c.line],l.page.borderBox.center[c.crossAxisLine]);return{id:l.descriptor.id,distance:ud(n,h)}}).sort((l,c)=>c.distance-l.distance);return a[0]?a[0].id:null}function tC({pageBorderBox:e,draggable:t,droppables:r}){const n=Cf(r).filter(a=>{if(!a.isEnabled)return!1;const l=a.subject.active;if(!l||!JT(e,l))return!1;if(t3(l)(e.center))return!0;const c=a.axis,h=l.center[c.crossAxisLine],p=e[c.crossAxisStart],m=e[c.crossAxisEnd],x=Lo(l[c.crossAxisStart],l[c.crossAxisEnd]),b=x(p),y=x(m);return!b&&!y?!0:b?p<h:m>h});return n.length?n.length===1?n[0].descriptor.id:eC({pageBorderBox:e,draggable:t,candidates:n}):null}const r3=(e,t)=>Wo(Td(e,t));var rC=(e,t)=>{const r=e.frame;return r?r3(t,r.scroll.diff.value):t};function n3({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function nC({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var sC=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:n,last:a,viewport:l,afterCritical:c})=>{const h=r.axis,p=Cd(r.axis,t.displaceBy),m=p.value,x=e[h.start],b=e[h.end],w=Lf(t,n).find(S=>{const I=S.descriptor.id,N=S.page.borderBox.center[h.line],Q=vc(I,c),W=n3({displaced:a,id:I});return Q?W?b<=N:x<N-m:W?b<=N+m:x<N})||null,C=nC({draggable:t,closest:w,inHomeList:K0(t,r)});return ef({draggable:t,insideDestination:n,destination:r,viewport:l,last:a,displacedBy:p,index:C})};const iC=4;var aC=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:n,insideDestination:a,afterCritical:l})=>{if(!n.isCombineEnabled)return null;const c=n.axis,h=Cd(n.axis,e.displaceBy),p=h.value,m=t[c.start],x=t[c.end],y=Lf(e,a).find(C=>{const S=C.descriptor.id,I=C.page.borderBox,Q=I[c.size]/iC,W=vc(S,l),B=n3({displaced:r.displaced,id:S});return W?B?x>I[c.start]+Q&&x<I[c.end]-Q:m>I[c.start]-p+Q&&m<I[c.end]-p-Q:B?x>I[c.start]+p+Q&&x<I[c.end]+p-Q:m>I[c.start]+Q&&m<I[c.end]-Q});return y?{displacedBy:h,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:y.descriptor.id,droppableId:n.descriptor.id}}}:null},s3=({pageOffset:e,draggable:t,draggables:r,droppables:n,previousImpact:a,viewport:l,afterCritical:c})=>{const h=r3(t.page.borderBox,e),p=tC({pageBorderBox:h,draggable:t,droppables:n});if(!p)return yT;const m=n[p],x=Y0(m.descriptor.id,r),b=rC(m,h);return aC({pageBorderBoxWithDroppableScroll:b,draggable:t,previousImpact:a,destination:m,insideDestination:x,afterCritical:c})||sC({pageBorderBoxWithDroppableScroll:b,draggable:t,destination:m,insideDestination:x,last:a.displaced,viewport:l,afterCritical:c})},w1=(e,t)=>({...e,[t.descriptor.id]:t});const oC=({previousImpact:e,impact:t,droppables:r})=>{const n=eo(e),a=eo(t);if(!n||n===a)return r;const l=r[n];if(!l.subject.withPlaceholder)return r;const c=VT(l);return w1(r,c)};var lC=({draggable:e,draggables:t,droppables:r,previousImpact:n,impact:a})=>{const l=oC({previousImpact:n,impact:a,droppables:r}),c=eo(a);if(!c)return l;const h=r[c];if(K0(e,h)||h.subject.withPlaceholder)return l;const p=e3(h,e,t);return w1(l,p)},ed=({state:e,clientSelection:t,dimensions:r,viewport:n,impact:a,scrollJumpRequest:l})=>{const c=n||e.viewport,h=r||e.dimensions,p=t||e.current.client.selection,m=Xa(p,e.initial.client.selection),x={offset:m,selection:p,borderBoxCenter:Hi(e.initial.client.borderBoxCenter,m)},b={selection:Hi(x.selection,c.scroll.current),borderBoxCenter:Hi(x.borderBoxCenter,c.scroll.current),offset:Hi(x.offset,c.scroll.diff.value)},y={client:x,page:b};if(e.phase==="COLLECTING")return{...e,dimensions:h,viewport:c,current:y};const w=h.draggables[e.critical.draggable.id],C=a||s3({pageOffset:b.offset,draggable:w,draggables:h.draggables,droppables:h.droppables,previousImpact:e.impact,viewport:c,afterCritical:e.afterCritical}),S=lC({draggable:w,impact:C,previousImpact:e.impact,draggables:h.draggables,droppables:h.droppables});return{...e,current:y,dimensions:{draggables:h.draggables,droppables:S},impact:C,viewport:c,scrollJumpRequest:l||null,forceShouldAnimate:l?!1:null}};function cC(e,t){return e.map(r=>t[r])}var i3=({impact:e,viewport:t,draggables:r,destination:n,forceShouldAnimate:a})=>{const l=e.displaced,c=cC(l.all,r),h=hd({afterDragging:c,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:a,last:l});return{...e,displaced:h}},a3=({impact:e,draggable:t,droppable:r,draggables:n,viewport:a,afterCritical:l})=>{const c=_f({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:l});return y1({pageBorderBoxCenter:c,draggable:t,viewport:a})},o3=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&jt();const n=e.impact,a=r||e.viewport,l=t||e.dimensions,{draggables:c,droppables:h}=l,p=c[e.critical.draggable.id],m=eo(n);m||jt();const x=h[m],b=i3({impact:n,viewport:a,destination:x,draggables:c}),y=a3({impact:b,draggable:p,droppable:x,draggables:c,viewport:a,afterCritical:e.afterCritical});return ed({impact:b,clientSelection:y,state:e,dimensions:l,viewport:a})},uC=e=>({index:e.index,droppableId:e.droppableId}),l3=({draggable:e,home:t,draggables:r,viewport:n})=>{const a=Cd(t.axis,e.displaceBy),l=Y0(t.descriptor.id,r),c=l.indexOf(e);c===-1&&jt();const h=l.slice(c+1),p=h.reduce((y,w)=>(y[w.descriptor.id]=!0,y),{}),m={inVirtualList:t.descriptor.mode==="virtual",displacedBy:a,effected:p};return{impact:{displaced:hd({afterDragging:h,destination:t,displacedBy:a,last:null,viewport:n.frame,forceShouldAnimate:!1}),displacedBy:a,at:{type:"REORDER",destination:uC(e.descriptor)}},afterCritical:m}},dC=(e,t)=>({draggables:e.draggables,droppables:w1(e.droppables,t)}),hC=({draggable:e,offset:t,initialWindowScroll:r})=>{const n=Zh(e.client,t),a=Yh(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:a}},fC=e=>{const t=e.frame;return t||jt(),t},pC=({additions:e,updatedDroppables:t,viewport:r})=>{const n=r.scroll.diff.value;return e.map(a=>{const l=a.descriptor.droppableId,c=t[l],p=fC(c).scroll.diff.value,m=Hi(n,p);return hC({draggable:a,offset:m,initialWindowScroll:r.scroll.initial})})},mC=({state:e,published:t})=>{const r=t.modified.map(N=>{const Q=e.dimensions.droppables[N.droppableId];return m1(Q,N.scroll)}),n={...e.dimensions.droppables,...Hb(r)},a=Wb(pC({additions:t.additions,updatedDroppables:n,viewport:e.viewport})),l={...e.dimensions.draggables,...a};t.removals.forEach(N=>{delete l[N]});const c={droppables:n,draggables:l},h=eo(e.impact),p=h?c.droppables[h]:null,m=c.draggables[e.critical.draggable.id],x=c.droppables[e.critical.droppable.id],{impact:b,afterCritical:y}=l3({draggable:m,home:x,draggables:l,viewport:e.viewport}),w=p&&p.isCombineEnabled?e.impact:b,C=s3({pageOffset:e.current.page.offset,draggable:c.draggables[e.critical.draggable.id],draggables:c.draggables,droppables:c.droppables,previousImpact:w,viewport:e.viewport,afterCritical:y}),S={...e,phase:"DRAGGING",impact:C,onLiftImpact:b,dimensions:c,afterCritical:y,forceShouldAnimate:!1};return e.phase==="COLLECTING"?S:{...S,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const Am=e=>e.movementMode==="SNAP",fp=(e,t,r)=>{const n=dC(e.dimensions,t);return!Am(e)||r?ed({state:e,dimensions:n}):o3({state:e,dimensions:n})};function pp(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const i2={phase:"IDLE",completed:null,shouldFlush:!1};var gC=(e=i2,t)=>{if(t.type==="FLUSH")return{...i2,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&jt();const{critical:r,clientSelection:n,viewport:a,dimensions:l,movementMode:c}=t.payload,h=l.draggables[r.draggable.id],p=l.droppables[r.droppable.id],m={selection:n,borderBoxCenter:h.client.borderBox.center,offset:Li},x={client:m,page:{selection:Hi(m.selection,a.scroll.initial),borderBoxCenter:Hi(m.selection,a.scroll.initial),offset:Hi(m.selection,a.scroll.diff.value)}},b=Cf(l.droppables).every(S=>!S.isFixedOnPage),{impact:y,afterCritical:w}=l3({draggable:h,home:p,draggables:l.draggables,viewport:a});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:c,dimensions:l,initial:x,current:x,isWindowScrollAllowed:b,impact:y,afterCritical:w,onLiftImpact:y,viewport:a,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&jt(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||jt(),mC({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;Oc(e)||jt();const{client:r}=t.payload;return gc(r,e.current.client.selection)?e:ed({state:e,clientSelection:r,impact:Am(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return pp(e);Oc(e)||jt();const{id:r,newScroll:n}=t.payload,a=e.dimensions.droppables[r];if(!a)return e;const l=m1(a,n);return fp(e,l,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;Oc(e)||jt();const{id:r,isEnabled:n}=t.payload,a=e.dimensions.droppables[r];a||jt(),a.isEnabled===n&&jt();const l={...a,isEnabled:n};return fp(e,l,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;Oc(e)||jt();const{id:r,isCombineEnabled:n}=t.payload,a=e.dimensions.droppables[r];a||jt(),a.isCombineEnabled===n&&jt();const l={...a,isCombineEnabled:n};return fp(e,l,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;Oc(e)||jt(),e.isWindowScrollAllowed||jt();const r=t.payload.newScroll;if(gc(e.viewport.scroll.current,r))return pp(e);const n=Kb(e.viewport,r);return Am(e)?o3({state:e,viewport:n}):ed({state:e,viewport:n})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Oc(e))return e;const r=t.payload.maxScroll;if(gc(r,e.viewport.scroll.max))return e;const n={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:n}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&jt();const r=XT({state:e,type:t.type});return r?ed({state:e,impact:r.impact,clientSelection:r.clientSelection,scrollJumpRequest:r.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const r=t.payload.reason;return e.phase!=="COLLECTING"&&jt(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:n,newHomeClientOffset:a}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||jt(),{phase:"DROP_ANIMATING",completed:r,dropDuration:n,newHomeClientOffset:a,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function Pn(e,t){return e instanceof Object&&"type"in e&&e.type===t}const xC=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),bC=e=>({type:"LIFT",payload:e}),vC=e=>({type:"INITIAL_PUBLISH",payload:e}),yC=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),wC=()=>({type:"COLLECTION_STARTING",payload:null}),AC=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),TC=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),CC=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),c3=e=>({type:"MOVE",payload:e}),SC=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),LC=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),_C=()=>({type:"MOVE_UP",payload:null}),kC=()=>({type:"MOVE_DOWN",payload:null}),IC=()=>({type:"MOVE_RIGHT",payload:null}),EC=()=>({type:"MOVE_LEFT",payload:null}),A1=()=>({type:"FLUSH",payload:null}),NC=e=>({type:"DROP_ANIMATE",payload:e}),T1=e=>({type:"DROP_COMPLETE",payload:e}),u3=e=>({type:"DROP",payload:e}),RC=e=>({type:"DROP_PENDING",payload:e}),d3=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var MC=e=>({getState:t,dispatch:r})=>n=>a=>{if(!Pn(a,"LIFT")){n(a);return}const{id:l,clientSelection:c,movementMode:h}=a.payload,p=t();p.phase==="DROP_ANIMATING"&&r(T1({completed:p.completed})),t().phase!=="IDLE"&&jt(),r(A1()),r(xC({draggableId:l,movementMode:h}));const x={draggableId:l,scrollOptions:{shouldPublishImmediately:h==="SNAP"}},{critical:b,dimensions:y,viewport:w}=e.startPublishing(x);r(vC({critical:b,dimensions:y,clientSelection:c,movementMode:h,viewport:w}))},jC=e=>()=>t=>r=>{Pn(r,"INITIAL_PUBLISH")&&e.dragging(),Pn(r,"DROP_ANIMATE")&&e.dropping(r.payload.completed.result.reason),(Pn(r,"FLUSH")||Pn(r,"DROP_COMPLETE"))&&e.resting(),t(r)};const C1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},fd={opacity:{drop:0,combining:.7},scale:{drop:.75}},h3={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Rc=`${h3.outOfTheWay}s ${C1.outOfTheWay}`,td={fluid:`opacity ${Rc}`,snap:`transform ${Rc}, opacity ${Rc}`,drop:e=>{const t=`${e}s ${C1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Rc}`,placeholder:`height ${Rc}, width ${Rc}, margin ${Rc}`},a2=e=>gc(e,Li)?void 0:`translate(${e.x}px, ${e.y}px)`,Tm={moveTo:a2,drop:(e,t)=>{const r=a2(e);if(r)return t?`${r} scale(${fd.scale.drop})`:r}},{minDropTime:Cm,maxDropTime:f3}=h3,DC=f3-Cm,o2=1500,QC=.6;var BC=({current:e,destination:t,reason:r})=>{const n=ud(e,t);if(n<=0)return Cm;if(n>=o2)return f3;const a=n/o2,l=Cm+DC*a,c=r==="CANCEL"?l*QC:l;return Number(c.toFixed(2))},PC=({impact:e,draggable:t,dimensions:r,viewport:n,afterCritical:a})=>{const{draggables:l,droppables:c}=r,h=eo(e),p=h?c[h]:null,m=c[t.descriptor.droppableId],x=a3({impact:e,draggable:t,draggables:l,afterCritical:a,droppable:p||m,viewport:n});return Xa(x,t.client.borderBox.center)},OC=({draggables:e,reason:t,lastImpact:r,home:n,viewport:a,onLiftImpact:l})=>!r.at||t!=="DROP"?{impact:i3({draggables:e,impact:l,destination:n,viewport:a,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:dd},didDropInsideDroppable:!0};const FC=({getState:e,dispatch:t})=>r=>n=>{if(!Pn(n,"DROP")){r(n);return}const a=e(),l=n.payload.reason;if(a.phase==="COLLECTING"){t(RC({reason:l}));return}if(a.phase==="IDLE")return;a.phase==="DROP_PENDING"&&a.isWaiting&&jt(),a.phase==="DRAGGING"||a.phase==="DROP_PENDING"||jt();const h=a.critical,p=a.dimensions,m=p.draggables[a.critical.draggable.id],{impact:x,didDropInsideDroppable:b}=OC({reason:l,lastImpact:a.impact,afterCritical:a.afterCritical,onLiftImpact:a.onLiftImpact,home:a.dimensions.droppables[a.critical.droppable.id],viewport:a.viewport,draggables:a.dimensions.draggables}),y=b?g1(x):null,w=b?Sf(x):null,C={index:h.draggable.index,droppableId:h.droppable.id},S={draggableId:m.descriptor.id,type:m.descriptor.type,source:C,reason:l,mode:a.movementMode,destination:y,combine:w},I=PC({impact:x,draggable:m,dimensions:p,viewport:a.viewport,afterCritical:a.afterCritical}),N={critical:a.critical,afterCritical:a.afterCritical,result:S,impact:x};if(!(!gc(a.current.client.offset,I)||!!S.combine)){t(T1({completed:N}));return}const W=BC({current:a.current.client.offset,destination:I,reason:l});t(NC({newHomeClientOffset:I,dropDuration:W,completed:N}))};var p3=()=>({x:window.pageXOffset,y:window.pageYOffset});function $C(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function UC({onWindowScroll:e}){function t(){e(p3())}const r=cd(t),n=$C(r);let a=mc;function l(){return a!==mc}function c(){l()&&jt(),a=So(window,[n])}function h(){l()||jt(),r.cancel(),a(),a=mc}return{start:c,stop:h,isActive:l}}const zC=e=>Pn(e,"DROP_COMPLETE")||Pn(e,"DROP_ANIMATE")||Pn(e,"FLUSH"),HC=e=>{const t=UC({onWindowScroll:r=>{e.dispatch(SC({newScroll:r}))}});return r=>n=>{!t.isActive()&&Pn(n,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&zC(n)&&t.stop(),r(n)}};var WC=e=>{let t=!1,r=!1;const n=setTimeout(()=>{r=!0}),a=l=>{t||r||(t=!0,e(l),clearTimeout(n))};return a.wasCalled=()=>t,a},GC=()=>{const e=[],t=a=>{const l=e.findIndex(h=>h.timerId===a);l===-1&&jt();const[c]=e.splice(l,1);c.callback()};return{add:a=>{const l=setTimeout(()=>t(l)),c={timerId:l,callback:a};e.push(c)},flush:()=>{if(!e.length)return;const a=[...e];e.length=0,a.forEach(l=>{clearTimeout(l.timerId),l.callback()})}}};const qC=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,VC=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,ZC=(e,t)=>{if(e===t)return!0;const r=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,n=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return r&&n},mu=(e,t)=>{t()},Zd=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function mp(e,t,r,n){if(!e){r(n(t));return}const a=WC(r);e(t,{announce:a}),a.wasCalled()||r(n(t))}var YC=(e,t)=>{const r=GC();let n=null;const a=(b,y)=>{n&&jt(),mu("onBeforeCapture",()=>{const w=e().onBeforeCapture;w&&w({draggableId:b,mode:y})})},l=(b,y)=>{n&&jt(),mu("onBeforeDragStart",()=>{const w=e().onBeforeDragStart;w&&w(Zd(b,y))})},c=(b,y)=>{n&&jt();const w=Zd(b,y);n={mode:y,lastCritical:b,lastLocation:w.source,lastCombine:null},r.add(()=>{mu("onDragStart",()=>mp(e().onDragStart,w,t,kh.onDragStart))})},h=(b,y)=>{const w=g1(y),C=Sf(y);n||jt();const S=!ZC(b,n.lastCritical);S&&(n.lastCritical=b);const I=!qC(n.lastLocation,w);I&&(n.lastLocation=w);const N=!VC(n.lastCombine,C);if(N&&(n.lastCombine=C),!S&&!I&&!N)return;const Q={...Zd(b,n.mode),combine:C,destination:w};r.add(()=>{mu("onDragUpdate",()=>mp(e().onDragUpdate,Q,t,kh.onDragUpdate))})},p=()=>{n||jt(),r.flush()},m=b=>{n||jt(),n=null,mu("onDragEnd",()=>mp(e().onDragEnd,b,t,kh.onDragEnd))};return{beforeCapture:a,beforeStart:l,start:c,update:h,flush:p,drop:m,abort:()=>{if(!n)return;const b={...Zd(n.lastCritical,n.mode),combine:null,destination:null,reason:"CANCEL"};m(b)}}},KC=(e,t)=>{const r=YC(e,t);return n=>a=>l=>{if(Pn(l,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(l.payload.draggableId,l.payload.movementMode);return}if(Pn(l,"INITIAL_PUBLISH")){const h=l.payload.critical;r.beforeStart(h,l.payload.movementMode),a(l),r.start(h,l.payload.movementMode);return}if(Pn(l,"DROP_COMPLETE")){const h=l.payload.completed.result;r.flush(),a(l),r.drop(h);return}if(a(l),Pn(l,"FLUSH")){r.abort();return}const c=n.getState();c.phase==="DRAGGING"&&r.update(c.critical,c.impact)}};const XC=e=>t=>r=>{if(!Pn(r,"DROP_ANIMATION_FINISHED")){t(r);return}const n=e.getState();n.phase!=="DROP_ANIMATING"&&jt(),e.dispatch(T1({completed:n.completed}))},JC=e=>{let t=null,r=null;function n(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return a=>l=>{if((Pn(l,"FLUSH")||Pn(l,"DROP_COMPLETE")||Pn(l,"DROP_ANIMATION_FINISHED"))&&n(),a(l),!Pn(l,"DROP_ANIMATE"))return;const c={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(d3())}};r=requestAnimationFrame(()=>{r=null,t=So(window,[c])})}};var eS=e=>()=>t=>r=>{(Pn(r,"DROP_COMPLETE")||Pn(r,"FLUSH")||Pn(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},tS=e=>{let t=!1;return()=>r=>n=>{if(Pn(n,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),r(n),e.tryRestoreFocusRecorded();return}if(r(n),!!t){if(Pn(n,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Pn(n,"DROP_COMPLETE")){t=!1;const a=n.payload.completed.result;a.combine&&e.tryShiftRecord(a.draggableId,a.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const rS=e=>Pn(e,"DROP_COMPLETE")||Pn(e,"DROP_ANIMATE")||Pn(e,"FLUSH");var nS=e=>t=>r=>n=>{if(rS(n)){e.stop(),r(n);return}if(Pn(n,"INITIAL_PUBLISH")){r(n);const a=t.getState();a.phase!=="DRAGGING"&&jt(),e.start(a);return}r(n),e.scroll(t.getState())};const sS=e=>t=>r=>{if(t(r),!Pn(r,"PUBLISH_WHILE_DRAGGING"))return;const n=e.getState();n.phase==="DROP_PENDING"&&(n.isWaiting||e.dispatch(u3({reason:n.reason})))},iS=Eb;var aS=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:n,announce:a,autoScroller:l})=>Ib(gC,iS(nA(jC(r),eS(e),MC(e),FC,XC,JC,sS,nS(l),HC,tS(t),KC(n,a))));const gp=()=>({additions:{},removals:{},modified:{}});function oS({registry:e,callbacks:t}){let r=gp(),n=null;const a=()=>{n||(t.collectionStarting(),n=requestAnimationFrame(()=>{n=null;const{additions:p,removals:m,modified:x}=r,b=Object.keys(p).map(C=>e.draggable.getById(C).getDimension(Li)).sort((C,S)=>C.descriptor.index-S.descriptor.index),y=Object.keys(x).map(C=>{const I=e.droppable.getById(C).callbacks.getScrollWhileDragging();return{droppableId:C,scroll:I}}),w={additions:b,removals:Object.keys(m),modified:y};r=gp(),t.publish(w)}))};return{add:p=>{const m=p.descriptor.id;r.additions[m]=p,r.modified[p.descriptor.droppableId]=!0,r.removals[m]&&delete r.removals[m],a()},remove:p=>{const m=p.descriptor;r.removals[m.id]=!0,r.modified[m.droppableId]=!0,r.additions[m.id]&&delete r.additions[m.id],a()},stop:()=>{n&&(cancelAnimationFrame(n),n=null,r=gp())}}}var m3=({scrollHeight:e,scrollWidth:t,height:r,width:n})=>{const a=Xa({x:t,y:e},{x:n,y:r});return{x:Math.max(0,a.x),y:Math.max(0,a.y)}},g3=()=>{const e=document.documentElement;return e||jt(),e},x3=()=>{const e=g3();return m3({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},lS=()=>{const e=p3(),t=x3(),r=e.y,n=e.x,a=g3(),l=a.clientWidth,c=a.clientHeight,h=n+l,p=r+c;return{frame:Wo({top:r,left:n,right:h,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:Li,displacement:Li}}}},cS=({critical:e,scrollOptions:t,registry:r})=>{const n=lS(),a=n.scroll.current,l=e.droppable,c=r.droppable.getAllByType(l.type).map(x=>x.callbacks.getDimensionAndWatchScroll(a,t)),h=r.draggable.getAllByType(e.draggable.type).map(x=>x.getDimension(a));return{dimensions:{draggables:Wb(h),droppables:Hb(c)},critical:e,viewport:n}};function l2(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var uS=(e,t)=>{let r=null;const n=oS({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),a=(y,w)=>{e.droppable.exists(y)||jt(),r&&t.updateDroppableIsEnabled({id:y,isEnabled:w})},l=(y,w)=>{r&&(e.droppable.exists(y)||jt(),t.updateDroppableIsCombineEnabled({id:y,isCombineEnabled:w}))},c=(y,w)=>{r&&(e.droppable.exists(y)||jt(),t.updateDroppableScroll({id:y,newScroll:w}))},h=(y,w)=>{r&&e.droppable.getById(y).callbacks.scroll(w)},p=()=>{if(!r)return;n.stop();const y=r.critical.droppable;e.droppable.getAllByType(y.type).forEach(w=>w.callbacks.dragStopped()),r.unsubscribe(),r=null},m=y=>{r||jt();const w=r.critical.draggable;y.type==="ADDITION"&&l2(e,w,y.value)&&n.add(y.value),y.type==="REMOVAL"&&l2(e,w,y.value)&&n.remove(y.value)};return{updateDroppableIsEnabled:a,updateDroppableIsCombineEnabled:l,scrollDroppable:h,updateDroppableScroll:c,startPublishing:y=>{r&&jt();const w=e.draggable.getById(y.draggableId),C=e.droppable.getById(w.descriptor.droppableId),S={draggable:w.descriptor,droppable:C.descriptor},I=e.subscribe(m);return r={critical:S,unsubscribe:I},cS({critical:S,registry:e,scrollOptions:y.scrollOptions})},stopPublishing:p}},b3=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",dS=e=>{window.scrollBy(e.x,e.y)};const hS=Si(e=>Cf(e).filter(t=>!(!t.isEnabled||!t.frame))),fS=(e,t)=>hS(t).find(n=>(n.frame||jt(),t3(n.frame.pageMarginBox)(e)))||null;var pS=({center:e,destination:t,droppables:r})=>{if(t){const a=r[t];return a.frame?a:null}return fS(e,r)};const pd={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var mS=(e,t,r=()=>pd)=>{const n=r(),a=e[t.size]*n.startFromPercentage,l=e[t.size]*n.maxScrollAtPercentage;return{startScrollingFrom:a,maxScrollValueAt:l}},v3=({startOfRange:e,endOfRange:t,current:r})=>{const n=t-e;return n===0?0:(r-e)/n},S1=1,gS=(e,t,r=()=>pd)=>{const n=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return n.maxPixelScroll;if(e===t.startScrollingFrom)return S1;const l=1-v3({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),c=n.maxPixelScroll*n.ease(l);return Math.ceil(c)},xS=(e,t,r)=>{const n=r(),a=n.durationDampening.accelerateAt,l=n.durationDampening.stopDampeningAt,c=t,h=l,m=Date.now()-c;if(m>=l)return e;if(m<a)return S1;const x=v3({startOfRange:a,endOfRange:h,current:m}),b=e*n.ease(x);return Math.ceil(b)},c2=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:n,getAutoScrollerOptions:a})=>{const l=gS(e,t,a);return l===0?0:n?Math.max(xS(l,r,a),S1):l},u2=({container:e,distanceToEdges:t,dragStartTime:r,axis:n,shouldUseTimeDampening:a,getAutoScrollerOptions:l})=>{const c=mS(e,n,l);return t[n.end]<t[n.start]?c2({distanceToEdge:t[n.end],thresholds:c,dragStartTime:r,shouldUseTimeDampening:a,getAutoScrollerOptions:l}):-1*c2({distanceToEdge:t[n.start],thresholds:c,dragStartTime:r,shouldUseTimeDampening:a,getAutoScrollerOptions:l})},bS=({container:e,subject:t,proposedScroll:r})=>{const n=t.height>e.height,a=t.width>e.width;return!a&&!n?r:a&&n?null:{x:a?0:r.x,y:n?0:r.y}};const vS=zb(e=>e===0?0:e);var y3=({dragStartTime:e,container:t,subject:r,center:n,shouldUseTimeDampening:a,getAutoScrollerOptions:l})=>{const c={top:n.y-t.top,right:t.right-n.x,bottom:t.bottom-n.y,left:n.x-t.left},h=u2({container:t,distanceToEdges:c,dragStartTime:e,axis:x1,shouldUseTimeDampening:a,getAutoScrollerOptions:l}),p=u2({container:t,distanceToEdges:c,dragStartTime:e,axis:Vb,shouldUseTimeDampening:a,getAutoScrollerOptions:l}),m=vS({x:p,y:h});if(gc(m,Li))return null;const x=bS({container:t,subject:r,proposedScroll:m});return x?gc(x,Li)?null:x:null};const yS=zb(e=>e===0?0:e>0?1:-1),L1=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:n})=>{const a=Hi(t,n),l={x:e(a.x,r.x),y:e(a.y,r.y)};return gc(l,Li)?null:l}})(),w3=({max:e,current:t,change:r})=>{const n={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},a=yS(r),l=L1({max:n,current:t,change:a});return!l||a.x!==0&&l.x===0||a.y!==0&&l.y===0},_1=(e,t)=>w3({current:e.scroll.current,max:e.scroll.max,change:t}),wS=(e,t)=>{if(!_1(e,t))return null;const r=e.scroll.max,n=e.scroll.current;return L1({current:n,max:r,change:t})},k1=(e,t)=>{const r=e.frame;return r?w3({current:r.scroll.current,max:r.scroll.max,change:t}):!1},AS=(e,t)=>{const r=e.frame;return!r||!k1(e,t)?null:L1({current:r.scroll.current,max:r.scroll.max,change:t})};var TS=({viewport:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:a,getAutoScrollerOptions:l})=>{const c=y3({dragStartTime:n,container:e.frame,subject:t,center:r,shouldUseTimeDampening:a,getAutoScrollerOptions:l});return c&&_1(e,c)?c:null},CS=({droppable:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:a,getAutoScrollerOptions:l})=>{const c=e.frame;if(!c)return null;const h=y3({dragStartTime:n,container:c.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:a,getAutoScrollerOptions:l});return h&&k1(e,h)?h:null},d2=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:n,scrollDroppable:a,getAutoScrollerOptions:l})=>{const c=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const b=e.viewport,y=TS({dragStartTime:t,viewport:b,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:l});if(y){n(y);return}}const m=pS({center:c,destination:eo(e.impact),droppables:e.dimensions.droppables});if(!m)return;const x=CS({dragStartTime:t,droppable:m,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:l});x&&a(m.descriptor.id,x)},SS=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>pd})=>{const n=cd(e),a=cd(t);let l=null;const c=m=>{l||jt();const{shouldUseTimeDampening:x,dragStartTime:b}=l;d2({state:m,scrollWindow:n,scrollDroppable:a,dragStartTime:b,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:m=>{l&&jt();const x=Date.now();let b=!1;const y=()=>{b=!0};d2({state:m,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:y,scrollDroppable:y,getAutoScrollerOptions:r}),l={dragStartTime:x,shouldUseTimeDampening:b},b&&c(m)},stop:()=>{l&&(n.cancel(),a.cancel(),l=null)},scroll:c}},LS=({move:e,scrollDroppable:t,scrollWindow:r})=>{const n=(h,p)=>{const m=Hi(h.current.client.selection,p);e({client:m})},a=(h,p)=>{if(!k1(h,p))return p;const m=AS(h,p);if(!m)return t(h.descriptor.id,p),null;const x=Xa(p,m);return t(h.descriptor.id,x),Xa(p,x)},l=(h,p,m)=>{if(!h||!_1(p,m))return m;const x=wS(p,m);if(!x)return r(m),null;const b=Xa(m,x);return r(b),Xa(m,b)};return h=>{const p=h.scrollJumpRequest;if(!p)return;const m=eo(h.impact);m||jt();const x=a(h.dimensions.droppables[m],p);if(!x)return;const b=h.viewport,y=l(h.isWindowScrollAllowed,b,x);y&&n(h,y)}},_S=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:n})=>{const a=SS({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n}),l=LS({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:p=>{if(!(n().disabled||p.phase!=="DRAGGING")){if(p.movementMode==="FLUID"){a.scroll(p);return}p.scrollJumpRequest&&l(p)}},start:a.start,stop:a.stop}};const z0="data-rfd",H0=(()=>{const e=`${z0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),Sm=(()=>{const e=`${z0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),kS=(()=>{const e=`${z0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),h2={contextId:`${z0}-scroll-container-context-id`},IS=e=>t=>`[${t}="${e}"]`,gu=(e,t)=>e.map(r=>{const n=r.styles[t];return n?`${r.selector} { ${n} }`:""}).join(" "),ES="pointer-events: none;";var NS=e=>{const t=IS(e),r=(()=>{const h=`
43
+ cursor: -webkit-grab;
44
+ cursor: grab;
45
+ `;return{selector:t(H0.contextId),styles:{always:`
46
+ -webkit-touch-callout: none;
47
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
48
+ touch-action: manipulation;
49
+ `,resting:h,dragging:ES,dropAnimating:h}}})(),n=(()=>{const h=`
50
+ transition: ${td.outOfTheWay};
51
+ `;return{selector:t(Sm.contextId),styles:{dragging:h,dropAnimating:h,userCancel:h}}})(),a={selector:t(kS.contextId),styles:{always:"overflow-anchor: none;"}},c=[n,r,a,{selector:"body",styles:{dragging:`
52
+ cursor: grabbing;
53
+ cursor: -webkit-grabbing;
54
+ user-select: none;
55
+ -webkit-user-select: none;
56
+ -moz-user-select: none;
57
+ -ms-user-select: none;
58
+ overflow-anchor: none;
59
+ `}}];return{always:gu(c,"always"),resting:gu(c,"resting"),dragging:gu(c,"dragging"),dropAnimating:gu(c,"dropAnimating"),userCancel:gu(c,"userCancel")}};const to=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?v.useLayoutEffect:v.useEffect,xp=()=>{const e=document.querySelector("head");return e||jt(),e},f2=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function RS(e,t){const r=vn(()=>NS(e),[e]),n=v.useRef(null),a=v.useRef(null),l=vr(Si(b=>{const y=a.current;y||jt(),y.textContent=b}),[]),c=vr(b=>{const y=n.current;y||jt(),y.textContent=b},[]);to(()=>{!n.current&&!a.current||jt();const b=f2(t),y=f2(t);return n.current=b,a.current=y,b.setAttribute(`${z0}-always`,e),y.setAttribute(`${z0}-dynamic`,e),xp().appendChild(b),xp().appendChild(y),c(r.always),l(r.resting),()=>{const w=C=>{const S=C.current;S||jt(),xp().removeChild(S),C.current=null};w(n),w(a)}},[t,c,l,r.always,r.resting,e]);const h=vr(()=>l(r.dragging),[l,r.dragging]),p=vr(b=>{if(b==="DROP"){l(r.dropAnimating);return}l(r.userCancel)},[l,r.dropAnimating,r.userCancel]),m=vr(()=>{a.current&&l(r.resting)},[l,r.resting]);return vn(()=>({dragging:h,dropping:p,resting:m}),[h,p,m])}function A3(e,t){return Array.from(e.querySelectorAll(t))}var T3=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function kf(e){return e instanceof T3(e).HTMLElement}function MS(e,t){const r=`[${H0.contextId}="${e}"]`,n=A3(document,r);if(!n.length)return null;const a=n.find(l=>l.getAttribute(H0.draggableId)===t);return!a||!kf(a)?null:a}function jS(e){const t=v.useRef({}),r=v.useRef(null),n=v.useRef(null),a=v.useRef(!1),l=vr(function(y,w){const C={id:y,focus:w};return t.current[y]=C,function(){const I=t.current;I[y]!==C&&delete I[y]}},[]),c=vr(function(y){const w=MS(e,y);w&&w!==document.activeElement&&w.focus()},[e]),h=vr(function(y,w){r.current===y&&(r.current=w)},[]),p=vr(function(){n.current||a.current&&(n.current=requestAnimationFrame(()=>{n.current=null;const y=r.current;y&&c(y)}))},[c]),m=vr(function(y){r.current=null;const w=document.activeElement;w&&w.getAttribute(H0.draggableId)===y&&(r.current=y)},[]);return to(()=>(a.current=!0,function(){a.current=!1;const y=n.current;y&&cancelAnimationFrame(y)}),[]),vn(()=>({register:l,tryRecordFocus:m,tryRestoreFocusRecorded:p,tryShiftRecord:h}),[l,m,p,h])}function DS(){const e={draggables:{},droppables:{}},t=[];function r(b){return t.push(b),function(){const w=t.indexOf(b);w!==-1&&t.splice(w,1)}}function n(b){t.length&&t.forEach(y=>y(b))}function a(b){return e.draggables[b]||null}function l(b){const y=a(b);return y||jt(),y}const c={register:b=>{e.draggables[b.descriptor.id]=b,n({type:"ADDITION",value:b})},update:(b,y)=>{const w=e.draggables[y.descriptor.id];w&&w.uniqueId===b.uniqueId&&(delete e.draggables[y.descriptor.id],e.draggables[b.descriptor.id]=b)},unregister:b=>{const y=b.descriptor.id,w=a(y);w&&b.uniqueId===w.uniqueId&&(delete e.draggables[y],e.droppables[b.descriptor.droppableId]&&n({type:"REMOVAL",value:b}))},getById:l,findById:a,exists:b=>!!a(b),getAllByType:b=>Object.values(e.draggables).filter(y=>y.descriptor.type===b)};function h(b){return e.droppables[b]||null}function p(b){const y=h(b);return y||jt(),y}const m={register:b=>{e.droppables[b.descriptor.id]=b},unregister:b=>{const y=h(b.descriptor.id);y&&b.uniqueId===y.uniqueId&&delete e.droppables[b.descriptor.id]},getById:p,findById:h,exists:b=>!!h(b),getAllByType:b=>Object.values(e.droppables).filter(y=>y.descriptor.type===b)};function x(){e.draggables={},e.droppables={},t.length=0}return{draggable:c,droppable:m,subscribe:r,clean:x}}function QS(){const e=vn(DS,[]);return v.useEffect(()=>function(){e.clean()},[e]),e}var I1=L.createContext(null),tf=()=>{const e=document.body;return e||jt(),e};const BS={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},PS=e=>`rfd-announcement-${e}`;function OS(e){const t=vn(()=>PS(e),[e]),r=v.useRef(null);return v.useEffect(function(){const l=document.createElement("div");return r.current=l,l.id=t,l.setAttribute("aria-live","assertive"),l.setAttribute("aria-atomic","true"),Kh(l.style,BS),tf().appendChild(l),function(){setTimeout(function(){const p=tf();p.contains(l)&&p.removeChild(l),l===r.current&&(r.current=null)})}},[t]),vr(a=>{const l=r.current;if(l){l.textContent=a;return}},[])}const FS={separator:"::"};function E1(e,t=FS){const r=L.useId();return vn(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function $S({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function US({contextId:e,text:t}){const r=E1("hidden-text",{separator:"-"}),n=vn(()=>$S({contextId:e,uniqueId:r}),[r,e]);return v.useEffect(function(){const l=document.createElement("div");return l.id=n,l.textContent=t,l.style.display="none",tf().appendChild(l),function(){const h=tf();h.contains(l)&&h.removeChild(l)}},[n,t]),n}var If=L.createContext(null);function C3(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),t}function zS(){let e=null;function t(){return!!e}function r(c){return c===e}function n(c){e&&jt();const h={abandon:c};return e=h,h}function a(){e||jt(),e=null}function l(){e&&(e.abandon(),a())}return{isClaimed:t,isActive:r,claim:n,release:a,tryAbandon:l}}function md(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const HS=9,WS=13,N1=27,S3=32,GS=33,qS=34,VS=35,ZS=36,YS=37,KS=38,XS=39,JS=40,eL={[WS]:!0,[HS]:!0};var L3=e=>{eL[e.keyCode]&&e.preventDefault()};const Ef=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(n=>`on${n}`in document)||e})(),_3=0,p2=5;function tL(e,t){return Math.abs(t.x-e.x)>=p2||Math.abs(t.y-e.y)>=p2}const m2={type:"IDLE"};function rL({cancel:e,completed:t,getPhase:r,setPhase:n}){return[{eventName:"mousemove",fn:a=>{const{button:l,clientX:c,clientY:h}=a;if(l!==_3)return;const p={x:c,y:h},m=r();if(m.type==="DRAGGING"){a.preventDefault(),m.actions.move(p);return}m.type!=="PENDING"&&jt();const x=m.point;if(!tL(x,p))return;a.preventDefault();const b=m.actions.fluidLift(p);n({type:"DRAGGING",actions:b})}},{eventName:"mouseup",fn:a=>{const l=r();if(l.type!=="DRAGGING"){e();return}a.preventDefault(),l.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:a=>{r().type==="DRAGGING"&&a.preventDefault(),e()}},{eventName:"keydown",fn:a=>{if(r().type==="PENDING"){e();return}if(a.keyCode===N1){a.preventDefault(),e();return}L3(a)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:a=>{const l=r();if(l.type==="IDLE"&&jt(),l.actions.shouldRespectForcePress()){e();return}a.preventDefault()}},{eventName:Ef,fn:e}]}function nL(e){const t=v.useRef(m2),r=v.useRef(mc),n=vn(()=>({eventName:"mousedown",fn:function(b){if(b.defaultPrevented||b.button!==_3||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)return;const y=e.findClosestDraggableId(b);if(!y)return;const w=e.tryGetLock(y,c,{sourceEvent:b});if(!w)return;b.preventDefault();const C={x:b.clientX,y:b.clientY};r.current(),m(w,C)}}),[e]),a=vn(()=>({eventName:"webkitmouseforcewillbegin",fn:x=>{if(x.defaultPrevented)return;const b=e.findClosestDraggableId(x);if(!b)return;const y=e.findOptionsForDraggable(b);y&&(y.shouldRespectForcePress||e.canGetLock(b)&&x.preventDefault())}}),[e]),l=vr(function(){const b={passive:!1,capture:!0};r.current=So(window,[a,n],b)},[a,n]),c=vr(()=>{t.current.type!=="IDLE"&&(t.current=m2,r.current(),l())},[l]),h=vr(()=>{const x=t.current;c(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[c]),p=vr(function(){const b={capture:!0,passive:!1},y=rL({cancel:h,completed:c,getPhase:()=>t.current,setPhase:w=>{t.current=w}});r.current=So(window,y,b)},[h,c]),m=vr(function(b,y){t.current.type!=="IDLE"&&jt(),t.current={type:"PENDING",point:y,actions:b},p()},[p]);to(function(){return l(),function(){r.current()}},[l])}function sL(){}const iL={[qS]:!0,[GS]:!0,[ZS]:!0,[VS]:!0};function aL(e,t){function r(){t(),e.cancel()}function n(){t(),e.drop()}return[{eventName:"keydown",fn:a=>{if(a.keyCode===N1){a.preventDefault(),r();return}if(a.keyCode===S3){a.preventDefault(),n();return}if(a.keyCode===JS){a.preventDefault(),e.moveDown();return}if(a.keyCode===KS){a.preventDefault(),e.moveUp();return}if(a.keyCode===XS){a.preventDefault(),e.moveRight();return}if(a.keyCode===YS){a.preventDefault(),e.moveLeft();return}if(iL[a.keyCode]){a.preventDefault();return}L3(a)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:Ef,fn:r}]}function oL(e){const t=v.useRef(sL),r=vn(()=>({eventName:"keydown",fn:function(l){if(l.defaultPrevented||l.keyCode!==S3)return;const c=e.findClosestDraggableId(l);if(!c)return;const h=e.tryGetLock(c,x,{sourceEvent:l});if(!h)return;l.preventDefault();let p=!0;const m=h.snapLift();t.current();function x(){p||jt(),p=!1,t.current(),n()}t.current=So(window,aL(m,x),{capture:!0,passive:!1})}}),[e]),n=vr(function(){const l={passive:!1,capture:!0};t.current=So(window,[r],l)},[r]);to(function(){return n(),function(){t.current()}},[n])}const bp={type:"IDLE"},lL=120,cL=.15;function uL({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:r=>{r.preventDefault()}},{eventName:"keydown",fn:r=>{if(t().type!=="DRAGGING"){e();return}r.keyCode===N1&&r.preventDefault(),e()}},{eventName:Ef,fn:e}]}function dL({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:n=>{const a=r();if(a.type!=="DRAGGING"){e();return}a.hasMoved=!0;const{clientX:l,clientY:c}=n.touches[0],h={x:l,y:c};n.preventDefault(),a.actions.move(h)}},{eventName:"touchend",fn:n=>{const a=r();if(a.type!=="DRAGGING"){e();return}n.preventDefault(),a.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:n=>{if(r().type!=="DRAGGING"){e();return}n.preventDefault(),e()}},{eventName:"touchforcechange",fn:n=>{const a=r();a.type==="IDLE"&&jt();const l=n.touches[0];if(!l||!(l.force>=cL))return;const h=a.actions.shouldRespectForcePress();if(a.type==="PENDING"){h&&e();return}if(h){if(a.hasMoved){n.preventDefault();return}e();return}n.preventDefault()}},{eventName:Ef,fn:e}]}function hL(e){const t=v.useRef(bp),r=v.useRef(mc),n=vr(function(){return t.current},[]),a=vr(function(w){t.current=w},[]),l=vn(()=>({eventName:"touchstart",fn:function(w){if(w.defaultPrevented)return;const C=e.findClosestDraggableId(w);if(!C)return;const S=e.tryGetLock(C,h,{sourceEvent:w});if(!S)return;const I=w.touches[0],{clientX:N,clientY:Q}=I,W={x:N,y:Q};r.current(),b(S,W)}}),[e]),c=vr(function(){const w={capture:!0,passive:!1};r.current=So(window,[l],w)},[l]),h=vr(()=>{const y=t.current;y.type!=="IDLE"&&(y.type==="PENDING"&&clearTimeout(y.longPressTimerId),a(bp),r.current(),c())},[c,a]),p=vr(()=>{const y=t.current;h(),y.type==="DRAGGING"&&y.actions.cancel({shouldBlockNextClick:!0}),y.type==="PENDING"&&y.actions.abort()},[h]),m=vr(function(){const w={capture:!0,passive:!1},C={cancel:p,completed:h,getPhase:n},S=So(window,dL(C),w),I=So(window,uL(C),w);r.current=function(){S(),I()}},[p,n,h]),x=vr(function(){const w=n();w.type!=="PENDING"&&jt();const C=w.actions.fluidLift(w.point);a({type:"DRAGGING",actions:C,hasMoved:!1})},[n,a]),b=vr(function(w,C){n().type!=="IDLE"&&jt();const S=setTimeout(x,lL);a({type:"PENDING",point:C,actions:w,longPressTimerId:S}),m()},[m,n,a,x]);to(function(){return c(),function(){r.current();const C=n();C.type==="PENDING"&&(clearTimeout(C.longPressTimerId),a(bp))}},[n,c,a]),to(function(){return So(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const fL=["input","button","textarea","select","option","optgroup","video","audio"];function k3(e,t){if(t==null)return!1;if(fL.includes(t.tagName.toLowerCase()))return!0;const n=t.getAttribute("contenteditable");return n==="true"||n===""?!0:t===e?!1:k3(e,t.parentElement)}function pL(e,t){const r=t.target;return kf(r)?k3(e,r):!1}var mL=e=>Wo(e.getBoundingClientRect()).center;function gL(e){return e instanceof T3(e).Element}const xL=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(n=>n in Element.prototype)||e})();function I3(e,t){return e==null?null:e[xL](t)?e:I3(e.parentElement,t)}function bL(e,t){return e.closest?e.closest(t):I3(e,t)}function vL(e){return`[${H0.contextId}="${e}"]`}function yL(e,t){const r=t.target;if(!gL(r))return null;const n=vL(e),a=bL(r,n);return!a||!kf(a)?null:a}function wL(e,t){const r=yL(e,t);return r?r.getAttribute(H0.draggableId):null}function AL(e,t){const r=`[${Sm.contextId}="${e}"]`,a=A3(document,r).find(l=>l.getAttribute(Sm.id)===t);return!a||!kf(a)?null:a}function TL(e){e.preventDefault()}function Yd({expected:e,phase:t,isLockActive:r,shouldWarn:n}){return!(!r()||e!==t)}function E3({lockAPI:e,store:t,registry:r,draggableId:n}){if(e.isClaimed())return!1;const a=r.draggable.findById(n);return!(!a||!a.options.isEnabled||!b3(t.getState(),n))}function CL({lockAPI:e,contextId:t,store:r,registry:n,draggableId:a,forceSensorStop:l,sourceEvent:c}){if(!E3({lockAPI:e,store:r,registry:n,draggableId:a}))return null;const p=n.draggable.getById(a),m=AL(t,p.descriptor.id);if(!m||c&&!p.options.canDragInteractiveElements&&pL(m,c))return null;const x=e.claim(l||mc);let b="PRE_DRAG";function y(){return p.options.shouldRespectForcePress}function w(){return e.isActive(x)}function C(U,K){Yd({expected:U,phase:b,isLockActive:w,shouldWarn:!0})&&r.dispatch(K())}const S=C.bind(null,"DRAGGING");function I(U){function K(){e.release(),b="COMPLETED"}b!=="PRE_DRAG"&&(K(),jt()),r.dispatch(bC(U.liftActionArgs)),b="DRAGGING";function re(H,Oe={shouldBlockNextClick:!1}){if(U.cleanup(),Oe.shouldBlockNextClick){const ne=So(window,[{eventName:"click",fn:TL,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(ne)}K(),r.dispatch(u3({reason:H}))}return{isActive:()=>Yd({expected:"DRAGGING",phase:b,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:y,drop:H=>re("DROP",H),cancel:H=>re("CANCEL",H),...U.actions}}function N(U){const K=cd(H=>{S(()=>c3({client:H}))});return{...I({liftActionArgs:{id:a,clientSelection:U,movementMode:"FLUID"},cleanup:()=>K.cancel(),actions:{move:K}}),move:K}}function Q(){const U={moveUp:()=>S(_C),moveRight:()=>S(IC),moveDown:()=>S(kC),moveLeft:()=>S(EC)};return I({liftActionArgs:{id:a,clientSelection:mL(m),movementMode:"SNAP"},cleanup:mc,actions:U})}function W(){Yd({expected:"PRE_DRAG",phase:b,isLockActive:w,shouldWarn:!0})&&e.release()}return{isActive:()=>Yd({expected:"PRE_DRAG",phase:b,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:y,fluidLift:N,snapLift:Q,abort:W}}const SL=[nL,oL,hL];function LL({contextId:e,store:t,registry:r,customSensors:n,enableDefaultSensors:a}){const l=[...a?SL:[],...n||[]],c=v.useState(()=>zS())[0],h=vr(function(I,N){md(I)&&!md(N)&&c.tryAbandon()},[c]);to(function(){let I=t.getState();return t.subscribe(()=>{const Q=t.getState();h(I,Q),I=Q})},[c,t,h]),to(()=>c.tryAbandon,[c.tryAbandon]);const p=vr(S=>E3({lockAPI:c,registry:r,store:t,draggableId:S}),[c,r,t]),m=vr((S,I,N)=>CL({lockAPI:c,registry:r,contextId:e,store:t,draggableId:S,forceSensorStop:I||null,sourceEvent:N&&N.sourceEvent?N.sourceEvent:null}),[e,c,r,t]),x=vr(S=>wL(e,S),[e]),b=vr(S=>{const I=r.draggable.findById(S);return I?I.options:null},[r.draggable]),y=vr(function(){c.isClaimed()&&(c.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(A1()))},[c,t]),w=vr(()=>c.isClaimed(),[c]),C=vn(()=>({canGetLock:p,tryGetLock:m,findClosestDraggableId:x,findOptionsForDraggable:b,tryReleaseLock:y,isLockClaimed:w}),[p,m,x,b,y,w]);for(let S=0;S<l.length;S++)l[S](C)}const _L=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};Wi.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),kL=e=>({...pd,...e.autoScrollerOptions,durationDampening:{...pd.durationDampening,...e.autoScrollerOptions}});function xu(e){return e.current||jt(),e.current}function IL(e){const{contextId:t,setCallbacks:r,sensors:n,nonce:a,dragHandleUsageInstructions:l}=e,c=v.useRef(null),h=C3(e),p=vr(()=>_L(h.current),[h]),m=vr(()=>kL(h.current),[h]),x=OS(t),b=US({contextId:t,text:l}),y=RS(t,a),w=vr(ne=>{xu(c).dispatch(ne)},[]),C=vn(()=>$g({publishWhileDragging:yC,updateDroppableScroll:AC,updateDroppableIsEnabled:TC,updateDroppableIsCombineEnabled:CC,collectionStarting:wC},w),[w]),S=QS(),I=vn(()=>uS(S,C),[S,C]),N=vn(()=>_S({scrollWindow:dS,scrollDroppable:I.scrollDroppable,getAutoScrollerOptions:m,...$g({move:c3},w)}),[I.scrollDroppable,w,m]),Q=jS(t),W=vn(()=>aS({announce:x,autoScroller:N,dimensionMarshal:I,focusMarshal:Q,getResponders:p,styleMarshal:y}),[x,N,I,Q,p,y]);c.current=W;const B=vr(()=>{const ne=xu(c);ne.getState().phase!=="IDLE"&&ne.dispatch(A1())},[]),U=vr(()=>{const ne=xu(c).getState();return ne.phase==="DROP_ANIMATING"?!0:ne.phase==="IDLE"?!1:ne.isDragging},[]),K=vn(()=>({isDragging:U,tryAbort:B}),[U,B]);r(K);const re=vr(ne=>b3(xu(c).getState(),ne),[]),H=vr(()=>Oc(xu(c).getState()),[]),Oe=vn(()=>({marshal:I,focus:Q,contextId:t,canLift:re,isMovementAllowed:H,dragHandleUsageInstructionsId:b,registry:S}),[t,I,b,Q,re,H,S]);return LL({contextId:t,store:W,registry:S,customSensors:n||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),v.useEffect(()=>B,[B]),L.createElement(If.Provider,{value:Oe},L.createElement(eT,{context:I1,store:W},e.children))}function EL(){return L.useId()}function NL(e){const t=EL(),r=e.dragHandleUsageInstructions||kh.dragHandleUsageInstructions;return L.createElement(oT,null,n=>L.createElement(IL,{nonce:e.nonce,contextId:t,setCallbacks:n,dragHandleUsageInstructions:r,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const g2={dragging:5e3,dropAnimating:4500},RL=(e,t)=>t?td.drop(t.duration):e?td.snap:td.fluid,ML=(e,t)=>{if(e)return t?fd.opacity.drop:fd.opacity.combining},jL=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function DL(e){const r=e.dimension.client,{offset:n,combineWith:a,dropping:l}=e,c=!!a,h=jL(e),p=!!l,m=p?Tm.drop(n,c):Tm.moveTo(n);return{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:RL(h,l),transform:m,opacity:ML(c,p),zIndex:p?g2.dropAnimating:g2.dragging,pointerEvents:"none"}}function QL(e){return{transform:Tm.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function BL(e){return e.type==="DRAGGING"?DL(e):QL(e)}function PL(e,t,r=Li){const n=window.getComputedStyle(t),a=t.getBoundingClientRect(),l=Bb(a,n),c=Yh(l,r),h={client:l,tagName:t.tagName.toLowerCase(),display:n.display},p={x:l.marginBox.width,y:l.marginBox.height};return{descriptor:e,placeholder:h,displaceBy:p,client:l,page:c}}function OL(e){const t=E1("draggable"),{descriptor:r,registry:n,getDraggableRef:a,canDragInteractiveElements:l,shouldRespectForcePress:c,isEnabled:h}=e,p=vn(()=>({canDragInteractiveElements:l,shouldRespectForcePress:c,isEnabled:h}),[l,h,c]),m=vr(w=>{const C=a();return C||jt(),PL(r,C,w)},[r,a]),x=vn(()=>({uniqueId:t,descriptor:r,options:p,getDimension:m}),[r,m,p,t]),b=v.useRef(x),y=v.useRef(!0);to(()=>(n.draggable.register(b.current),()=>n.draggable.unregister(b.current)),[n.draggable]),to(()=>{if(y.current){y.current=!1;return}const w=b.current;b.current=x,n.draggable.update(x,w)},[x,n.draggable])}var R1=L.createContext(null);function rf(e){const t=v.useContext(e);return t||jt(),t}function FL(e){e.preventDefault()}const $L=e=>{const t=v.useRef(null),r=vr((K=null)=>{t.current=K},[]),n=vr(()=>t.current,[]),{contextId:a,dragHandleUsageInstructionsId:l,registry:c}=rf(If),{type:h,droppableId:p}=rf(R1),m=vn(()=>({id:e.draggableId,index:e.index,type:h,droppableId:p}),[e.draggableId,e.index,h,p]),{children:x,draggableId:b,isEnabled:y,shouldRespectForcePress:w,canDragInteractiveElements:C,isClone:S,mapped:I,dropAnimationFinished:N}=e;if(!S){const K=vn(()=>({descriptor:m,registry:c,getDraggableRef:n,canDragInteractiveElements:C,shouldRespectForcePress:w,isEnabled:y}),[m,c,n,C,w,y]);OL(K)}const Q=vn(()=>y?{tabIndex:0,role:"button","aria-describedby":l,"data-rfd-drag-handle-draggable-id":b,"data-rfd-drag-handle-context-id":a,draggable:!1,onDragStart:FL}:null,[a,l,b,y]),W=vr(K=>{I.type==="DRAGGING"&&I.dropping&&K.propertyName==="transform"&&Wi.flushSync(N)},[N,I]),B=vn(()=>{const K=BL(I),re=I.type==="DRAGGING"&&I.dropping?W:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":a,"data-rfd-draggable-id":b,style:K,onTransitionEnd:re},dragHandleProps:Q}},[a,Q,b,I,W,r]),U=vn(()=>({draggableId:m.id,type:m.type,source:{index:m.index,droppableId:m.droppableId}}),[m.droppableId,m.id,m.index,m.type]);return L.createElement(L.Fragment,null,x(B,I.snapshot,U))};var N3=(e,t)=>e===t,R3=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const UL=e=>e.combine?e.combine.draggableId:null,zL=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function HL(){const e=Si((a,l)=>({x:a,y:l})),t=Si((a,l,c=null,h=null,p=null)=>({isDragging:!0,isClone:l,isDropAnimating:!!p,dropAnimation:p,mode:a,draggingOver:c,combineWith:h,combineTargetFor:null})),r=Si((a,l,c,h,p=null,m=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:m,mode:l,offset:a,dimension:c,forceShouldAnimate:x,snapshot:t(l,h,p,m,null)}}));return(a,l)=>{if(md(a)){if(a.critical.draggable.id!==l.draggableId)return null;const c=a.current.client.offset,h=a.dimensions.draggables[l.draggableId],p=eo(a.impact),m=zL(a.impact),x=a.forceShouldAnimate;return r(e(c.x,c.y),a.movementMode,h,l.isClone,p,m,x)}if(a.phase==="DROP_ANIMATING"){const c=a.completed;if(c.result.draggableId!==l.draggableId)return null;const h=l.isClone,p=a.dimensions.draggables[l.draggableId],m=c.result,x=m.mode,b=R3(m),y=UL(m),C={duration:a.dropDuration,curve:C1.drop,moveTo:a.newHomeClientOffset,opacity:y?fd.opacity.drop:null,scale:y?fd.scale.drop:null};return{mapped:{type:"DRAGGING",offset:a.newHomeClientOffset,dimension:p,dropping:C,draggingOver:b,combineWith:y,mode:x,forceShouldAnimate:null,snapshot:t(x,h,b,y,C)}}}return null}}function M3(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const WL={mapped:{type:"SECONDARY",offset:Li,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:M3(null)}};function GL(){const e=Si((c,h)=>({x:c,y:h})),t=Si(M3),r=Si((c,h=null,p)=>({mapped:{type:"SECONDARY",offset:c,combineTargetFor:h,shouldAnimateDisplacement:p,snapshot:t(h)}})),n=c=>c?r(Li,c,!0):null,a=(c,h,p,m)=>{const x=p.displaced.visible[c],b=!!(m.inVirtualList&&m.effected[c]),y=Sf(p),w=y&&y.draggableId===c?h:null;if(!x){if(!b)return n(w);if(p.displaced.invisible[c])return null;const I=Z0(m.displacedBy.point),N=e(I.x,I.y);return r(N,w,!0)}if(b)return n(w);const C=p.displacedBy.point,S=e(C.x,C.y);return r(S,w,x.shouldAnimate)};return(c,h)=>{if(md(c))return c.critical.draggable.id===h.draggableId?null:a(h.draggableId,c.critical.draggable.id,c.impact,c.afterCritical);if(c.phase==="DROP_ANIMATING"){const p=c.completed;return p.result.draggableId===h.draggableId?null:a(h.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const qL=()=>{const e=HL(),t=GL();return(n,a)=>e(n,a)||t(n,a)||WL},VL={dropAnimationFinished:d3},ZL=Qb(qL,VL,null,{context:I1,areStatePropsEqual:N3})($L);function j3(e){return rf(R1).isUsingCloneFor===e.draggableId&&!e.isClone?null:L.createElement(ZL,e)}function Rl(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,n=!!e.shouldRespectForcePress;return L.createElement(j3,Kh({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:n}))}const D3=e=>t=>e===t,YL=D3("scroll"),KL=D3("auto"),x2=(e,t)=>t(e.overflowX)||t(e.overflowY),XL=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return x2(r,YL)||x2(r,KL)},JL=()=>!1,Q3=e=>e==null?null:e===document.body?JL()?e:null:e===document.documentElement?null:XL(e)?e:Q3(e.parentElement);var Lm=e=>({x:e.scrollLeft,y:e.scrollTop});const B3=e=>e?window.getComputedStyle(e).position==="fixed"?!0:B3(e.parentElement):!1;var e_=e=>{const t=Q3(e),r=B3(e);return{closestScrollable:t,isFixedOnPage:r}},t_=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:n,direction:a,client:l,page:c,closest:h})=>{const p=(()=>{if(!h)return null;const{scrollSize:y,client:w}=h,C=m3({scrollHeight:y.scrollHeight,scrollWidth:y.scrollWidth,height:w.paddingBox.height,width:w.paddingBox.width});return{pageMarginBox:h.page.marginBox,frameClient:w,scrollSize:y,shouldClipSubject:h.shouldClipSubject,scroll:{initial:h.scroll,current:h.scroll,max:C,diff:{value:Li,displacement:Li}}}})(),m=a==="vertical"?x1:Vb,x=U0({page:c,withPlaceholder:null,axis:m,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:n,axis:m,isEnabled:t,client:l,page:c,frame:p,subject:x}};const r_=(e,t)=>{const r=Pb(e);if(!t||e!==t)return r;const n=r.paddingBox.top-t.scrollTop,a=r.paddingBox.left-t.scrollLeft,l=n+t.scrollHeight,c=a+t.scrollWidth,p=f1({top:n,right:c,bottom:l,left:a},r.border);return p1({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var n_=({ref:e,descriptor:t,env:r,windowScroll:n,direction:a,isDropDisabled:l,isCombineEnabled:c,shouldClipSubject:h})=>{const p=r.closestScrollable,m=r_(e,p),x=Yh(m,n),b=(()=>{if(!p)return null;const w=Pb(p),C={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:w,page:Yh(w,n),scroll:Lm(p),scrollSize:C,shouldClipSubject:h}})();return t_({descriptor:t,isEnabled:!l,isCombineEnabled:c,isFixedOnPage:r.isFixedOnPage,direction:a,client:m,page:x,closest:b})};const s_={passive:!1},i_={passive:!0};var b2=e=>e.shouldPublishImmediately?s_:i_;const Kd=e=>e&&e.env.closestScrollable||null;function a_(e){const t=v.useRef(null),r=rf(If),n=E1("droppable"),{registry:a,marshal:l}=r,c=C3(e),h=vn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=v.useRef(h),m=vn(()=>Si((B,U)=>{t.current||jt();const K={x:B,y:U};l.updateDroppableScroll(h.id,K)}),[h.id,l]),x=vr(()=>{const B=t.current;return!B||!B.env.closestScrollable?Li:Lm(B.env.closestScrollable)},[]),b=vr(()=>{const B=x();m(B.x,B.y)},[x,m]),y=vn(()=>cd(b),[b]),w=vr(()=>{const B=t.current,U=Kd(B);if(B&&U||jt(),B.scrollOptions.shouldPublishImmediately){b();return}y()},[y,b]),C=vr((B,U)=>{t.current&&jt();const K=c.current,re=K.getDroppableRef();re||jt();const H=e_(re),Oe={ref:re,descriptor:h,env:H,scrollOptions:U};t.current=Oe;const ne=n_({ref:re,descriptor:h,env:H,windowScroll:B,direction:K.direction,isDropDisabled:K.isDropDisabled,isCombineEnabled:K.isCombineEnabled,shouldClipSubject:!K.ignoreContainerClipping}),ce=H.closestScrollable;return ce&&(ce.setAttribute(h2.contextId,r.contextId),ce.addEventListener("scroll",w,b2(Oe.scrollOptions))),ne},[r.contextId,h,w,c]),S=vr(()=>{const B=t.current,U=Kd(B);return B&&U||jt(),Lm(U)},[]),I=vr(()=>{const B=t.current;B||jt();const U=Kd(B);t.current=null,U&&(y.cancel(),U.removeAttribute(h2.contextId),U.removeEventListener("scroll",w,b2(B.scrollOptions)))},[w,y]),N=vr(B=>{const U=t.current;U||jt();const K=Kd(U);K||jt(),K.scrollTop+=B.y,K.scrollLeft+=B.x},[]),Q=vn(()=>({getDimensionAndWatchScroll:C,getScrollWhileDragging:S,dragStopped:I,scroll:N}),[I,C,S,N]),W=vn(()=>({uniqueId:n,descriptor:h,callbacks:Q}),[Q,h,n]);to(()=>(p.current=W.descriptor,a.droppable.register(W),()=>{t.current&&I(),a.droppable.unregister(W)}),[Q,h,I,W,l,a.droppable]),to(()=>{t.current&&l.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,l]),to(()=>{t.current&&l.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,l])}function vp(){}const v2={width:0,height:0,margin:pT},o_=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?v2:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},l_=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const n=o_({isAnimatingOpenOnMount:e,placeholder:t,animate:r});return{display:t.display,boxSizing:"border-box",width:n.width,height:n.height,marginTop:n.margin.top,marginRight:n.margin.right,marginBottom:n.margin.bottom,marginLeft:n.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:r!=="none"?td.placeholder:null}},c_=e=>{const t=v.useRef(null),r=vr(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:n,onTransitionEnd:a,onClose:l,contextId:c}=e,[h,p]=v.useState(e.animate==="open");v.useEffect(()=>h?n!=="open"?(r(),p(!1),vp):t.current?vp:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):vp,[n,h,r]);const m=vr(b=>{b.propertyName==="height"&&(a(),n==="close"&&l())},[n,l,a]),x=l_({isAnimatingOpenOnMount:h,animate:e.animate,placeholder:e.placeholder});return L.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":c,onTransitionEnd:m,ref:e.innerRef})};var u_=L.memo(c_);class d_ extends L.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,r){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:r.isVisible?{isVisible:!0,data:r.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const h_=e=>{const t=v.useContext(If);t||jt();const{contextId:r,isMovementAllowed:n}=t,a=v.useRef(null),l=v.useRef(null),{children:c,droppableId:h,type:p,mode:m,direction:x,ignoreContainerClipping:b,isDropDisabled:y,isCombineEnabled:w,snapshot:C,useClone:S,updateViewportMaxScroll:I,getContainerForClone:N}=e,Q=vr(()=>a.current,[]),W=vr((ce=null)=>{a.current=ce},[]);vr(()=>l.current,[]);const B=vr((ce=null)=>{l.current=ce},[]),U=vr(()=>{n()&&I({maxScroll:x3()})},[n,I]);a_({droppableId:h,type:p,mode:m,direction:x,isDropDisabled:y,isCombineEnabled:w,ignoreContainerClipping:b,getDroppableRef:Q});const K=vn(()=>L.createElement(d_,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:ce,data:Ne,animate:Me})=>L.createElement(u_,{placeholder:Ne,onClose:ce,innerRef:B,animate:Me,contextId:r,onTransitionEnd:U})),[r,U,e.placeholder,e.shouldAnimatePlaceholder,B]),re=vn(()=>({innerRef:W,placeholder:K,droppableProps:{"data-rfd-droppable-id":h,"data-rfd-droppable-context-id":r}}),[r,h,K,W]),H=S?S.dragging.draggableId:null,Oe=vn(()=>({droppableId:h,type:p,isUsingCloneFor:H}),[h,H,p]);function ne(){if(!S)return null;const{dragging:ce,render:Ne}=S,Me=L.createElement(j3,{draggableId:ce.draggableId,index:ce.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(be,V)=>Ne(be,V,ce));return Tw.createPortal(Me,N())}return L.createElement(R1.Provider,{value:Oe},c(re,C),ne())};function f_(){return document.body||jt(),document.body}const y2={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:f_},P3=e=>{let t={...e},r;for(r in y2)e[r]===void 0&&(t={...t,[r]:y2[r]});return t},yp=(e,t)=>e===t.droppable.type,w2=(e,t)=>t.draggables[e.draggable.id],p_=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=Si(l=>({draggableId:l.id,type:l.type,source:{index:l.index,droppableId:l.droppableId}})),n=Si((l,c,h,p,m,x)=>{const b=m.descriptor.id;if(m.descriptor.droppableId===l){const C=x?{render:x,dragging:r(m.descriptor)}:null,S={isDraggingOver:h,draggingOverWith:h?b:null,draggingFromThisWith:b,isUsingPlaceholder:!0};return{placeholder:m.placeholder,shouldAnimatePlaceholder:!1,snapshot:S,useClone:C}}if(!c)return t;if(!p)return e;const w={isDraggingOver:h,draggingOverWith:b,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:m.placeholder,shouldAnimatePlaceholder:!0,snapshot:w,useClone:null}});return(l,c)=>{const h=P3(c),p=h.droppableId,m=h.type,x=!h.isDropDisabled,b=h.renderClone;if(md(l)){const y=l.critical;if(!yp(m,y))return t;const w=w2(y,l.dimensions),C=eo(l.impact)===p;return n(p,x,C,C,w,b)}if(l.phase==="DROP_ANIMATING"){const y=l.completed;if(!yp(m,y.critical))return t;const w=w2(y.critical,l.dimensions);return n(p,x,R3(y.result)===p,eo(y.impact)===p,w,b)}if(l.phase==="IDLE"&&l.completed&&!l.shouldFlush){const y=l.completed;if(!yp(m,y.critical))return t;const w=eo(y.impact)===p,C=!!(y.impact.at&&y.impact.at.type==="COMBINE"),S=y.critical.droppable.id===p;return w?C?e:t:S?e:t}return t}},m_={updateViewportMaxScroll:LC},Ml=Qb(p_,m_,(e,t,r)=>({...P3(r),...e,...t}),{context:I1,areStatePropsEqual:N3})(h_),_m="termdock-interrupt-drag";function W0(){window.dispatchEvent(new Event(_m))}function g_(e){v.useEffect(()=>{P4();let t=null;const r=()=>{t?.(),t=null},n=()=>{r(),e.tryReleaseLock()},a=l=>{r(),!(l.button!==0||e.findClosestDraggableId(l)===null)&&(t=q5({onFinish:c=>{t=null,c!=="release"&&c!=="dispose"&&e.tryReleaseLock()}}))};return window.addEventListener(_m,n),window.addEventListener("mousedown",a,!0),window.addEventListener("keydown",r,!0),window.addEventListener("touchstart",r,!0),window.addEventListener("blur",n),()=>{r(),window.removeEventListener(_m,n),window.removeEventListener("mousedown",a,!0),window.removeEventListener("keydown",r,!0),window.removeEventListener("touchstart",r,!0),window.removeEventListener("blur",n)}},[e])}const x_=[g_];function k0(e){return s.jsx(NL,{...e,sensors:x_})}function O3(e){const t=e instanceof Error?e.message:"";return/directory does not exist|not a directory/i.test(t)?"directoryUnavailable":/EACCES|permission denied|outside.*allowed|not allowed/i.test(t)?"permissionDenied":e instanceof TypeError||id(e)||/network|failed to fetch|connection|timed? ?out|timeout|aborted/i.test(t)?"connection":"unknown"}const km=e=>({directoryUnavailable:"sidebar.sessionCreateDirectoryUnavailable",permissionDenied:"sidebar.sessionCreatePermissionDenied",connection:"sidebar.sessionCreateConnectionFailed",unknown:"sidebar.sessionCreateFailed"})[e];async function b_(e,t,r){const n=e.preferredFrontendSessionId||e.cwd?{...e,preferredFrontendSessionId:e.preferredFrontendSessionId||`terminal-${crypto.randomUUID()}`}:e;try{for(let a=0;;a++)try{return await t(n)}catch(l){if(!n.preferredFrontendSessionId||a>=3||O3(l)!=="connection"||!r.current()||(r.pending(!0),await new Promise(c=>{const h=()=>{clearTimeout(p),window.removeEventListener("online",h),window.removeEventListener(Co,h),c()},p=setTimeout(h,1e3*2**a);window.addEventListener("online",h),window.addEventListener(Co,h)}),!r.current()))throw l}}finally{r.pending(!1)}}const G0=wd(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function F3({sessionId:e,backendSessionId:t,groupId:r,itemClassName:n,iconClassName:a,compact:l=!1,onOpen:c,onDone:h}){const{t:p}=Xr(),m=G0(re=>re.collaborationGroups),[x,b]=v.useState(null),[y,w]=v.useState(!1),[C,S]=v.useState(""),I=v.useRef(!1),N=v.useRef(!0),Q=v.useRef(null),W=v.useRef(new Map),B=re=>re===e||re===t,U=m.filter(re=>(!r||re.id===r)&&re.sessionIds.some(B));v.useEffect(()=>(N.current=!0,()=>{N.current=!1}),[]),v.useEffect(()=>{x&&Q.current?.querySelector("button")?.focus({preventScroll:!0})},[x]),v.useEffect(()=>{x&&Q.current?.scrollIntoView({block:"nearest"})},[x,C]);const K=async()=>{if(!x||I.current)return;const re=x,H=Ki(),Oe=as()?.targetPeerId,ne=()=>Ki()===H&&as()?.targetPeerId===Oe;I.current=!0,w(!0),S("");try{const ce=await ml({id:re.id,name:re.name,sessionIds:re.sessionIds.filter(Ne=>!B(Ne)),expectedUpdatedAt:re.updatedAt});if(!ne())return;G0.getState().setCollaborationGroups(Ne=>Ne.map(Me=>Me.id===ce.group.id&&Me.updatedAt<=ce.group.updatedAt?ce.group:Me)),N.current&&h()}catch(ce){N.current&&ne()&&S(ce instanceof Error?ce.message:p("tab.leaveGroupFailed"))}finally{I.current=!1,N.current&&w(!1)}};return s.jsx(s.Fragment,{children:U.map(re=>s.jsxs("div",{className:"border-t border-border/15 py-1",children:[s.jsxs("button",{type:"button",disabled:y,className:`${n} w-full text-foreground hover:bg-surface-2 disabled:opacity-50`,onClick:()=>c(re.id),children:[s.jsx("span",{className:`${a} bg-primary/15 text-primary`,children:s.jsx(bc,{size:14})}),s.jsxs("span",{className:`min-w-0 flex-1 ${l?"flex items-center gap-2":""}`,children:[s.jsx("span",{className:"block shrink-0 font-medium",children:p("tab.openGroup")}),s.jsx("span",{className:"block truncate text-[11px] text-muted-foreground",title:re.name,children:re.name})]})]}),x?.id===re.id?s.jsxs("div",{ref:Q,role:"group","aria-label":p("tab.leaveGroupConfirm"),"aria-busy":y,className:"mx-3 my-1 rounded-lg border border-border/30 bg-surface p-3",children:[s.jsx("p",{className:"break-words text-xs leading-5 text-foreground",children:p("tab.leaveGroupQuestion",{name:x.name})}),s.jsx("p",{className:"mt-1 text-[11px] leading-5 text-muted-foreground",children:p("tab.leaveGroupHint")}),C&&s.jsx("p",{role:"alert",className:"mt-2 break-words text-xs leading-5 text-destructive",children:C}),s.jsxs("div",{className:"mt-2 flex flex-wrap justify-end gap-2",children:[s.jsx("button",{type:"button",disabled:y,className:"min-h-11 rounded-lg bg-surface-2 px-3 text-xs text-foreground disabled:opacity-50",onClick:()=>{b(null),S(""),queueMicrotask(()=>W.current.get(re.id)?.focus({preventScroll:!0}))},children:p("common.cancel")}),s.jsxs("button",{type:"button",disabled:y,className:"inline-flex min-h-11 items-center gap-2 rounded-lg bg-primary px-3 text-xs text-primary-foreground disabled:opacity-50",onClick:()=>{K()},children:[y&&s.jsx(sn,{size:14,className:"animate-spin"}),p(y?"tab.leavingGroup":"tab.leaveGroupConfirm")]})]})]}):s.jsxs("button",{type:"button",ref:H=>{H?W.current.set(re.id,H):W.current.delete(re.id)},disabled:y,className:`${n} w-full text-foreground hover:bg-surface-2 disabled:opacity-50`,onClick:()=>{b(re),S("")},children:[s.jsx("span",{className:`${a} bg-surface-2 text-muted-foreground`,children:s.jsx(_9,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:p("tab.leaveGroup")}),!l&&s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:p("tab.leaveGroupShortHint")})]})]})]},re.id))})}function v_({workspace:e,children:t,rightInset:r=0}){const n=!!e;return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:a=>{a&&(a.inert=n)},"aria-hidden":n?!0:void 0,style:{visibility:n?"hidden":void 0},className:"relative flex h-full w-full min-h-0 flex-col overflow-visible app-chrome-bg",children:t}),n&&s.jsx("div",{"data-collaboration-workspace-frame":!0,className:"absolute inset-y-0 left-0",style:{right:r},children:e})]})}const Ds=wd(e=>({todoOpen:!1,todoId:null,openTodos:()=>e({todoOpen:!0,groupId:null}),selectTodo:t=>e({todoId:t}),drafts:{},setDraft:(t,r)=>e(n=>({drafts:{...n.drafts,[t]:r}})),groupId:null,view:"tasks",open:(t,r="tasks")=>e({groupId:t,view:r,todoOpen:!1}),terminal:()=>e({groupId:null,todoOpen:!1})})),X0=(e,t)=>s1(`/todos${e}`,{method:"POST",body:JSON.stringify(t)}),FQ=()=>s1("/todos"),y_=()=>s1("/todos/summary"),$Q=e=>X0("",e),UQ=(e,t)=>X0(`/${encodeURIComponent(e.id)}`,{...t,revision:e.revision}),zQ=e=>X0("/collectors",e),HQ=e=>X0("/collectors/"+encodeURIComponent(e.id)+"/remove",{revision:e.revision}),WQ=e=>X0("/handoff",e),GQ=(e,t)=>X0(`/collectors/${encodeURIComponent(e)}/run`,{idempotencyKey:t});function yc(e,t,r=[]){let n;const a=()=>{document.hidden||e()},l=()=>{n!==void 0&&(window.clearInterval(n),n=void 0)},c=()=>{l(),!document.hidden&&(a(),n=window.setInterval(a,t))};document.addEventListener("visibilitychange",c);for(const h of r)window.addEventListener(h,a);return c(),()=>{l(),document.removeEventListener("visibilitychange",c);for(const h of r)window.removeEventListener(h,a)}}function $3({onOpen:e,placement:t="sidebar"}){const r=t==="toolbar",n=Ds(c=>c.todoOpen),[a,l]=v.useState(null);return v.useEffect(()=>{let c=!0,h=!1,p=as()?.targetPeerId;const m=()=>{const x=as()?.targetPeerId;p!==x&&(p=x,l(null))};return window.addEventListener(pl,m),(()=>{const x=yc(()=>{h||navigator.onLine===!1||(h=!0,Promise.resolve().then(async()=>{const b=as()?.targetPeerId,y=await y_();c&&as()?.targetPeerId===b&&l(y.count)}).catch(()=>{}).finally(()=>{h=!1}))},15e3,[Co,"termdock:todos-changed"]);return()=>{c=!1,x(),window.removeEventListener(pl,m)}})()},[]),s.jsxs("button",{type:"button","aria-label":t==="toolbar"?"打开待办清单":void 0,"aria-description":a===null?void 0:`${a} 项未完成`,"aria-current":n?"page":void 0,onClick:e,title:"待办清单",className:`${r?"inline-flex min-h-9 min-w-11 shrink-0 items-center justify-center gap-1 rounded-md px-1.5 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring":"mx-2 my-2 flex min-h-11 shrink-0 items-center gap-2.5 rounded-lg px-3 text-left text-xs"} transition ${n?"bg-[rgb(var(--primary-rgb)/0.1)] text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[!r&&s.jsx(Cb,{size:16}),s.jsx("span",{className:r?"font-medium":"flex-1 font-medium",children:"待办"}),a!==null&&a>0&&s.jsx("span",{className:r?"min-w-3 text-center text-[10px] font-semibold tabular-nums text-primary":"rounded-md bg-surface px-1.5 py-0.5 text-[10px] tabular-nums",children:a>99?"99+":a})]})}function w_({state:e,onCopy:t,copied:r}){const{t:n}=Xr(),[a,l]=v.useState(null),c=e.caAvailable&&e.onboardingUrl?new URL("/ca",e.onboardingUrl).href:null;return v.useEffect(()=>{let h=!1;return l(null),c&&O4.toDataURL(c,{width:180,margin:2,errorCorrectionLevel:"M"}).then(p=>{h||l(p)}).catch(()=>{}),()=>{h=!0}},[c]),s.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-muted-foreground",children:[s.jsx("p",{children:n("settings.mobileSetupIntro")}),e.httpsEnabled&&s.jsxs("section",{className:"space-y-3 rounded-xl bg-surface-2 p-3",children:[s.jsx("h3",{className:"font-medium text-foreground",children:n("settings.mobileSetupDownload")}),c?s.jsxs(s.Fragment,{children:[a&&s.jsx("img",{src:a,alt:n("settings.mobileSetupDownload"),className:"h-44 w-44 rounded-lg"}),s.jsxs("button",{type:"button",onClick:()=>t(c),className:"flex w-full items-center justify-between gap-3 rounded-lg bg-surface p-2 text-left",children:[s.jsx("span",{className:"break-all",children:c}),s.jsx("span",{className:"shrink-0 text-primary",children:n(r?"rightSidebar.copied":"common.copy")})]})]}):s.jsx("p",{children:n("settings.caMissing")}),s.jsx("p",{children:n("settings.mobileSetupIos")}),s.jsx("p",{children:n("settings.mobileSetupAndroid")})]}),s.jsx("h3",{className:"font-medium text-foreground",children:e.httpsEnabled?n("settings.mobileSetupConnect"):n("settings.localAccess")}),s.jsx("p",{children:n("settings.mobileSetupConnectHint")})]})}function A2(){const e=F4(),t=e.visualViewport,r=document.documentElement.style,n=m=>m===void 0?"?":Math.round(m),a=m=>r.getPropertyValue(m)||"?";let l=document.activeElement?.parentElement,c=null;for(;l&&!c;)c=l.querySelector('[data-mobile-keyboard="true"]'),l=l.parentElement;const h=c?.getBoundingClientRect(),p=document.getElementById("root")?.getBoundingClientRect();return[`VVP ${n(t?.height)} off ${n(t?.offsetTop)} win ${e.innerHeight}`,`base ${a("--app-base-vh")} kb ${a("--kb-height")} move ${a("--kb-translate-y")}`,`bar ${n(h?.top)}…${n(h?.bottom)} h ${n(h?.height)} root ${n(p?.bottom)}`,`safe ${a("--safe-top-inset")}/${a("--safe-bottom-inset")} frame ${e!==window?"child":"root"} focus ${document.activeElement?.tagName??"?"}`].join(`
60
+ `)}function A_({onClose:e}){const[t,r]=L.useState(A2);return L.useEffect(()=>{const n=window.setInterval(()=>r(A2()),200);return()=>window.clearInterval(n)},[]),s.jsxs("div",{className:"pointer-events-none fixed inset-x-2 z-toast rounded-lg border border-border/15 bg-surface p-2 text-foreground md:hidden",style:{top:"calc(var(--safe-top-inset, 0px) + 40px)"},children:[s.jsx("button",{type:"button",className:"pointer-events-auto absolute right-1 top-1 px-2 py-1 text-xs",onPointerDown:n=>n.preventDefault(),onClick:e,"aria-label":"关闭布局诊断",children:"×"}),s.jsx("pre",{className:"pr-5 font-mono text-[10px] leading-tight",children:t})]})}const U3=()=>Pl(()=>import("./SessionChatView-hFOVLdHC.js").then(e=>e.S),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])).then(e=>({default:e.SessionChatView})),T_=v.lazy(U3);function C_({sessionId:e,name:t,active:r,terminalReady:n=!1,onKeyboardChange:a,onChatReadyChange:l,children:c}){const h=V5(),[p,m]=Af(e,r),[x,b]=v.useState(p==="chat"),[y,w]=v.useState(!1);return v.useEffect(()=>{if(r&&p==="chat")return kw(e)},[r,p,e]),v.useEffect(()=>(l?.(e,p==="chat"?y:null),()=>l?.(e,null)),[e,p,y,l]),v.useEffect(()=>{if(!r||x)return;const C=()=>{U3().catch(()=>{})};if(typeof requestIdleCallback=="function"){const I=requestIdleCallback(C,{timeout:3e3});return()=>cancelIdleCallback(I)}const S=setTimeout(C,800);return()=>clearTimeout(S)},[r,x]),p==="chat"&&!x&&b(!0),s.jsxs("div",{className:"flex h-full min-h-0 flex-col","data-session-workspace":e,"data-session-active":r,"data-session-input-ready":h.has("todo.guidance")&&(p==="chat"?y:n),onContextMenuCapture:h.has("session.owner-menu")?void 0:$4,onContextMenu:C=>{if(!r||window.matchMedia("(pointer: coarse)").matches)return;const S=C.target instanceof Element?C.target:null;S?.closest('a, button, input[type="file"]')||window.getSelection()?.toString()||S instanceof HTMLTextAreaElement&&S.selectionStart!==S.selectionEnd||(C.preventDefault(),C.stopPropagation(),window.dispatchEvent(new CustomEvent("termdock:session-context-menu",{detail:{sessionId:e,x:C.clientX,y:C.clientY}})))},children:[s.jsx("div",{className:`min-h-0 flex-1 ${p==="terminal"?"":"hidden"}`,children:c(p==="terminal")}),x&&s.jsx("div",{className:`min-h-0 flex-1 ${p==="chat"?"":"hidden"}`,children:s.jsx(v.Suspense,{fallback:s.jsx("div",{className:"h-full bg-[var(--chrome-bg)] px-4 sm:px-8",children:s.jsx("div",{className:"mx-auto max-w-screen-2xl py-5 sm:py-8",children:s.jsx(Iw,{})})}),children:s.jsx(T_,{sessionId:e,name:t,active:r&&p==="chat",terminalLink:!1,onKeyboardChange:a,onReadyChange:w,onTerminal:()=>m("terminal")})})})]})}function S_(e){return e.state==="succeeded"||e.state==="partial_failure"||e.state==="paused"&&e.paused&&e.running===0}const L_={x:0,y:0,width:1,height:1};function Wc(e){return"id"in e?[e.id]:[...Wc(e.first),...Wc(e.second)]}function Im(e,t=0,r=new Set){if(!e||typeof e!="object"||t>24)return null;const n=e;if(typeof n.id=="string"&&n.id&&!r.has(n.id))return r.add(n.id),{id:n.id};if(!["x","y"].includes(String(n.axis))||!Number.isFinite(n.ratio))return null;const a=Im(n.first,t+1,r),l=Im(n.second,t+1,r);return a&&l?{axis:n.axis,ratio:Math.max(.02,Math.min(.98,Number(n.ratio))),first:a,second:l}:a??l}function gd(e,t){if("id"in e)return t.has(e.id)?e:null;const r=gd(e.first,t),n=gd(e.second,t);return r&&n?{...e,first:r,second:n}:r??n}function nf(e,t,r,n){return"id"in e?e.id===t?{axis:n==="left"||n==="right"?"x":"y",ratio:.5,first:n==="left"||n==="top"?{id:r}:e,second:n==="left"||n==="top"?e:{id:r}}:e:{...e,first:nf(e.first,t,r,n),second:nf(e.second,t,r,n)}}function __(e,t,r,n){if(t===r||!Wc(e).includes(t)||!Wc(e).includes(r))return e;if(n==="center"){const a=l=>"id"in l?{id:l.id===t?r:l.id===r?t:l.id}:{...l,first:a(l.first),second:a(l.second)};return a(e)}return nf(gd(e,new Set(Wc(e).filter(a=>a!==t))),r,t,n)}function D0(e,t){if(e.length===1)return{id:e[0]};if(t==="grid"&&e.length>2){const r=Math.ceil(e.length/2);return{axis:"y",ratio:.5,first:D0(e.slice(0,r),"horizontal"),second:D0(e.slice(r),"horizontal")}}return{axis:t==="vertical"?"y":"x",ratio:1/e.length,first:{id:e[0]},second:D0(e.slice(1),t)}}function Em(e,t=L_,r=""){if("id"in e)return{panes:[{id:e.id,rect:t}],dividers:[]};const n={...t},a={...t};e.axis==="x"?(n.width*=e.ratio,a.x+=n.width,a.width-=n.width):(n.height*=e.ratio,a.y+=n.height,a.height-=n.height);const l=Em(e.first,n,r+"0"),c=Em(e.second,a,r+"1");return{panes:[...l.panes,...c.panes],dividers:[{path:r,node:e,rect:t},...l.dividers,...c.dividers]}}function rd(e,t,r){return"id"in e?e:t?t[0]==="0"?{...e,first:rd(e.first,t.slice(1),r)}:{...e,second:rd(e.second,t.slice(1),r)}:{...e,ratio:r}}function z3(e){return"id"in e||"id"in e.first||"id"in e.second||e.first.axis===e.axis||e.second.axis===e.axis||!("id"in e.first.first)||!("id"in e.first.second)||!("id"in e.second.first)||!("id"in e.second.second)?null:e.axis==="y"?{ids:[e.first.first.id,e.first.second.id,e.second.first.id,e.second.second.id],top:e.first.ratio,bottom:e.second.ratio,left:e.ratio,right:e.ratio}:{ids:[e.first.first.id,e.second.first.id,e.first.second.id,e.second.second.id],top:e.ratio,bottom:e.ratio,left:e.first.ratio,right:e.second.ratio}}function wp(e,t,r){const n=z3(e);if(!n)return e;const[a,l,c,h]=n.ids.map(p=>({id:p}));return t==="top"||t==="bottom"?{axis:"y",ratio:(n.left+n.right)/2,first:{axis:"x",ratio:t==="top"?r:n.top,first:a,second:l},second:{axis:"x",ratio:t==="bottom"?r:n.bottom,first:c,second:h}}:{axis:"x",ratio:(n.top+n.bottom)/2,first:{axis:"y",ratio:t==="left"?r:n.left,first:a,second:c},second:{axis:"y",ratio:t==="right"?r:n.right,first:l,second:h}}}function k_(e,t,r,n,a){const l=(p,m,x)=>{if(p.length===1)return p[0];const b=x?.length===p.length&&x.every(y=>Number.isFinite(y)&&y>0)?x:p.map(()=>1);return{axis:m,ratio:b[0]/b.reduce((y,w)=>y+w,0),first:p[0],second:l(p.slice(1),m,b.slice(1))}};if(t!=="grid")return l(e.map(p=>({id:p})),t==="vertical"?"y":"x",r);const c=Math.ceil(Math.sqrt(e.length)),h=[];for(let p=0;p<e.length;p+=c){const m=e.slice(p,p+c).map(b=>({id:b})),x=n?.length===c?n.slice(0,m.length):void 0;x&&m.length<c&&(x[x.length-1]+=n.slice(m.length).reduce((b,y)=>b+y,0)),h.push(l(m,"x",x))}return l(h,"y",a)}let I_;function Nf(){try{const e="termdock-collaboration-panel-client",t=localStorage.getItem(e);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(e,r),r}catch{return I_??=crypto.randomUUID()}}let T2=Promise.resolve();function Qa(e,t){t&&(e={groups:{[t]:e}});const r=Nf(),n=T2.catch(()=>{}).then(()=>Ka({collaborationPanel:{clientId:r,state:e}}));return T2=n,n.then(()=>{})}function C2(e,t,r,n,a,l){return{x:a>0?Math.max(0,Math.min(1,(e-r)/a)):.5,y:l>0?Math.max(0,Math.min(1,(t-n)/l)):.5}}function H3(e,t){return t?{...{...e?.floatingGroupId===t?e:{},...e?.groups?.[t]},drafts:e?.drafts}:{drafts:e?.drafts}}function W3(e){const t=Object.entries(e?.groups??{}).filter(([,r])=>r.floatingGroupId).map(([r])=>r);return e?.floatingGroupId&&!e.groups?.[e.floatingGroupId]&&t.push(e.floatingGroupId),t}async function E_(e,t){const r=Ds.getState(),n=r.groupId;r.drafts[e]&&await Qa({drafts:{[e]:r.drafts[e]}});const a={sessionId:t,side:window.innerWidth<640?"bottom":"right"};if(await Qa({floatingGroupId:e,mode:"docked",dock:a},e),Ds.getState().groupId!==n)throw new Error("布局已保存;页面已切换,请重新打开成员消息");window.dispatchEvent(new CustomEvent("termdock:open-collaboration-messages",{detail:{groupId:e,dock:a}}))}function N_(e,t,r){const{locale:n}=Xr(),[a,l]=v.useState(!1),[c,h]=v.useState(!1),p=v.useRef(r);p.current=r;const m=v.useRef({edited:!1,revision:0,persist:()=>{}}),x=v.useCallback(()=>m.current.persist(),[]),b=v.useCallback(()=>{m.current.edited=!0,m.current.revision++},[]);return jl(c?{tone:"recovering",message:n==="zh"?"正在恢复布局同步…":"Restoring layout sync…"}:null),v.useEffect(()=>{let y=!1,w=!1,C=!1,S=!1,I=0,N=0,Q;const W={edited:!1,revision:0,persist:()=>{U()}};m.current=W,l(!1),h(!1);const B=()=>{y||(clearTimeout(Q),Q=setTimeout(()=>{U()},Math.min(3e4,1e3*2**Math.min(N++,5))))},U=async()=>{if(!(y||C||S)){clearTimeout(Q);try{if(!w){C=!0;const re=await V0();if(y)return;W.edited||p.current(re),w=!0,C=!1,l(!0)}if(W.revision>I&&t.current){const re=W.revision;S=!0,await Qa({layouts:{[e]:t.current}}),I=re,S=!1}y||(N=0,h(!1),W.revision>I&&B())}catch{y||(l(!0),h(!0),B())}finally{C=!1,S=!1}}},K=()=>{document.hidden||U()};return U(),window.addEventListener("online",K),window.addEventListener(Co,K),document.addEventListener("visibilitychange",K),()=>{y=!0,clearTimeout(Q),window.removeEventListener("online",K),window.removeEventListener(Co,K),document.removeEventListener("visibilitychange",K),W.revision>I&&w&&t.current&&Qa({layouts:{[e]:t.current}}).catch(()=>{})}},[e,t]),{ready:a,markChanged:b,persist:x}}const R_=e=>e.startsWith("@collaboration:"),S2=e=>({left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.width*100}%`,height:`${e.height*100}%`});function M_({groupId:e}){const t=Hs(a=>a.setHost),r=v.useRef(null),n=v.useCallback(a=>{(a||Hs.getState().hosts[e]===r.current)&&t(e,a),r.current=a},[e,t]);return s.jsx("div",{ref:n,className:"h-full min-h-0 min-w-0 bg-surface"})}function L2({layoutId:e,panes:t,preset:r="grid",initialTree:n,focusId:a,mobile:l=!1}){const c=Hs(X=>X.docks),h=JSON.stringify(t.map(X=>X.id)),p=Object.entries(c).filter(([,X])=>t.some(He=>He.id===X.sessionId)),m=JSON.stringify(p),x=v.useRef(null),[b,y]=v.useState(()=>n??D0(t.map(X=>X.id),l?"vertical":r)),w=v.useRef(b);w.current=b;const C=Hs(X=>X.activePaneId),[S,I]=v.useState(null),[N,Q]=v.useState(null),W=v.useRef(r),B=v.useRef(t.map(X=>X.id)),U=v.useRef({}),{ready:K,markChanged:re,persist:H}=N_(e,w,X=>{const He=X.collaborationPanels?.[Nf()];for(const ve of W3(He)){const Fe=H3(He,ve);Fe.mode==="docked"&&Fe.dock&&t.some(lt=>lt.id===Fe.dock.sessionId)&&!Hs.getState().docks[ve]&&Hs.getState().setDock(ve,Fe.dock)}let je=Im(He?.layouts?.[e]);if(je&&He?.floatingGroupId){const ve=Fe=>"id"in Fe?{id:Fe.id==="@collaboration"?Wd(He.floatingGroupId):Fe.id}:{...Fe,first:ve(Fe.first),second:ve(Fe.second)};je=ve(je)}je&&y(je)}),Oe=X=>{re(),w.current=X,y(X)};v.useLayoutEffect(()=>{if(!K)return;const X=JSON.parse(h),He=W.current!==r;W.current=r;let je=He?D0(X,r):w.current;const ve=B.current;if(!He&&ve.length===X.length&&ve.every(ye=>X.includes(ye))&&ve.some((ye,de)=>ye!==X[de])){const ye=new Map(ve.map((nt,Xe)=>[nt,X[Xe]])),de=nt=>"id"in nt?{id:ye.get(nt.id)??nt.id}:{...nt,first:de(nt.first),second:de(nt.second)};je=de(je)}B.current=X;const Fe=new Set([...X,...p.map(([ye])=>Wd(ye))]);je=gd(je,Fe)??D0(X,r);for(const ye of X)Wc(je).includes(ye)||(je={axis:"x",ratio:.5,first:je,second:{id:ye}});const lt={};for(const[ye,de]of p){const nt=Wd(ye),Xe=`${de.sessionId}:${de.side}`;if(lt[ye]=Xe,(!Wc(je).includes(nt)||U.current[ye]&&U.current[ye]!==Xe)&&(je=gd(je,new Set([...Fe].filter(pt=>pt!==nt))),je=nf(je,de.sessionId,nt,de.side)),de.preferredWidth&&(de.side==="left"||de.side==="right")){const pt=(xe,mt)=>{if("id"in xe)return xe;const It="id"in xe.first&&xe.first.id===nt,At="id"in xe.second&&xe.second.id===nt;if(xe.axis==="x"&&(It||At)&&xe.ratio===.5){const F=(x.current?.clientWidth||window.innerWidth)*mt.width,we=Math.max(.1,Math.min(.45,de.preferredWidth/Math.max(1,F)));return{...xe,ratio:It?we:1-we}}const Nt={...mt},oe={...mt};return xe.axis==="x"?(Nt.width*=xe.ratio,oe.x+=Nt.width,oe.width-=Nt.width):(Nt.height*=xe.ratio,oe.y+=Nt.height,oe.height-=Nt.height),{...xe,first:pt(xe.first,Nt),second:pt(xe.second,oe)}};je=pt(je,{x:0,y:0,width:1,height:1})}}U.current=lt,JSON.stringify(je)!==JSON.stringify(w.current)&&(Oe(je),H())},[K,h,r,m]),v.useEffect(()=>{const X=()=>H();return window.addEventListener("pagehide",X),()=>{window.removeEventListener("pagehide",X),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),X()}},[e]);const ne=Em(b),ce=z3(b),Ne=[...t,...p.map(([X])=>({id:Wd(X),content:s.jsx(M_,{groupId:X})}))],Me=Ne.some(X=>X.id===C),be=v.useRef(null),V=v.useRef(N);V.current=N;const Ke=v.useRef(null),he=$0(X=>{Ke.current=null,be.current=null,V.current=null,X!=="dispose"&&(Q(null),I(null),H()),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}}))});v.useEffect(()=>{const X=x.current;if(!X||!K)return;const He=ve=>{if(ve.button!==0||!(ve.target instanceof Element))return;const Fe=ve.target.closest("[data-split-pane-title], [data-panel-drag-title]"),lt=ve.target.closest("button, a, input, textarea, select, summary");if(!Fe||lt&&lt!==Fe)return;const ye=Fe.closest("[data-layout-pane]");if(!ye||!X.contains(ye))return;he(ve,X),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}}));const de=ye.getBoundingClientRect();be.current={id:ye.dataset.layoutPane,x:ve.clientX,y:ve.clientY,moved:!1,originX:ve.clientX-de.left,originY:ve.clientY-de.top,scale:Math.min(.8,480/Math.max(1,de.width),320/Math.max(1,de.height))},X.setPointerCapture?.(ve.pointerId)},je=ve=>{const Fe=ve.target;if(!(Fe instanceof Element))return;const lt=Fe.closest("[data-layout-pane]");if(!(!lt||!X.contains(lt))){if(ve.type==="pointerdown"&&Hs.getState().activePaneId!==lt.dataset.layoutPane){const ye=document.activeElement;ye instanceof HTMLElement&&ye.closest("[data-layout-pane]")&&!lt.contains(ye)&&ye.blur();const de=window.getSelection();de?.anchorNode&&!lt.contains(de.anchorNode)&&de.removeAllRanges()}Hs.getState().setActivePane(lt.dataset.layoutPane)}};return X.addEventListener("pointerdown",je,!0),X.addEventListener("focusin",je,!0),X.addEventListener("pointerdown",He,!0),()=>{X.removeEventListener("pointerdown",He,!0),X.removeEventListener("pointerdown",je,!0),X.removeEventListener("focusin",je,!0)}},[K,he]);const Be=(X,He)=>{const je=x.current?.getBoundingClientRect(),ve=Ke.current;if(!je||!ve)return;const Fe=ve.axis==="x"?je.width*ve.rect.width:je.height*ve.rect.height,lt=ve.axis==="x"?je.left+je.width*ve.rect.x:je.top+je.height*ve.rect.y,ye=Math.min(.45,(l?48:120)/Math.max(1,Fe)),de=Math.max(ye,Math.min(1-ye,((ve.axis==="x"?X:He)-lt)/Math.max(1,Fe)));Oe(ve.side?wp(w.current,ve.side,de):rd(w.current,ve.path,de))},ae=ce?[{key:"top",side:"top",axis:"x",x:ce.top,y:0,length:(ce.left+ce.right)/2},{key:"bottom",side:"bottom",axis:"x",x:ce.bottom,y:(ce.left+ce.right)/2,length:1-(ce.left+ce.right)/2},{key:"left",side:"left",axis:"y",x:0,y:ce.left,length:(ce.top+ce.bottom)/2},{key:"right",side:"right",axis:"y",x:(ce.top+ce.bottom)/2,y:ce.right,length:1-(ce.top+ce.bottom)/2}].map(X=>({...X,rect:{x:0,y:0,width:1,height:1},path:void 0})):ne.dividers.map(X=>({key:X.path,path:X.path,side:void 0,axis:X.node.axis,rect:X.rect,x:X.rect.x+(X.node.axis==="x"?X.rect.width*X.node.ratio:0),y:X.rect.y+(X.node.axis==="y"?X.rect.height*X.node.ratio:0),length:X.node.axis==="x"?X.rect.height:X.rect.width}));return s.jsxs("div",{ref:x,"data-split-container":"true",className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-[var(--chrome-bg)] [&_[data-split-pane-title]]:touch-none [&_[data-panel-drag-title]]:touch-none",onPointerMove:X=>{if(Ke.current){X.preventDefault(),Be(X.clientX,X.clientY);return}const He=be.current,je=x.current?.getBoundingClientRect();if(!He||!je||!He.moved&&Math.hypot(X.clientX-He.x,X.clientY-He.y)<6)return;He.moved=!0,I({id:He.id,dx:X.clientX-He.x,dy:X.clientY-He.y,originX:He.originX,originY:He.originY,scale:He.scale});const ve=(X.clientX-je.left)/je.width,Fe=(X.clientY-je.top)/je.height,lt=ne.panes.find(pt=>ve>=pt.rect.x&&ve<=pt.rect.x+pt.rect.width&&Fe>=pt.rect.y&&Fe<=pt.rect.y+pt.rect.height);if(!lt||lt.id===He.id){V.current=null,Q(null);return}const ye=(ve-lt.rect.x)/lt.rect.width,de=(Fe-lt.rect.y)/lt.rect.height,nt=Math.min(ye,1-ye,de,1-de)>.25?"center":ye<1-ye&&ye<=de&&ye<=1-de?"left":1-ye<=de&&1-ye<=1-de?"right":de<1-de?"top":"bottom",Xe={id:lt.id,side:nt};V.current=Xe,Q(Xe)},onPointerUp:X=>{Ke.current&&(Ke.current=null,H()),be.current?.moved&&V.current&&(Oe(__(w.current,be.current.id,V.current.id,V.current.side)),H()),be.current=null,V.current=null,Q(null),I(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),X.currentTarget.hasPointerCapture?.(X.pointerId)&&X.currentTarget.releasePointerCapture(X.pointerId)},onLostPointerCapture:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),Ke.current=null,be.current=null,V.current=null,Q(null),I(null),H()},onKeyDownCapture:X=>{X.key==="Escape"&&(be.current=null,V.current=null,Q(null),I(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})))},onPointerCancel:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),Ke.current=null,be.current=null,V.current=null,Q(null),I(null),H()},children:[S&&s.jsx("div",{"aria-hidden":"true","data-drag-placeholder":"true",className:"pointer-events-none absolute border-2 border-dashed border-primary/30 bg-primary/5",style:S2(ne.panes.find(X=>X.id===S.id)?.rect??{x:0,y:0,width:0,height:0})}),Ne.map(X=>{const He=ne.panes.find(Fe=>Fe.id===X.id)?.rect,je=!He||!!a&&X.id!==a,ve=Ne.length>1&&!a&&Me&&C!==X.id;return s.jsxs("div",{"data-layout-pane":X.id,"data-pane-active":C===X.id,className:`absolute min-h-0 min-w-0 overflow-hidden bg-[var(--chrome-bg)] ${S?.id===X.id?"pointer-events-none z-30 rounded-lg ring-1 ring-primary/60 shadow-xl":""}`,style:{...S2(a===X.id?{x:0,y:0,width:1,height:1}:He??{x:0,y:0,width:0,height:0}),padding:Ne.length>1?"0.5px":0,opacity:S?.id===X.id?.9:ve?.7:1,transition:"none",visibility:je?"hidden":void 0,...S?.id===X.id?{transform:`translate(${S.dx}px, ${S.dy}px) scale(${S.scale})`,transformOrigin:`${S.originX}px ${S.originY}px`}:{}},onDragStart:Fe=>{Fe.target.closest("[data-split-pane-title], [data-panel-drag-title]")&&Fe.preventDefault()},children:[X.content,l&&Ne.length>1&&!R_(X.id)&&s.jsx("button",{type:"button","data-panel-drag-title":"true","aria-label":"拖动面板到其他区域",className:"swiper-no-swiping absolute right-1 top-1 z-20 rounded bg-surface p-1 text-muted-foreground",children:s.jsx(yb,{size:14})}),N?.id===X.id&&s.jsx("div",{className:"pointer-events-none absolute z-30 border-2 border-primary bg-primary/20",style:{top:N.side==="bottom"?"50%":0,bottom:N.side==="top"?"50%":0,left:N.side==="right"?"50%":0,right:N.side==="left"?"50%":0}})]},X.id)}),!a&&ae.map(X=>s.jsx("button",{type:"button",role:"separator","aria-label":X.side?`调整${{top:"上",bottom:"下",left:"左",right:"右"}[X.side]}半段分隔线`:"调整分屏大小","aria-orientation":X.axis==="x"?"vertical":"horizontal",disabled:!K,className:`swiper-no-swiping absolute z-10 touch-none bg-border hover:bg-primary focus-visible:bg-primary ${X.axis==="x"?"w-px cursor-col-resize":"h-px cursor-row-resize"}`,style:{left:`${X.x*100}%`,top:`${X.y*100}%`,...X.axis==="x"?{height:`${X.length*100}%`}:{width:`${X.length*100}%`}},onPointerDown:He=>{He.preventDefault(),He.stopPropagation(),he(He,x.current??void 0),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),Ke.current=X,x.current?.setPointerCapture?.(He.pointerId)},onDoubleClick:()=>{Oe(X.side?wp(w.current,X.side,.5):rd(w.current,X.path,.5)),H()},onKeyDown:He=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(He.key))return;He.preventDefault();const je=X.side?ce[X.side]:ne.dividers.find(Fe=>Fe.path===X.path).node.ratio,ve=Math.max(.05,Math.min(.95,je+(["ArrowRight","ArrowDown"].includes(He.key)?.03:-.03)));Oe(X.side?wp(w.current,X.side,ve):rd(w.current,X.path,ve)),H()},children:s.jsx("span",{"aria-hidden":"true",className:`absolute ${X.axis==="x"?"inset-y-0 -inset-x-1":"inset-x-0 -inset-y-1"}`})},X.key))]})}let Nm=0,_2=!1,I0=0;function j_(){if(_2||typeof window>"u")return;_2=!0;const e=()=>{Nm=performance.now()};window.addEventListener("pointerdown",()=>{I0+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{I0=Math.max(0,I0-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{I0=0,e()})}function M1(e,t=500){j_();let r=!1,n,a;const l=()=>{if(r)return;if(I0>0||performance.now()-Nm<400){a=setTimeout(l,100);return}const c=()=>{if(!r){if(I0>0||performance.now()-Nm<400){a=setTimeout(l,100);return}e()}};"requestIdleCallback"in window?n=window.requestIdleCallback(c):a=setTimeout(c,16)};return a=setTimeout(l,t),()=>{r=!0,clearTimeout(a),n!==void 0&&window.cancelIdleCallback(n)}}function D_(e){const[t,r]=v.useState(e);return v.useEffect(()=>M1(()=>r(e),0),[e]),t}function Q_(e,t){if(t||e.defaultPrevented||e.isComposing||e.keyCode===229)return!1;const n=(e.target instanceof Element?e.target:null)?.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"]');return!n||n.matches("textarea[data-terminal-input-anchor], textarea.xterm-helper-textarea")&&!!n.closest(".terminal-viewport-container")}class B_{until=-1/0;lastFlush=-1/0;input(t){this.until=t+1500}consume(t,r,n){const a=r<=this.until;return this.until=-1/0,!a||!n||t>8192||r-this.lastFlush<16?!1:(this.lastFlush=r,!0)}}function P_(e,t,r){v.useEffect(()=>{e&&U4(e,!0)},[e,r])}const G3="\x1B[?2026h",O_="\x1B[?2026l",q3="\x1Bc";function F_(e){return e.replace(/(?:\x1b\]|\x9d)[\s\S]*?(?:\x07|\x1b\\|\x9c|$)|(?:\x1b[P_X^]|[\x90\x98\x9e\x9f])[\s\S]*?(?:\x1b\\|\x9c|$)|(?:\x1b\[|\x9b)\?([\d;]+)([hl])|(?:\x1b\[|\x9b)[\d;]*!p|\x1bc/g,(t,r,n)=>{if(t===q3||t.endsWith("!p"))return t+G3;if(r===void 0)return t;const a=r.split(";").filter(l=>Number(l)!==2026);return a.length?`\x1B[?${a.join(";")}${n}`:""})}function $_(e){const t=e.filter(n=>n.length>0).join("");if(!t)return[];const r=F_(t.replace(/^(?:\x1bc)+/,""));return[`${q3}${G3}${r}${O_}`]}function U_(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}function z_(e){return[["10",e.foreground],["11",e.background]].map(([t,r])=>{const n=/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(r);if(!n)return"";const a=n.slice(1).map(l=>l.repeat(2)).join("/");return`\x1B]${t};rgb:${a}\x1B\\`}).join("")}function H_({target:e}){const[t,r]=v.useState(null);if(v.useEffect(()=>{const p=e.current;if(!p)return;p.dataset.nativeFileFeedback="true";const m=()=>{const b=p.dataset.nativeFileDropState,y=p.dataset.nativeFileDropProgress,w=p.dataset.nativeFileDropCancellable==="true";r(C=>b?C?.phase===b&&C.progress===y&&C.cancellable===w?C:{phase:b,progress:y,cancellable:w}:null)};m();const x=new MutationObserver(m);return x.observe(p,{attributes:!0,attributeFilter:["data-native-file-drop-state","data-native-file-drop-progress","data-native-file-drop-cancellable"]}),()=>{x.disconnect(),delete p.dataset.nativeFileFeedback}},[e]),!t)return null;const n=t.phase==="preparing"||t.phase==="uploading",a=t.phase==="uploaded"||t.phase==="inserted",l=t.progress===void 0?void 0:Number(t.progress),c=l!==void 0&&Number.isFinite(l)?Math.min(100,Math.max(0,l)):void 0,h=t.phase==="local"?"松开以插入原文件路径":t.phase==="remote"?"松开以上传到当前服务并插入路径":t.phase==="preparing"?"正在读取文件…":t.phase==="uploading"?`正在上传到当前服务${c===void 0?"…":` · ${c}%`}`:t.phase==="uploaded"?"上传完成,已插入远端路径":t.phase==="inserted"?"已插入原文件路径":t.phase==="cancelled"?"已取消":"文件处理失败,请重新拖入";return s.jsx("div",{className:"absolute bottom-3 left-3 right-3 z-30 flex justify-center pointer-events-none","data-terminal-file-drop-feedback":!0,children:s.jsxs("div",{className:"pointer-events-auto flex max-w-full items-center gap-2 rounded-lg border border-border bg-surface-2 px-3 py-2 text-xs text-foreground shadow-lg",onMouseDown:p=>{p.preventDefault(),p.stopPropagation()},onClick:p=>p.stopPropagation(),children:[n?s.jsx(z4,{size:15,className:"shrink-0 animate-spin text-primary"}):a?s.jsx(Ba,{size:15,className:"shrink-0 text-primary"}):s.jsx(Bw,{size:15,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{role:"status","aria-live":"polite",className:"min-w-0 break-words",children:h}),t.phase==="uploading"&&s.jsx("span",{role:"progressbar","aria-label":"文件上传进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":c,className:"sr-only"}),n&&t.cancellable&&s.jsxs("button",{type:"button","aria-label":"取消文件处理",className:"inline-flex min-h-8 shrink-0 items-center gap-1 rounded px-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground",onClick:()=>e.current?.dispatchEvent(new CustomEvent("termdock:file-drop-cancel",{bubbles:!0})),children:[s.jsx(zn,{size:13}),"取消"]})]})})}function bu(e){return e.replace(/\r\n|\r|\n/g,"\r").replace(/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"")}const W_={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},G_={F1:"P",F2:"Q",F3:"R",F4:"S"},q_={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24};function V_(e,t=!1){if(e.metaKey||e.isComposing||e.keyCode===229||e.getModifierState?.("AltGraph"))return null;const{key:r,shiftKey:n,altKey:a,ctrlKey:l}=e,c=1+Number(n)+2*Number(a)+4*Number(l),h=c===1?"":`;${c}`,p=W_[r];if(p)return c!==1?`\x1B[1${h}${p}`:`\x1B${t?"O":"["}${p}`;const m=G_[r];if(m)return c!==1?`\x1B[1${h}${m}`:`\x1BO${m}`;if(r==="Insert"&&!a&&(n||l))return null;const x=q_[r];if(x)return`\x1B[${x}${h}~`;if(r==="Tab")return a?`\x1B${n?"\x1B[Z":" "}`:n?"\x1B[Z":" ";if(r==="Escape")return a?"\x1B\x1B":"\x1B";if(r==="Enter")return a?"\x1B\r":null;if(r==="Backspace")return l||a?`${a?"\x1B":""}${l?"\b":""}`:null;if(r.length!==1)return null;if(l){const b=r.toUpperCase();let y;return/^[A-Z]$/.test(b)?y=b.charCodeAt(0)-64:r===" "||r==="@"||r==="2"?y=0:"[\\]^_".includes(r)?y=r.charCodeAt(0)-64:/^[3-7]$/.test(r)?y=Number(r)+24:r==="?"||r==="8"?y=127:r==="/"&&(y=31),y===void 0?null:`${a?"\x1B":""}${String.fromCharCode(y)}`}return a?`\x1B${r}`:null}function ci(e){return{dispose:e}}function Z_(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function Y_(...e){return ci(()=>Z_(e))}var V3=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},Xc=class{constructor(){this._store=new V3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Xc.None=Object.freeze({dispose(){}});var vu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},Z3=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),Sd=Z3?"node":navigator.userAgent,K_=Z3?"node":navigator.platform,X_=Sd.includes("Firefox");Sd.includes("Chrome");var J_=Sd.includes("Edge"),Y3=/^((?!chrome|android).)*safari/i.test(Sd);function ek(){if(!Y3)return 0;let e=Sd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}K_.indexOf("Linux")>=0;var xi=0,bi=0,vi=0,Ms=0,yo={css:"#00000000",rgba:0},ya;(e=>{function t(a,l,c,h){return h!==void 0?`#${Mc(a)}${Mc(l)}${Mc(c)}${Mc(h)}`:`#${Mc(a)}${Mc(l)}${Mc(c)}`}e.toCss=t;function r(a,l,c,h=255){return(a<<24|l<<16|c<<8|h)>>>0}e.toRgba=r;function n(a,l,c,h){return{css:e.toCss(a,l,c,h),rgba:e.toRgba(a,l,c,h)}}e.toColor=n})(ya||={});var Gu;(e=>{function t(p,m){if(Ms=(m.rgba&255)/255,Ms===1)return{css:m.css,rgba:m.rgba};let x=m.rgba>>24&255,b=m.rgba>>16&255,y=m.rgba>>8&255,w=p.rgba>>24&255,C=p.rgba>>16&255,S=p.rgba>>8&255;xi=w+Math.round((x-w)*Ms),bi=C+Math.round((b-C)*Ms),vi=S+Math.round((y-S)*Ms);let I=ya.toCss(xi,bi,vi),N=ya.toRgba(xi,bi,vi);return{css:I,rgba:N}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,m,x){let b=Gc.ensureContrastRatio(p.rgba,m.rgba,x);if(b)return ya.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=n;function a(p){let m=(p.rgba|255)>>>0;return[xi,bi,vi]=Gc.toChannels(m),{css:ya.toCss(xi,bi,vi),rgba:m}}e.opaque=a;function l(p,m){return Ms=Math.round(m*255),[xi,bi,vi]=Gc.toChannels(p.rgba),{css:ya.toCss(xi,bi,vi,Ms),rgba:ya.toRgba(xi,bi,vi,Ms)}}e.opacity=l;function c(p,m){return Ms=p.rgba&255,l(p,Ms*m/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(Gu||={});var tk;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return xi=parseInt(a.slice(1,2).repeat(2),16),bi=parseInt(a.slice(2,3).repeat(2),16),vi=parseInt(a.slice(3,4).repeat(2),16),ya.toColor(xi,bi,vi);case 5:return xi=parseInt(a.slice(1,2).repeat(2),16),bi=parseInt(a.slice(2,3).repeat(2),16),vi=parseInt(a.slice(3,4).repeat(2),16),Ms=parseInt(a.slice(4,5).repeat(2),16),ya.toColor(xi,bi,vi,Ms);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let l=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return xi=parseInt(l[1],10),bi=parseInt(l[2],10),vi=parseInt(l[3],10),Ms=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),ya.toColor(xi,bi,vi,Ms);if(a==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[xi,bi,vi,Ms]=t.getImageData(0,0,1,1).data,Ms!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ya.toRgba(xi,bi,vi,Ms),css:a}}e.toColor=n})(tk||={});var ga;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,l){let c=n/255,h=a/255,p=l/255,m=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return m*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(ga||={});var Gc;(e=>{function t(c,h){if(Ms=(h&255)/255,Ms===1)return h;let p=h>>24&255,m=h>>16&255,x=h>>8&255,b=c>>24&255,y=c>>16&255,w=c>>8&255;return xi=b+Math.round((p-b)*Ms),bi=y+Math.round((m-y)*Ms),vi=w+Math.round((x-w)*Ms),ya.toRgba(xi,bi,vi)}e.blend=t;function r(c,h,p){let m=ga.relativeLuminance(c>>8),x=ga.relativeLuminance(h>>8);if(Cl(m,x)<p){if(x<m){let w=n(c,h,p),C=Cl(m,ga.relativeLuminance(w>>8));if(C<p){let S=a(c,h,p),I=Cl(m,ga.relativeLuminance(S>>8));return C>I?w:S}return w}let b=a(c,h,p),y=Cl(m,ga.relativeLuminance(b>>8));if(y<p){let w=n(c,h,p),C=Cl(m,ga.relativeLuminance(w>>8));return y>C?b:w}return b}}e.ensureContrastRatio=r;function n(c,h,p){let m=c>>24&255,x=c>>16&255,b=c>>8&255,y=h>>24&255,w=h>>16&255,C=h>>8&255,S=Cl(ga.relativeLuminance2(y,w,C),ga.relativeLuminance2(m,x,b));for(;S<p&&(y>0||w>0||C>0);)y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),C-=Math.max(0,Math.ceil(C*.1)),S=Cl(ga.relativeLuminance2(y,w,C),ga.relativeLuminance2(m,x,b));return(y<<24|w<<16|C<<8|255)>>>0}e.reduceLuminance=n;function a(c,h,p){let m=c>>24&255,x=c>>16&255,b=c>>8&255,y=h>>24&255,w=h>>16&255,C=h>>8&255,S=Cl(ga.relativeLuminance2(y,w,C),ga.relativeLuminance2(m,x,b));for(;S<p&&(y<255||w<255||C<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),S=Cl(ga.relativeLuminance2(y,w,C),ga.relativeLuminance2(m,x,b));return(y<<24|w<<16|C<<8|255)>>>0}e.increaseLuminance=a;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(Gc||={});function Mc(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Cl(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ys(e){if(!e)throw new Error("value must not be falsy");return e}function j1(e){return 57508<=e&&e<=57558}function rk(e){return 57520<=e&&e<=57527}function nk(e){return 57344<=e&&e<=63743}function sk(e){return 9472<=e&&e<=9631}function ik(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function ak(e,t,r,n){return t===1&&r>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!ik(e)&&!j1(e)&&!nk(e)}function K3(e){return j1(e)||sk(e)}function ok(){return{css:{canvas:Xd(),cell:Xd()},device:{canvas:Xd(),cell:Xd(),char:{width:0,height:0,left:0,top:0}}}}function Xd(){return{width:0,height:0}}function lk(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Ee;(e=>(e.LINE_H=Object.freeze({type:2,data:"M0,.5 L1,.5",strokeWidth:1}),e.LINE_V=Object.freeze({type:2,data:"M.5,0 L.5,1",strokeWidth:1}),e.FADE_RIGHT=Object.freeze({type:2,data:"M0,.5 L.28,.5 M.32,.5 L.52,.5 M.60,.5 L.72,.5 M.84,.5 L.90,.5",strokeWidth:1}),e.FADE_LEFT=Object.freeze({type:2,data:"M.10,.5 L.16,.5 M.28,.5 L.40,.5 M.48,.5 L.68,.5 M.72,.5 L1,.5",strokeWidth:1}),e.FADE_DOWN=Object.freeze({type:2,data:"M.5,0 L.5,.28 M.5,.32 L.5,.52 M.5,.60 L.5,.72 M.5,.84 L.5,.90",strokeWidth:1}),e.FADE_UP=Object.freeze({type:2,data:"M.5,.10 L.5,.16 M.5,.28 L.5,.40 M.5,.48 L.5,.68 M.5,.72 L.5,1",strokeWidth:1}),e.CURVE_DOWN_RIGHT=Object.freeze({type:2,data:(t,r)=>`M.5,1 L.5,${.5+r/.15*.5} C.5,${.5+r/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_DOWN_LEFT=Object.freeze({type:2,data:(t,r)=>`M.5,1 L.5,${.5+r/.15*.5} C.5,${.5+r/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.CURVE_UP_RIGHT=Object.freeze({type:2,data:(t,r)=>`M.5,0 L.5,${.5-r/.15*.5} C.5,${.5-r/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_UP_LEFT=Object.freeze({type:2,data:(t,r)=>`M.5,0 L.5,${.5-r/.15*.5} C.5,${.5-r/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.NODE_FILL=Object.freeze({type:3,data:"M.85,.5 A.35,.175,0,1,1,.15,.5 A.35,.175,0,1,1,.85,.5"}),e.NODE_STROKE=Object.freeze({type:3,data:"M.85,.5 A.35,.175,0,1,1,.15,.5 A.35,.175,0,1,1,.85,.5",strokeWidth:1}),e.NODE_LINE_RIGHT=Object.freeze({type:3,data:"M1,.5 L.85,.5",strokeWidth:1}),e.NODE_LINE_LEFT=Object.freeze({type:3,data:"M0,.5 L.15,.5",strokeWidth:1}),e.NODE_LINE_DOWN=Object.freeze({type:3,data:"M.5,1 L.5,.7",strokeWidth:1}),e.NODE_LINE_UP=Object.freeze({type:3,data:"M.5,0 L.5,.3",strokeWidth:1})))(Ee||={});var ck={"─":{type:2,data:"M0,.5 L1,.5",strokeWidth:1},"━":{type:2,data:"M0,.5 L1,.5",strokeWidth:3},"│":{type:2,data:"M.5,0 L.5,1",strokeWidth:1},"┃":{type:2,data:"M.5,0 L.5,1",strokeWidth:3},"┄":{type:2,data:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",strokeWidth:1},"┅":{type:2,data:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",strokeWidth:3},"┆":{type:2,data:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",strokeWidth:1},"┇":{type:2,data:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",strokeWidth:3},"┈":{type:2,data:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",strokeWidth:1},"┉":{type:2,data:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",strokeWidth:3},"┊":{type:2,data:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",strokeWidth:1},"┋":{type:2,data:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",strokeWidth:3},"┌":{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},"┍":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┎":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┏":{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3},"┐":{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},"┑":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┒":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┓":{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3},"└":{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},"┕":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┖":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┗":{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3},"┘":{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},"┙":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┚":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┛":{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3},"├":{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:1},"┝":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┞":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┟":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┠":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"┡":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"┢":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"┣":{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:3},"┤":{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:1},"┥":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┦":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┧":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┨":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"┩":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"┪":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"┫":{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:3},"┬":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:1},"┭":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┮":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┯":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"┰":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┱":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"┲":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"┳":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:3},"┴":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,0",strokeWidth:1},"┵":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┶":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┷":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"┸":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┹":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"┺":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"┻":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,0",strokeWidth:3},"┼":{type:2,data:"M0,.5 L1,.5 M.5,0 L.5,1",strokeWidth:1},"┽":[{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┾":[{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┿":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"╀":[{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"╁":[{type:2,data:"M.5,.5 L.5,0 M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"╂":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"╃":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"╄":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"╅":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"╆":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"╇":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0 M0,.5 L1,.5",strokeWidth:3}],"╈":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:3}],"╉":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:3}],"╊":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:3}],"╋":{type:2,data:"M0,.5 L1,.5 M.5,0 L.5,1",strokeWidth:3},"╌":{type:2,data:"M.1,.5 L.4,.5 M.6,.5 L.9,.5",strokeWidth:1},"╍":{type:2,data:"M.1,.5 L.4,.5 M.6,.5 L.9,.5",strokeWidth:3},"╎":{type:2,data:"M.5,.1 L.5,.4 M.5,.6 L.5,.9",strokeWidth:1},"╏":{type:2,data:"M.5,.1 L.5,.4 M.5,.6 L.5,.9",strokeWidth:3},"═":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"║":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╒":{type:2,data:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`,strokeWidth:1},"╓":{type:2,data:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`,strokeWidth:1},"╔":{type:2,data:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`,strokeWidth:1},"╕":{type:2,data:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`,strokeWidth:1},"╖":{type:2,data:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`,strokeWidth:1},"╗":{type:2,data:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`,strokeWidth:1},"╘":{type:2,data:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`,strokeWidth:1},"╙":{type:2,data:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`,strokeWidth:1},"╚":{type:2,data:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`,strokeWidth:1},"╛":{type:2,data:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`,strokeWidth:1},"╜":{type:2,data:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`,strokeWidth:1},"╝":{type:2,data:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`,strokeWidth:1},"╞":{type:2,data:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`,strokeWidth:1},"╟":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`,strokeWidth:1},"╠":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╡":{type:2,data:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`,strokeWidth:1},"╢":{type:2,data:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╣":{type:2,data:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`,strokeWidth:1},"╤":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`,strokeWidth:1},"╥":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`,strokeWidth:1},"╦":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`,strokeWidth:1},"╧":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"╨":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`,strokeWidth:1},"╩":{type:2,data:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╪":{type:2,data:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"╫":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╬":{type:2,data:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╭":{type:2,data:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`,strokeWidth:1},"╮":{type:2,data:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`,strokeWidth:1},"╯":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`,strokeWidth:1},"╰":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`,strokeWidth:1},"╱":{type:2,data:"M1,0 L0,1",strokeWidth:1},"╲":{type:2,data:"M0,0 L1,1",strokeWidth:1},"╳":{type:2,data:"M1,0 L0,1 M0,0 L1,1",strokeWidth:1},"╴":{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},"╵":{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},"╶":{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},"╷":{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},"╸":{type:2,data:"M.5,.5 L0,.5",strokeWidth:3},"╹":{type:2,data:"M.5,.5 L.5,0",strokeWidth:3},"╺":{type:2,data:"M.5,.5 L1,.5",strokeWidth:3},"╻":{type:2,data:"M.5,.5 L.5,1",strokeWidth:3},"╼":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"╽":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"╾":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"╿":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"▀":{type:0,data:[{x:0,y:0,w:8,h:4}]},"▁":{type:0,data:[{x:0,y:7,w:8,h:1}]},"▂":{type:0,data:[{x:0,y:6,w:8,h:2}]},"▃":{type:0,data:[{x:0,y:5,w:8,h:3}]},"▄":{type:0,data:[{x:0,y:4,w:8,h:4}]},"▅":{type:0,data:[{x:0,y:3,w:8,h:5}]},"▆":{type:0,data:[{x:0,y:2,w:8,h:6}]},"▇":{type:0,data:[{x:0,y:1,w:8,h:7}]},"█":{type:0,data:[{x:0,y:0,w:8,h:8}]},"▉":{type:0,data:[{x:0,y:0,w:7,h:8}]},"▊":{type:0,data:[{x:0,y:0,w:6,h:8}]},"▋":{type:0,data:[{x:0,y:0,w:5,h:8}]},"▌":{type:0,data:[{x:0,y:0,w:4,h:8}]},"▍":{type:0,data:[{x:0,y:0,w:3,h:8}]},"▎":{type:0,data:[{x:0,y:0,w:2,h:8}]},"▏":{type:0,data:[{x:0,y:0,w:1,h:8}]},"▐":{type:0,data:[{x:4,y:0,w:4,h:8}]},"░":{type:1,data:[[1,0],[0,0]]},"▒":{type:1,data:[[1,0],[0,1]]},"▓":{type:1,data:[[1,1],[1,0]]},"▔":{type:0,data:[{x:0,y:0,w:8,h:1}]},"▕":{type:0,data:[{x:7,y:0,w:1,h:8}]},"▖":{type:0,data:[{x:0,y:4,w:4,h:4}]},"▗":{type:0,data:[{x:4,y:4,w:4,h:4}]},"▘":{type:0,data:[{x:0,y:0,w:4,h:4}]},"▙":{type:0,data:[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}]},"▚":{type:0,data:[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}]},"▛":{type:0,data:[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}]},"▜":{type:0,data:[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}]},"▝":{type:0,data:[{x:4,y:0,w:4,h:4}]},"▞":{type:0,data:[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}]},"▟":{type:0,data:[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}]},"":{type:5,data:{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0}},"":{type:5,data:{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0}},"":{type:5,data:{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0}},"":{type:5,data:{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.7,.03 L.7,.1 L.355,.1 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0}},"":{type:5,data:{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2}},"":{type:5,data:{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2}},"":{type:5,data:{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1}},"":{type:5,data:{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1}},"":{type:5,data:{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1}},"":{type:5,data:{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M0.8069,0.6075 Q0.7991,0.612,0.7815,0.6218 T0.7542,0.6369 T0.7282,0.6508 T0.7016,0.6644 T0.6778,0.6758 T0.6551,0.6854 T0.637,0.6911 T0.622,0.6936 Q0.6186,0.6936,0.6128,0.6942 T0.6018,0.6952 T0.5894,0.6956 T0.5757,0.6952 T0.561,0.693 T0.5451,0.6879 Q0.5342,0.6834,0.5193,0.6756 T0.4925,0.6614 T0.4673,0.6485 T0.4436,0.6389 T0.4239,0.6363 T0.4089,0.6422 Q0.4045,0.6467,0.3958,0.6554 T0.3843,0.6669 T0.3748,0.6746 T0.3613,0.683 T0.3442,0.6903 L0.3499,0.6956 Q0.3584,0.7042,0.3679,0.7177 T0.3836,0.7403 T0.4019,0.7583 T0.4295,0.7703 Q0.4688,0.7785,0.5203,0.7605 Q0.4902,0.7817,0.449,0.7911 T0.3696,0.8001 Q0.3567,0.7997,0.341,0.7942 T0.3111,0.7813 T0.2805,0.766 T0.2493,0.753 T0.218,0.7472 T0.187,0.754 Q0.1762,0.7589,0.1653,0.7681 T0.1453,0.7895 T0.1308,0.818 T0.1264,0.8507 L0.1264,0.858 Q0.1453,0.8462,0.1607,0.8433 T0.1899,0.8452 T0.2226,0.8625 Q0.2344,0.8707,0.2485,0.8752 T0.2813,0.8831 T0.3089,0.889 Q0.2981,0.8915,0.2846,0.8956 T0.2603,0.9037 T0.2368,0.9115 T0.2129,0.9174 T0.1894,0.9194 T0.1653,0.9155 Q0.1504,0.9115,0.1328,0.9196 T0.0986,0.9421 T0.0655,0.9708 T0.0317,0.9943 T0,1 Q0.001,0.94,0.0017,0.6508 T0.0024,0.2322 Q0.002,0.2109,0.0007,0.1379 T0,0.0249 Q0.0058,0.0253,0.009,0.0257 T0.0156,0.0288 T0.0203,0.0333 T0.0264,0.0422 T0.0349,0.0539 Q0.044,0.0657,0.0542,0.072 T0.0752,0.0789 T0.096,0.0775 T0.1175,0.0694 T0.1379,0.0573 T0.1579,0.0432 Q0.2141,0,0.2673,0.0318 Q0.2588,0.0318,0.2517,0.033 T0.239,0.0361 T0.2276,0.0424 T0.218,0.0504 T0.2085,0.0612 T0.1997,0.0732 T0.1899,0.0875 T0.1795,0.1028 Q0.1748,0.1093,0.1507,0.1234 T0.1186,0.1448 Q0.0999,0.1612,0.1108,0.1783 Q0.1162,0.1877,0.1238,0.1928 T0.1404,0.1979 T0.158,0.1967 T0.1775,0.1895 T0.1963,0.1791 T0.2151,0.1663 T0.2314,0.1534 T0.2458,0.141 T0.2561,0.1322 Q0.2815,0.1106,0.3017,0.101 T0.344,0.0926 T0.3919,0.1077 Q0.4099,0.1175,0.4265,0.1206 T0.4588,0.1202 T0.488,0.1098 T0.5176,0.0914 Q0.5071,0.1032,0.4963,0.1122 T0.4722,0.1285 T0.4497,0.1401 T0.4223,0.1518 T0.3943,0.1636 Q0.374,0.1726,0.3623,0.1863 T0.3482,0.2162 Q0.3445,0.2403,0.3608,0.2605 T0.4072,0.2876 Q0.4194,0.2909,0.4326,0.2899 T0.457,0.2856 T0.4805,0.2764 T0.5032,0.264 T0.5256,0.2497 T0.5478,0.2352 T0.5698,0.2222 T0.5921,0.2118 Q0.6982,0.173,0.81,0.2436 Q0.833,0.2583,0.8496,0.2674 T0.887,0.2846 T0.925,0.294 T0.9617,0.2911 T1,0.2746 Q0.9817,0.2946,0.96,0.3056 T0.9175,0.3191 T0.8731,0.3209 T0.8277,0.3164 T0.7818,0.3109 T0.7359,0.3101 T0.6907,0.3197 T0.647,0.3448 Q0.6443,0.3472,0.6333,0.3562 T0.6194,0.3674 T0.6076,0.3766 T0.594,0.386 T0.5815,0.3931 T0.5661,0.4007 T0.5501,0.4064 L0.5556,0.4121 Q0.5627,0.4198,0.5722,0.4251 T0.5926,0.4337 T0.6131,0.439 T0.6343,0.4431 T0.6521,0.4468 Q0.6762,0.4529,0.7056,0.4463 Q0.6772,0.4623,0.6543,0.471 T0.604,0.4814 Q0.5962,0.4818,0.5815,0.4825 T0.5591,0.4835 T0.5393,0.4857 T0.519,0.4908 T0.5007,0.4996 T0.4812,0.5141 T0.4627,0.5353 L0.4549,0.5451 L0.4661,0.543 Q0.4759,0.541,0.4909,0.55 T0.5315,0.5796 T0.5684,0.6083 Q0.5799,0.6161,0.5915,0.6212 T0.6181,0.6308 L0.6331,0.6353 Q0.6514,0.6418,0.7004,0.633 T0.8069,0.6075 Z",type:0}},"":{type:5,data:{d:"M0.011,0.0469 Q0.0152,0.0412,0.02,0.0361 T0.0292,0.0281 T0.0365,0.0253 Q0.0426,0.0257,0.0461,0.0263 T0.0534,0.03 T0.0582,0.0345 T0.0645,0.0434 T0.0723,0.0546 Q0.0807,0.0653,0.0897,0.0712 T0.1081,0.0775 T0.1255,0.0765 T0.1438,0.0695 T0.1605,0.0593 T0.1772,0.0473 Q0.2388,0,0.2927,0.0326 L0.2614,0.0767 L0.2581,0.0767 Q0.2494,0.0767,0.2444,0.0773 T0.2359,0.0789 T0.2291,0.0842 T0.2233,0.0922 T0.2146,0.1054 T0.2026,0.1236 Q0.1943,0.1354,0.1843,0.1444 T0.1675,0.1574 T0.1526,0.1654 T0.1429,0.1701 Q0.1436,0.1717,0.1446,0.1733 Q0.1504,0.1823,0.1581,0.1866 T0.1733,0.1915 T0.1909,0.1884 T0.2085,0.1809 T0.2265,0.169 T0.2427,0.1564 T0.2575,0.1436 T0.2688,0.1338 Q0.2969,0.1101,0.3195,0.0995 T0.3643,0.0901 T0.4114,0.1048 Q0.4279,0.1138,0.4426,0.1168 T0.4705,0.117 T0.4945,0.1089 T0.5186,0.0942 L0.5211,0.0926 L0.5289,0.0922 Q0.5411,0.095,0.5189,0.1203 Q0.505,0.1358,0.4913,0.1474 T0.4634,0.167 T0.4389,0.1796 T0.4121,0.1909 T0.3866,0.2011 Q0.3782,0.2047,0.3727,0.2092 Q0.3717,0.2117,0.3714,0.2141 Q0.3695,0.2263,0.3751,0.2388 T0.394,0.2616 T0.4253,0.2761 Q0.4398,0.2785,0.4513,0.2779 T0.4756,0.2724 T0.4987,0.2616 T0.5216,0.2476 T0.5453,0.2321 T0.5703,0.217 T0.5976,0.2043 Q0.7015,0.166,0.8099,0.2345 Q0.8361,0.2512,0.8572,0.2616 T0.9006,0.2779 T0.9432,0.281 T0.9819,0.2663 L0.9887,0.2671 Q1,0.272,0.9768,0.2969 Q0.9558,0.3193,0.9319,0.333 T0.8858,0.3513 T0.8391,0.3569 T0.793,0.3546 T0.7485,0.3497 T0.7065,0.3473 T0.6681,0.3522 T0.6344,0.3699 Q0.5963,0.4005,0.5847,0.4082 Q0.595,0.4139,0.6079,0.4174 T0.6367,0.4237 T0.6586,0.4278 Q0.6793,0.4331,0.7044,0.4278 Q0.7057,0.4278,0.707,0.4274 Q0.7067,0.429,0.7062,0.4313 T0.7036,0.4398 T0.6993,0.4513 T0.6931,0.4619 T0.6851,0.4698 Q0.6573,0.4857,0.6336,0.4947 T0.5831,0.5053 Q0.577,0.5057,0.5615,0.5065 T0.5394,0.508 T0.5221,0.51 T0.5042,0.5139 T0.4905,0.5204 Q0.5008,0.5232,0.515,0.5328 T0.549,0.5585 T0.5799,0.5824 Q0.5905,0.5897,0.6013,0.5946 T0.6262,0.6036 T0.6409,0.6081 Q0.6567,0.6134,0.7035,0.605 T0.8028,0.5816 L0.7974,0.5922 T0.7867,0.6134 L0.7812,0.624 Q0.7799,0.6248,0.7786,0.6252 Q0.7709,0.6297,0.7573,0.6372 T0.7346,0.6499 T0.7123,0.6621 T0.6897,0.6741 T0.6686,0.6847 T0.648,0.6941 T0.6297,0.7013 T0.6129,0.7062 T0.5995,0.7076 Q0.5992,0.7076,0.5831,0.7092 T0.5529,0.7092 T0.525,0.7019 Q0.5105,0.6958,0.4824,0.6811 T0.4356,0.6586 T0.4079,0.6533 Q0.3872,0.6741,0.3827,0.6782 Q0.3872,0.6835,0.3934,0.6929 T0.4037,0.7078 T0.4142,0.7198 T0.4284,0.7304 T0.4466,0.7365 Q0.4824,0.7443,0.5292,0.728 L0.5292,0.7294 T0.529,0.7333 T0.5284,0.7392 T0.5266,0.7463 T0.5236,0.7539 T0.5186,0.7612 T0.5111,0.7679 Q0.5086,0.77,0.5056,0.7716 Q0.4466,0.8104,0.3591,0.8091 Q0.344,0.8091,0.3246,0.802 T0.2893,0.7863 T0.2543,0.77 T0.2206,0.76 T0.1894,0.7643 Q0.1804,0.7684,0.1733,0.7753 Q0.1591,0.7892,0.1601,0.8169 Q0.1784,0.8067,0.1938,0.8053 T0.2212,0.8087 T0.2507,0.825 Q0.2614,0.8324,0.2744,0.8365 T0.3053,0.844 T0.332,0.8499 L0.303,0.894 L0.2998,0.8948 Q0.2904,0.8968,0.278,0.9009 T0.2554,0.9086 T0.233,0.9158 T0.2099,0.9213 T0.1868,0.9229 T0.1633,0.9192 Q0.1517,0.916,0.1367,0.9241 T0.1065,0.9462 T0.0753,0.9737 T0.041,0.9955 T0.0061,1 Q0,0.9984,0.0068,0.9845 Q0.009,0.9804,0.0123,0.9755 Q0.0187,0.9666,0.0261,0.9606 T0.0374,0.9555 Q0.0481,0.958,0.0629,0.949 T0.0931,0.9262 T0.1247,0.8987 T0.1597,0.8777 T0.1949,0.8752 Q0.213,0.8805,0.2343,0.8772 Q0.2249,0.8736,0.2172,0.8683 Q0.1914,0.8511,0.1738,0.8497 T0.1349,0.8617 Q0.1304,0.865,0.1273,0.8646 T0.1242,0.8605 L0.1239,0.8536 Q0.1226,0.8295,0.1354,0.8016 T0.1723,0.7496 Q0.1914,0.7308,0.2104,0.7219 Q0.2259,0.7145,0.2425,0.7141 T0.273,0.7182 T0.3022,0.7296 T0.3301,0.7439 T0.3569,0.7571 T0.3821,0.7643 Q0.373,0.7561,0.3598,0.7367 T0.3382,0.7088 L0.3327,0.7035 Q0.3282,0.699,0.3353,0.6884 T0.3517,0.6692 L0.3611,0.6607 Q0.3711,0.657,0.3751,0.6554 T0.3837,0.6507 T0.3898,0.6458 T0.3979,0.637 T0.4111,0.6236 Q0.4172,0.6175,0.4234,0.6138 Q0.4327,0.6081,0.4439,0.6077 T0.4655,0.6105 T0.4884,0.6201 T0.5113,0.633 T0.5347,0.6468 T0.5573,0.6578 Q0.5705,0.6635,0.5833,0.665 T0.6112,0.665 T0.6286,0.6635 Q0.6421,0.6631,0.6718,0.6501 Q0.626,0.6578,0.6089,0.6517 Q0.6063,0.6509,0.6002,0.6491 T0.5884,0.6454 T0.5757,0.6409 T0.561,0.6344 T0.5466,0.6256 Q0.536,0.6183,0.5108,0.5989 T0.4722,0.5712 T0.4527,0.564 L0.4418,0.5661 Q0.4308,0.5681,0.4366,0.5563 Q0.4401,0.5485,0.4476,0.5392 L0.455,0.5298 Q0.4631,0.5188,0.4714,0.51 T0.4866,0.4947 T0.5021,0.4831 T0.516,0.4749 T0.53,0.4694 T0.5428,0.4657 T0.5558,0.4637 T0.5674,0.4629 T0.5795,0.4625 Q0.5489,0.4543,0.534,0.4384 L0.5286,0.4327 Q0.5244,0.4282,0.5318,0.4174 T0.5486,0.398 L0.5579,0.3899 Q0.567,0.387,0.5749,0.3834 T0.5878,0.3772 T0.6012,0.3687 T0.6126,0.3603 T0.6268,0.3487 T0.6421,0.3361 Q0.6567,0.3242,0.6712,0.3159 T0.7009,0.3034 T0.7277,0.2973 T0.7556,0.2961 T0.7809,0.2977 T0.8074,0.301 Q0.8096,0.3014,0.8109,0.3016 T0.8143,0.302 T0.818,0.3026 Q0.8012,0.2936,0.7767,0.2781 Q0.6718,0.2117,0.5744,0.2476 Q0.5637,0.2516,0.5492,0.2604 T0.5218,0.2779 T0.4923,0.2965 T0.461,0.3124 T0.4282,0.3216 T0.394,0.3206 Q0.3637,0.3136,0.3474,0.2936 T0.3353,0.2459 Q0.3385,0.2247,0.355,0.2023 Q0.3646,0.1892,0.3763,0.179 Q0.3898,0.1672,0.4063,0.1595 Q0.3927,0.1562,0.3785,0.1485 Q0.3604,0.1387,0.3453,0.1354 T0.3161,0.1354 T0.2899,0.1458 T0.2627,0.166 Q0.262,0.1664,0.254,0.1733 T0.2414,0.1841 T0.2267,0.196 T0.2094,0.2086 T0.1915,0.2196 T0.1725,0.2288 T0.1546,0.2337 T0.1373,0.2343 T0.1223,0.228 T0.1097,0.2145 Q0.0962,0.1929,0.1258,0.1582 Q0.131,0.1517,0.1371,0.1464 Q0.1462,0.1387,0.156,0.1321 T0.1752,0.1205 T0.1878,0.1134 Q0.1891,0.1117,0.1947,0.103 T0.2035,0.0899 T0.2125,0.0781 T0.2243,0.064 Q0.1949,0.0616,0.1672,0.0828 Q0.153,0.0934,0.1412,0.1009 T0.1146,0.1146 T0.0873,0.1213 T0.0616,0.116 T0.0374,0.0962 Q0.0339,0.0909,0.0295,0.0846 T0.024,0.0767 T0.0202,0.0728 T0.0148,0.0704 T0.0068,0.0697 Q0.0003,0.0693,0.0058,0.0567 Q0.0077,0.0522,0.011,0.0469 Z",type:0}},"":{type:5,data:{d:"M0.1934,0.6075 Q0.2012,0.612,0.2188,0.6218 T0.2459,0.6369 T0.2718,0.6508 T0.2983,0.6644 T0.322,0.6758 T0.3447,0.6854 T0.363,0.6911 T0.3783,0.6936 Q0.3796,0.6936,0.396,0.6952 T0.4265,0.6952 T0.4548,0.6879 Q0.4656,0.6834,0.4805,0.6756 T0.5073,0.6614 T0.5327,0.6485 T0.5564,0.6389 T0.5759,0.6363 T0.5909,0.6422 Q0.5953,0.6467,0.604,0.6554 T0.6155,0.6669 T0.6251,0.6746 T0.6387,0.683 T0.6556,0.6903 L0.6498,0.6956 Q0.6414,0.7042,0.6319,0.7177 T0.6162,0.7403 T0.5979,0.7583 T0.5703,0.7703 Q0.5313,0.7785,0.4799,0.7605 Q0.5097,0.7817,0.5508,0.7911 T0.6302,0.8001 Q0.6431,0.7997,0.659,0.7942 T0.6888,0.7813 T0.7194,0.766 T0.7506,0.753 T0.7819,0.7472 T0.8131,0.754 Q0.8239,0.7589,0.8346,0.7681 T0.8544,0.7895 T0.8689,0.818 T0.8737,0.8507 L0.8733,0.858 Q0.8591,0.849,0.8474,0.845 T0.8242,0.8421 T0.8021,0.8482 T0.7772,0.8625 Q0.7653,0.8707,0.7513,0.8752 T0.7184,0.8831 T0.6908,0.889 Q0.7017,0.8915,0.7152,0.8956 T0.7396,0.9037 T0.7633,0.9115 T0.7872,0.9174 T0.8107,0.9194 T0.8347,0.9155 Q0.8493,0.9115,0.8671,0.9196 T0.9015,0.9421 T0.9345,0.9708 T0.9682,0.9943 T0.9997,1 Q0.999,0.94,0.9983,0.6508 T0.9976,0.2322 Q0.9976,0.2109,0.9992,0.1379 T1,0.0249 Q0.9949,0.0249,0.9917,0.0257 T0.9863,0.0273 T0.9817,0.0308 T0.9776,0.0357 T0.9721,0.0437 T0.9651,0.0539 Q0.956,0.0657,0.9456,0.072 T0.9247,0.0789 T0.904,0.0775 T0.8823,0.0694 T0.862,0.0573 T0.8422,0.0432 Q0.7856,0,0.7328,0.0318 Q0.7392,0.0318,0.7452,0.0324 T0.756,0.0345 T0.7657,0.0386 T0.7741,0.0437 T0.7821,0.0506 T0.7894,0.0588 T0.7966,0.0683 T0.8039,0.0787 T0.8119,0.0904 T0.8202,0.1028 Q0.8249,0.1093,0.849,0.1234 T0.8811,0.1448 Q0.8998,0.1612,0.8893,0.1783 Q0.8835,0.1877,0.8759,0.1928 T0.8593,0.1979 T0.8417,0.1967 T0.8222,0.1895 T0.8034,0.1791 T0.7848,0.1663 T0.7687,0.1534 T0.7543,0.141 T0.744,0.1322 Q0.7186,0.1106,0.6984,0.101 T0.6559,0.0926 T0.6082,0.1077 Q0.5899,0.1175,0.5733,0.1206 T0.5411,0.1202 T0.5122,0.1098 T0.4822,0.0914 Q0.4927,0.1032,0.5036,0.1122 T0.5276,0.1285 T0.5503,0.1401 T0.5777,0.1518 T0.6055,0.1636 Q0.6258,0.1726,0.6375,0.1863 T0.6519,0.2162 Q0.6556,0.2403,0.6392,0.2605 T0.5926,0.2876 Q0.5804,0.2909,0.5672,0.2899 T0.5428,0.2856 T0.5193,0.2764 T0.4966,0.264 T0.4744,0.2497 T0.4523,0.2352 T0.4301,0.2222 T0.4077,0.2118 Q0.3021,0.173,0.1903,0.2436 Q0.1669,0.2583,0.1504,0.2674 T0.1129,0.2846 T0.075,0.294 T0.0384,0.2911 T0,0.2746 Q0.021,0.297,0.0459,0.3082 T0.0953,0.3207 T0.146,0.3193 T0.1988,0.3131 T0.2508,0.3095 T0.3029,0.3176 T0.3529,0.3448 Q0.3566,0.348,0.3652,0.355 T0.3771,0.3645 T0.3877,0.3731 T0.3993,0.3815 T0.4103,0.3884 T0.4226,0.3953 T0.4352,0.4009 T0.4497,0.4064 L0.4443,0.4121 Q0.4372,0.4198,0.4277,0.4251 T0.4072,0.4337 T0.3867,0.439 T0.3656,0.4431 T0.3481,0.4468 Q0.3241,0.4529,0.2943,0.4463 Q0.3227,0.4623,0.3458,0.471 T0.3959,0.4814 Q0.404,0.4818,0.4187,0.4825 T0.4409,0.4835 T0.4605,0.4857 T0.4809,0.4908 T0.4992,0.4996 T0.5186,0.5141 T0.5371,0.5353 L0.5449,0.5451 L0.5337,0.543 Q0.5242,0.541,0.5091,0.55 T0.4683,0.5796 T0.4314,0.6083 Q0.4203,0.6161,0.4086,0.6212 T0.382,0.6308 T0.3667,0.6353 Q0.3485,0.6418,0.2995,0.633 T0.1934,0.6075 Z",type:0}},"":{type:5,data:{d:"M0.989,0.0469 Q0.9829,0.0379,0.9753,0.0316 T0.9635,0.0253 Q0.9574,0.0257,0.9539,0.0263 T0.9466,0.03 T0.9418,0.0345 T0.9355,0.0434 T0.9277,0.0546 Q0.9193,0.0653,0.9103,0.0712 T0.8919,0.0775 T0.8745,0.0765 T0.8564,0.0695 T0.8396,0.0593 T0.8228,0.0473 Q0.7612,0,0.7073,0.0326 L0.7386,0.0767 L0.7419,0.0767 Q0.7506,0.0767,0.7556,0.0773 T0.7641,0.0789 T0.7709,0.0842 T0.7767,0.0922 T0.7854,0.1054 T0.7974,0.1236 Q0.8057,0.1354,0.8157,0.1444 T0.8325,0.1574 T0.8474,0.1654 T0.8571,0.1701 Q0.8564,0.1717,0.8554,0.1733 Q0.8503,0.1815,0.844,0.186 T0.8301,0.1909 T0.8153,0.1903 T0.7993,0.1845 T0.7836,0.1758 T0.768,0.1648 T0.754,0.1535 T0.741,0.1425 T0.7312,0.1338 Q0.7031,0.1101,0.6805,0.0995 T0.6357,0.0901 T0.5886,0.1048 Q0.5721,0.1138,0.5574,0.1168 T0.5295,0.117 T0.5055,0.1089 T0.4814,0.0942 L0.4789,0.0926 L0.4711,0.0922 Q0.4589,0.095,0.4811,0.1203 Q0.495,0.1358,0.5087,0.1474 T0.5366,0.167 T0.5611,0.1796 T0.5879,0.1909 T0.6134,0.2011 Q0.6218,0.2047,0.6273,0.2092 Q0.6283,0.2117,0.6286,0.2141 Q0.6305,0.2263,0.6249,0.2388 T0.606,0.2616 T0.5747,0.2761 Q0.5602,0.2785,0.5487,0.2779 T0.5245,0.2724 T0.5015,0.2616 T0.4784,0.2476 T0.4547,0.2321 T0.4297,0.217 T0.4024,0.2043 Q0.2985,0.166,0.1901,0.2345 Q0.1694,0.248,0.1523,0.2569 T0.1165,0.2726 T0.0818,0.2812 T0.0494,0.2796 T0.0181,0.2663 L0.0116,0.2671 Q0,0.272,0.0232,0.2969 Q0.0468,0.3222,0.0742,0.3365 T0.1278,0.3542 T0.1807,0.3564 T0.233,0.352 T0.2815,0.3473 T0.3269,0.3509 T0.3656,0.3699 Q0.4037,0.4005,0.4153,0.4082 Q0.405,0.4139,0.3921,0.4174 T0.3633,0.4237 T0.3414,0.4278 Q0.3207,0.4331,0.2956,0.4278 Q0.2943,0.4278,0.293,0.4274 Q0.2933,0.429,0.2938,0.4313 T0.2964,0.4398 T0.3007,0.4513 T0.3069,0.4619 T0.3149,0.4698 Q0.3427,0.4857,0.3664,0.4947 T0.4169,0.5053 Q0.423,0.5057,0.4385,0.5065 T0.4606,0.508 T0.4779,0.51 T0.4958,0.5139 T0.5095,0.5204 Q0.4992,0.5232,0.485,0.5328 T0.451,0.5585 T0.4201,0.5824 Q0.4095,0.5897,0.3987,0.5946 T0.3738,0.6036 T0.3591,0.6081 Q0.3433,0.6134,0.2965,0.605 T0.1972,0.5816 L0.2026,0.5922 T0.2133,0.6134 L0.2188,0.624 Q0.2201,0.6248,0.2214,0.6252 Q0.2291,0.6297,0.2486,0.6405 T0.2786,0.657 T0.3066,0.6721 T0.3353,0.6866 T0.3598,0.6972 T0.383,0.7051 T0.4005,0.7076 Q0.4008,0.7076,0.4169,0.7092 T0.4471,0.7092 T0.475,0.7019 Q0.4895,0.6958,0.5176,0.6811 T0.5644,0.6586 T0.5921,0.6533 Q0.6128,0.6741,0.6173,0.6782 Q0.6131,0.6835,0.6068,0.6929 T0.5963,0.7078 T0.5858,0.7198 T0.5716,0.7304 T0.5534,0.7365 Q0.5179,0.7443,0.4708,0.728 L0.4708,0.7294 T0.471,0.7333 T0.4716,0.7392 T0.4734,0.7463 T0.4764,0.7539 T0.4814,0.7612 T0.4889,0.7679 Q0.4914,0.77,0.4944,0.7716 Q0.5534,0.8104,0.6409,0.8091 Q0.6521,0.8091,0.6654,0.8053 T0.6907,0.7959 T0.7157,0.7838 T0.741,0.772 T0.7652,0.7631 T0.7888,0.7594 T0.8106,0.7643 Q0.8196,0.7684,0.8267,0.7753 Q0.8409,0.7892,0.8399,0.8169 Q0.8216,0.8067,0.8062,0.8053 T0.7788,0.8087 T0.7493,0.825 Q0.7386,0.8324,0.7256,0.8365 T0.6947,0.844 T0.668,0.8499 L0.697,0.894 L0.7002,0.8948 Q0.7099,0.8968,0.7222,0.9009 T0.7446,0.9086 T0.767,0.9158 T0.7901,0.9213 T0.8132,0.9229 T0.8367,0.9192 Q0.8483,0.916,0.8633,0.9241 T0.8937,0.9462 T0.9248,0.9737 T0.959,0.9955 T0.9939,1 Q1,0.9984,0.9932,0.9845 Q0.991,0.9804,0.9877,0.9755 Q0.9813,0.9666,0.9739,0.9606 T0.9626,0.9555 Q0.9519,0.958,0.9372,0.949 T0.9071,0.9262 T0.8753,0.8987 T0.8403,0.8777 T0.8051,0.8752 Q0.787,0.8805,0.7657,0.8772 Q0.7751,0.8736,0.7828,0.8683 Q0.8086,0.8511,0.8262,0.8497 T0.8651,0.8617 Q0.8696,0.865,0.8727,0.8646 T0.8758,0.8605 L0.8761,0.8536 Q0.8774,0.8295,0.8646,0.8016 T0.8277,0.7496 Q0.8086,0.7308,0.7896,0.7219 Q0.7741,0.7145,0.7575,0.7141 T0.727,0.7182 T0.6978,0.7296 T0.6699,0.7439 T0.6433,0.7571 T0.6179,0.7643 Q0.627,0.7561,0.6402,0.7367 T0.6618,0.7088 L0.6673,0.7035 Q0.6718,0.699,0.6647,0.6884 T0.6483,0.6692 L0.6389,0.6607 Q0.6289,0.657,0.6249,0.6554 T0.6163,0.6507 T0.6102,0.6458 T0.6021,0.637 T0.5889,0.6236 Q0.5828,0.6175,0.5766,0.6138 Q0.5673,0.6081,0.5561,0.6077 T0.5345,0.6105 T0.5116,0.6201 T0.4887,0.633 T0.4653,0.6468 T0.4427,0.6578 Q0.4295,0.6635,0.4167,0.665 T0.3888,0.665 T0.3714,0.6635 Q0.3579,0.6631,0.3282,0.6501 Q0.374,0.6578,0.3911,0.6517 Q0.3937,0.6509,0.4024,0.6482 T0.4179,0.6434 T0.4348,0.6364 T0.4534,0.6256 Q0.464,0.6183,0.4892,0.5989 T0.5278,0.5712 T0.5476,0.564 L0.5582,0.5661 Q0.5692,0.5681,0.5634,0.5563 Q0.5599,0.5485,0.5524,0.5392 L0.545,0.5298 Q0.5369,0.5188,0.5286,0.51 T0.5134,0.4947 T0.4979,0.4831 T0.484,0.4749 T0.47,0.4694 T0.4572,0.4657 T0.4442,0.4637 T0.4326,0.4629 T0.4205,0.4625 Q0.4511,0.4543,0.466,0.4384 L0.4714,0.4327 Q0.4795,0.4237,0.4469,0.394 L0.4421,0.3899 Q0.433,0.387,0.4251,0.3834 T0.4122,0.3772 T0.3988,0.3687 T0.3874,0.3603 T0.3732,0.3487 T0.3579,0.3361 Q0.3433,0.3242,0.3288,0.3159 T0.2993,0.3034 T0.2725,0.2973 T0.2446,0.2961 T0.2193,0.2977 T0.1926,0.301 Q0.1855,0.3022,0.182,0.3026 Q0.1991,0.2936,0.2233,0.2781 Q0.3282,0.2117,0.4256,0.2476 Q0.4363,0.2516,0.451,0.2604 T0.4784,0.2779 T0.5077,0.2965 T0.539,0.3124 T0.5718,0.3216 T0.606,0.3206 Q0.6363,0.3136,0.6526,0.2936 T0.6647,0.2459 Q0.6615,0.2247,0.645,0.2023 Q0.6354,0.1892,0.6237,0.179 Q0.6102,0.1672,0.5937,0.1595 Q0.6073,0.1562,0.6215,0.1485 Q0.6396,0.1387,0.6547,0.1354 T0.6839,0.1354 T0.7101,0.1458 T0.7373,0.166 Q0.738,0.1664,0.746,0.1733 T0.7586,0.1841 T0.7733,0.196 T0.7907,0.2086 T0.8086,0.2196 T0.8275,0.2288 T0.8454,0.2337 T0.8627,0.2343 T0.8777,0.228 T0.8903,0.2145 Q0.9038,0.1929,0.8742,0.1582 Q0.869,0.1517,0.8629,0.1464 Q0.8538,0.1387,0.844,0.1321 T0.8248,0.1205 T0.8122,0.1134 Q0.8109,0.1117,0.8053,0.103 T0.7965,0.0899 T0.7875,0.0781 T0.7757,0.064 Q0.8051,0.0616,0.8328,0.0828 Q0.847,0.0934,0.8588,0.1009 T0.8854,0.1146 T0.9127,0.1213 T0.9384,0.116 T0.9626,0.0962 Q0.9664,0.0909,0.9706,0.0846 T0.976,0.0767 T0.9798,0.0728 T0.9852,0.0704 T0.9932,0.0697 Q0.9997,0.0693,0.9942,0.0567 Q0.9923,0.0522,0.989,0.0469 Z",type:0}},"":{type:5,data:{d:"M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0.9099,0.1158 L0.9099,0.1888 L0.9951,0.1888 L0.9951,0.1158 L0.9099,0.1158 Z M0.9075,0.1116 L0.9976,0.1116 Q1,0.1116,1,0.1137 L1,0.1909 Q1,0.193,0.9976,0.193 L0.9075,0.193 Q0.905,0.193,0.905,0.1909 L0.905,0.1137 Q0.905,0.1116,0.9075,0.1116 Z M0.7852,0.6086 L0.7852,0.682 L0.8704,0.682 L0.8704,0.6086 L0.7852,0.6086 Z M0.7828,0.6044 L0.8729,0.6044 Q0.8753,0.6044,0.8753,0.6065 L0.8753,0.6841 Q0.8753,0.6862,0.8729,0.6862 L0.7828,0.6862 Q0.7803,0.6862,0.7803,0.6841 L0.7803,0.6065 Q0.7803,0.6044,0.7828,0.6044 Z M0.66,0.1137 L0.7501,0.1137 L0.7501,0.1909 L0.66,0.1909 L0.66,0.1137 Z M0.6624,0.4102 L0.6624,0.4836 L0.7477,0.4836 L0.7477,0.4102 L0.6624,0.4102 Z M0.66,0.406 L0.7501,0.406 Q0.7526,0.406,0.7526,0.4081 L0.7526,0.4857 Q0.7526,0.4878,0.7501,0.4878 L0.66,0.4878 Q0.6576,0.4878,0.6576,0.4857 L0.6576,0.4081 Q0.6576,0.406,0.66,0.406 Z M0.6624,0.7131 L0.6624,0.7865 L0.7477,0.7865 L0.7477,0.7131 L0.6624,0.7131 Z M0.66,0.7089 L0.7501,0.7089 Q0.7526,0.7089,0.7526,0.711 L0.7526,0.7886 Q0.7526,0.7907,0.7501,0.7907 L0.66,0.7907 Q0.6576,0.7907,0.6576,0.7886 L0.6576,0.711 Q0.6576,0.7089,0.66,0.7089 Z M0.5407,0.2227 L0.5407,0.2836 L0.6113,0.2836 L0.6113,0.2227 L0.5407,0.2227 Z M0.5309,0.206 L0.621,0.206 Q0.623,0.206,0.6249,0.2068 T0.6281,0.2089 T0.6301,0.2116 T0.6308,0.2143 L0.6308,0.2919 Q0.6308,0.2957,0.6276,0.298 T0.621,0.3003 L0.5309,0.3003 Q0.5265,0.3003,0.5239,0.2976 T0.5212,0.2919 L0.5212,0.2143 Q0.5212,0.211,0.5244,0.2085 T0.5309,0.206 Z M0.5407,0.3184 L0.5407,0.3792 L0.6113,0.3792 L0.6113,0.3184 L0.5407,0.3184 Z M0.5309,0.3016 L0.621,0.3016 Q0.6254,0.3016,0.6281,0.3043 T0.6308,0.31 L0.6308,0.3876 Q0.6308,0.3914,0.6276,0.3937 T0.621,0.396 L0.5309,0.396 Q0.5265,0.396,0.5239,0.3932 T0.5212,0.3876 L0.5212,0.31 Q0.5212,0.3062,0.5244,0.3039 T0.5309,0.3016 Z M0.5309,0.4081 L0.621,0.4081 L0.621,0.4857 L0.5309,0.4857 L0.5309,0.4081 Z M0.5309,0.5059 L0.621,0.5059 L0.621,0.5835 L0.5309,0.5835 L0.5309,0.5059 Z M0.5407,0.6149 L0.5407,0.6758 L0.6113,0.6758 L0.6113,0.6149 L0.5407,0.6149 Z M0.5309,0.5982 L0.621,0.5982 Q0.6254,0.5982,0.6281,0.6009 T0.6308,0.6065 L0.6308,0.6841 Q0.6308,0.6879,0.6276,0.6902 T0.621,0.6925 L0.5309,0.6925 Q0.5265,0.6925,0.5239,0.6898 T0.5212,0.6841 L0.5212,0.6065 Q0.5212,0.6028,0.5244,0.6005 T0.5309,0.5982 Z M0.4062,0.1137 L0.4963,0.1137 L0.4963,0.1909 L0.4062,0.1909 L0.4062,0.1137 Z M0.4062,0.2143 L0.4963,0.2143 L0.4963,0.2919 L0.4062,0.2919 L0.4062,0.2143 Z M0.4184,0.4186 L0.4184,0.4753 L0.4842,0.4753 L0.4842,0.4186 L0.4184,0.4186 Z M0.4062,0.3977 L0.4963,0.3977 Q0.5017,0.3977,0.5051,0.401 T0.5085,0.4081 L0.5085,0.4857 Q0.5085,0.4904,0.5046,0.4933 T0.4963,0.4962 L0.4062,0.4962 Q0.4009,0.4962,0.3975,0.4929 T0.3941,0.4857 L0.3941,0.4081 Q0.3941,0.4035,0.398,0.4006 T0.4062,0.3977 Z M0.4062,0.5059 L0.4963,0.5059 L0.4963,0.5835 L0.4062,0.5835 L0.4062,0.5059 Z M0.4087,0.7131 L0.4087,0.7865 L0.4939,0.7865 L0.4939,0.7131 L0.4087,0.7131 Z M0.4062,0.7089 L0.4963,0.7089 Q0.4988,0.7089,0.4988,0.711 L0.4988,0.7886 Q0.4988,0.7907,0.4963,0.7907 L0.4062,0.7907 Q0.4038,0.7907,0.4038,0.7886 L0.4038,0.711 Q0.4038,0.7089,0.4062,0.7089 Z M0.2689,0.1137 L0.359,0.1137 L0.359,0.1909 L0.2689,0.1909 L0.2689,0.1137 Z M0.2689,0.2143 L0.359,0.2143 L0.359,0.2919 L0.2689,0.2919 L0.2689,0.2143 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.2689,0.31 L0.359,0.31 L0.359,0.3876 L0.2689,0.3876 L0.2689,0.31 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.2689,0.4081 L0.359,0.4081 L0.359,0.4857 L0.2689,0.4857 L0.2689,0.4081 Z M0.2689,0.5059 L0.359,0.5059 L0.359,0.5835 L0.2689,0.5835 L0.2689,0.5059 Z M0.2689,0.711 L0.359,0.711 L0.359,0.7886 L0.2689,0.7886 L0.2689,0.711 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.1374,0.1137 L0.2275,0.1137 L0.2275,0.1909 L0.1374,0.1909 L0.1374,0.1137 Z M0.1374,0.2143 L0.2275,0.2143 L0.2275,0.2919 L0.1374,0.2919 L0.1374,0.2143 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0.1374,0.31 L0.2275,0.31 L0.2275,0.3876 L0.1374,0.3876 L0.1374,0.31 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0.1374,0.4081 L0.2275,0.4081 L0.2275,0.4857 L0.1374,0.4857 L0.1374,0.4081 Z M0.1374,0.5059 L0.2275,0.5059 L0.2275,0.5835 L0.1374,0.5835 L0.1374,0.5059 Z M0.1374,0.6065 L0.2275,0.6065 L0.2275,0.6841 L0.1374,0.6841 L0.1374,0.6065 Z M0.1374,0.711 L0.2275,0.711 L0.2275,0.7886 L0.1374,0.7886 L0.1374,0.711 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0,0.1137 L0.0901,0.1137 L0.0901,0.1909 L0,0.1909 L0,0.1137 Z M0,0.2143 L0.0901,0.2143 L0.0901,0.2919 L0,0.2919 L0,0.2143 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z M0,0.31 L0.0901,0.31 L0.0901,0.3876 L0,0.3876 L0,0.31 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z M0,0.4081 L0.0901,0.4081 L0.0901,0.4857 L0,0.4857 L0,0.4081 Z M0,0.5059 L0.0901,0.5059 L0.0901,0.5835 L0,0.5835 L0,0.5059 Z M0,0.6065 L0.0901,0.6065 L0.0901,0.6841 L0,0.6841 L0,0.6065 Z M0,0.711 L0.0901,0.711 L0.0901,0.7886 L0,0.7886 L0,0.711 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z",type:0}},"":{type:5,data:{d:"M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M0.0901,0.1158 L0.0901,0.1888 L0.0049,0.1888 L0.0049,0.1158 L0.0901,0.1158 Z M0.0925,0.1116 L0.0024,0.1116 Q0,0.1116,0,0.1137 L0,0.1909 Q0,0.193,0.0024,0.193 L0.0925,0.193 Q0.095,0.193,0.095,0.1909 L0.095,0.1137 Q0.095,0.1116,0.0925,0.1116 Z M0.2148,0.6086 L0.2148,0.682 L0.1296,0.682 L0.1296,0.6086 L0.2148,0.6086 Z M0.2172,0.6044 L0.1271,0.6044 Q0.1247,0.6044,0.1247,0.6065 L0.1247,0.6841 Q0.1247,0.6862,0.1271,0.6862 L0.2172,0.6862 Q0.2197,0.6862,0.2197,0.6841 L0.2197,0.6065 Q0.2197,0.6044,0.2172,0.6044 Z M0.34,0.1137 L0.2499,0.1137 L0.2499,0.1909 L0.34,0.1909 L0.34,0.1137 Z M0.3376,0.4102 L0.3376,0.4836 L0.2523,0.4836 L0.2523,0.4102 L0.3376,0.4102 Z M0.34,0.406 L0.2499,0.406 Q0.2474,0.406,0.2474,0.4081 L0.2474,0.4857 Q0.2474,0.4878,0.2499,0.4878 L0.34,0.4878 Q0.3424,0.4878,0.3424,0.4857 L0.3424,0.4081 Q0.3424,0.406,0.34,0.406 Z M0.3376,0.7131 L0.3376,0.7865 L0.2523,0.7865 L0.2523,0.7131 L0.3376,0.7131 Z M0.34,0.7089 L0.2499,0.7089 Q0.2474,0.7089,0.2474,0.711 L0.2474,0.7886 Q0.2474,0.7907,0.2499,0.7907 L0.34,0.7907 Q0.3424,0.7907,0.3424,0.7886 L0.3424,0.711 Q0.3424,0.7089,0.34,0.7089 Z M0.4593,0.2227 L0.4593,0.2836 L0.3887,0.2836 L0.3887,0.2227 L0.4593,0.2227 Z M0.4691,0.206 L0.379,0.206 Q0.3746,0.206,0.3719,0.2087 T0.3692,0.2143 L0.3692,0.2919 Q0.3692,0.2957,0.3724,0.298 T0.379,0.3003 L0.4691,0.3003 Q0.4735,0.3003,0.4761,0.2976 T0.4788,0.2919 L0.4788,0.2143 Q0.4788,0.211,0.4756,0.2085 T0.4691,0.206 Z M0.4593,0.3184 L0.4593,0.3792 L0.3887,0.3792 L0.3887,0.3184 L0.4593,0.3184 Z M0.4691,0.3016 L0.379,0.3016 Q0.3746,0.3016,0.3719,0.3043 T0.3692,0.31 L0.3692,0.3876 Q0.3692,0.3914,0.3724,0.3937 T0.379,0.396 L0.4691,0.396 Q0.4735,0.396,0.4761,0.3932 T0.4788,0.3876 L0.4788,0.31 Q0.4788,0.3062,0.4756,0.3039 T0.4691,0.3016 Z M0.4691,0.4081 L0.379,0.4081 L0.379,0.4857 L0.4691,0.4857 L0.4691,0.4081 Z M0.4691,0.5059 L0.379,0.5059 L0.379,0.5835 L0.4691,0.5835 L0.4691,0.5059 Z M0.4593,0.6149 L0.4593,0.6758 L0.3887,0.6758 L0.3887,0.6149 L0.4593,0.6149 Z M0.4691,0.5982 L0.379,0.5982 Q0.3746,0.5982,0.3719,0.6009 T0.3692,0.6065 L0.3692,0.6841 Q0.3692,0.6879,0.3724,0.6902 T0.379,0.6925 L0.4691,0.6925 Q0.4735,0.6925,0.4761,0.6898 T0.4788,0.6841 L0.4788,0.6065 Q0.4788,0.6028,0.4756,0.6005 T0.4691,0.5982 Z M0.5938,0.1137 L0.5037,0.1137 L0.5037,0.1909 L0.5938,0.1909 L0.5938,0.1137 Z M0.5938,0.2143 L0.5037,0.2143 L0.5037,0.2919 L0.5938,0.2919 L0.5938,0.2143 Z M0.5816,0.4186 L0.5816,0.4753 L0.5158,0.4753 L0.5158,0.4186 L0.5816,0.4186 Z M0.5938,0.3977 L0.5037,0.3977 Q0.4983,0.3977,0.4949,0.401 T0.4915,0.4081 L0.4915,0.4857 Q0.4915,0.4904,0.4954,0.4933 T0.5037,0.4962 L0.5938,0.4962 Q0.5991,0.4962,0.6025,0.4929 T0.6059,0.4857 L0.6059,0.4081 Q0.6059,0.4035,0.602,0.4006 T0.5938,0.3977 Z M0.5938,0.5059 L0.5037,0.5059 L0.5037,0.5835 L0.5938,0.5835 L0.5938,0.5059 Z M0.5913,0.7131 L0.5913,0.7865 L0.5061,0.7865 L0.5061,0.7131 L0.5913,0.7131 Z M0.5938,0.7089 L0.5037,0.7089 Q0.5012,0.7089,0.5012,0.711 L0.5012,0.7886 Q0.5012,0.7907,0.5037,0.7907 L0.5938,0.7907 Q0.5962,0.7907,0.5962,0.7886 L0.5962,0.711 Q0.5962,0.7089,0.5938,0.7089 Z M0.7311,0.1137 L0.641,0.1137 L0.641,0.1909 L0.7311,0.1909 L0.7311,0.1137 Z M0.7311,0.2143 L0.641,0.2143 L0.641,0.2919 L0.7311,0.2919 L0.7311,0.2143 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.7311,0.31 L0.641,0.31 L0.641,0.3876 L0.7311,0.3876 L0.7311,0.31 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.7311,0.4081 L0.641,0.4081 L0.641,0.4857 L0.7311,0.4857 L0.7311,0.4081 Z M0.7311,0.5059 L0.641,0.5059 L0.641,0.5835 L0.7311,0.5835 L0.7311,0.5059 Z M0.7311,0.711 L0.641,0.711 L0.641,0.7886 L0.7311,0.7886 L0.7311,0.711 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.8626,0.1137 L0.7725,0.1137 L0.7725,0.1909 L0.8626,0.1909 L0.8626,0.1137 Z M0.8626,0.2143 L0.7725,0.2143 L0.7725,0.2919 L0.8626,0.2919 L0.8626,0.2143 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M0.8626,0.31 L0.7725,0.31 L0.7725,0.3876 L0.8626,0.3876 L0.8626,0.31 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M0.8626,0.4081 L0.7725,0.4081 L0.7725,0.4857 L0.8626,0.4857 L0.8626,0.4081 Z M0.8626,0.5059 L0.7725,0.5059 L0.7725,0.5835 L0.8626,0.5835 L0.8626,0.5059 Z M0.8626,0.6065 L0.7725,0.6065 L0.7725,0.6841 L0.8626,0.6841 L0.8626,0.6065 Z M0.8626,0.711 L0.7725,0.711 L0.7725,0.7886 L0.8626,0.7886 L0.8626,0.711 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M1,0.1137 L0.9099,0.1137 L0.9099,0.1909 L1,0.1909 L1,0.1137 Z M1,0.2143 L0.9099,0.2143 L0.9099,0.2919 L1,0.2919 L1,0.2143 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z M1,0.31 L0.9099,0.31 L0.9099,0.3876 L1,0.3876 L1,0.31 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z M1,0.4081 L0.9099,0.4081 L0.9099,0.4857 L1,0.4857 L1,0.4081 Z M1,0.5059 L0.9099,0.5059 L0.9099,0.5835 L1,0.5835 L1,0.5059 Z M1,0.6065 L0.9099,0.6065 L0.9099,0.6841 L1,0.6841 L1,0.6065 Z M1,0.711 L0.9099,0.711 L0.9099,0.7886 L1,0.7886 L1,0.711 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z",type:0}},"":{type:5,data:{d:"M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0.8574,0.3217 L0.8574,0.4098 L0.9691,0.4098 L0.9691,0.3217 L0.8574,0.3217 Z M0.8419,0.2978 L0.9846,0.2978 Q0.9892,0.2978,0.9928,0.2997 T0.9982,0.3043 T1,0.31 L1,0.4216 Q1,0.427,0.9951,0.4304 T0.9846,0.4337 L0.8419,0.4337 Q0.8352,0.4337,0.8308,0.4299 T0.8265,0.4216 L0.8265,0.31 Q0.8265,0.3062,0.829,0.3035 T0.835,0.2993 T0.8419,0.2978 Z M0.8574,0.888 L0.8574,0.9757 L0.9691,0.9757 L0.9691,0.888 L0.8574,0.888 Z M0.8419,0.8637 L0.9846,0.8637 Q0.9892,0.8637,0.9928,0.8658 T0.9982,0.8706 T1,0.8758 L1,0.9878 Q1,0.9929,0.9951,0.9964 T0.9846,1 L0.8419,1 Q0.8352,1,0.8308,0.996 T0.8265,0.9878 L0.8265,0.8758 Q0.8265,0.8708,0.8314,0.8672 T0.8419,0.8637 Z M0.6509,0.169 L0.6509,0.2706 L0.7806,0.2706 L0.7806,0.169 L0.6509,0.169 Z M0.6442,0.159 L0.7868,0.159 Q0.7899,0.159,0.7917,0.1604 T0.7935,0.164 L0.7935,0.2756 Q0.7935,0.2781,0.7915,0.2796 T0.7868,0.281 L0.6442,0.281 Q0.6416,0.281,0.6395,0.2794 T0.6375,0.2756 L0.6375,0.164 Q0.6375,0.1619,0.6398,0.1604 T0.6442,0.159 Z M0.6632,0.6044 L0.6632,0.6858 L0.7678,0.6858 L0.7678,0.6044 L0.6632,0.6044 Z M0.6442,0.5742 L0.7868,0.5742 Q0.7951,0.5742,0.8007,0.5791 T0.8064,0.5893 L0.8064,0.7013 Q0.8064,0.7076,0.8002,0.712 T0.7868,0.7164 L0.6442,0.7164 Q0.6359,0.7164,0.6305,0.7114 T0.6251,0.7013 L0.6251,0.5893 Q0.6251,0.5847,0.6282,0.5812 T0.6357,0.5759 T0.6442,0.5742 Z M0.4264,0.164 L0.5695,0.164 L0.5695,0.2756 L0.4264,0.2756 L0.4264,0.164 Z M0.4325,0.315 L0.4325,0.4165 L0.5628,0.4165 L0.5628,0.315 L0.4325,0.315 Z M0.4264,0.3049 L0.5695,0.3049 Q0.5721,0.3049,0.5739,0.3064 T0.5757,0.31 L0.5757,0.4216 Q0.5757,0.4237,0.5736,0.4251 T0.5695,0.4266 L0.4264,0.4266 Q0.4238,0.4266,0.422,0.4251 T0.4202,0.4216 L0.4202,0.31 Q0.4202,0.3087,0.4207,0.3077 T0.4222,0.306 T0.4243,0.3052 T0.4264,0.3049 Z M0.4264,0.4476 L0.5695,0.4476 L0.5695,0.5596 L0.4264,0.5596 L0.4264,0.4476 Z M0.4392,0.7408 L0.4392,0.8326 L0.5561,0.8326 L0.5561,0.7408 L0.4392,0.7408 Z M0.4264,0.7206 L0.5695,0.7206 Q0.5747,0.7206,0.5783,0.724 T0.5819,0.7307 L0.5819,0.8427 Q0.5819,0.8469,0.5778,0.8498 T0.5695,0.8528 L0.4264,0.8528 Q0.4207,0.8528,0.4171,0.8496 T0.4135,0.8427 L0.4135,0.7307 Q0.4135,0.7265,0.4176,0.7236 T0.4264,0.7206 Z M0.2178,0.164 L0.3605,0.164 L0.3605,0.2756 L0.2178,0.2756 L0.2178,0.164 Z M0.2178,0.31 L0.3605,0.31 L0.3605,0.4216 L0.2178,0.4216 L0.2178,0.31 Z M0.2178,0.5893 L0.3605,0.5893 L0.3605,0.7013 L0.2178,0.7013 L0.2178,0.5893 Z M0.2178,0.7307 L0.3605,0.7307 L0.3605,0.8427 L0.2178,0.8427 L0.2178,0.7307 Z M0.2178,0.8758 L0.3605,0.8758 L0.3605,0.9878 L0.2178,0.9878 L0.2178,0.8758 Z M0,0.164 L0.1432,0.164 L0.1432,0.2756 L0,0.2756 L0,0.164 Z M0,0.31 L0.1432,0.31 L0.1432,0.4216 L0,0.4216 L0,0.31 Z M0,0.4476 L0.1432,0.4476 L0.1432,0.5596 L0,0.5596 L0,0.4476 Z M0,0.5893 L0.1432,0.5893 L0.1432,0.7013 L0,0.7013 L0,0.5893 Z M0,0.7307 L0.1432,0.7307 L0.1432,0.8427 L0,0.8427 L0,0.7307 Z M0,0.8758 L0.1432,0.8758 L0.1432,0.9878 L0,0.9878 L0,0.8758 Z",type:0}},"":{type:5,data:{d:"M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M0.1432,0.3217 L0.1432,0.4098 L0.0309,0.4098 L0.0309,0.3217 L0.1432,0.3217 Z M0.1586,0.2978 L0.0154,0.2978 Q0.0088,0.2978,0.0044,0.3016 T0,0.31 L0,0.4216 Q0,0.427,0.0049,0.4304 T0.0154,0.4337 L0.1586,0.4337 Q0.1648,0.4337,0.1694,0.4299 T0.174,0.4216 L0.174,0.31 Q0.174,0.3062,0.1715,0.3035 T0.1653,0.2993 T0.1586,0.2978 Z M0.1432,0.888 L0.1432,0.9757 L0.0309,0.9757 L0.0309,0.888 L0.1432,0.888 Z M0.1586,0.8637 L0.0154,0.8637 Q0.0108,0.8637,0.0072,0.8658 T0.0018,0.8706 T0,0.8758 L0,0.9878 Q0,0.9929,0.0049,0.9964 T0.0154,1 L0.1586,1 Q0.1648,1,0.1694,0.996 T0.174,0.9878 L0.174,0.8758 Q0.174,0.8725,0.1715,0.8695 T0.1653,0.8651 T0.1586,0.8637 Z M0.3496,0.169 L0.3496,0.2706 L0.2194,0.2706 L0.2194,0.169 L0.3496,0.169 Z M0.3563,0.159 L0.2132,0.159 Q0.2106,0.159,0.2088,0.1604 T0.207,0.164 L0.207,0.2756 Q0.207,0.2781,0.2091,0.2796 T0.2132,0.281 L0.3563,0.281 Q0.3589,0.281,0.3607,0.2794 T0.3625,0.2756 L0.3625,0.164 Q0.3625,0.1619,0.3605,0.1604 T0.3563,0.159 Z M0.3368,0.6044 L0.3368,0.6858 L0.2327,0.6858 L0.2327,0.6044 L0.3368,0.6044 Z M0.3563,0.5742 L0.2132,0.5742 Q0.2049,0.5742,0.1993,0.5791 T0.1936,0.5893 L0.1936,0.7013 Q0.1936,0.7076,0.2001,0.712 T0.2132,0.7164 L0.3563,0.7164 Q0.3641,0.7164,0.3697,0.7114 T0.3754,0.7013 L0.3754,0.5893 Q0.3754,0.5847,0.3723,0.5812 T0.3648,0.5759 T0.3563,0.5742 Z M0.5736,0.164 L0.431,0.164 L0.431,0.2756 L0.5736,0.2756 L0.5736,0.164 Z M0.5675,0.315 L0.5675,0.4165 L0.4377,0.4165 L0.4377,0.315 L0.5675,0.315 Z M0.5736,0.3049 L0.431,0.3049 Q0.4284,0.3049,0.4264,0.3064 T0.4243,0.31 L0.4243,0.4216 Q0.4243,0.4237,0.4266,0.4251 T0.431,0.4266 L0.5736,0.4266 Q0.5767,0.4266,0.5785,0.4251 T0.5803,0.4216 L0.5803,0.31 Q0.5803,0.3087,0.5798,0.3077 T0.5783,0.306 T0.5762,0.3052 T0.5736,0.3049 Z M0.5736,0.4476 L0.431,0.4476 L0.431,0.5596 L0.5736,0.5596 L0.5736,0.4476 Z M0.5613,0.7408 L0.5613,0.8326 L0.4439,0.8326 L0.4439,0.7408 L0.5613,0.7408 Z M0.5736,0.7206 L0.431,0.7206 Q0.4253,0.7206,0.4217,0.724 T0.4181,0.7307 L0.4181,0.8427 Q0.4181,0.8469,0.4222,0.8498 T0.431,0.8528 L0.5736,0.8528 Q0.5778,0.8528,0.5808,0.8511 T0.5855,0.8471 T0.587,0.8427 L0.587,0.7307 Q0.587,0.7265,0.5826,0.7236 T0.5736,0.7206 Z M0.7827,0.164 L0.6395,0.164 L0.6395,0.2756 L0.7827,0.2756 L0.7827,0.164 Z M0.7827,0.31 L0.6395,0.31 L0.6395,0.4216 L0.7827,0.4216 L0.7827,0.31 Z M0.7827,0.5893 L0.6395,0.5893 L0.6395,0.7013 L0.7827,0.7013 L0.7827,0.5893 Z M0.7827,0.7307 L0.6395,0.7307 L0.6395,0.8427 L0.7827,0.8427 L0.7827,0.7307 Z M0.7827,0.8758 L0.6395,0.8758 L0.6395,0.9878 L0.7827,0.9878 L0.7827,0.8758 Z M1,0.164 L0.8574,0.164 L0.8574,0.2756 L1,0.2756 L1,0.164 Z M1,0.31 L0.8574,0.31 L0.8574,0.4216 L1,0.4216 L1,0.31 Z M1,0.4476 L0.8574,0.4476 L0.8574,0.5596 L1,0.5596 L1,0.4476 Z M1,0.5893 L0.8574,0.5893 L0.8574,0.7013 L1,0.7013 L1,0.5893 Z M1,0.7307 L0.8574,0.7307 L0.8574,0.8427 L1,0.8427 L1,0.7307 Z M1,0.8758 L0.8574,0.8758 L0.8574,0.9878 L1,0.9878 L1,0.8758 Z",type:0}},"":{type:5,data:{d:"M0.0008,0.9979 Q0.0008,1,0.0032,1 Q0.0482,1,0.0602,0.9975 Q0.0667,0.9963,0.0847,0.9917 T0.1084,0.9859 Q0.1124,0.9851,0.1221,0.9851 L0.1253,0.9851 L0.1285,0.9851 Q0.1518,0.9851,0.1655,0.9809 Q0.1695,0.9801,0.1731,0.9788 T0.1791,0.9766 T0.1839,0.9747 T0.1888,0.9732 L0.1936,0.972 T0.1988,0.9712 T0.2048,0.971 L0.2096,0.971 Q0.2201,0.9714,0.2233,0.9714 T0.2345,0.9693 Q0.2386,0.9685,0.2502,0.9674 T0.2715,0.966 L0.2811,0.9656 Q0.2916,0.9647,0.2916,0.9573 Q0.2916,0.954,0.2892,0.9515 T0.2819,0.9486 Q0.2755,0.9482,0.2683,0.9482 Q0.2643,0.9482,0.2582,0.9484 T0.2498,0.9486 Q0.2426,0.9486,0.2402,0.9473 Q0.2386,0.9469,0.2317,0.943 T0.2161,0.937 Q0.2104,0.9357,0.1992,0.933 T0.1831,0.9291 Q0.1807,0.9287,0.1783,0.9285 T0.1739,0.928 T0.1703,0.9276 T0.1675,0.9272 T0.1655,0.9266 T0.1639,0.9253 Q0.1598,0.9216,0.1462,0.9216 L0.143,0.9216 L0.1398,0.9216 L0.1365,0.9216 Q0.1197,0.9195,0.1197,0.9154 L0.1197,0.9154 Q0.1205,0.9121,0.1373,0.9088 T0.1703,0.9054 Q0.1791,0.9054,0.1863,0.904 T0.1984,0.9011 T0.2064,0.8992 Q0.2402,0.8967,0.2506,0.8934 Q0.2538,0.8926,0.2602,0.8899 T0.2707,0.8872 Q0.2715,0.8872,0.2731,0.8876 Q0.2795,0.8884,0.2884,0.8884 Q0.3068,0.8884,0.3092,0.8826 L0.3092,0.8797 Q0.3092,0.8772,0.3076,0.8747 T0.3044,0.8706 T0.3028,0.8681 Q0.3076,0.8656,0.3237,0.8656 Q0.3317,0.8656,0.3622,0.8623 Q0.3655,0.8623,0.3867,0.8617 T0.4217,0.8602 Q0.4241,0.8598,0.4289,0.8598 L0.4345,0.8598 L0.441,0.8598 Q0.4578,0.8598,0.4667,0.8586 Q0.4739,0.8573,0.4851,0.8567 T0.5004,0.8552 Q0.5012,0.8552,0.5108,0.855 T0.5269,0.853 T0.5333,0.8461 Q0.5333,0.8445,0.5325,0.8432 T0.5309,0.8409 T0.5289,0.8391 T0.5261,0.8378 L0.5229,0.837 T0.5185,0.8362 T0.5133,0.8355 T0.5076,0.8349 T0.502,0.8341 Q0.4932,0.8324,0.4859,0.8324 Q0.4827,0.8324,0.4787,0.8328 T0.4731,0.8333 Q0.4707,0.8333,0.4683,0.8324 Q0.4482,0.825,0.4394,0.825 Q0.4369,0.825,0.4345,0.8254 Q0.4225,0.827,0.4153,0.827 Q0.4088,0.827,0.4064,0.8258 Q0.3976,0.8204,0.3751,0.8204 Q0.3703,0.8204,0.3667,0.8214 T0.3622,0.8225 Q0.3598,0.8225,0.3558,0.82 Q0.351,0.8175,0.3402,0.8167 T0.3177,0.8156 T0.3028,0.8146 L0.2956,0.8121 T0.2871,0.8094 T0.2771,0.8073 T0.2635,0.8063 Q0.261,0.8063,0.2586,0.8067 Q0.2378,0.8071,0.2273,0.8071 Q0.2072,0.8071,0.2024,0.8051 Q0.1976,0.8034,0.1932,0.8026 T0.1867,0.8013 T0.1847,0.8001 L0.1847,0.7993 Q0.1855,0.7984,0.1855,0.7978 T0.1859,0.7966 T0.1867,0.7959 T0.188,0.7955 T0.1896,0.7951 T0.1916,0.7949 T0.1944,0.7945 T0.1984,0.7941 T0.2032,0.7939 Q0.212,0.7926,0.2325,0.7918 T0.2562,0.7905 Q0.2691,0.7893,0.2787,0.7847 Q0.2835,0.7827,0.2968,0.7791 T0.3149,0.7756 Q0.3189,0.7756,0.3305,0.7733 T0.3446,0.771 L0.3454,0.771 Q0.3462,0.771,0.3498,0.7721 T0.3574,0.774 T0.3655,0.7748 Q0.3703,0.7748,0.3743,0.7731 T0.3823,0.7708 T0.3916,0.77 T0.3992,0.7694 Q0.4008,0.7694,0.4076,0.7688 T0.4205,0.7675 L0.4305,0.7665 Q0.4345,0.7657,0.4402,0.7617 T0.4458,0.7545 Q0.4458,0.7503,0.4353,0.7487 Q0.4297,0.7478,0.4209,0.7462 T0.4044,0.7433 T0.3904,0.7416 L0.3847,0.7416 Q0.3807,0.7416,0.3747,0.7422 T0.3663,0.7428 T0.3606,0.7424 Q0.3582,0.742,0.3562,0.7418 T0.3522,0.7412 T0.3482,0.7406 T0.3446,0.7401 T0.341,0.7397 T0.3373,0.7393 T0.3341,0.7391 L0.3293,0.7391 Q0.3277,0.7395,0.3253,0.7395 Q0.3205,0.7395,0.3052,0.7387 T0.2835,0.7379 Q0.2755,0.7379,0.253,0.7325 Q0.2506,0.7316,0.2462,0.731 T0.2382,0.7296 T0.2305,0.7271 T0.2181,0.7234 T0.2048,0.7196 T0.2,0.7155 Q0.2,0.7142,0.2016,0.713 Q0.208,0.7059,0.2285,0.6978 T0.2618,0.6898 Q0.2739,0.6898,0.2831,0.6848 T0.2956,0.6794 Q0.3028,0.6786,0.3289,0.6765 T0.3566,0.674 Q0.3582,0.674,0.3855,0.6723 T0.4406,0.6688 T0.4755,0.6653 Q0.5004,0.6607,0.5124,0.6599 L0.5165,0.6599 Q0.5213,0.6599,0.5277,0.6605 T0.5373,0.6611 Q0.543,0.6611,0.5494,0.6599 Q0.592,0.6524,0.6,0.6524 Q0.6064,0.6524,0.61,0.6499 T0.6161,0.6474 Q0.6177,0.6474,0.6261,0.6495 T0.6418,0.6516 L0.6482,0.6516 Q0.653,0.6512,0.6651,0.6506 T0.6876,0.6493 T0.7084,0.6477 T0.7229,0.645 Q0.7269,0.6437,0.7333,0.6437 Q0.7373,0.6437,0.7458,0.6443 T0.7574,0.645 Q0.7614,0.645,0.7631,0.6445 T0.7655,0.6441 Q0.7671,0.6441,0.7723,0.6448 T0.7823,0.6454 Q0.788,0.6454,0.7952,0.6445 Q0.8233,0.6408,0.8723,0.6367 Q0.9012,0.6342,0.9092,0.6342 L0.9165,0.6342 L0.9205,0.6342 Q0.9277,0.6342,0.9382,0.6323 T0.9526,0.6304 Q0.9534,0.6304,0.9594,0.6307 T0.9695,0.6309 Q0.9976,0.6309,0.9992,0.6234 Q1,0.6201,1,0.618 Q1,0.6089,0.9775,0.608 Q0.9703,0.6076,0.9582,0.6076 Q0.9518,0.6076,0.9394,0.6078 T0.9213,0.608 Q0.9036,0.608,0.8972,0.6072 Q0.894,0.6068,0.8871,0.6058 T0.8751,0.6039 T0.8627,0.6024 T0.8506,0.6018 L0.8474,0.6018 Q0.841,0.6022,0.8281,0.6041 T0.8112,0.606 Q0.8096,0.606,0.808,0.6056 Q0.7783,0.6002,0.7647,0.6002 Q0.7598,0.6002,0.7454,0.6006 T0.7261,0.601 Q0.7221,0.601,0.7145,0.6022 T0.7036,0.6035 Q0.6996,0.6035,0.6964,0.6022 Q0.6723,0.5902,0.6442,0.5902 Q0.6426,0.5902,0.6386,0.5904 T0.6337,0.5906 Q0.6273,0.5906,0.6249,0.5894 L0.6177,0.5856 T0.6116,0.5838 T0.6016,0.5825 T0.5855,0.5823 Q0.5719,0.5823,0.5574,0.5798 T0.5373,0.5774 L0.5341,0.5774 Q0.5293,0.5778,0.5213,0.5786 T0.51,0.5794 Q0.5036,0.5794,0.4988,0.5769 Q0.4932,0.574,0.4771,0.574 Q0.4723,0.574,0.4631,0.5745 T0.4498,0.5749 Q0.4418,0.5749,0.4394,0.5736 Q0.4353,0.5724,0.4305,0.5715 T0.4225,0.5707 T0.4145,0.5705 T0.4056,0.5699 Q0.4008,0.5691,0.398,0.5689 T0.394,0.5689 T0.3908,0.5686 T0.3855,0.5674 Q0.3831,0.567,0.3811,0.5662 T0.3779,0.5645 T0.3743,0.563 T0.3695,0.5624 Q0.3655,0.5624,0.3594,0.5635 T0.3494,0.5645 T0.3406,0.5635 T0.3325,0.5624 Q0.3309,0.5624,0.3301,0.5628 L0.3141,0.5628 Q0.2635,0.5628,0.2506,0.5612 Q0.2474,0.5608,0.2434,0.5608 Q0.2402,0.5608,0.2349,0.561 T0.2273,0.5612 Q0.2209,0.5612,0.2177,0.5595 Q0.2145,0.557,0.2145,0.5558 Q0.2169,0.5537,0.2345,0.5521 Q0.2876,0.5475,0.3028,0.5425 Q0.3068,0.5413,0.3149,0.5396 T0.3309,0.5367 T0.3478,0.5338 T0.3606,0.5309 Q0.3631,0.5305,0.3755,0.5259 T0.3968,0.5214 Q0.3992,0.5214,0.4024,0.5218 T0.4096,0.5222 Q0.4161,0.5222,0.4213,0.5209 T0.4313,0.5185 T0.4402,0.5172 Q0.4418,0.5168,0.447,0.5168 L0.4558,0.5168 T0.4639,0.5162 T0.4707,0.5141 T0.4731,0.5102 Q0.4731,0.5089,0.4723,0.5081 Q0.4699,0.5019,0.4627,0.4994 T0.4369,0.4965 Q0.4273,0.4961,0.4193,0.4946 T0.4048,0.4915 T0.3952,0.4894 Q0.392,0.4886,0.388,0.4886 Q0.3847,0.4886,0.3775,0.4892 T0.3647,0.4898 Q0.3598,0.4898,0.355,0.4894 Q0.3165,0.4861,0.3141,0.4853 Q0.2779,0.4774,0.2715,0.4774 Q0.2699,0.4774,0.2683,0.4776 T0.2627,0.4778 Q0.2498,0.4778,0.2281,0.4762 Q0.2241,0.4749,0.2233,0.4737 Q0.2249,0.472,0.2321,0.4708 Q0.2402,0.4695,0.2554,0.4695 L0.2675,0.4695 L0.2795,0.4695 Q0.294,0.4695,0.2996,0.4679 Q0.3141,0.4629,0.3373,0.4616 Q0.3414,0.4612,0.3466,0.4606 T0.3582,0.4589 T0.3687,0.4562 T0.3727,0.4525 Q0.3727,0.4509,0.3703,0.4492 Q0.3639,0.4455,0.3474,0.4419 T0.3213,0.4384 L0.3157,0.4384 L0.31,0.4384 Q0.294,0.4384,0.2859,0.4363 Q0.2795,0.4347,0.2691,0.4347 L0.2618,0.4347 L0.2546,0.4347 Q0.2458,0.4347,0.2394,0.4338 Q0.2257,0.4318,0.2193,0.4303 T0.2092,0.4266 T0.2052,0.4224 T0.2024,0.4154 T0.196,0.4052 Q0.1912,0.3994,0.1867,0.3949 T0.1807,0.3884 T0.1791,0.3849 Q0.1791,0.3824,0.1839,0.3745 Q0.1871,0.3687,0.1944,0.3637 T0.2072,0.3561 T0.2221,0.3501 T0.2321,0.3463 Q0.2353,0.3455,0.241,0.3445 T0.2522,0.3428 T0.2639,0.3411 T0.2731,0.3384 T0.2956,0.3351 T0.3197,0.3326 Q0.3213,0.3322,0.3237,0.3322 T0.3325,0.3331 T0.3414,0.3339 Q0.3478,0.3339,0.3518,0.3314 Q0.3606,0.3264,0.3703,0.3264 Q0.3775,0.3264,0.3847,0.3293 Q0.3888,0.331,0.396,0.331 Q0.4024,0.331,0.4116,0.3295 T0.4265,0.3266 T0.4414,0.3227 T0.4514,0.3202 Q0.4578,0.3181,0.4839,0.3152 T0.5112,0.3123 T0.5177,0.3119 T0.5285,0.3111 T0.5398,0.3096 T0.549,0.3065 T0.5526,0.3015 Q0.5526,0.2999,0.5518,0.2982 Q0.547,0.2903,0.5386,0.2883 T0.5165,0.2862 Q0.5116,0.2862,0.5056,0.2866 T0.4972,0.287 Q0.4884,0.287,0.4787,0.2833 Q0.4594,0.2758,0.4265,0.2758 Q0.4169,0.2758,0.4129,0.2766 Q0.4112,0.2771,0.4104,0.2771 Q0.4088,0.2771,0.4056,0.2748 T0.3968,0.2721 Q0.3695,0.2696,0.359,0.2659 Q0.355,0.2646,0.351,0.2646 T0.3426,0.2661 T0.3365,0.2675 T0.3333,0.2659 Q0.3277,0.2605,0.3116,0.2553 T0.2859,0.2501 L0.2843,0.2501 L0.2819,0.2501 Q0.2779,0.2501,0.2723,0.2493 T0.2586,0.2472 T0.2474,0.2455 Q0.1799,0.236,0.1719,0.236 Q0.1663,0.236,0.1606,0.235 T0.1502,0.2316 T0.1454,0.2265 Q0.1454,0.2223,0.1558,0.2173 Q0.1679,0.2115,0.1859,0.2092 T0.2185,0.207 T0.2353,0.2057 Q0.2369,0.2049,0.2502,0.2041 T0.2799,0.2022 T0.302,0.2007 Q0.3084,0.1999,0.3245,0.1954 T0.347,0.1908 Q0.3502,0.1908,0.3534,0.1916 Q0.3663,0.197,0.388,0.197 Q0.404,0.197,0.4088,0.1929 Q0.4096,0.192,0.4108,0.192 T0.4177,0.1945 T0.4277,0.197 T0.4369,0.1949 Q0.4442,0.1908,0.4843,0.1875 Q0.4892,0.1871,0.4968,0.1839 T0.5084,0.1808 L0.5108,0.1808 Q0.5213,0.1825,0.5454,0.1825 Q0.5823,0.1825,0.5992,0.1779 Q0.6096,0.1746,0.6217,0.1746 Q0.6249,0.1746,0.6309,0.1748 T0.6394,0.175 Q0.6434,0.175,0.6466,0.1746 Q0.6474,0.1746,0.6594,0.1738 T0.6787,0.1713 T0.6892,0.1659 Q0.6924,0.1634,0.6924,0.1593 Q0.6924,0.1547,0.6888,0.151 T0.6795,0.1472 Q0.6779,0.1472,0.6763,0.1477 Q0.6699,0.1493,0.6667,0.1493 Q0.661,0.1493,0.6506,0.1456 Q0.6329,0.1394,0.6129,0.1394 Q0.6048,0.1394,0.5992,0.1377 T0.5888,0.136 T0.5803,0.1377 T0.5751,0.1394 Q0.5711,0.1394,0.5639,0.1369 Q0.5365,0.1273,0.5116,0.1273 Q0.4876,0.1273,0.4667,0.1253 Q0.4627,0.1248,0.4542,0.1211 T0.4337,0.1174 L0.4305,0.1174 Q0.4217,0.1178,0.4153,0.119 T0.408,0.1203 Q0.4056,0.1203,0.4,0.117 Q0.3976,0.1153,0.396,0.1136 T0.3932,0.1112 T0.39,0.1099 T0.3847,0.1095 Q0.3799,0.1095,0.3687,0.1103 Q0.355,0.1112,0.3434,0.1141 T0.3301,0.117 Q0.3261,0.117,0.3229,0.1145 Q0.3181,0.1116,0.3052,0.1087 T0.2787,0.1043 T0.2546,0.1029 Q0.2506,0.1029,0.2474,0.1033 Q0.2418,0.1037,0.2349,0.1054 T0.2249,0.107 Q0.2225,0.107,0.2193,0.1066 Q0.2024,0.1024,0.1863,0.1024 Q0.1823,0.1024,0.1562,0.0971 T0.1269,0.0917 T0.1161,0.0896 T0.106,0.0854 Q0.1076,0.0846,0.11,0.0842 Q0.1173,0.0821,0.1261,0.0821 Q0.1301,0.0821,0.1369,0.0825 T0.1462,0.083 Q0.1494,0.083,0.151,0.0825 T0.1831,0.0813 T0.2201,0.0784 T0.243,0.074 T0.2667,0.0718 Q0.2707,0.0718,0.2755,0.0724 T0.2843,0.073 T0.2936,0.0724 T0.3024,0.0705 T0.3072,0.068 T0.3092,0.0657 T0.3108,0.0647 Q0.3116,0.0643,0.3133,0.0643 L0.3157,0.0643 L0.3181,0.0643 Q0.3446,0.0643,0.3446,0.0556 T0.3205,0.0469 L0.3189,0.0469 Q0.3157,0.0469,0.3157,0.0465 Q0.3084,0.0427,0.2835,0.0386 Q0.2739,0.0369,0.2675,0.0342 T0.2538,0.0299 Q0.249,0.029,0.245,0.029 T0.2378,0.0303 T0.2321,0.0315 Q0.2305,0.0315,0.2273,0.0307 Q0.2201,0.0286,0.2004,0.0272 T0.1775,0.0245 Q0.1735,0.0228,0.1663,0.0226 T0.1522,0.0197 T0.1345,0.0145 T0.1124,0.0079 Q0.0996,0.0033,0.0671,0.0044 T0.0297,0.0041 Q0.0169,0,0.0024,0.0017 Q0,0.0021,0,0.0037 Z M0.0064,0.9954 L0.0056,0.0058 Q0.0177,0.005,0.0281,0.0083 Q0.0345,0.01,0.0675,0.0089 T0.1108,0.012 Q0.1221,0.0162,0.1329,0.0187 T0.1498,0.0236 T0.1606,0.0268 T0.1691,0.0274 T0.1759,0.0286 Q0.1807,0.0303,0.2,0.0315 T0.2257,0.0348 Q0.2305,0.0361,0.2337,0.0361 Q0.2361,0.0361,0.2398,0.0348 T0.2466,0.0336 Q0.249,0.0336,0.2522,0.034 Q0.2586,0.0353,0.2655,0.0382 T0.2827,0.0427 Q0.3068,0.0469,0.3124,0.0502 Q0.3157,0.0523,0.3237,0.0523 L0.3277,0.0523 L0.3309,0.0523 Q0.3398,0.0523,0.3398,0.0556 Q0.3398,0.0581,0.3341,0.0587 T0.3205,0.0593 T0.3092,0.0603 T0.3036,0.0643 T0.2932,0.068 Q0.2884,0.0684,0.2843,0.0684 Q0.2811,0.0684,0.2763,0.0678 T0.2667,0.0672 Q0.2586,0.0672,0.2422,0.0697 T0.2177,0.0747 Q0.2137,0.0759,0.1831,0.0767 T0.1494,0.0784 L0.1474,0.0784 T0.1398,0.078 T0.1285,0.0776 Q0.1173,0.0776,0.1084,0.08 Q0.1004,0.0817,0.1004,0.0846 Q0.1004,0.0867,0.104,0.0888 T0.1124,0.0923 T0.1213,0.0948 T0.1269,0.0958 T0.155,0.1014 T0.1863,0.107 Q0.2016,0.107,0.2185,0.1107 Q0.2217,0.1116,0.2257,0.1116 Q0.2289,0.1116,0.2365,0.1099 T0.2482,0.1074 L0.2538,0.1074 Q0.2683,0.1074,0.2912,0.1107 T0.3197,0.1182 Q0.3245,0.1215,0.3301,0.1215 Q0.3333,0.1215,0.3454,0.1184 T0.3687,0.1145 Q0.3735,0.1141,0.3779,0.1139 T0.3843,0.1134 T0.3871,0.1132 Q0.3896,0.1132,0.39,0.1136 T0.392,0.1161 T0.3968,0.1203 Q0.404,0.1248,0.408,0.1248 Q0.4096,0.1248,0.4165,0.1234 T0.4305,0.1215 L0.4337,0.1215 Q0.4442,0.1215,0.4518,0.1251 T0.4659,0.1294 Q0.4876,0.1319,0.5116,0.1319 T0.5622,0.141 Q0.5703,0.1439,0.5751,0.1439 Q0.5791,0.1439,0.5831,0.1423 T0.5888,0.1406 Q0.592,0.1406,0.5944,0.1412 T0.6012,0.1427 T0.6129,0.1435 Q0.6313,0.1435,0.649,0.1497 Q0.6602,0.1535,0.6667,0.1535 Q0.6715,0.1535,0.6779,0.1522 Q0.6787,0.1518,0.6795,0.1518 Q0.6827,0.1518,0.6847,0.1541 T0.6867,0.1593 Q0.6867,0.1618,0.6851,0.1634 Q0.6835,0.1655,0.6775,0.1667 T0.6598,0.169 T0.6458,0.1705 T0.6402,0.1709 Q0.6378,0.1709,0.6321,0.1705 T0.6225,0.1701 Q0.6096,0.1701,0.5968,0.1738 Q0.5823,0.1779,0.5446,0.1779 Q0.5205,0.1779,0.5116,0.1767 Q0.51,0.1763,0.5084,0.1763 Q0.5028,0.1763,0.4944,0.1796 T0.4835,0.1829 L0.4771,0.1833 T0.4659,0.1844 L0.4546,0.1858 T0.443,0.1881 T0.4337,0.1912 Q0.4321,0.1916,0.4305,0.1916 Q0.4273,0.1916,0.4209,0.1895 T0.412,0.1875 Q0.408,0.1875,0.4056,0.19 Q0.4024,0.1925,0.388,0.1925 Q0.3663,0.1925,0.3558,0.1879 Q0.3518,0.1862,0.3462,0.1862 Q0.3373,0.1862,0.3213,0.191 T0.3012,0.1962 Q0.2964,0.1966,0.2799,0.1976 T0.2494,0.1997 T0.2313,0.2024 L0.2313,0.2024 L0.2293,0.2024 L0.2261,0.2024 L0.2217,0.2024 Q0.204,0.2024,0.1851,0.2047 T0.1526,0.2136 Q0.1406,0.2198,0.1406,0.226 Q0.1406,0.2319,0.1518,0.2362 T0.1719,0.2406 Q0.1791,0.2406,0.2466,0.2497 Q0.2498,0.2501,0.2574,0.2516 T0.2711,0.2538 T0.2819,0.2547 L0.2851,0.2547 Q0.2851,0.2543,0.2859,0.2543 Q0.294,0.2543,0.3096,0.2592 T0.3285,0.2684 Q0.3317,0.2721,0.3373,0.2721 Q0.3406,0.2721,0.3462,0.2708 T0.3542,0.2696 Q0.3558,0.2696,0.3574,0.27 Q0.3679,0.2737,0.3968,0.2762 Q0.3984,0.2766,0.4004,0.2779 L0.4044,0.2804 T0.4096,0.2816 Q0.412,0.2816,0.4145,0.2808 Q0.4177,0.2804,0.4249,0.2804 Q0.4586,0.2804,0.4763,0.287 Q0.4867,0.2912,0.4972,0.2912 Q0.5004,0.2912,0.5064,0.2908 T0.5165,0.2903 Q0.5293,0.2903,0.5361,0.2922 T0.547,0.3003 L0.547,0.3011 Q0.547,0.3036,0.5414,0.3049 T0.5249,0.3067 T0.51,0.3082 Q0.5092,0.3082,0.4831,0.3111 T0.4498,0.3161 Q0.408,0.3264,0.3952,0.3264 Q0.3896,0.3264,0.3863,0.3252 Q0.3783,0.3223,0.3703,0.3223 Q0.359,0.3223,0.3494,0.3277 Q0.347,0.3293,0.343,0.3293 Q0.3414,0.3293,0.3353,0.3285 T0.3253,0.3277 T0.3181,0.3285 Q0.3149,0.3289,0.2952,0.3306 T0.2699,0.3347 Q0.2675,0.3364,0.2598,0.3372 T0.2434,0.3395 T0.2297,0.3426 L0.2205,0.3461 T0.2048,0.3523 T0.1908,0.3606 T0.1791,0.3725 Q0.1743,0.3803,0.1743,0.3845 Q0.1743,0.3874,0.1763,0.3901 T0.1827,0.3976 T0.1912,0.4073 T0.198,0.4189 T0.2032,0.4276 T0.2137,0.4326 T0.2386,0.438 Q0.2458,0.4392,0.2562,0.4392 L0.2639,0.4392 L0.2699,0.4392 Q0.2795,0.4392,0.2843,0.4405 Q0.2932,0.443,0.3092,0.443 L0.3157,0.443 L0.3213,0.443 Q0.3293,0.443,0.3458,0.4463 T0.3671,0.4525 Q0.3598,0.4558,0.3373,0.4571 Q0.3124,0.4587,0.298,0.4637 Q0.294,0.465,0.2811,0.465 L0.2703,0.465 L0.2586,0.465 Q0.241,0.465,0.2305,0.4666 Q0.2185,0.4687,0.2185,0.4728 Q0.2185,0.4745,0.2205,0.4764 T0.2241,0.4791 L0.2265,0.4803 L0.2273,0.4803 Q0.2506,0.4824,0.261,0.4824 Q0.2675,0.4824,0.2699,0.482 Q0.2699,0.4815,0.2707,0.4815 Q0.2771,0.4815,0.3124,0.4898 Q0.3173,0.4907,0.3229,0.4913 T0.3386,0.4925 T0.3542,0.4936 T0.3663,0.494 Q0.3711,0.494,0.3787,0.4936 T0.3888,0.4932 Q0.392,0.4932,0.3944,0.4936 T0.4032,0.4959 T0.4181,0.499 T0.4369,0.5006 Q0.449,0.501,0.455,0.5021 T0.4639,0.5048 T0.4675,0.5093 L0.4675,0.5097 Q0.4675,0.5106,0.4663,0.511 T0.4622,0.5116 L0.4566,0.512 T0.4486,0.5124 T0.4402,0.5127 Q0.4345,0.5131,0.4257,0.5153 T0.4096,0.5176 Q0.4064,0.5176,0.4024,0.5172 L0.3968,0.5172 Q0.3863,0.5172,0.3731,0.522 T0.359,0.5268 Q0.355,0.528,0.3317,0.5321 T0.3004,0.5388 Q0.2867,0.5433,0.2337,0.5479 Q0.2096,0.55,0.2096,0.5562 Q0.2096,0.5591,0.2145,0.5628 Q0.2193,0.5662,0.2289,0.5662 Q0.2313,0.5662,0.2373,0.5657 T0.2458,0.5653 L0.2498,0.5653 Q0.2635,0.5674,0.3124,0.5674 Q0.3261,0.5674,0.3301,0.567 L0.3317,0.567 Q0.3341,0.567,0.3394,0.568 T0.3486,0.5691 Q0.3542,0.5691,0.3606,0.5678 T0.3699,0.5666 T0.3759,0.5686 T0.3839,0.5718 T0.3908,0.573 T0.3964,0.5734 T0.4048,0.5742 T0.4165,0.5751 T0.4277,0.5757 T0.4369,0.5778 Q0.4426,0.5794,0.4538,0.5794 Q0.4586,0.5794,0.4679,0.5792 T0.4811,0.579 Q0.4924,0.579,0.4956,0.5807 Q0.502,0.584,0.5108,0.584 L0.5137,0.584 T0.5173,0.5838 L0.5205,0.5834 L0.5237,0.583 L0.5269,0.5825 T0.5305,0.5821 T0.5341,0.5819 L0.5365,0.5819 Q0.5414,0.5819,0.5562,0.5842 T0.5855,0.5865 Q0.5912,0.5865,0.5948,0.5867 T0.6012,0.5869 T0.6064,0.5873 T0.61,0.5877 T0.6133,0.5886 T0.6157,0.5896 L0.6185,0.591 T0.6217,0.5931 Q0.6265,0.5952,0.6369,0.5952 L0.6418,0.5952 L0.6466,0.5952 Q0.6723,0.5952,0.6932,0.606 Q0.698,0.608,0.7044,0.608 Q0.7084,0.608,0.7161,0.6068 T0.7261,0.6056 Q0.7309,0.6056,0.7454,0.6051 T0.7647,0.6047 Q0.7775,0.6047,0.8072,0.6101 Q0.8096,0.6105,0.812,0.6105 Q0.8177,0.6105,0.8297,0.6085 T0.8474,0.606 L0.8506,0.606 Q0.8562,0.606,0.8647,0.607 T0.8831,0.6095 T0.8964,0.6118 Q0.9036,0.6122,0.9221,0.6122 L0.9406,0.6122 L0.959,0.6122 L0.9767,0.6122 Q0.9952,0.613,0.9952,0.6172 Q0.9952,0.6176,0.9944,0.6221 Q0.9936,0.6259,0.9574,0.6259 L0.955,0.6259 L0.9526,0.6259 Q0.9478,0.6259,0.9373,0.628 T0.9205,0.63 L0.9173,0.63 Q0.9133,0.6296,0.9084,0.6296 Q0.9004,0.6296,0.8715,0.6321 Q0.8233,0.6367,0.7944,0.64 Q0.7888,0.6408,0.7839,0.6408 T0.7739,0.6402 T0.7671,0.6396 Q0.7639,0.6396,0.7622,0.64 Q0.7614,0.6404,0.759,0.6404 Q0.7574,0.6404,0.749,0.6398 T0.7357,0.6392 Q0.7261,0.6392,0.7213,0.6412 Q0.7173,0.6425,0.7032,0.6437 T0.6711,0.6458 T0.6474,0.647 Q0.645,0.6474,0.6418,0.6474 Q0.6353,0.6474,0.6277,0.6454 T0.6161,0.6433 Q0.6104,0.6433,0.6072,0.6456 T0.6,0.6479 Q0.5912,0.6479,0.5486,0.6557 Q0.5422,0.657,0.5373,0.657 Q0.5349,0.657,0.5289,0.6564 T0.5173,0.6557 L0.5124,0.6557 Q0.4996,0.6562,0.4739,0.6611 Q0.4675,0.6624,0.4398,0.6645 T0.3851,0.668 T0.3558,0.6698 Q0.355,0.6698,0.3285,0.6721 T0.2948,0.6752 Q0.2892,0.6761,0.2843,0.6786 T0.2747,0.6831 T0.2618,0.6852 Q0.253,0.6852,0.2394,0.6893 T0.2141,0.6993 T0.1968,0.7105 Q0.1944,0.713,0.1944,0.7155 Q0.1944,0.7196,0.2012,0.7229 T0.2177,0.7285 T0.2281,0.7308 Q0.2321,0.7329,0.2365,0.7339 T0.245,0.7356 T0.2514,0.7366 Q0.2522,0.737,0.2554,0.7379 T0.2614,0.7393 T0.2679,0.7406 T0.2755,0.7416 T0.2835,0.742 Q0.29,0.742,0.3048,0.7428 T0.3253,0.7437 L0.3301,0.7437 L0.3333,0.7437 Q0.3341,0.7437,0.3598,0.7466 Q0.3639,0.7474,0.3671,0.7474 T0.3759,0.7466 T0.3855,0.7457 Q0.388,0.7457,0.3904,0.7462 Q0.3984,0.7466,0.4137,0.7495 T0.4349,0.7532 T0.441,0.7557 Q0.441,0.7599,0.4289,0.7619 Q0.4257,0.7628,0.4197,0.7634 T0.4072,0.7644 T0.3984,0.7652 Q0.3968,0.7652,0.3912,0.7655 T0.3811,0.7665 T0.3719,0.7694 Q0.3695,0.7702,0.3655,0.7702 T0.3546,0.7686 T0.3462,0.7665 L0.3446,0.7665 Q0.3406,0.7665,0.3293,0.769 T0.3149,0.7715 Q0.3084,0.7715,0.2952,0.7748 T0.2763,0.781 Q0.2675,0.7847,0.2554,0.7864 Q0.253,0.7864,0.2325,0.7874 T0.2024,0.7893 Q0.2008,0.7893,0.1984,0.7897 T0.1948,0.7901 T0.1916,0.7903 T0.1888,0.7908 T0.1867,0.7914 T0.1847,0.7922 L0.1831,0.793 T0.1819,0.7943 L0.1811,0.7959 T0.1799,0.7976 Q0.1791,0.7993,0.1791,0.8001 Q0.1791,0.8034,0.1831,0.8051 T0.1932,0.8078 T0.2,0.8092 Q0.2072,0.8117,0.2257,0.8117 Q0.2337,0.8117,0.2586,0.8109 L0.2635,0.8109 Q0.2707,0.8109,0.2767,0.8117 T0.2859,0.8136 T0.2936,0.8163 T0.3012,0.8187 Q0.3068,0.82,0.3277,0.8206 T0.3526,0.8237 Q0.3582,0.8266,0.3622,0.8266 Q0.3647,0.8266,0.3687,0.8258 T0.3751,0.825 Q0.396,0.825,0.404,0.8291 Q0.408,0.8316,0.4161,0.8316 Q0.4217,0.8316,0.4353,0.8295 L0.4394,0.8295 Q0.4466,0.8295,0.4659,0.8366 Q0.4699,0.8378,0.4747,0.8378 Q0.4763,0.8378,0.4807,0.8374 T0.4884,0.837 Q0.494,0.837,0.5004,0.8382 Q0.5052,0.8391,0.5124,0.8399 Q0.5221,0.8411,0.5249,0.8422 T0.5277,0.8461 Q0.5277,0.8482,0.5233,0.849 T0.5112,0.8501 T0.4996,0.8511 Q0.4964,0.8519,0.4851,0.8523 T0.4659,0.8544 Q0.4578,0.8557,0.4402,0.8557 L0.4349,0.8557 L0.4297,0.8557 L0.4209,0.8557 Q0.408,0.8565,0.3867,0.8571 T0.3614,0.8582 Q0.3317,0.8611,0.3237,0.8611 L0.3225,0.8611 L0.3213,0.8611 Q0.2972,0.8611,0.2972,0.8681 Q0.2972,0.8714,0.3008,0.8747 T0.3044,0.8805 Q0.3044,0.881,0.3036,0.8814 Q0.3012,0.8839,0.2851,0.8839 Q0.2779,0.8839,0.2739,0.883 Q0.2723,0.8826,0.2699,0.8826 T0.2643,0.8835 T0.259,0.8853 T0.2542,0.8876 T0.249,0.8893 Q0.2386,0.8922,0.2056,0.8946 Q0.2016,0.8951,0.1916,0.898 T0.1703,0.9009 Q0.1518,0.9009,0.1337,0.9044 T0.1149,0.9146 L0.1149,0.9158 Q0.1149,0.9175,0.1157,0.9187 T0.1173,0.921 T0.1201,0.9226 T0.1233,0.9237 T0.1269,0.9245 L0.1305,0.9251 T0.1337,0.9255 L0.1357,0.9258 Q0.139,0.9262,0.1446,0.9262 T0.1542,0.9266 T0.1598,0.9282 Q0.1614,0.9303,0.1647,0.9314 T0.1739,0.9328 T0.1815,0.9336 Q0.1863,0.9345,0.1976,0.9372 T0.2145,0.9415 Q0.2225,0.9432,0.2285,0.9467 T0.2378,0.9515 Q0.2426,0.9531,0.2514,0.9531 Q0.2538,0.9531,0.2602,0.9529 T0.2707,0.9527 Q0.2763,0.9527,0.2815,0.9531 T0.2867,0.9569 T0.2811,0.9614 Q0.2434,0.9627,0.2329,0.9652 Q0.2249,0.9672,0.2241,0.9672 L0.2096,0.9668 L0.2056,0.9668 Q0.2,0.9668,0.196,0.9672 T0.1884,0.9687 T0.1815,0.9708 T0.1731,0.9737 T0.1639,0.9772 Q0.1518,0.9805,0.1285,0.9805 L0.1253,0.9805 Q0.1124,0.9805,0.1076,0.9818 Q0.1012,0.983,0.0831,0.9876 T0.0594,0.9934 Q0.049,0.9954,0.0064,0.9954 Z M0.0032,0.9979 L0.0024,0.0037 Q0.0161,0.0021,0.0289,0.0062 Q0.0337,0.0075,0.0671,0.0066 T0.1116,0.01 T0.1337,0.0166 T0.151,0.022 Q0.1582,0.0249,0.1659,0.0251 T0.1767,0.0265 Q0.1807,0.0278,0.2,0.0292 T0.2265,0.0328 Q0.2305,0.034,0.2329,0.034 T0.239,0.0326 T0.2458,0.0311 T0.253,0.0319 Q0.2578,0.0332,0.2614,0.0342 T0.2667,0.0363 T0.2723,0.0384 T0.2827,0.0406 Q0.3084,0.0448,0.3141,0.0485 Q0.3149,0.0494,0.3225,0.0494 T0.3361,0.0504 T0.3422,0.0554 T0.3357,0.0606 T0.3205,0.0618 T0.31,0.0626 Q0.3092,0.0626,0.3056,0.0659 T0.2932,0.0701 Q0.2884,0.0709,0.2843,0.0709 Q0.2811,0.0709,0.2759,0.0701 T0.2667,0.0693 Q0.2586,0.0693,0.2422,0.0718 T0.2193,0.0763 Q0.2137,0.0784,0.1831,0.079 T0.1502,0.0805 Q0.1494,0.0809,0.147,0.0809 Q0.1454,0.0809,0.1386,0.0803 T0.1277,0.0796 Q0.1173,0.0796,0.1092,0.0821 Q0.1036,0.0834,0.1036,0.0854 Q0.1036,0.0879,0.1129,0.0908 T0.1269,0.0937 Q0.1293,0.0937,0.1558,0.0991 T0.1863,0.1045 Q0.2016,0.1045,0.2193,0.1087 Q0.2225,0.1091,0.2249,0.1091 Q0.2289,0.1091,0.2357,0.1076 T0.2482,0.1054 Q0.2506,0.1049,0.2546,0.1049 Q0.2699,0.1049,0.2924,0.1085 T0.3213,0.1165 Q0.3253,0.119,0.3301,0.119 Q0.3325,0.119,0.3446,0.1161 T0.3687,0.1124 Q0.3831,0.1112,0.3863,0.1112 T0.3908,0.1118 T0.3936,0.1145 T0.3984,0.1186 Q0.4048,0.1228,0.408,0.1228 Q0.4096,0.1228,0.4161,0.1213 T0.4305,0.1195 L0.4337,0.1195 Q0.4426,0.1195,0.4474,0.1211 T0.4566,0.1246 T0.4667,0.1273 Q0.4876,0.1298,0.5116,0.1298 Q0.5365,0.1298,0.5631,0.1389 Q0.5703,0.1414,0.5751,0.1414 Q0.5783,0.1414,0.5819,0.1398 T0.5888,0.1381 Q0.5928,0.1381,0.5984,0.1398 T0.6129,0.1414 Q0.6321,0.1414,0.6498,0.1477 Q0.661,0.1514,0.6667,0.1514 Q0.6707,0.1514,0.6771,0.1501 Q0.6787,0.1497,0.6795,0.1497 Q0.6835,0.1497,0.6863,0.1526 T0.6892,0.1593 Q0.6892,0.1626,0.6876,0.1647 Q0.6851,0.1672,0.6799,0.1686 T0.6695,0.1705 T0.6566,0.1715 T0.6458,0.1725 Q0.6434,0.173,0.6402,0.173 Q0.6378,0.173,0.6317,0.1727 T0.6225,0.1725 Q0.6096,0.1725,0.5984,0.1759 Q0.5823,0.1804,0.5454,0.1804 Q0.5205,0.1804,0.5116,0.1788 L0.5084,0.1788 Q0.5036,0.1788,0.4956,0.1819 T0.4843,0.185 Q0.4434,0.1887,0.4353,0.1929 Q0.4321,0.1945,0.4289,0.1945 T0.4197,0.1922 T0.4112,0.19 T0.4072,0.1912 Q0.4032,0.1949,0.388,0.1949 Q0.3663,0.1949,0.3542,0.19 Q0.351,0.1883,0.3462,0.1883 Q0.3406,0.1883,0.3321,0.1906 T0.3153,0.1954 T0.302,0.1983 Q0.2972,0.1991,0.2859,0.1997 T0.2643,0.201 T0.245,0.2024 T0.2337,0.2041 Q0.2321,0.2045,0.2181,0.2045 T0.1851,0.207 T0.1542,0.2157 Q0.143,0.2211,0.143,0.226 Q0.143,0.2314,0.153,0.2348 T0.1719,0.2381 Q0.1791,0.2381,0.2474,0.2476 Q0.2506,0.248,0.2558,0.2489 T0.2651,0.2505 T0.2739,0.252 T0.2819,0.2526 Q0.2835,0.2526,0.2851,0.2522 L0.2859,0.2522 Q0.2948,0.2522,0.3104,0.2574 T0.3309,0.2671 Q0.3333,0.2696,0.3365,0.2696 Q0.339,0.2696,0.3442,0.2684 T0.3526,0.2671 T0.3582,0.2679 Q0.3687,0.2717,0.3968,0.2742 Q0.4,0.2746,0.4036,0.2771 T0.4096,0.2796 Q0.4112,0.2796,0.4137,0.2787 Q0.4169,0.2779,0.4257,0.2779 Q0.4594,0.2779,0.4779,0.2849 Q0.4876,0.2891,0.4972,0.2891 Q0.4996,0.2891,0.506,0.2887 T0.5165,0.2883 Q0.5253,0.2883,0.5305,0.2889 T0.541,0.292 T0.5494,0.299 L0.5494,0.3015 Q0.5494,0.3036,0.5466,0.3051 T0.5386,0.3073 T0.5285,0.3086 T0.5181,0.3094 T0.5108,0.3102 Q0.5068,0.3107,0.494,0.3121 L0.4683,0.315 T0.4506,0.3181 Q0.449,0.3181,0.4426,0.32 T0.4313,0.3229 T0.4197,0.3256 T0.4064,0.3281 T0.3952,0.3289 Q0.3888,0.3289,0.3855,0.3273 Q0.3783,0.3243,0.3703,0.3243 Q0.3598,0.3243,0.351,0.3297 Q0.3478,0.3314,0.3422,0.3314 Q0.3398,0.3314,0.3337,0.3306 T0.3245,0.3297 T0.3189,0.3306 Q0.3149,0.3314,0.2956,0.3328 T0.2715,0.3368 Q0.2691,0.338,0.2635,0.3391 T0.2522,0.3407 T0.2406,0.3424 T0.2313,0.3447 Q0.2305,0.3447,0.2213,0.348 T0.206,0.354 T0.1924,0.3621 T0.1815,0.3733 Q0.1767,0.3816,0.1767,0.3849 Q0.1767,0.387,0.1783,0.3893 T0.1847,0.3961 T0.1936,0.4063 T0.2004,0.4181 T0.2052,0.4264 T0.2145,0.4309 T0.2386,0.4359 Q0.2458,0.4372,0.2554,0.4372 Q0.2578,0.4372,0.2627,0.437 T0.2699,0.4367 Q0.2795,0.4367,0.2851,0.4384 Q0.294,0.4409,0.3092,0.4409 Q0.3116,0.4409,0.3157,0.4407 T0.3213,0.4405 Q0.3301,0.4405,0.3466,0.444 T0.3687,0.4509 Q0.3703,0.4517,0.3703,0.4525 Q0.3703,0.4575,0.3373,0.4596 Q0.3133,0.4608,0.2988,0.4658 Q0.294,0.4674,0.2803,0.4674 Q0.2763,0.4674,0.2687,0.4672 T0.257,0.467 Q0.2402,0.467,0.2313,0.4687 Q0.2209,0.4708,0.2209,0.4737 Q0.2209,0.4741,0.2213,0.4749 T0.2229,0.4764 L0.2249,0.4774 T0.2265,0.4778 L0.2273,0.4782 Q0.2498,0.4803,0.2618,0.4803 Q0.2667,0.4803,0.2691,0.4799 Q0.2699,0.4795,0.2715,0.4795 Q0.2779,0.4795,0.3133,0.4873 Q0.3181,0.4886,0.3233,0.4892 T0.3386,0.4905 T0.3542,0.4915 T0.3655,0.4919 Q0.3703,0.4919,0.3779,0.4915 T0.3888,0.4911 T0.3952,0.4915 Q0.3976,0.4919,0.4008,0.4927 L0.4072,0.4944 T0.4149,0.4961 T0.4249,0.4975 T0.4369,0.4985 Q0.449,0.499,0.4554,0.5 T0.4651,0.5031 T0.4699,0.5085 Q0.4707,0.5093,0.4707,0.5097 Q0.4707,0.5114,0.4687,0.5124 T0.4631,0.5139 T0.4562,0.5145 T0.4478,0.5147 L0.4402,0.5147 Q0.4353,0.5151,0.4265,0.5174 T0.4096,0.5197 L0.4024,0.5197 Q0.4,0.5193,0.3968,0.5193 Q0.3896,0.5193,0.3831,0.5209 T0.3703,0.5253 T0.3598,0.5288 Q0.3558,0.5301,0.3321,0.5342 T0.302,0.5409 Q0.2876,0.5454,0.2337,0.55 Q0.2112,0.5521,0.2112,0.5558 Q0.2112,0.5574,0.2161,0.5612 Q0.2201,0.5637,0.2281,0.5637 Q0.2305,0.5637,0.2361,0.5633 T0.2442,0.5628 Q0.2474,0.5628,0.2498,0.5633 Q0.2635,0.5653,0.3133,0.5653 Q0.3261,0.5653,0.3301,0.5649 L0.3325,0.5649 Q0.3349,0.5649,0.3402,0.5657 T0.3494,0.5666 Q0.3542,0.5666,0.3598,0.5657 Q0.3663,0.5645,0.3695,0.5645 Q0.3735,0.5645,0.3775,0.5666 T0.3847,0.5695 Q0.3888,0.5707,0.3912,0.5709 T0.3968,0.5711 T0.4048,0.572 Q0.4096,0.5724,0.4165,0.5726 T0.4281,0.5734 T0.4378,0.5757 Q0.4418,0.5774,0.4522,0.5774 Q0.4562,0.5774,0.4655,0.5769 T0.4795,0.5765 Q0.4932,0.5765,0.4972,0.579 Q0.5028,0.5819,0.51,0.5819 Q0.5141,0.5819,0.5221,0.5809 T0.5341,0.5798 L0.5373,0.5798 Q0.5422,0.5798,0.557,0.5821 T0.5855,0.5844 L0.5936,0.5844 L0.5992,0.5844 T0.604,0.5848 T0.6076,0.5852 T0.6108,0.5859 T0.6137,0.5865 T0.6161,0.5873 T0.6181,0.5881 T0.6209,0.5896 L0.6233,0.591 Q0.6265,0.5927,0.6353,0.5927 L0.6402,0.5927 L0.645,0.5927 Q0.6723,0.5927,0.6948,0.6039 Q0.6988,0.606,0.7036,0.606 Q0.7076,0.606,0.7153,0.6045 T0.7261,0.6031 Q0.7309,0.6031,0.7454,0.6027 T0.7647,0.6022 Q0.7783,0.6022,0.808,0.608 L0.812,0.608 Q0.8169,0.608,0.8293,0.6062 T0.8474,0.6039 L0.8506,0.6039 Q0.857,0.6039,0.8655,0.6049 T0.8835,0.6074 T0.8972,0.6093 Q0.9036,0.6101,0.9213,0.6101 L0.9398,0.6101 L0.959,0.6101 L0.9767,0.6101 Q0.9976,0.6109,0.9976,0.6176 Q0.9976,0.6188,0.9968,0.6226 Q0.9952,0.6284,0.9671,0.6284 L0.959,0.6284 L0.9526,0.6284 Q0.9486,0.6284,0.9382,0.6302 T0.9205,0.6321 L0.9173,0.6321 Q0.9133,0.6317,0.9092,0.6317 Q0.9012,0.6317,0.8715,0.6346 Q0.8233,0.6387,0.7944,0.6421 Q0.7888,0.6429,0.7831,0.6429 Q0.7783,0.6429,0.7731,0.6425 T0.7663,0.6421 L0.7622,0.6421 Q0.7614,0.6425,0.7586,0.6425 T0.7474,0.6421 T0.7349,0.6416 Q0.7261,0.6416,0.7221,0.6429 Q0.7173,0.645,0.7032,0.646 T0.6711,0.6479 T0.6482,0.6491 Q0.645,0.6495,0.6418,0.6495 Q0.6353,0.6495,0.6273,0.6474 T0.6161,0.6454 Q0.612,0.6454,0.6088,0.6477 T0.6,0.6499 Q0.5912,0.6499,0.5494,0.6578 Q0.5422,0.6591,0.5373,0.6591 Q0.5341,0.6591,0.5281,0.6584 T0.5173,0.6578 L0.5124,0.6578 Q0.5004,0.6582,0.4747,0.6632 Q0.4675,0.6649,0.4398,0.6667 T0.3851,0.6703 T0.3566,0.6719 Q0.3534,0.6723,0.3406,0.6734 T0.3141,0.6757 T0.2948,0.6773 Q0.2908,0.6781,0.2819,0.6829 T0.2618,0.6877 Q0.2482,0.6877,0.2273,0.6958 T0.1992,0.7117 Q0.1976,0.7138,0.1976,0.7155 Q0.1976,0.7188,0.2032,0.7213 T0.2181,0.7258 T0.2289,0.7292 Q0.2337,0.7308,0.2378,0.7316 L0.2458,0.7333 T0.2522,0.7345 Q0.2747,0.7399,0.2835,0.7399 Q0.29,0.7399,0.3048,0.7408 T0.3253,0.7416 Q0.3277,0.7416,0.3297,0.7414 T0.3341,0.7412 L0.3598,0.7445 Q0.3639,0.7449,0.3663,0.7449 Q0.3695,0.7449,0.3751,0.7443 T0.3855,0.7437 L0.3904,0.7437 Q0.3984,0.7441,0.4141,0.7472 T0.4353,0.7507 Q0.4434,0.752,0.4434,0.7553 Q0.4434,0.7578,0.439,0.7605 T0.4297,0.764 Q0.4257,0.7648,0.4201,0.7655 T0.4076,0.7665 T0.3984,0.7673 Q0.3968,0.7673,0.3912,0.7677 T0.3815,0.7688 T0.3735,0.771 T0.3655,0.7727 Q0.3606,0.7727,0.3534,0.7708 T0.3458,0.769 L0.3446,0.769 Q0.3414,0.769,0.3297,0.7713 T0.3149,0.7735 Q0.3092,0.7735,0.296,0.7771 T0.2771,0.7831 Q0.2683,0.7872,0.2554,0.7885 Q0.253,0.7889,0.2325,0.7897 T0.2032,0.7914 Q0.2008,0.7918,0.198,0.792 T0.194,0.7924 T0.1912,0.7928 T0.1888,0.793 T0.1867,0.7934 T0.1851,0.7943 T0.1843,0.7953 T0.1835,0.7968 T0.1823,0.7984 T0.1815,0.8001 Q0.1815,0.8022,0.1847,0.8032 T0.1932,0.8053 T0.2008,0.8071 Q0.2072,0.8092,0.2265,0.8092 Q0.2361,0.8092,0.2586,0.8088 L0.2635,0.8088 Q0.2731,0.8088,0.2795,0.8098 T0.2928,0.8134 T0.302,0.8167 Q0.306,0.8179,0.3277,0.8183 T0.3542,0.8221 Q0.359,0.8246,0.3622,0.8246 Q0.3639,0.8246,0.3675,0.8237 T0.3751,0.8229 Q0.3968,0.8229,0.4048,0.8275 Q0.4088,0.8291,0.4161,0.8291 Q0.4225,0.8291,0.4353,0.8275 Q0.4369,0.827,0.4394,0.827 Q0.4474,0.827,0.4675,0.8345 Q0.4707,0.8358,0.4739,0.8358 Q0.4755,0.8358,0.4799,0.8353 T0.4876,0.8349 Q0.494,0.8349,0.5012,0.8362 L0.5076,0.837 T0.5133,0.8376 T0.5181,0.8382 T0.5221,0.8391 L0.5253,0.8399 T0.5277,0.8409 L0.5293,0.8422 T0.5301,0.8438 L0.5301,0.8461 Q0.5301,0.8499,0.5249,0.8511 T0.5112,0.8526 T0.5004,0.8532 Q0.4964,0.854,0.4851,0.8546 T0.4667,0.8565 Q0.4578,0.8577,0.441,0.8577 L0.4345,0.8577 L0.4289,0.8577 L0.4209,0.8577 Q0.4153,0.8582,0.4088,0.8586 T0.3968,0.8592 T0.3855,0.8594 T0.3755,0.8596 T0.3675,0.86 T0.3622,0.8602 Q0.3317,0.8635,0.3237,0.8635 Q0.2996,0.8635,0.2996,0.8681 Q0.2996,0.8698,0.3032,0.8733 T0.3068,0.8797 L0.3068,0.8822 Q0.3052,0.8859,0.2859,0.8859 Q0.2787,0.8859,0.2739,0.8851 L0.2699,0.8851 Q0.2659,0.8851,0.259,0.888 T0.2498,0.8913 Q0.2394,0.8946,0.2056,0.8971 Q0.2032,0.8971,0.1928,0.9002 T0.1703,0.9034 Q0.1526,0.9034,0.1353,0.9067 T0.1173,0.915 L0.1173,0.9158 Q0.1173,0.9166,0.1177,0.9175 T0.1189,0.9191 T0.1205,0.9204 T0.1229,0.9212 T0.1257,0.922 T0.1285,0.9226 T0.1309,0.9231 T0.1337,0.9235 T0.1365,0.9237 L0.1446,0.9237 T0.1554,0.9243 T0.1614,0.9268 T0.1659,0.9293 T0.1743,0.9303 T0.1823,0.9316 Q0.1863,0.932,0.1912,0.9332 T0.2028,0.9361 T0.2153,0.939 Q0.2233,0.9411,0.2297,0.9448 T0.2386,0.9494 Q0.2426,0.9506,0.2506,0.9506 Q0.253,0.9506,0.2594,0.9504 T0.2699,0.9502 Q0.2763,0.9502,0.2819,0.9511 Q0.2851,0.9511,0.2871,0.9529 T0.2892,0.9573 Q0.2892,0.9627,0.2811,0.9635 Q0.2434,0.9652,0.2337,0.9672 Q0.2257,0.9693,0.2241,0.9693 Q0.2217,0.9693,0.2096,0.9689 L0.2056,0.9689 Q0.1976,0.9689,0.1924,0.9699 T0.1787,0.9741 L0.1647,0.9793 Q0.1518,0.983,0.1285,0.983 L0.1261,0.983 L0.1237,0.983 Q0.1124,0.983,0.1076,0.9838 Q0.102,0.9851,0.0839,0.9896 T0.0602,0.9954 T0.0406,0.9971 T0.0153,0.9979 L0.0032,0.9979 Z",type:0}},"":{type:5,data:{d:"M0.9992,0.998 Q0.9992,1,0.9968,1 Q0.9521,1,0.9392,0.998 Q0.9335,0.997,0.9152,0.9921 T0.8913,0.9862 Q0.8873,0.9852,0.8783,0.9852 L0.8747,0.9852 L0.871,0.9852 Q0.8483,0.9852,0.8345,0.9812 Q0.8289,0.9792,0.8228,0.9773 T0.8135,0.9743 T0.8054,0.9723 T0.7948,0.9713 L0.7908,0.9713 L0.777,0.9713 T0.7656,0.9693 Q0.7616,0.9683,0.7498,0.9674 T0.7283,0.9664 L0.7186,0.9654 Q0.708,0.9644,0.708,0.9575 Q0.708,0.9545,0.7109,0.952 T0.7178,0.9486 L0.7315,0.9486 L0.7417,0.9486 L0.7502,0.9486 Q0.7575,0.9486,0.7599,0.9476 Q0.7616,0.9466,0.7685,0.9426 T0.7843,0.9377 Q0.7899,0.9357,0.8009,0.9332 T0.8175,0.9298 Q0.82,0.9288,0.8228,0.9283 T0.8277,0.9278 T0.8313,0.9273 T0.8341,0.9263 T0.8362,0.9258 Q0.8402,0.9219,0.854,0.9219 L0.8569,0.9219 L0.8597,0.9219 L0.8637,0.9219 Q0.88,0.9199,0.88,0.9159 L0.88,0.9149 Q0.88,0.913,0.8719,0.911 T0.852,0.9075 T0.8297,0.906 Q0.8224,0.906,0.8167,0.905 T0.8074,0.9031 T0.8001,0.9006 T0.794,0.8991 Q0.7599,0.8971,0.7494,0.8942 Q0.7461,0.8932,0.7397,0.8902 T0.7299,0.8872 L0.7267,0.8872 Q0.721,0.8882,0.7121,0.8882 Q0.6926,0.8882,0.691,0.8833 L0.691,0.8803 Q0.691,0.8773,0.6922,0.8749 T0.6955,0.8704 L0.6975,0.8684 Q0.6926,0.8655,0.6764,0.8655 Q0.6683,0.8655,0.6375,0.8625 Q0.6358,0.8625,0.629,0.862 T0.6148,0.8615 T0.5973,0.861 T0.5791,0.8605 L0.5718,0.8605 L0.5661,0.8605 L0.5596,0.8605 Q0.5426,0.8605,0.5337,0.8586 Q0.5264,0.8576,0.515,0.8571 T0.4996,0.8556 Q0.498,0.8556,0.4947,0.8551 T0.4882,0.8546 T0.4809,0.8541 T0.474,0.8531 T0.4692,0.8506 T0.4672,0.8467 Q0.4672,0.8437,0.468,0.8422 T0.4704,0.8398 T0.4736,0.8383 T0.4781,0.8368 T0.4838,0.8358 T0.4911,0.8353 T0.4988,0.8338 Q0.5069,0.8328,0.5142,0.8328 Q0.5174,0.8328,0.5215,0.8333 T0.5264,0.8338 Q0.5296,0.8338,0.532,0.8328 Q0.5523,0.8249,0.5604,0.8249 L0.5653,0.8249 Q0.5775,0.8269,0.5848,0.8269 Q0.5912,0.8269,0.5937,0.8259 Q0.6026,0.821,0.6253,0.821 Q0.6294,0.821,0.6334,0.822 T0.6383,0.8229 Q0.6399,0.8229,0.644,0.82 Q0.6504,0.817,0.6723,0.816 T0.6975,0.814 Q0.6999,0.814,0.7048,0.8121 T0.7129,0.8091 T0.7226,0.8071 T0.7372,0.8061 L0.7421,0.8061 Q0.7624,0.8071,0.7721,0.8071 Q0.7924,0.8071,0.7981,0.8051 Q0.8021,0.8032,0.807,0.8027 T0.8135,0.8017 T0.8151,0.8002 L0.8151,0.7992 Q0.8143,0.7962,0.8127,0.7957 T0.8045,0.7943 Q0.7997,0.7943,0.7964,0.7933 Q0.7883,0.7933,0.7676,0.7923 T0.7437,0.7903 Q0.7307,0.7893,0.7218,0.7844 Q0.7194,0.7834,0.7141,0.7819 L0.7036,0.7789 T0.693,0.7765 T0.6853,0.7755 Q0.6805,0.7755,0.6691,0.773 T0.6553,0.7705 Q0.6545,0.7705,0.6545,0.7715 Q0.6537,0.7715,0.65,0.7725 T0.6423,0.774 T0.635,0.7745 Q0.6294,0.7745,0.6257,0.773 T0.618,0.771 T0.6083,0.77 T0.601,0.7695 Q0.5985,0.7695,0.5921,0.769 T0.5795,0.7676 T0.5702,0.7666 Q0.5653,0.7656,0.5596,0.7616 T0.5539,0.7547 Q0.5539,0.7498,0.5645,0.7488 Q0.5693,0.7478,0.5852,0.7448 T0.6099,0.7418 L0.6148,0.7418 Q0.6196,0.7418,0.6253,0.7423 T0.6338,0.7428 L0.6399,0.7428 Q0.6431,0.7418,0.6488,0.7409 T0.6586,0.7394 T0.6659,0.7389 L0.6707,0.7389 Q0.6723,0.7399,0.6748,0.7399 Q0.6796,0.7399,0.6946,0.7389 T0.7161,0.7379 Q0.7251,0.7379,0.7478,0.7319 Q0.7494,0.7319,0.7539,0.7315 T0.762,0.73 T0.7697,0.727 T0.7818,0.723 T0.7948,0.7196 T0.7997,0.7151 Q0.7997,0.7141,0.7989,0.7132 Q0.7924,0.7062,0.7717,0.6978 T0.738,0.6894 Q0.7267,0.6894,0.717,0.6845 T0.7048,0.6795 Q0.6975,0.6785,0.6711,0.6766 T0.6431,0.6746 Q0.6415,0.6736,0.6144,0.6721 T0.5596,0.6686 T0.5247,0.6657 Q0.4996,0.6607,0.4874,0.6597 L0.4834,0.6597 Q0.4785,0.6597,0.4724,0.6607 T0.4631,0.6617 Q0.4574,0.6617,0.4501,0.6597 Q0.4088,0.6518,0.4006,0.6518 Q0.3933,0.6518,0.3901,0.6499 T0.3844,0.6479 T0.3739,0.6499 T0.3585,0.6518 L0.352,0.6518 Q0.3471,0.6508,0.335,0.6503 T0.3122,0.6494 T0.2912,0.6479 T0.2766,0.6449 Q0.2733,0.6439,0.2668,0.6439 Q0.2628,0.6439,0.2543,0.6444 T0.2425,0.6449 T0.2368,0.6439 L0.2344,0.6439 Q0.2336,0.6439,0.2283,0.6444 T0.2182,0.6449 Q0.2117,0.6449,0.2052,0.6439 Q0.1768,0.6409,0.1281,0.637 Q0.0989,0.634,0.0916,0.634 L0.0835,0.634 L0.0795,0.634 Q0.0722,0.634,0.0616,0.632 T0.0479,0.6301 Q0.0462,0.6301,0.0406,0.6306 T0.0308,0.6311 Q0.0032,0.6311,0.0008,0.6231 Q0,0.6202,0,0.6182 Q0,0.6083,0.0227,0.6083 Q0.03,0.6073,0.0422,0.6073 Q0.0487,0.6073,0.0608,0.6078 T0.0787,0.6083 Q0.0973,0.6083,0.103,0.6073 Q0.1062,0.6063,0.1131,0.6053 T0.1253,0.6039 T0.1375,0.6024 T0.1492,0.6014 L0.1533,0.6014 Q0.1598,0.6024,0.1723,0.6044 T0.189,0.6063 Q0.1906,0.6063,0.1922,0.6053 Q0.2214,0.6004,0.236,0.6004 Q0.2409,0.6004,0.2551,0.6009 T0.2741,0.6014 Q0.2782,0.6014,0.2859,0.6024 T0.2968,0.6034 Q0.3009,0.6034,0.3041,0.6024 Q0.3277,0.5905,0.356,0.5905 L0.3613,0.5905 L0.3666,0.5905 Q0.3731,0.5905,0.3755,0.5895 Q0.382,0.5856,0.3844,0.5846 T0.3938,0.5831 T0.4144,0.5826 T0.4428,0.5801 T0.4631,0.5776 L0.4663,0.5776 Q0.4704,0.5776,0.4785,0.5786 T0.4899,0.5796 Q0.4964,0.5796,0.5012,0.5767 Q0.5069,0.5737,0.5223,0.5737 Q0.5272,0.5737,0.5369,0.5742 T0.5499,0.5747 Q0.558,0.5747,0.5612,0.5737 Q0.5661,0.5717,0.5714,0.5712 T0.5835,0.5702 T0.5945,0.5692 T0.6018,0.5687 L0.6062,0.5687 T0.6095,0.5682 T0.6148,0.5678 Q0.6172,0.5668,0.6196,0.5653 T0.6245,0.5633 T0.631,0.5628 T0.6407,0.5638 T0.6504,0.5648 T0.6594,0.5638 T0.6675,0.5628 L0.6707,0.5628 L0.6861,0.5628 Q0.7364,0.5628,0.7494,0.5608 L0.7567,0.5608 L0.7652,0.5608 L0.7729,0.5608 Q0.7794,0.5608,0.7818,0.5589 Q0.7851,0.5569,0.7859,0.5559 Q0.7835,0.5539,0.7656,0.5519 Q0.7121,0.547,0.6975,0.543 Q0.6934,0.541,0.6853,0.5396 L0.6691,0.5366 T0.6525,0.5336 T0.6391,0.5312 Q0.6367,0.5302,0.6245,0.5257 T0.6034,0.5213 L0.5977,0.5213 Q0.5945,0.5223,0.5904,0.5223 Q0.5839,0.5223,0.5787,0.5208 T0.5685,0.5183 T0.5596,0.5173 Q0.558,0.5173,0.5552,0.5168 T0.5495,0.5163 L0.5434,0.5163 T0.5373,0.5158 T0.532,0.5148 T0.5284,0.5129 T0.5272,0.5104 L0.5272,0.5074 Q0.5304,0.5015,0.5377,0.499 T0.5629,0.4965 Q0.5734,0.4955,0.5811,0.4946 T0.5953,0.4916 T0.605,0.4896 Q0.6083,0.4886,0.6123,0.4886 Q0.6148,0.4886,0.6225,0.4891 T0.635,0.4896 L0.6456,0.4896 Q0.6837,0.4857,0.6861,0.4857 Q0.7226,0.4768,0.7283,0.4768 Q0.7307,0.4768,0.732,0.4773 T0.7372,0.4777 Q0.7502,0.4777,0.7721,0.4758 Q0.7753,0.4748,0.777,0.4738 Q0.7745,0.4718,0.768,0.4708 Q0.7599,0.4688,0.7445,0.4688 Q0.7405,0.4688,0.7324,0.4693 T0.721,0.4698 Q0.7056,0.4698,0.6999,0.4679 Q0.6861,0.4629,0.6626,0.4619 Q0.6586,0.4609,0.6533,0.4604 T0.6419,0.459 T0.6314,0.456 T0.6269,0.452 Q0.6269,0.451,0.6302,0.4491 Q0.6358,0.4451,0.6525,0.4416 T0.6788,0.4382 L0.6845,0.4382 L0.6902,0.4382 Q0.7064,0.4382,0.7145,0.4362 Q0.7202,0.4342,0.7307,0.4342 L0.7356,0.4342 L0.7409,0.4342 L0.7453,0.4342 Q0.7543,0.4342,0.7607,0.4332 Q0.7778,0.4313,0.7847,0.4288 T0.7932,0.4248 T0.7972,0.4169 T0.8045,0.4045 L0.8094,0.3986 T0.8135,0.3942 L0.8167,0.3912 T0.8191,0.3887 T0.8204,0.3867 T0.8208,0.3848 Q0.8208,0.3818,0.8167,0.3739 Q0.8127,0.3689,0.8054,0.3635 T0.7924,0.3556 T0.7778,0.3497 T0.768,0.3462 Q0.764,0.3442,0.7478,0.3427 T0.7267,0.3383 Q0.7234,0.3363,0.7044,0.3348 T0.6805,0.3323 L0.6764,0.3323 T0.6679,0.3328 T0.6586,0.3333 Q0.6521,0.3333,0.648,0.3314 Q0.6391,0.3264,0.6294,0.3264 Q0.6229,0.3264,0.6156,0.3294 Q0.6115,0.3304,0.6042,0.3304 Q0.5977,0.3304,0.5888,0.3289 T0.5738,0.3264 T0.5584,0.3225 L0.5491,0.3195 Q0.5418,0.3185,0.5162,0.3155 T0.4895,0.3121 T0.4826,0.3116 T0.4716,0.3111 T0.4607,0.3096 T0.4513,0.3066 T0.4477,0.3017 Q0.4477,0.2997,0.4485,0.2977 Q0.4526,0.2898,0.4611,0.2878 T0.4842,0.2859 Q0.4882,0.2859,0.4943,0.2864 T0.5028,0.2868 Q0.5118,0.2868,0.5215,0.2829 Q0.5401,0.276,0.5734,0.276 Q0.5831,0.276,0.5872,0.277 L0.5904,0.277 T0.5949,0.2745 T0.6034,0.272 Q0.631,0.269,0.6407,0.2661 Q0.6448,0.2641,0.6488,0.2641 T0.6573,0.2656 T0.6634,0.2671 Q0.6659,0.2671,0.6675,0.2651 Q0.6723,0.2601,0.6886,0.2552 T0.7137,0.2502 L0.7153,0.2502 L0.7178,0.2502 Q0.7218,0.2502,0.7279,0.2493 T0.7417,0.2468 T0.7526,0.2453 Q0.8208,0.2354,0.8281,0.2354 Q0.8337,0.2354,0.8394,0.2344 T0.8496,0.2315 T0.854,0.2265 Q0.854,0.2216,0.8443,0.2176 Q0.8354,0.2127,0.8216,0.2102 T0.7972,0.2072 T0.777,0.2067 T0.7648,0.2057 Q0.7632,0.2047,0.7498,0.2038 T0.7202,0.2018 T0.6983,0.1998 Q0.6918,0.1998,0.676,0.1949 T0.6537,0.1899 Q0.6496,0.1899,0.6472,0.1919 Q0.6342,0.1968,0.6123,0.1968 Q0.5961,0.1968,0.5912,0.1929 Q0.5904,0.1919,0.5892,0.1919 T0.5823,0.1944 T0.5722,0.1968 T0.5637,0.1949 Q0.5556,0.1909,0.5158,0.1869 Q0.5109,0.1869,0.5032,0.1835 T0.4915,0.18 Q0.4907,0.18,0.4891,0.181 Q0.4793,0.182,0.455,0.182 Q0.4177,0.182,0.4015,0.1771 Q0.3901,0.1741,0.3779,0.1741 Q0.3747,0.1741,0.369,0.1746 T0.3609,0.1751 Q0.3569,0.1751,0.3536,0.1741 Q0.3512,0.1741,0.3459,0.1736 T0.3358,0.1726 T0.3256,0.1716 T0.3167,0.1696 T0.3106,0.1662 Q0.3082,0.1632,0.3082,0.1592 Q0.3082,0.1543,0.3114,0.1508 T0.3204,0.1474 L0.3236,0.1474 Q0.3301,0.1494,0.3333,0.1494 Q0.339,0.1494,0.3496,0.1454 Q0.3674,0.1385,0.3869,0.1385 Q0.395,0.1385,0.4011,0.137 T0.4116,0.1355 T0.4197,0.1375 T0.425,0.1395 Q0.429,0.1395,0.4355,0.1365 Q0.4631,0.1266,0.4882,0.1266 Q0.5126,0.1266,0.5337,0.1246 Q0.5369,0.1246,0.5458,0.1207 T0.5661,0.1167 L0.5693,0.1167 Q0.5791,0.1177,0.5852,0.1187 T0.5921,0.1197 Q0.5945,0.1197,0.6002,0.1167 Q0.6026,0.1147,0.605,0.1123 T0.6091,0.1093 T0.6156,0.1088 T0.6318,0.1098 Q0.6456,0.1108,0.6569,0.1137 T0.6707,0.1167 Q0.674,0.1167,0.6772,0.1147 Q0.6821,0.1108,0.6946,0.1083 T0.721,0.1044 T0.7453,0.1029 L0.7526,0.1029 Q0.7583,0.1039,0.7652,0.1053 T0.7753,0.1068 Q0.7778,0.1068,0.7802,0.1058 Q0.7981,0.1019,0.8143,0.1019 Q0.8175,0.1019,0.8439,0.0964 T0.8735,0.091 Q0.8759,0.091,0.8836,0.089 T0.8938,0.0851 Q0.8929,0.0841,0.8905,0.0841 Q0.8832,0.0821,0.8735,0.0821 Q0.8694,0.0821,0.8629,0.0826 T0.854,0.0831 Q0.8508,0.0831,0.8491,0.0821 Q0.8475,0.0821,0.8171,0.0811 T0.7802,0.0781 T0.7571,0.0737 T0.7332,0.0712 Q0.7299,0.0712,0.7247,0.0717 T0.7161,0.0722 L0.7064,0.0722 Q0.7032,0.0712,0.7003,0.0707 T0.6959,0.0692 T0.693,0.0678 T0.6914,0.0663 T0.6902,0.0648 T0.689,0.0643 L0.6869,0.0643 L0.6845,0.0643 L0.6821,0.0643 Q0.6553,0.0643,0.6553,0.0554 T0.6796,0.0465 L0.6813,0.0465 L0.6845,0.0465 Q0.6918,0.0425,0.717,0.0376 Q0.7226,0.0366,0.7267,0.0356 T0.7324,0.0336 T0.7376,0.0317 T0.747,0.0297 Q0.7518,0.0287,0.7551,0.0287 T0.762,0.0297 T0.768,0.0307 L0.7729,0.0307 Q0.7802,0.0277,0.7997,0.0267 T0.8224,0.0237 Q0.8273,0.0227,0.8341,0.0223 T0.8475,0.0193 T0.8654,0.0143 T0.8873,0.0079 Q0.9002,0.003,0.9331,0.004 T0.97,0.004 Q0.9838,0,0.9976,0.001 Q1,0.001,1,0.003 Z M0.9935,0.996 L0.9951,0.0049 Q0.9822,0.0049,0.9716,0.0079 Q0.9659,0.0099,0.9327,0.0089 T0.8897,0.0119 Q0.8775,0.0158,0.8666,0.0183 T0.85,0.0237 Q0.8418,0.0267,0.8341,0.0272 T0.8248,0.0277 Q0.82,0.0297,0.8001,0.0312 T0.7745,0.0346 Q0.7697,0.0356,0.7664,0.0356 Q0.764,0.0356,0.7603,0.0341 T0.7534,0.0326 Q0.751,0.0326,0.7478,0.0336 Q0.7429,0.0346,0.7397,0.0356 T0.7344,0.0376 T0.7283,0.0401 T0.7178,0.0425 Q0.6926,0.0465,0.6878,0.0495 Q0.6845,0.0514,0.6764,0.0514 L0.6723,0.0514 L0.6691,0.0514 Q0.6602,0.0514,0.6602,0.0554 Q0.6602,0.0574,0.6659,0.0579 T0.6796,0.0589 T0.691,0.0603 T0.6967,0.0643 T0.7072,0.0673 Q0.7121,0.0682,0.7153,0.0682 T0.7238,0.0678 T0.7332,0.0673 Q0.7413,0.0673,0.7579,0.0692 T0.7818,0.0742 Q0.7867,0.0752,0.8171,0.0762 T0.8508,0.0781 L0.852,0.0781 T0.8601,0.0776 T0.8719,0.0772 Q0.8832,0.0772,0.8921,0.0791 Q0.8994,0.0811,0.8994,0.0841 T0.8933,0.0895 T0.8812,0.094 T0.8735,0.0959 T0.8451,0.1014 T0.8143,0.1068 Q0.7989,0.1068,0.7818,0.1098 Q0.7778,0.1108,0.7745,0.1108 T0.768,0.1103 T0.7603,0.1088 T0.7518,0.1068 L0.7461,0.1068 Q0.7315,0.1068,0.7088,0.1103 T0.6805,0.1177 Q0.6756,0.1207,0.6699,0.1207 Q0.6667,0.1207,0.6545,0.1177 T0.631,0.1147 Q0.6269,0.1137,0.6225,0.1133 T0.616,0.1128 L0.6123,0.1128 T0.6103,0.1133 L0.6083,0.1157 T0.6034,0.1197 Q0.5961,0.1246,0.5921,0.1246 Q0.5904,0.1246,0.5835,0.1231 T0.5693,0.1217 L0.5661,0.1217 Q0.558,0.1217,0.5535,0.1231 T0.5446,0.1266 T0.5345,0.1296 Q0.5126,0.1316,0.4882,0.1316 T0.438,0.1405 Q0.4298,0.1434,0.425,0.1434 Q0.4209,0.1434,0.4173,0.1419 T0.4112,0.1405 T0.4027,0.1419 T0.3869,0.1434 Q0.3682,0.1434,0.3512,0.1494 Q0.3398,0.1533,0.3333,0.1533 Q0.3285,0.1533,0.3228,0.1513 L0.3212,0.1513 Q0.3179,0.1513,0.3155,0.1538 T0.3131,0.1592 Q0.3131,0.1612,0.3147,0.1632 Q0.3171,0.1652,0.3232,0.1667 T0.3406,0.1691 T0.3544,0.1701 L0.3601,0.1701 L0.3678,0.1701 L0.3771,0.1701 Q0.3909,0.1701,0.4031,0.1731 Q0.4177,0.178,0.4558,0.178 Q0.4793,0.178,0.4882,0.1761 L0.4915,0.1761 Q0.498,0.1761,0.5061,0.179 T0.5158,0.183 Q0.5166,0.183,0.5231,0.1835 T0.5341,0.1845 T0.545,0.1855 T0.5572,0.1874 T0.5661,0.1909 Q0.5677,0.1919,0.5702,0.1919 T0.5791,0.1894 T0.588,0.1869 Q0.5921,0.1869,0.5945,0.1899 Q0.5977,0.1919,0.6123,0.1919 Q0.6334,0.1919,0.6448,0.1879 Q0.6488,0.186,0.6537,0.186 Q0.6626,0.186,0.6784,0.1909 T0.6983,0.1958 Q0.704,0.1968,0.7206,0.1973 T0.7506,0.1993 T0.7689,0.2018 L0.7705,0.2018 L0.7741,0.2018 L0.7786,0.2018 Q0.8248,0.2018,0.8475,0.2136 Q0.8597,0.2196,0.8597,0.2255 T0.8483,0.2359 T0.8281,0.2404 Q0.8208,0.2404,0.7534,0.2493 Q0.7502,0.2502,0.7425,0.2512 T0.7287,0.2532 T0.7178,0.2542 L0.7153,0.2542 L0.7137,0.2542 Q0.7064,0.2542,0.6906,0.2591 T0.6715,0.2681 T0.6626,0.272 Q0.6594,0.272,0.6541,0.2705 T0.6464,0.269 T0.6431,0.27 Q0.6318,0.273,0.6034,0.276 Q0.6018,0.276,0.5998,0.2774 T0.5957,0.2799 T0.5904,0.2809 L0.5856,0.2809 Q0.5823,0.2799,0.575,0.2799 Q0.541,0.2799,0.5239,0.2868 Q0.5134,0.2908,0.5028,0.2908 Q0.4996,0.2908,0.4935,0.2903 T0.4842,0.2898 Q0.4704,0.2898,0.4635,0.2918 T0.4534,0.2997 L0.4534,0.3007 Q0.4534,0.3037,0.459,0.3046 T0.4753,0.3066 T0.4899,0.3076 Q0.4907,0.3076,0.5166,0.3106 T0.5507,0.3155 Q0.5921,0.3264,0.605,0.3264 Q0.6107,0.3264,0.6131,0.3254 Q0.6212,0.3225,0.6294,0.3225 Q0.6407,0.3225,0.6513,0.3274 Q0.6529,0.3294,0.6569,0.3294 Q0.6594,0.3294,0.665,0.3284 T0.6748,0.3274 T0.6821,0.3284 Q0.6861,0.3294,0.6967,0.3299 T0.7165,0.3314 T0.7299,0.3343 Q0.7324,0.3363,0.7486,0.3383 T0.7697,0.3422 Q0.7713,0.3432,0.7774,0.3452 T0.7887,0.3492 T0.8005,0.3546 T0.8127,0.3625 T0.8208,0.3719 Q0.8256,0.3798,0.8256,0.3848 Q0.8256,0.3877,0.8236,0.3902 T0.8171,0.3976 T0.809,0.4075 T0.8021,0.4189 T0.7968,0.4273 T0.7867,0.4322 T0.7616,0.4382 Q0.7543,0.4392,0.7437,0.4392 L0.7364,0.4392 L0.7299,0.4392 Q0.7202,0.4392,0.7161,0.4402 Q0.7072,0.4431,0.691,0.4431 L0.6845,0.4431 L0.6788,0.4431 Q0.6707,0.4431,0.6545,0.4461 T0.6334,0.452 Q0.6399,0.456,0.6626,0.457 Q0.6878,0.458,0.7024,0.4639 Q0.7064,0.4649,0.7186,0.4649 L0.7295,0.4649 L0.7413,0.4649 Q0.7591,0.4649,0.7697,0.4669 Q0.7818,0.4688,0.7818,0.4728 Q0.7818,0.4748,0.7798,0.4763 T0.7753,0.4787 L0.7737,0.4797 L0.7729,0.4797 Q0.7494,0.4827,0.7388,0.4827 Q0.7332,0.4827,0.7307,0.4817 L0.7291,0.4817 Q0.7226,0.4817,0.6878,0.4896 Q0.6829,0.4906,0.6772,0.4911 T0.6618,0.4921 T0.646,0.4931 T0.6342,0.4936 T0.6212,0.4931 T0.6115,0.4926 Q0.6083,0.4926,0.6058,0.4931 T0.5969,0.4955 T0.5819,0.499 T0.5629,0.5005 Q0.5572,0.5005,0.5527,0.501 T0.545,0.502 T0.5397,0.503 T0.5361,0.5045 T0.5337,0.5064 T0.5328,0.5094 L0.532,0.5094 Q0.532,0.5104,0.5337,0.5109 T0.5381,0.5114 T0.5438,0.5119 T0.5515,0.5124 L0.5604,0.5124 Q0.5661,0.5134,0.5746,0.5153 T0.5912,0.5173 L0.5977,0.5173 L0.6026,0.5173 Q0.6139,0.5173,0.6273,0.5218 T0.6407,0.5272 Q0.6448,0.5282,0.6683,0.5321 T0.6991,0.5381 Q0.7137,0.543,0.7664,0.548 Q0.7908,0.55,0.7908,0.5559 Q0.7908,0.5589,0.7859,0.5628 Q0.781,0.5658,0.7713,0.5658 Q0.7689,0.5658,0.7628,0.5653 T0.7543,0.5648 T0.7502,0.5658 Q0.7364,0.5678,0.6878,0.5678 Q0.674,0.5678,0.6699,0.5668 L0.6683,0.5668 Q0.6659,0.5668,0.6606,0.5678 T0.6513,0.5687 Q0.6464,0.5687,0.6391,0.5678 Q0.6334,0.5668,0.6302,0.5668 T0.6241,0.5687 T0.6164,0.5717 Q0.6123,0.5727,0.6099,0.5727 L0.6062,0.5727 T0.6022,0.5732 T0.5953,0.5737 Q0.5904,0.5747,0.5839,0.5747 T0.5726,0.5752 T0.5629,0.5776 T0.5458,0.5796 Q0.5418,0.5796,0.5324,0.5791 T0.5191,0.5786 Q0.5077,0.5786,0.5045,0.5806 Q0.498,0.5836,0.4899,0.5836 Q0.4858,0.5836,0.4777,0.5826 T0.4655,0.5816 L0.4631,0.5816 Q0.4582,0.5816,0.4436,0.5841 T0.4144,0.5865 L0.4051,0.5865 L0.3986,0.5865 T0.3933,0.587 T0.3897,0.5875 T0.3869,0.5885 T0.3844,0.5895 T0.3812,0.591 T0.3779,0.5925 Q0.3739,0.5955,0.3633,0.5955 L0.3585,0.5955 L0.3536,0.5955 Q0.3277,0.5955,0.3066,0.6053 Q0.3017,0.6083,0.296,0.6083 Q0.2912,0.6083,0.2839,0.6068 T0.2741,0.6053 Q0.2693,0.6053,0.2547,0.6048 T0.236,0.6044 Q0.2222,0.6044,0.193,0.6103 L0.1882,0.6103 Q0.1825,0.6103,0.1703,0.6083 T0.1525,0.6063 L0.15,0.6063 Q0.1436,0.6063,0.135,0.6073 T0.1168,0.6098 T0.1038,0.6113 Q0.0973,0.6123,0.0787,0.6123 L0.06,0.6123 L0.0414,0.6123 L0.0235,0.6123 Q0.0049,0.6133,0.0049,0.6172 L0.0057,0.6222 Q0.0073,0.6261,0.043,0.6261 L0.0454,0.6261 L0.0479,0.6261 Q0.0527,0.6261,0.0633,0.6281 T0.0803,0.6301 L0.0835,0.6301 L0.0916,0.6301 Q0.0998,0.6301,0.129,0.632 Q0.1768,0.636,0.206,0.64 Q0.2117,0.6409,0.2165,0.6409 Q0.2206,0.6409,0.2263,0.6405 T0.2336,0.64 L0.2384,0.64 L0.2409,0.64 T0.251,0.6395 T0.2644,0.639 Q0.2741,0.639,0.279,0.6409 Q0.283,0.6429,0.2972,0.6439 T0.3293,0.6459 T0.3528,0.6469 L0.3577,0.6469 Q0.3642,0.6469,0.3723,0.6449 T0.3844,0.6429 Q0.3901,0.6429,0.3933,0.6454 T0.4006,0.6479 Q0.4088,0.6479,0.4517,0.6558 Q0.4582,0.6568,0.4623,0.6568 Q0.4655,0.6568,0.4716,0.6563 T0.4826,0.6558 L0.4882,0.6558 Q0.5004,0.6558,0.5255,0.6607 Q0.5328,0.6627,0.5604,0.6647 T0.6152,0.6682 T0.644,0.6696 T0.6719,0.6721 T0.7056,0.6756 Q0.7113,0.6756,0.7198,0.6805 T0.738,0.6855 Q0.7453,0.6855,0.7551,0.6879 T0.7741,0.6939 T0.7912,0.7018 T0.8029,0.7102 Q0.8054,0.7132,0.8054,0.7151 Q0.8054,0.7191,0.8009,0.7216 T0.7908,0.7255 T0.779,0.7285 T0.7721,0.731 Q0.7672,0.7329,0.7632,0.7339 T0.7551,0.7354 T0.7486,0.7369 Q0.7478,0.7369,0.7445,0.7379 T0.7388,0.7394 T0.7324,0.7404 L0.7242,0.7413 T0.7161,0.7418 Q0.7105,0.7418,0.6955,0.7428 T0.6748,0.7438 L0.6699,0.7438 L0.6667,0.7438 Q0.6659,0.7438,0.6407,0.7468 Q0.6367,0.7478,0.6334,0.7478 T0.6245,0.7468 T0.6148,0.7458 L0.6099,0.7458 Q0.6018,0.7468,0.5864,0.7498 T0.5653,0.7532 T0.5596,0.7557 Q0.5596,0.7596,0.571,0.7616 Q0.5742,0.7626,0.5803,0.7631 T0.5929,0.7641 T0.6018,0.7656 L0.6087,0.7656 T0.6192,0.7666 T0.6277,0.7695 Q0.631,0.7705,0.6342,0.7705 Q0.6383,0.7705,0.6452,0.7685 T0.6537,0.7666 L0.6553,0.7666 Q0.6602,0.7666,0.6711,0.769 T0.6853,0.7715 Q0.691,0.7715,0.7048,0.775 T0.7242,0.7814 Q0.7324,0.7854,0.7445,0.7864 Q0.7478,0.7864,0.768,0.7873 T0.7972,0.7893 Q0.7989,0.7893,0.8017,0.7898 T0.8054,0.7903 L0.8082,0.7903 T0.811,0.7908 T0.8131,0.7913 T0.8151,0.7918 L0.8167,0.7928 T0.8179,0.7943 T0.8191,0.7957 T0.8204,0.7977 T0.8208,0.8002 Q0.8208,0.8032,0.8171,0.8051 T0.8074,0.8081 T0.7997,0.8091 Q0.7932,0.8121,0.7737,0.8121 Q0.7664,0.8121,0.7413,0.8111 L0.7364,0.8111 Q0.7275,0.8111,0.7214,0.8121 T0.7084,0.8155 T0.6991,0.819 Q0.6934,0.82,0.6723,0.8205 T0.6472,0.8239 Q0.6423,0.8269,0.6375,0.8269 Q0.6358,0.8269,0.6338,0.8264 T0.6294,0.8254 T0.6253,0.8249 Q0.6042,0.8249,0.5961,0.8289 Q0.5921,0.8318,0.5839,0.8318 Q0.5783,0.8318,0.5645,0.8299 L0.5604,0.8299 Q0.5531,0.8299,0.5337,0.8368 Q0.5296,0.8378,0.5255,0.8378 Q0.5239,0.8378,0.5195,0.8373 T0.5118,0.8368 Q0.5061,0.8368,0.4996,0.8388 Q0.4947,0.8388,0.4882,0.8398 Q0.4777,0.8417,0.4753,0.8427 T0.4728,0.8467 Q0.4728,0.8487,0.4769,0.8492 T0.4886,0.8501 T0.5004,0.8516 Q0.5036,0.8516,0.515,0.8521 T0.5345,0.8546 Q0.5426,0.8556,0.5596,0.8556 L0.5649,0.8556 L0.5702,0.8556 L0.5791,0.8556 Q0.5921,0.8566,0.6135,0.8571 T0.6383,0.8586 Q0.6683,0.8615,0.6764,0.8615 L0.6776,0.8615 L0.6788,0.8615 Q0.7032,0.8615,0.7032,0.8684 Q0.7032,0.8714,0.6995,0.8749 T0.6959,0.8803 L0.6959,0.8813 Q0.6991,0.8843,0.7153,0.8843 Q0.7218,0.8843,0.7259,0.8833 L0.7299,0.8833 Q0.7324,0.8833,0.7348,0.8838 T0.7393,0.8848 T0.7433,0.8863 L0.7474,0.8882 T0.751,0.8892 Q0.7616,0.8922,0.7948,0.8952 Q0.7981,0.8952,0.8082,0.8981 T0.8297,0.9011 T0.8528,0.9026 T0.8747,0.907 T0.8856,0.9149 L0.8856,0.9159 Q0.8856,0.9179,0.8848,0.9189 T0.8828,0.9209 T0.88,0.9228 T0.8767,0.9243 T0.8731,0.9248 T0.8698,0.9253 T0.8666,0.9258 L0.8646,0.9258 Q0.8621,0.9258,0.8577,0.9263 T0.85,0.9268 T0.8439,0.9273 T0.8402,0.9278 Q0.8386,0.9298,0.8358,0.9308 T0.8305,0.9322 T0.8244,0.9332 T0.8183,0.9337 Q0.8135,0.9347,0.8025,0.9372 T0.7859,0.9416 Q0.7778,0.9436,0.7717,0.9471 T0.7624,0.9515 Q0.7575,0.9535,0.7486,0.9535 Q0.7461,0.9535,0.7397,0.953 T0.7291,0.9525 Q0.7234,0.9525,0.7186,0.953 T0.7137,0.957 T0.7194,0.9614 Q0.7567,0.9634,0.7664,0.9654 Q0.7745,0.9674,0.7762,0.9674 L0.7908,0.9674 Q0.7924,0.9664,0.7948,0.9664 Q0.8029,0.9664,0.8082,0.9679 T0.8224,0.9723 T0.8362,0.9773 Q0.8483,0.9812,0.871,0.9812 L0.8751,0.9812 Q0.8873,0.9812,0.8929,0.9822 T0.9165,0.9876 T0.9408,0.9931 Q0.9513,0.996,0.9935,0.996 Z M0.9968,0.998 L0.9976,0.003 Q0.9838,0.002,0.9708,0.0059 Q0.9659,0.0069,0.9327,0.0059 T0.8881,0.0099 Q0.8767,0.0138,0.8658,0.0163 T0.8491,0.0218 Q0.8418,0.0247,0.8341,0.0247 T0.8232,0.0257 Q0.8191,0.0277,0.7997,0.0292 T0.7737,0.0326 Q0.7697,0.0336,0.7672,0.0336 T0.7612,0.0321 T0.7543,0.0307 T0.747,0.0317 Q0.7397,0.0326,0.7336,0.0356 T0.717,0.0406 Q0.6918,0.0445,0.6861,0.0475 Q0.6845,0.0485,0.6772,0.0485 T0.6638,0.05 T0.6577,0.0549 T0.6642,0.0598 T0.6796,0.0613 T0.6902,0.0623 Q0.691,0.0623,0.6946,0.0658 T0.7064,0.0702 L0.7161,0.0702 Q0.7194,0.0702,0.7242,0.0697 T0.7332,0.0692 Q0.7413,0.0692,0.7579,0.0717 T0.781,0.0762 Q0.7867,0.0781,0.8171,0.0786 T0.85,0.0801 L0.8532,0.0801 Q0.8548,0.0801,0.8613,0.0796 T0.8727,0.0791 Q0.8832,0.0791,0.8913,0.0811 Q0.897,0.0831,0.897,0.0851 Q0.897,0.088,0.8873,0.0905 T0.8735,0.093 Q0.871,0.093,0.8447,0.0984 T0.8143,0.1039 Q0.7981,0.1039,0.781,0.1078 Q0.7778,0.1088,0.7745,0.1088 T0.7644,0.1073 T0.7518,0.1048 L0.7453,0.1048 Q0.7299,0.1048,0.7076,0.1083 T0.6788,0.1157 Q0.6748,0.1187,0.6699,0.1187 Q0.6675,0.1187,0.6557,0.1157 T0.6318,0.1118 Q0.6164,0.1108,0.6135,0.1108 T0.6095,0.1113 T0.6067,0.1142 T0.6018,0.1187 Q0.5953,0.1227,0.5921,0.1227 Q0.5904,0.1227,0.5839,0.1212 T0.5693,0.1187 L0.5661,0.1187 Q0.558,0.1187,0.5527,0.1207 T0.5434,0.1246 T0.5337,0.1266 Q0.5126,0.1296,0.4882,0.1296 T0.4371,0.1385 Q0.4298,0.1414,0.425,0.1414 Q0.4225,0.1414,0.4189,0.1395 T0.4112,0.1375 Q0.4079,0.1375,0.4019,0.1395 T0.3869,0.1414 Q0.3682,0.1414,0.3504,0.1474 Q0.3398,0.1513,0.3333,0.1513 Q0.3293,0.1513,0.3228,0.1494 L0.3204,0.1494 Q0.3179,0.1494,0.3155,0.1508 T0.3118,0.1543 T0.3106,0.1592 T0.3127,0.1642 T0.32,0.1677 T0.3305,0.1701 T0.3435,0.1716 T0.3544,0.1721 Q0.3569,0.1731,0.3601,0.1731 Q0.3625,0.1731,0.3686,0.1726 T0.3779,0.1721 Q0.3901,0.1721,0.4023,0.1751 Q0.4177,0.18,0.455,0.18 Q0.4793,0.18,0.4882,0.178 L0.4915,0.178 Q0.4964,0.178,0.5045,0.1815 T0.5158,0.185 Q0.5564,0.1889,0.5645,0.1929 Q0.5677,0.1939,0.571,0.1939 Q0.575,0.1939,0.5807,0.1919 T0.5888,0.1899 T0.5929,0.1909 Q0.5969,0.1949,0.6123,0.1949 Q0.6334,0.1949,0.6456,0.1899 Q0.6488,0.1879,0.6537,0.1879 Q0.661,0.1879,0.6772,0.1929 T0.6983,0.1978 Q0.704,0.1988,0.7206,0.1998 T0.7502,0.2018 T0.7664,0.2038 Q0.7672,0.2038,0.7818,0.2043 T0.8151,0.2067 T0.8459,0.2156 Q0.8573,0.2206,0.8573,0.2255 Q0.8573,0.2295,0.8516,0.2324 T0.8394,0.2369 T0.8281,0.2384 Q0.8208,0.2384,0.7526,0.2473 Q0.7494,0.2483,0.7421,0.2493 T0.7287,0.2512 T0.7178,0.2522 L0.7153,0.2522 L0.7137,0.2522 Q0.7056,0.2522,0.6898,0.2572 T0.6691,0.2671 Q0.6667,0.269,0.6634,0.269 Q0.661,0.269,0.6557,0.2681 T0.6472,0.2671 Q0.6448,0.2671,0.6415,0.2681 Q0.631,0.271,0.6034,0.274 Q0.5994,0.274,0.5961,0.2765 T0.5904,0.2789 L0.5864,0.2789 Q0.5831,0.2779,0.5742,0.2779 Q0.541,0.2779,0.5223,0.2849 Q0.5126,0.2888,0.5028,0.2888 Q0.5004,0.2888,0.4943,0.2883 T0.4842,0.2878 Q0.4704,0.2878,0.4627,0.2898 T0.4509,0.2987 Q0.4501,0.2997,0.4501,0.3007 Q0.4501,0.3046,0.4574,0.3066 T0.4765,0.3091 T0.4899,0.3096 Q0.4931,0.3106,0.5061,0.3121 T0.5316,0.315 T0.5499,0.3175 Q0.5507,0.3175,0.5572,0.3195 T0.5685,0.3225 T0.5803,0.3254 T0.5933,0.3279 T0.605,0.3284 T0.6148,0.3274 Q0.6221,0.3244,0.6294,0.3244 Q0.6399,0.3244,0.6496,0.3294 Q0.6529,0.3314,0.6577,0.3314 Q0.6602,0.3314,0.6663,0.3304 T0.6756,0.3294 T0.6813,0.3304 Q0.6837,0.3304,0.6873,0.3309 L0.6946,0.3318 T0.7024,0.3323 T0.7105,0.3328 T0.7178,0.3338 T0.7238,0.3348 T0.7283,0.3363 Q0.7324,0.3383,0.7482,0.3403 T0.7689,0.3442 Q0.7697,0.3442,0.779,0.3477 T0.794,0.3536 T0.8074,0.3615 T0.8183,0.3729 Q0.8232,0.3808,0.8232,0.3848 Q0.8232,0.3867,0.8216,0.3892 T0.8151,0.3961 T0.8062,0.406 T0.7997,0.4179 T0.7952,0.4263 T0.7855,0.4308 T0.7616,0.4362 Q0.7543,0.4372,0.7445,0.4372 L0.7372,0.4372 L0.7307,0.4372 Q0.7202,0.4372,0.7153,0.4382 Q0.7064,0.4402,0.691,0.4402 L0.6845,0.4402 L0.6788,0.4402 Q0.6699,0.4402,0.6533,0.4436 T0.6318,0.451 Q0.6302,0.451,0.6302,0.452 Q0.6302,0.457,0.6626,0.459 Q0.6869,0.4609,0.7015,0.4659 Q0.7064,0.4669,0.7202,0.4669 L0.7311,0.4669 L0.7429,0.4669 Q0.7599,0.4669,0.7689,0.4688 Q0.7794,0.4708,0.7794,0.4738 L0.7786,0.4748 T0.777,0.4763 T0.7749,0.4773 L0.7737,0.4777 L0.7729,0.4777 Q0.7502,0.4797,0.738,0.4797 L0.7315,0.4797 L0.7291,0.4797 Q0.7226,0.4797,0.6869,0.4876 Q0.6821,0.4886,0.6768,0.4891 T0.6614,0.4901 T0.6456,0.4916 L0.6342,0.4916 Q0.6294,0.4916,0.6217,0.4911 T0.6115,0.4906 Q0.6083,0.4906,0.6054,0.4911 T0.5961,0.4936 T0.5815,0.4965 T0.5629,0.4985 Q0.5507,0.4985,0.5442,0.4995 T0.5345,0.5025 T0.5304,0.5084 L0.5296,0.5094 Q0.5296,0.5114,0.5316,0.5124 T0.5373,0.5138 T0.5442,0.5143 L0.5523,0.5143 L0.5604,0.5143 Q0.5637,0.5153,0.5677,0.5158 T0.5742,0.5173 T0.5811,0.5188 T0.5904,0.5193 L0.5977,0.5193 L0.6026,0.5193 Q0.6107,0.5193,0.6168,0.5208 T0.6294,0.5252 T0.6399,0.5292 Q0.6448,0.5302,0.6679,0.5341 T0.6983,0.541 Q0.7129,0.545,0.7664,0.55 Q0.7883,0.5519,0.7883,0.5559 Q0.7883,0.5579,0.7843,0.5608 T0.7721,0.5638 Q0.7697,0.5638,0.764,0.5633 T0.7559,0.5628 L0.7502,0.5628 Q0.7364,0.5648,0.6869,0.5648 L0.6699,0.5648 L0.6675,0.5648 Q0.665,0.5648,0.6602,0.5658 T0.6513,0.5668 Q0.6464,0.5668,0.6399,0.5658 Q0.6342,0.5648,0.6302,0.5648 T0.6225,0.5668 T0.6156,0.5697 Q0.6107,0.5707,0.6087,0.5707 T0.6034,0.5712 T0.5953,0.5717 Q0.5904,0.5727,0.5835,0.5727 T0.5718,0.5732 T0.562,0.5757 Q0.558,0.5767,0.5483,0.5767 L0.5349,0.5767 L0.5207,0.5767 Q0.5069,0.5767,0.5028,0.5786 Q0.4972,0.5816,0.4899,0.5816 Q0.4858,0.5816,0.4781,0.5806 T0.4663,0.5796 L0.4631,0.5796 Q0.4582,0.5796,0.4432,0.5821 T0.4144,0.5846 L0.4071,0.5846 L0.4011,0.5846 T0.3958,0.5851 T0.3921,0.5856 T0.3889,0.5861 T0.3865,0.5865 T0.384,0.5875 L0.382,0.5885 L0.3796,0.5895 L0.3771,0.5905 Q0.3731,0.5925,0.365,0.5925 L0.3601,0.5925 L0.3552,0.5925 Q0.3277,0.5925,0.3049,0.6044 Q0.3017,0.6053,0.296,0.6053 Q0.292,0.6053,0.2847,0.6044 T0.2741,0.6034 Q0.2693,0.6034,0.2547,0.6029 T0.236,0.6024 Q0.2222,0.6024,0.1922,0.6073 Q0.1906,0.6083,0.1882,0.6083 Q0.1833,0.6083,0.1711,0.6063 T0.1533,0.6044 Q0.1517,0.6034,0.1492,0.6034 Q0.1436,0.6034,0.135,0.6048 T0.1168,0.6078 T0.103,0.6093 Q0.0973,0.6103,0.0787,0.6103 L0.0604,0.6103 L0.0414,0.6103 L0.0235,0.6103 Q0.0024,0.6113,0.0024,0.6172 Q0.0024,0.6192,0.0032,0.6231 Q0.0049,0.6281,0.0333,0.6281 L0.0414,0.6281 L0.0479,0.6281 Q0.0519,0.6281,0.0624,0.6301 T0.0803,0.632 L0.0835,0.632 L0.0916,0.632 Q0.0989,0.632,0.1281,0.634 L0.206,0.6419 Q0.2117,0.6429,0.2174,0.6429 Q0.2214,0.6429,0.2271,0.6424 T0.2344,0.6419 L0.2376,0.6419 Q0.2393,0.6429,0.2417,0.6429 T0.2526,0.6419 T0.2652,0.6409 Q0.2741,0.6409,0.2782,0.6429 T0.2968,0.6459 T0.3293,0.6479 T0.352,0.6489 Q0.3552,0.6499,0.3585,0.6499 Q0.365,0.6499,0.3731,0.6474 T0.3844,0.6449 Q0.3885,0.6449,0.3917,0.6474 T0.4006,0.6499 Q0.4088,0.6499,0.4509,0.6578 Q0.4574,0.6588,0.4631,0.6588 Q0.4655,0.6588,0.4716,0.6583 T0.4834,0.6578 L0.4874,0.6578 Q0.5004,0.6588,0.5255,0.6637 Q0.532,0.6647,0.56,0.6667 T0.6148,0.6701 T0.644,0.6716 Q0.6464,0.6726,0.6594,0.6736 T0.6861,0.6756 T0.7048,0.6775 Q0.7097,0.6775,0.7186,0.6825 T0.738,0.6874 Q0.7518,0.6874,0.7729,0.6958 T0.8005,0.7122 Q0.8029,0.7141,0.8029,0.7151 Q0.8029,0.7191,0.7968,0.7216 T0.7818,0.726 T0.7705,0.729 L0.764,0.731 T0.7583,0.7324 T0.753,0.7334 T0.7486,0.7349 Q0.7251,0.7399,0.7161,0.7399 Q0.7097,0.7399,0.6951,0.7409 T0.6748,0.7418 L0.6703,0.7418 L0.6667,0.7418 Q0.6659,0.7418,0.6399,0.7448 L0.6334,0.7448 Q0.631,0.7448,0.6249,0.7443 T0.6148,0.7438 L0.6099,0.7438 Q0.601,0.7448,0.5856,0.7473 T0.5645,0.7507 Q0.5572,0.7517,0.5572,0.7547 T0.5616,0.7606 T0.5702,0.7646 Q0.5734,0.7646,0.5779,0.7651 T0.5864,0.7661 T0.5949,0.7671 T0.6018,0.7676 L0.6071,0.7676 T0.6135,0.7681 T0.62,0.769 T0.6269,0.771 T0.6342,0.7725 Q0.6391,0.7725,0.6464,0.7705 T0.6541,0.7685 L0.6553,0.7685 Q0.6586,0.7685,0.6699,0.771 T0.6853,0.7735 Q0.6902,0.7735,0.704,0.777 T0.7226,0.7834 Q0.7315,0.7873,0.7445,0.7883 Q0.747,0.7883,0.7676,0.7893 T0.7972,0.7913 Q0.7989,0.7913,0.8017,0.7918 T0.8058,0.7923 T0.809,0.7928 T0.8114,0.7933 T0.8131,0.7938 T0.8147,0.7943 T0.8159,0.7953 L0.8171,0.7967 T0.8175,0.7982 Q0.8183,0.7992,0.8183,0.8002 Q0.8183,0.8022,0.8155,0.8032 T0.807,0.8051 T0.7989,0.8071 Q0.7932,0.8091,0.7737,0.8091 L0.7413,0.8091 L0.7372,0.8091 Q0.7275,0.8091,0.721,0.8101 T0.7072,0.8136 T0.6983,0.817 Q0.6942,0.818,0.6825,0.818 T0.6602,0.819 T0.6456,0.822 Q0.6415,0.8249,0.6375,0.8249 Q0.6367,0.8249,0.6326,0.8239 T0.6253,0.8229 Q0.6034,0.8229,0.5953,0.8279 Q0.5912,0.8289,0.5848,0.8289 Q0.5775,0.8289,0.5645,0.8279 Q0.5629,0.8269,0.5604,0.8269 Q0.5523,0.8269,0.5328,0.8348 Q0.5296,0.8358,0.5264,0.8358 Q0.5247,0.8358,0.5203,0.8353 T0.5126,0.8348 Q0.5061,0.8348,0.4988,0.8358 Q0.4947,0.8368,0.4882,0.8378 Q0.4826,0.8388,0.4797,0.8388 T0.474,0.8398 T0.4704,0.8422 T0.4696,0.8462 T0.472,0.8501 T0.4781,0.8521 T0.4854,0.8526 L0.4935,0.8526 T0.4996,0.8536 Q0.5036,0.8536,0.515,0.8546 T0.5337,0.8566 Q0.5426,0.8576,0.5596,0.8576 L0.5657,0.8576 L0.571,0.8576 L0.5791,0.8576 Q0.5921,0.8586,0.6135,0.8591 T0.6383,0.8605 Q0.6683,0.8635,0.6764,0.8635 Q0.6999,0.8635,0.6999,0.8684 Q0.6999,0.8694,0.6967,0.8734 T0.6934,0.8803 L0.6934,0.8823 Q0.6951,0.8863,0.7137,0.8863 Q0.7218,0.8863,0.7267,0.8853 L0.7299,0.8853 Q0.734,0.8853,0.7409,0.8882 T0.7502,0.8912 Q0.7607,0.8942,0.794,0.8971 Q0.7972,0.8971,0.8078,0.9001 T0.8297,0.9031 Q0.8475,0.9031,0.8646,0.9065 T0.8824,0.9149 L0.8824,0.9159 Q0.8824,0.9169,0.882,0.9179 T0.8808,0.9194 L0.8792,0.9204 T0.8767,0.9214 T0.8743,0.9224 T0.8715,0.9228 L0.8686,0.9228 T0.8662,0.9233 T0.8637,0.9238 L0.8556,0.9238 T0.8447,0.9243 T0.8386,0.9268 Q0.837,0.9278,0.835,0.9288 T0.8305,0.9303 T0.8244,0.9308 T0.8175,0.9318 Q0.8127,0.9327,0.8017,0.9352 T0.7851,0.9397 Q0.777,0.9416,0.7705,0.9451 T0.7616,0.9496 Q0.7575,0.9505,0.7494,0.9505 L0.7405,0.9505 L0.7307,0.9505 Q0.7234,0.9505,0.7178,0.9515 Q0.7145,0.9515,0.7125,0.9535 T0.7105,0.9575 Q0.7105,0.9624,0.7194,0.9634 Q0.7567,0.9654,0.7664,0.9674 Q0.7745,0.9693,0.7762,0.9693 L0.7908,0.9693 L0.7948,0.9693 Q0.8005,0.9693,0.8058,0.9698 T0.8143,0.9718 T0.824,0.9753 T0.8354,0.9792 Q0.8483,0.9832,0.871,0.9832 L0.8739,0.9832 L0.8767,0.9832 Q0.8873,0.9832,0.8921,0.9842 Q0.8978,0.9852,0.9157,0.9896 T0.94,0.996 Q0.9424,0.996,0.9469,0.9965 T0.9566,0.997 T0.9676,0.9975 T0.9781,0.998 L0.9874,0.998 L0.9943,0.998 L0.9968,0.998 Z",type:0}},"":{type:5,data:{d:"M1,0.5071 L0.8623,0.7102 L0.5865,0.7102 L0.4489,0.5071 L0.5865,0.3045 L0.8623,0.3045 Z M0.4135,0.7974 L0.2758,1 L0,1 L0,0.5944 L0.2758,0.5944 Z M0.4135,0.2026 L0.2758,0.4056 L0,0.4056 L0,0 L0.2758,0 Z",type:0}},"":{type:5,data:{d:"M0.9726,0.5071 L0.8451,0.3184 L0.59,0.3184 L0.4624,0.5071 L0.59,0.6955 L0.8451,0.6955 Z M1,0.5071 L0.8588,0.716 L0.5768,0.716 L0.4355,0.5071 L0.5768,0.2982 L0.8588,0.2982 Z M0.401,0.7911 L0.2735,0.6028 L0.0236,0.6028 L0.0236,0.9799 L0.2735,0.9799 Z M0.4284,0.7911 L0.2872,1 L0,1 L0,0.5826 L0.2872,0.5826 Z M0.401,0.2089 L0.2735,0.0201 L0.0236,0.0201 L0.0236,0.3972 L0.2735,0.3972 Z M0.4284,0.2089 L0.2872,0.4174 L0,0.4174 L0,0 L0.2872,0 Z",type:0}},"":{type:5,data:{d:"M1,0.4996 Q1,0.5365,0.9924,0.568 T0.9718,0.6177 T0.9433,0.6363 L0.9425,0.6367 Q0.9355,0.6367,0.9285,0.6326 L0.9308,0.6326 Q0.9129,0.6195,0.9013,0.587 T0.8871,0.5164 T0.8943,0.4373 T0.9254,0.3687 L0.9254,0.3691 Q0.9339,0.3628,0.9425,0.3628 Q0.9584,0.3628,0.9716,0.3811 T0.9924,0.431 T1,0.4996 Z M0.9234,0.6321 L0.8776,0.7169 Q0.8791,0.732,0.8791,0.7441 Q0.8791,0.781,0.8716,0.8123 T0.8508,0.862 T0.8224,0.8809 L0.8216,0.8809 Q0.8154,0.8809,0.8092,0.8775 L0.8088,0.8775 Q0.7905,0.8633,0.7792,0.8297 T0.766,0.7571 T0.775,0.6768 T0.8088,0.6086 L0.7431,0.6065 Q0.719,0.6313,0.7072,0.6705 T0.6965,0.7487 T0.7097,0.823 T0.7423,0.8763 L0.7913,0.8775 L0.7314,0.9895 L0.4648,0.5038 L0.7299,0.0176 L0.7882,0.1229 L0.7404,0.1212 Q0.7244,0.138,0.7136,0.1617 T0.6982,0.2108 T0.6943,0.2632 T0.7003,0.3144 T0.7159,0.3586 T0.7396,0.3909 L0.8072,0.3926 Q0.7894,0.3796,0.7777,0.3479 T0.7635,0.2789 T0.7697,0.2011 T0.7987,0.1326 Q0.8092,0.1225,0.8204,0.1225 Q0.8321,0.1225,0.8426,0.1332 T0.8609,0.1623 T0.8731,0.2062 T0.8776,0.2592 Q0.8776,0.268,0.8768,0.2815 L0.9219,0.3628 L0.8644,0.3612 Q0.8403,0.3855,0.8284,0.4247 T0.8177,0.5029 T0.8309,0.5772 T0.8632,0.6305 Z M0.6759,0.6384 Q0.6576,0.625,0.6457,0.5914 T0.6319,0.5185 T0.6407,0.4375 T0.6751,0.3691 L0.609,0.367 Q0.5849,0.3918,0.5731,0.431 T0.5626,0.509 T0.5758,0.5833 T0.6082,0.6367 Z M0.6459,0.0025 L0.391,0.4551 L0.0035,0.4551 L0.246,0 Z M0.6553,1 L0.2421,1 L0,0.5449 L0.3875,0.5449 Z",type:0}},"":{type:5,data:{d:"M0.4996,0 Q0.5562,0,0.5961,0.0166 T0.6364,0.0566 L0.6368,0.0575 Q0.6368,0.0646,0.6324,0.0713 L0.6324,0.0692 Q0.6196,0.0868,0.5872,0.0986 T0.5166,0.1128 T0.4373,0.1057 T0.3689,0.0747 L0.3694,0.0747 Q0.3627,0.0663,0.3627,0.0575 Q0.3627,0.0336,0.4028,0.0168 T0.4996,0 Z M0.6324,0.0768 L0.717,0.1225 Q0.7321,0.1212,0.744,0.1212 Q0.8007,0.1212,0.8406,0.1378 T0.8809,0.1779 L0.8813,0.1783 Q0.8813,0.1846,0.8778,0.1909 Q0.8636,0.2093,0.8299,0.2208 T0.7573,0.2343 T0.6769,0.2253 T0.6089,0.1913 L0.6067,0.2567 Q0.6315,0.281,0.6707,0.2928 T0.7489,0.3035 T0.8231,0.2903 T0.8764,0.258 L0.8778,0.2085 L0.9898,0.2685 L0.504,0.5352 L0.0177,0.2701 L0.1227,0.2118 L0.1213,0.2596 Q0.1457,0.2836,0.1851,0.2955 T0.2635,0.3062 T0.3377,0.293 T0.3911,0.2605 L0.3928,0.193 Q0.38,0.2106,0.3483,0.2221 T0.2792,0.2364 T0.2013,0.2303 T0.1324,0.2013 Q0.1222,0.1909,0.1222,0.1795 Q0.1222,0.156,0.1623,0.1393 T0.2591,0.1225 Q0.2679,0.1225,0.2817,0.1233 L0.3627,0.078 L0.3609,0.1359 Q0.3857,0.1598,0.4249,0.1718 T0.5031,0.1825 T0.5773,0.1693 T0.6306,0.1367 Z M0.6386,0.3242 Q0.6253,0.3427,0.5917,0.3544 T0.5186,0.3683 T0.4376,0.3595 T0.3689,0.3251 L0.3671,0.3909 Q0.3915,0.4148,0.4309,0.4268 T0.5093,0.4375 T0.5835,0.4243 T0.6368,0.3918 Z M0.0027,0.354 L0.4553,0.6091 L0.4553,0.9962 L0,0.7542 Z M1,0.3448 L1,0.7576 L0.5447,1 L0.5447,0.6128 Z",type:0}},"":{type:5,data:{d:"M0,0.7699 Q0,0.7172,0.0277,0.6731 T0.103,0.6032 T0.2066,0.5774 Q0.2487,0.5774,0.2865,0.5922 T0.3526,0.6339 L0.3935,0.6715 Q0.4218,0.6984,0.438,0.7336 T0.4541,0.8075 Q0.4541,0.8602,0.4264,0.9046 T0.3511,0.9745 T0.2475,1 Q0.2054,1,0.1676,0.9852 T0.1016,0.9435 L0.0606,0.9059 Q0.0317,0.879,0.0159,0.8438 T0,0.7699 Z M0.5459,0.7699 Q0.5459,0.7172,0.5736,0.6731 T0.6489,0.6032 T0.7525,0.5774 Q0.7946,0.5774,0.8324,0.5922 T0.8984,0.6339 L0.9394,0.6715 Q0.9579,0.6892,0.9714,0.7105 T0.9925,0.7567 T1,0.8075 Q1,0.8602,0.9723,0.9046 T0.897,0.9745 T0.7934,1 Q0.7513,1,0.7135,0.9852 T0.6474,0.9435 L0.6065,0.9059 Q0.5776,0.879,0.5617,0.8438 T0.5459,0.7699 Z M0,0.1925 Q0,0.1398,0.0277,0.0957 T0.103,0.0258 T0.2066,0 Q0.2487,0,0.2865,0.0148 T0.3526,0.0565 L0.3935,0.0941 Q0.4218,0.121,0.438,0.1562 T0.4541,0.2301 Q0.4541,0.2828,0.4264,0.3269 T0.3511,0.3968 T0.2475,0.4226 Q0.2054,0.4226,0.1676,0.4078 T0.1016,0.3661 L0.0606,0.3285 Q0.0317,0.3016,0.0159,0.2664 T0,0.1925 Z M0.5459,0.1925 Q0.5459,0.1398,0.5736,0.0957 T0.6489,0.0258 T0.7525,0 Q0.7946,0,0.8324,0.0148 T0.8984,0.0565 L0.9394,0.0941 Q0.9677,0.121,0.9838,0.1562 T1,0.2301 Q1,0.2828,0.9723,0.3269 T0.897,0.3968 T0.7934,0.4226 Q0.7513,0.4226,0.7135,0.4078 T0.6474,0.3661 L0.6065,0.3285 Q0.5874,0.3108,0.5741,0.2895 T0.5534,0.2433 T0.5459,0.1925 Z M0.3301,0.6403 Q0.3306,0.6403,0.3312,0.6409 L0.3272,0.6371 L0.3272,0.6371 Z M0.8759,0.6403 Q0.8765,0.6403,0.8771,0.6409 Q0.8748,0.6387,0.8725,0.6371 L0.8731,0.6371 Z M0.3301,0.0629 Q0.3306,0.0629,0.3312,0.0634 L0.3272,0.0597 L0.3272,0.0602 Z M0.8759,0.0629 Q0.8765,0.0629,0.8771,0.0634 Q0.8748,0.0613,0.8725,0.0597 Q0.8731,0.0597,0.8731,0.0602 Z M0.779,0.4113 L0.7501,0.3849 Q0.7046,0.3844,0.6636,0.3661 Q0.7132,0.407,0.779,0.4113 Z M0.7957,0.4118 Q0.8477,0.4113,0.8918,0.3874 T0.9619,0.3223 T0.9885,0.2323 L0.9585,0.2048 Q0.9538,0.2769,0.8987,0.3282 T0.7657,0.3844 Z M0.9879,0.2167 Q0.9827,0.1554,0.9388,0.1097 Q0.9585,0.1478,0.959,0.1898 Z M0.2331,0.4113 L0.2043,0.3849 Q0.1587,0.3844,0.1177,0.3661 Q0.1673,0.407,0.2331,0.4113 Z M0.2499,0.4118 Q0.2885,0.4118,0.324,0.3973 T0.3852,0.3589 T0.4264,0.3019 T0.4426,0.2323 L0.4126,0.2048 Q0.408,0.2769,0.3529,0.3282 T0.2198,0.3844 Z M0.442,0.2167 Q0.4368,0.1554,0.393,0.1097 Q0.4126,0.1478,0.4132,0.1903 Z M0.779,0.9887 L0.7501,0.9624 Q0.7046,0.9618,0.6636,0.9435 Q0.7132,0.9844,0.779,0.9887 Z M0.7957,0.9892 Q0.8477,0.9887,0.8918,0.9648 T0.9619,0.8997 T0.9885,0.8097 L0.9585,0.7823 Q0.9538,0.8543,0.8987,0.9056 T0.7657,0.9618 Z M0.9879,0.7941 Q0.9827,0.7328,0.9388,0.6871 Q0.9585,0.7253,0.959,0.7672 Z M0.2331,0.9887 L0.2043,0.9624 Q0.1587,0.9618,0.1177,0.9435 Q0.1673,0.9844,0.2331,0.9887 Z M0.2499,0.9892 Q0.3018,0.9887,0.3459,0.9648 T0.416,0.8997 T0.4426,0.8102 L0.4126,0.7823 Q0.408,0.8543,0.3529,0.9056 T0.2198,0.9618 Z M0.442,0.7941 Q0.4368,0.7328,0.393,0.6871 Q0.4126,0.7253,0.4132,0.7672 Z M0.3191,0.6452 Q0.2943,0.622,0.2643,0.6091 T0.2066,0.5962 Q0.1795,0.5962,0.1497,0.6091 T0.0949,0.6441 T0.0537,0.6995 T0.0375,0.7699 Q0.0375,0.8419,0.0941,0.8941 Q0.1189,0.9172,0.1489,0.9304 T0.2066,0.9435 Q0.2337,0.9435,0.2634,0.9304 T0.3182,0.8952 T0.3595,0.8398 T0.3756,0.7699 Q0.3756,0.6978,0.3191,0.6452 Z M0.026,0.7731 L0.026,0.7699 Q0.026,0.6935,0.0854,0.6376 Q0.0658,0.6538,0.0514,0.6739 T0.0289,0.718 T0.0202,0.7677 Z M0.0271,0.7892 L0.0208,0.7833 Q0.0254,0.8419,0.0681,0.886 Q0.0664,0.8828,0.0646,0.879 Q0.0329,0.8382,0.0271,0.7892 Z M0.3866,0.7823 Q0.382,0.8511,0.3278,0.9016 Q0.3843,0.8565,0.3918,0.7871 Z M0.3872,0.7677 L0.393,0.7726 L0.393,0.7699 Q0.393,0.7349,0.3791,0.7038 Q0.3739,0.6973,0.3681,0.6914 Q0.3866,0.7274,0.3872,0.7677 Z M0.865,0.6452 Q0.8402,0.622,0.8102,0.6091 T0.7525,0.5962 Q0.7305,0.5962,0.7072,0.6043 T0.6619,0.628 T0.6223,0.6642 T0.5941,0.7124 T0.5834,0.7699 Q0.5834,0.8419,0.6399,0.8941 Q0.6561,0.9097,0.6757,0.9207 T0.7149,0.9376 T0.7525,0.9435 Q0.7796,0.9435,0.8093,0.9304 T0.8641,0.8952 T0.9054,0.8398 T0.9215,0.7699 Q0.9215,0.6978,0.865,0.6452 Z M0.5718,0.7731 L0.5718,0.7699 Q0.5718,0.6935,0.6313,0.6376 Q0.6013,0.6618,0.584,0.6954 T0.5661,0.7677 Z M0.573,0.7892 L0.5666,0.7833 Q0.5713,0.8419,0.614,0.886 Q0.6122,0.8828,0.6105,0.879 Q0.5788,0.8382,0.573,0.7892 Z M0.9325,0.7823 Q0.9279,0.8511,0.8736,0.9016 Q0.9308,0.8565,0.9377,0.7871 Z M0.9331,0.7672 L0.9388,0.7726 L0.9388,0.7699 Q0.9388,0.7349,0.925,0.7038 Q0.9198,0.6973,0.914,0.6914 Q0.9325,0.7274,0.9331,0.7672 Z M0.3191,0.0677 Q0.2943,0.0446,0.2643,0.0317 T0.2066,0.0188 Q0.1795,0.0188,0.1497,0.0317 T0.0949,0.0667 T0.0537,0.122 T0.0375,0.1925 Q0.0375,0.2645,0.0941,0.3167 Q0.1189,0.3398,0.1489,0.353 T0.2066,0.3661 Q0.2337,0.3661,0.2634,0.353 T0.3182,0.3177 T0.3595,0.2624 T0.3756,0.1925 Q0.3756,0.1204,0.3191,0.0677 Z M0.026,0.1957 L0.026,0.1925 Q0.026,0.1161,0.0854,0.0602 Q0.0554,0.0844,0.0381,0.118 T0.0202,0.1903 Z M0.0271,0.2118 L0.0208,0.2059 Q0.0254,0.2645,0.0681,0.3086 Q0.0664,0.3054,0.0646,0.3016 Q0.0329,0.2608,0.0271,0.2118 Z M0.3866,0.2048 Q0.382,0.2737,0.3278,0.3242 Q0.3849,0.279,0.3918,0.2097 Z M0.3872,0.1903 L0.393,0.1952 L0.393,0.1925 Q0.393,0.1581,0.3791,0.1263 Q0.3739,0.1199,0.3681,0.114 Q0.3866,0.15,0.3872,0.1903 Z M0.865,0.0677 Q0.8402,0.0446,0.8102,0.0317 T0.7525,0.0188 Q0.7253,0.0188,0.6956,0.0317 T0.6408,0.0667 T0.5995,0.122 T0.5834,0.1925 Q0.5834,0.2645,0.6399,0.3167 Q0.6647,0.3398,0.6947,0.353 T0.7525,0.3661 Q0.7796,0.3661,0.8093,0.353 T0.8641,0.3177 T0.9054,0.2624 T0.9215,0.1925 Q0.9215,0.1204,0.865,0.0677 Z M0.5718,0.1957 L0.5718,0.1925 Q0.5718,0.1161,0.6313,0.0602 Q0.6013,0.0844,0.584,0.118 T0.5661,0.1903 Z M0.573,0.2118 L0.5666,0.2059 Q0.5713,0.2645,0.614,0.3086 Q0.6122,0.3054,0.6105,0.3016 Q0.5788,0.2608,0.573,0.2118 Z M0.9325,0.2048 Q0.9279,0.2737,0.8736,0.3242 Q0.9308,0.279,0.9377,0.2097 Z M0.9331,0.1898 L0.9388,0.1952 L0.9388,0.1925 Q0.9388,0.1575,0.925,0.1263 Q0.9198,0.1199,0.914,0.114 Q0.9325,0.15,0.9331,0.1898 Z",type:0}},"":{type:5,data:{d:"M0.7639,0.1974 L0.9593,0.1974 L0.9593,0.1443 L0.7639,0.1443 L0.7639,0.1974 Z M0.7586,0.109 L0.9727,0.109 Q0.9839,0.109,0.992,0.1153 T1,0.1291 L1,0.382 Q1,0.3906,0.9912,0.3964 T0.9727,0.4021 L0.7586,0.4021 Q0.7468,0.4021,0.739,0.3956 T0.7313,0.382 L0.7313,0.1291 Q0.7313,0.1246,0.7339,0.1207 T0.7406,0.1143 T0.7495,0.1104 T0.7586,0.109 Z M0.7639,0.6575 L0.9593,0.6575 L0.9593,0.6044 L0.7639,0.6044 L0.7639,0.6575 Z M0.7313,0.8347 L0.7313,0.5843 Q0.7313,0.5757,0.7401,0.5699 T0.7586,0.5641 L0.9706,0.5641 Q0.9818,0.5641,0.9898,0.5705 T0.9979,0.5843 L0.9979,0.8347 Q0.9979,0.8433,0.989,0.8491 T0.9706,0.8549 L0.7586,0.8549 Q0.7468,0.8549,0.739,0.8483 T0.7313,0.8347 Z M0,1 L0,0 L0.7607,0 L0.7607,1 L0,1 Z",type:0}},"":{type:5,data:{d:"M0.9764,0.0029 L0.3179,0.4552 L0,0.4552 L0,0 Z M1,1 L0,1 L0,0.5448 L0.3091,0.5448 Z",type:0}},"":{type:5,data:{d:"M0.0236,0.0029 L0.6824,0.4552 L1,0.4552 L1,0 Z M0,1 L1,1 L1,0.5448 L0.6912,0.5448 Z",type:0}},"":{type:3,data:"M0,0 L1,0 L1,.05 L.1,.05 L.1,.95 L1,.95 L1,1 L0,1 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L0,.05 Z M0,.95 L1,.95 L1,1 L0,1 Z"},"":{type:3,data:"M1,0 L0,0 L0,.05 L.9,.05 L.9,.95 L0,.95 L0,1 L1,1 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L.1,.05 L.1,.95 L1,.95 L1,1 L0,1 Z M.25,.15 L1,.15 L1,.85 L.25,.85 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L0,.05 Z M0,.95 L1,.95 L1,1 L0,1 Z M0,.15 L1,.15 L1,.85 L0,.85 Z"},"":{type:3,data:"M1,0 L0,0 L0,.05 L.9,.05 L.9,.95 L0,.95 L0,1 L1,1 Z M0,.15 L.75,.15 L.75,.85 L0,.85 Z"},"":{type:5,data:{d:"M0.6574,0.303 Q0.623,0.291,0.5852,0.285 T0.5082,0.279 T0.4311,0.285 T0.359,0.303 L0.3082,0.248 Q0.3525,0.232,0.4041,0.2235 T0.5082,0.215 T0.6123,0.2235 T0.7082,0.248 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.8557,0.582 L0.7656,0.551 Q0.7852,0.53,0.7951,0.507 T0.8049,0.46 Q0.8049,0.424,0.782,0.3905 T0.718,0.332 T0.6221,0.293 T0.5082,0.279 L0.5082,0.215 Q0.5607,0.215,0.6123,0.2235 T0.709,0.248 T0.7918,0.287 T0.8557,0.3375 T0.8959,0.3965 T0.9098,0.46 T0.8959,0.5235 T0.8557,0.582 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.482,0.705,0.4557,0.703 T0.4049,0.697 L0.4311,0.635 Q0.4508,0.638,0.4697,0.6395 T0.5082,0.641 Q0.5672,0.641,0.6221,0.627 T0.718,0.588 T0.782,0.5295 T0.8049,0.46 Q0.8049,0.436,0.7951,0.413 T0.7656,0.369 L0.8557,0.338 Q0.882,0.365,0.8959,0.3965 T0.9098,0.46 T0.8959,0.5235 T0.8557,0.5825 T0.7918,0.633 T0.709,0.672 T0.6123,0.6965 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.4557,0.705,0.4041,0.6965 T0.3074,0.672 T0.2246,0.633 T0.1607,0.5825 T0.1205,0.5235 T0.1066,0.46 L0.2115,0.46 Q0.2115,0.496,0.2344,0.5295 T0.2984,0.588 T0.3943,0.627 T0.5082,0.641 T0.6221,0.627 T0.718,0.588 T0.782,0.5295 T0.8049,0.46 L0.9098,0.46 Q0.9098,0.492,0.8959,0.5235 T0.8557,0.5825 T0.7918,0.633 T0.709,0.672 T0.6123,0.6965 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.4557,0.705,0.4041,0.6965 T0.3074,0.672 T0.2246,0.633 T0.1607,0.5825 T0.1205,0.5235 T0.1066,0.46 T0.1205,0.3965 T0.1607,0.338 L0.2508,0.369 Q0.2311,0.39,0.2213,0.413 T0.2115,0.46 Q0.2115,0.496,0.2344,0.5295 T0.2984,0.588 T0.3943,0.627 T0.5082,0.641 Q0.5279,0.641,0.5467,0.6395 T0.5852,0.635 L0.6115,0.697 Q0.5869,0.701,0.5607,0.703 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.1607,0.582 Q0.1344,0.555,0.1205,0.5235 T0.1066,0.46 T0.1205,0.3965 T0.1607,0.3375 T0.2246,0.287 T0.3074,0.248 T0.4041,0.2235 T0.5082,0.215 L0.5082,0.279 Q0.4492,0.279,0.3943,0.293 T0.2984,0.332 T0.2344,0.3905 T0.2115,0.46 Q0.2115,0.484,0.2213,0.507 T0.2508,0.551 Z",type:0},scaleType:1},"":Ee.LINE_H,"":Ee.LINE_V,"":Ee.FADE_RIGHT,"":Ee.FADE_LEFT,"":Ee.FADE_DOWN,"":Ee.FADE_UP,"":Ee.CURVE_DOWN_RIGHT,"":Ee.CURVE_DOWN_LEFT,"":Ee.CURVE_UP_RIGHT,"":Ee.CURVE_UP_LEFT,"":[Ee.LINE_V,Ee.CURVE_UP_RIGHT],"":[Ee.LINE_V,Ee.CURVE_DOWN_RIGHT],"":[Ee.CURVE_DOWN_RIGHT,Ee.CURVE_UP_RIGHT],"":[Ee.LINE_V,Ee.CURVE_UP_LEFT],"":[Ee.LINE_V,Ee.CURVE_DOWN_LEFT],"":[Ee.CURVE_DOWN_LEFT,Ee.CURVE_UP_LEFT],"":[Ee.LINE_H,Ee.CURVE_DOWN_LEFT],"":[Ee.LINE_H,Ee.CURVE_DOWN_RIGHT],"":[Ee.CURVE_DOWN_LEFT,Ee.CURVE_DOWN_RIGHT],"":[Ee.LINE_H,Ee.CURVE_UP_LEFT],"":[Ee.LINE_H,Ee.CURVE_UP_RIGHT],"":[Ee.CURVE_UP_LEFT,Ee.CURVE_UP_RIGHT],"":[Ee.LINE_V,Ee.CURVE_UP_LEFT,Ee.CURVE_UP_RIGHT],"":[Ee.LINE_V,Ee.CURVE_DOWN_LEFT,Ee.CURVE_DOWN_RIGHT],"":[Ee.LINE_H,Ee.CURVE_DOWN_LEFT,Ee.CURVE_UP_LEFT],"":[Ee.LINE_H,Ee.CURVE_DOWN_RIGHT,Ee.CURVE_UP_RIGHT],"":[Ee.LINE_V,Ee.CURVE_DOWN_RIGHT,Ee.CURVE_UP_LEFT],"":[Ee.LINE_V,Ee.CURVE_DOWN_LEFT,Ee.CURVE_UP_RIGHT],"":[Ee.LINE_H,Ee.CURVE_DOWN_RIGHT,Ee.CURVE_UP_LEFT],"":[Ee.LINE_H,Ee.CURVE_DOWN_LEFT,Ee.CURVE_UP_RIGHT],"":[Ee.NODE_FILL,Ee.NODE_STROKE],"":Ee.NODE_STROKE,"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_LEFT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_LEFT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_LEFT,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_LEFT,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_DOWN],"":[Ee.NODE_STROKE,Ee.NODE_LINE_DOWN],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_UP],"":[Ee.NODE_STROKE,Ee.NODE_LINE_UP],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_UP],"":[Ee.NODE_STROKE,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_UP],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_LEFT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_LEFT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_LEFT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_LEFT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_LEFT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_LEFT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_LEFT,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_LEFT,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_LEFT,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_LEFT,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_FILL,Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_LEFT,Ee.NODE_LINE_RIGHT],"":[Ee.NODE_STROKE,Ee.NODE_LINE_UP,Ee.NODE_LINE_DOWN,Ee.NODE_LINE_LEFT,Ee.NODE_LINE_RIGHT],"🬀":hr(1),"🬁":hr(2),"🬂":hr(3),"🬃":hr(4),"🬄":hr(5),"🬅":hr(6),"🬆":hr(7),"🬇":hr(8),"🬈":hr(9),"🬉":hr(10),"🬊":hr(11),"🬋":hr(12),"🬌":hr(13),"🬍":hr(14),"🬎":hr(15),"🬏":hr(16),"🬐":hr(17),"🬑":hr(18),"🬒":hr(19),"🬓":hr(20),"🬔":hr(22),"🬕":hr(23),"🬖":hr(24),"🬗":hr(25),"🬘":hr(26),"🬙":hr(27),"🬚":hr(28),"🬛":hr(29),"🬜":hr(30),"🬝":hr(31),"🬞":hr(32),"🬟":hr(33),"🬠":hr(34),"🬡":hr(35),"🬢":hr(36),"🬣":hr(37),"🬤":hr(38),"🬥":hr(39),"🬦":hr(40),"🬧":hr(41),"🬨":hr(43),"🬩":hr(44),"🬪":hr(45),"🬫":hr(46),"🬬":hr(47),"🬭":hr(48),"🬮":hr(49),"🬯":hr(50),"🬰":hr(51),"🬱":hr(52),"🬲":hr(53),"🬳":hr(54),"🬴":hr(55),"🬵":hr(56),"🬶":hr(57),"🬷":hr(58),"🬸":hr(59),"🬹":hr(60),"🬺":hr(61),"🬻":hr(62),"🬼":{type:3,data:"M0,0.6667 L0,1 L0.5,1 Z"},"🬽":{type:3,data:"M0,0.6667 L0,1 L1,1 Z"},"🬾":{type:3,data:"M0,0.3333 L0,1 L0.5,1 Z"},"🬿":{type:3,data:"M0,0.3333 L0,1 L1,1 Z"},"🭀":{type:3,data:"M0,0 L0,1 L0.5,1 Z"},"🭁":{type:3,data:"M0,0.3333 L0.5,0 L1,0 L1,1 L0,1 Z"},"🭂":{type:3,data:"M0,0.3333 L1,0 L1,1 L0,1 Z"},"🭃":{type:3,data:"M0,0.6667 L0.5,0 L1,0 L1,1 L0,1 Z"},"🭄":{type:3,data:"M0,0.6667 L1,0 L1,1 L0,1 Z"},"🭅":{type:3,data:"M0,1 L0.5,0 L1,0 L1,1 Z"},"🭆":{type:3,data:"M0,0.6667 L1,0.3333 L1,1 L0,1 Z"},"🭇":{type:3,data:"M0.5,1 L1,0.6667 L1,1 Z"},"🭈":{type:3,data:"M0,1 L1,0.6667 L1,1 Z"},"🭉":{type:3,data:"M0.5,1 L1,0.3333 L1,1 Z"},"🭊":{type:3,data:"M0,1 L1,0.3333 L1,1 Z"},"🭋":{type:3,data:"M0.5,1 L1,0 L1,1 Z"},"🭌":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 L1,0.3333 Z"},"🭍":{type:3,data:"M0,0 L0,1 L1,1 L1,0.3333 Z"},"🭎":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 L1,0.6667 Z"},"🭏":{type:3,data:"M0,0 L0,1 L1,1 L1,0.6667 Z"},"🭐":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 Z"},"🭑":{type:3,data:"M0,0.3333 L0,1 L1,1 L1,0.6667 Z"},"🭒":{type:3,data:"M0,0.6667 L0.5,1 L1,1 L1,0 L0,0 Z"},"🭓":{type:3,data:"M0,0.6667 L1,1 L1,0 L0,0 Z"},"🭔":{type:3,data:"M0,0.3333 L0.5,1 L1,1 L1,0 L0,0 Z"},"🭕":{type:3,data:"M0,0.3333 L1,1 L1,0 L0,0 Z"},"🭖":{type:3,data:"M0,0 L0.5,1 L1,1 L1,0 Z"},"🭗":{type:3,data:"M0,0.3333 L0,0 L0.5,0 Z"},"🭘":{type:3,data:"M0,0.3333 L0,0 L1,0 Z"},"🭙":{type:3,data:"M0,0.6667 L0,0 L0.5,0 Z"},"🭚":{type:3,data:"M0,0.6667 L0,0 L1,0 Z"},"🭛":{type:3,data:"M0,1 L0,0 L0.5,0 Z"},"🭜":{type:3,data:"M0,0.6667 L0,0 L1,0 L1,0.3333 Z"},"🭝":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 L1,0.6667 Z"},"🭞":{type:3,data:"M0,1 L0,0 L1,0 L1,0.6667 Z"},"🭟":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 L1,0.3333 Z"},"🭠":{type:3,data:"M0,1 L0,0 L1,0 L1,0.3333 Z"},"🭡":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 Z"},"🭢":{type:3,data:"M0.5,0 L1,0 L1,0.3333 Z"},"🭣":{type:3,data:"M0,0 L1,0 L1,0.3333 Z"},"🭤":{type:3,data:"M0.5,0 L1,0 L1,0.6667 Z"},"🭥":{type:3,data:"M0,0 L1,0 L1,0.6667 Z"},"🭦":{type:3,data:"M0.5,0 L1,0 L1,1 Z"},"🭧":{type:3,data:"M0,0.3333 L1,0.6667 L1,0 L0,0 Z"},"🭨":{type:3,data:"M0,0 L1,0 L1,1 L0,1 L0.5,0.5 Z"},"🭩":{type:3,data:"M0,0 L0.5,0.5 L1,0 L1,1 L0,1 Z"},"🭪":{type:3,data:"M0,0 L1,0 L0.5,0.5 L1,1 L0,1 Z"},"🭫":{type:3,data:"M0,0 L1,0 L1,1 L0.5,0.5 L0,1 Z"},"🭬":{type:3,data:"M0,0 L0.5,0.5 L0,1 Z"},"🭭":{type:3,data:"M0,0 L1,0 L0.5,0.5 Z"},"🭮":{type:3,data:"M1,0 L1,1 L0.5,0.5 Z"},"🭯":{type:3,data:"M0,1 L1,1 L0.5,0.5 Z"},"🭰":{type:0,data:[{x:1,y:0,w:1,h:8}]},"🭱":{type:0,data:[{x:2,y:0,w:1,h:8}]},"🭲":{type:0,data:[{x:3,y:0,w:1,h:8}]},"🭳":{type:0,data:[{x:4,y:0,w:1,h:8}]},"🭴":{type:0,data:[{x:5,y:0,w:1,h:8}]},"🭵":{type:0,data:[{x:6,y:0,w:1,h:8}]},"🭶":{type:0,data:[{x:0,y:1,w:8,h:1}]},"🭷":{type:0,data:[{x:0,y:2,w:8,h:1}]},"🭸":{type:0,data:[{x:0,y:3,w:8,h:1}]},"🭹":{type:0,data:[{x:0,y:4,w:8,h:1}]},"🭺":{type:0,data:[{x:0,y:5,w:8,h:1}]},"🭻":{type:0,data:[{x:0,y:6,w:8,h:1}]},"🭼":{type:0,data:[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}]},"🭽":{type:0,data:[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}]},"🭾":{type:0,data:[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}]},"🭿":{type:0,data:[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}]},"🮀":{type:0,data:[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}]},"🮁":{type:0,data:[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}]},"🮂":{type:0,data:[{x:0,y:0,w:8,h:2}]},"🮃":{type:0,data:[{x:0,y:0,w:8,h:3}]},"🮄":{type:0,data:[{x:0,y:0,w:8,h:5}]},"🮅":{type:0,data:[{x:0,y:0,w:8,h:6}]},"🮆":{type:0,data:[{x:0,y:0,w:8,h:7}]},"🮇":{type:0,data:[{x:6,y:0,w:2,h:8}]},"🮈":{type:0,data:[{x:5,y:0,w:3,h:8}]},"🮉":{type:0,data:[{x:3,y:0,w:5,h:8}]},"🮊":{type:0,data:[{x:2,y:0,w:6,h:8}]},"🮋":{type:0,data:[{x:1,y:0,w:7,h:8}]},"🮌":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L0.5,0 L0.5,1 L0,1 Z"},"🮍":{type:1,data:[[1,0],[0,1]],clipPath:"M0.5,0 L1,0 L1,1 L0.5,1 Z"},"🮎":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L1,0.5 L0,0.5 Z"},"🮏":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0.5 L1,0.5 L1,1 L0,1 Z"},"🮐":{type:1,data:[[0,1],[1,0]]},"🮑":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0.5 L1,0.5 L1,1 L0,1 Z"},{type:0,data:[{x:0,y:0,w:8,h:4}]}],"🮒":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0 L1,0 L1,0.5 L0,0.5 Z"},{type:0,data:[{x:0,y:4,w:8,h:4}]}],"🮔":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0 L0.5,0 L0.5,1 L0,1 Z"},{type:0,data:[{x:4,y:0,w:4,h:8}]}],"🮕":{type:0,data:[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}]},"🮖":{type:0,data:[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}]},"🮗":{type:0,data:[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},"🮘":{type:2,data:"M-0.25,-0.25 L1.25,1.25 M-0.25,0 L1,1.25 M-0.25,0.25 L0.75,1.25 M-0.25,0.5 L0.5,1.25 M0,-0.25 L1.25,1 M0.25,-0.25 L1.25,0.75 M0.5,-0.25 L1.25,0.5 M-0.25,0.75 L0.25,1.25 M0.75,-0.25 L1.25,0.25",strokeWidth:1},"🮙":{type:2,data:"M-0.25,0.5 L0.5,-0.25 M-0.25,0.75 L0.75,-0.25 M-0.25,1 L1,-0.25 M-0.25,1.25 L1.25,-0.25 M0,1.25 L1.25,0 M0.25,1.25 L1.25,0.25 M0.5,1.25 L1.25,0.5 M-0.25,0.25 L0.25,-0.25 M0.75,1.25 L1.25,0.75",strokeWidth:1},"🮚":{type:5,data:{d:"M0,0 L.5,.5 L0,1 L1,1 L.5,.5 L1,0",type:0}},"🮛":{type:5,data:{d:"M0,0 L.5,.5 L1,0 L1,1 L.5,.5 L0,1",type:0}},"🮜":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L0,1 Z"},"🮝":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L1,1 Z"},"🮞":{type:1,data:[[1,0],[0,1]],clipPath:"M1,0 L1,1 L0,1 Z"},"🮟":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,1 L0,1 Z"},"🮠":{type:2,data:"M.5,0 L0,.5",strokeWidth:1},"🮡":{type:2,data:"M.5,0 L1,.5",strokeWidth:1},"🮢":{type:2,data:"M0,.5 L.5,1",strokeWidth:1},"🮣":{type:2,data:"M1,.5 L.5,1",strokeWidth:1},"🮤":{type:2,data:"M.5,0 L0,.5 L.5,1",strokeWidth:1},"🮥":{type:2,data:"M.5,0 L1,.5 L.5,1",strokeWidth:1},"🮦":{type:2,data:"M0,.5 L.5,1 L1,.5",strokeWidth:1},"🮧":{type:2,data:"M0,.5 L.5,0 L1,.5",strokeWidth:1},"🮨":{type:2,data:"M.5,0 L0,.5 M1,.5 L.5,1",strokeWidth:1},"🮩":{type:2,data:"M.5,0 L1,.5 M0,.5 L.5,1",strokeWidth:1},"🮪":{type:2,data:"M.5,0 L1,.5 L.5,1 L0,.5",strokeWidth:1},"🮫":{type:2,data:"M.5,0 L0,.5 L.5,1 L1,.5",strokeWidth:1},"🮬":{type:2,data:"M0,.5 L.5,0 L1,.5 L.5,1",strokeWidth:1},"🮭":{type:2,data:"M1,.5 L.5,0 L0,.5 L.5,1",strokeWidth:1},"🮮":{type:2,data:"M.5,0 L1,.5 L.5,1 L0,.5 Z",strokeWidth:1},"🮯":{type:2,data:"M0,.5 L1,.5 M.5,.35 L.5,.65",strokeWidth:1},"🮰":{type:3,data:"M0.1,0.2 L0.1,.8 L.4,.6 L.9,0.6 Z",scaleType:1},"🮱":{type:4,data:{d:"M.1,.525 L.35,.675 L.9,.35",type:1},scaleType:1},"🮲":{type:3,data:"M.29,.27 L0.13,.56 L.22,.59 L.35,0.35 L.67,.35 L.57,.57 L.71,.76 L.22,.76 L.42,1 L.53,.98 L.43,.86 L.9,.86 L.71,.6 L1,.6 L1,.52 L.83,.52 L.92,.36 L1,.36 L1,.27Z M.99,.13 A.12,.12,0,1,1,.75,.13 A.12,.12,0,1,1,.99,.13"},"🮳":{type:3,data:"M0,.27 L.3,.27 L.55,.12 L.63,.18 L.33,.36 L0,.36 M0,.52 L.33,.52 L.59,.89 L.73,.89 L.73,.98 L.53,.98 L.28,.6 L0,.6"},"🮴":{type:4,data:{d:"M.15,.55 L.5,.4 L.5,.45 L.65,.45 L.65,.35 L.85,.35 L.85,.625 L.5,.625 L.5,.7 Z",type:0},scaleType:1},"🮵":[{type:5,data:{d:"M0,0 L1,0 L1,.0625 L0,.0625 Z M0,.9375 L1,.9375 L1,1 L0,1 Z",type:0}},{type:5,data:{d:"M.15,.5 L.5,.35 L.5,.425 L.85,.425 L.85,.575 L.5,.575 L.5,.65 Z",type:0},scaleType:1}],"🮶":[{type:5,data:{d:"M0,0 L1,0 L1,.0625 L0,.0625 Z M0,.9375 L1,.9375 L1,1 L0,1 Z",type:0}},{type:5,data:{d:"M.85,.5 L.5,.35 L.5,.425 L.15,.425 L.15,.575 L.5,.575 L.5,.65 Z",type:0},scaleType:1}],"🮷":[{type:5,data:{d:"M.875,0 L1,0 L1,1 L.875,1 Z",type:0}},{type:5,data:{d:"M.5,.675 L.2,.5 L.35,.5 L.35,.325 L.65,.325 L.65,.5 L.8,.5 Z",type:0},scaleType:1}],"🮸":[{type:5,data:{d:"M.875,0 L1,0 L1,1 L.875,1 Z",type:0}},{type:5,data:{d:"M.5,.325 L.2,.5 L.35,.5 L.35,.675 L.65,.675 L.65,.5 L.8,.5 Z",type:0},scaleType:1}],"🮹":{type:5,data:{d:"M1,.89 L.11,.89 L.11,.37 L.36,.12 L.74,.12 L.96,.34 L1,.34 L1,.405 L.92,.405 L.69,.185 L.41,.185 L.21,.42 L.21,.825 L1,.825 Z",type:0}},"🮺":{type:5,data:{d:"M0,.89 L0,.825 L.78,.825 L.78,.53 L.7,.415 L0,.415 L0,.35 L.75,.35 L.88,.48 L.88,.89 Z",type:0}},"🮻":{type:5,data:{d:"M.31,.275 L.44,.275 L.44,.47 L.05,.47 L.05,.405 L.31,.405 Z M.56,.275 L.69,.275 L.69,.405 L.95,.405 L.95,.47 L.56,.47 Z M.05,.53 L.44,.53 L.44,.725 L.31,.725 L.31,.595 L.05,.595 Z M.56,.53 L.95,.53 L.95,.595 L.69,.595 L.69,.725 L.56,.725 Z",type:0},scaleType:1},"🮼":[{type:3,data:"M0,0 L1,0 L1,1 L0,1 L0,.935 L.885,.935 L.885,.065 L0,.065 Z"},{type:3,data:"M.67,.5 A.17,.085,0,1,1,.33,.5 A.17,.085,0,1,1,.67,.5",scaleType:1}],"🮽":{type:4,data:{d:"M0,0 L.5,.5 L1,0 L1,1 L.5,.5 L0,1 Z",type:1}},"🮾":{type:4,data:{d:"M1,.5 L.5,1",type:1}},"🮿":{type:4,data:{d:"M.5,0 L1,.5 L.5,1 L0,.5 Z",type:1}},"🯀":{type:3,data:"M.16,.445 A.02,.01,0,0,1,.39,.33 L.5,.375 L.61,.33 A.02,.01,0,0,1,.84,.445 L.75,.5 L.84,.555 A.02,.01,0,0,1,.61,.67 L.5,.625 L.39,.67 A.02,.01,0,0,1,.16,.555 L.25,.5 Z M.24,.41 L.39,.5 L.24,.59 L.32,.63 L.5,.555 L.68,.63 L.76,.59 L.61,.5 L.76,.41 L.68,.37 L.5,.445 L.32,.37 Z",scaleType:1},"🯁":{type:3,data:"M0.142308,0.924 Q0.130770,0.924,0.120193,0.922 T0.101924,0.916 T0.089424,0.9065 T0.084616,0.895 V0.025 Q0.084616,0.019,0.089424,0.0135 T0.101924,0.004 T0.120193,-0.002 T0.142308,-0.004 Q0.150000,-0.004,0.157693,-0.003 T0.173078,0.000 L0.430770,0.085 Q0.451924,0.059,0.494232,0.041 T0.587501,0.013 T0.692309,-0.0005 T0.800001,-0.004 H1 V0.055 H0.800001 Q0.771155,0.055,0.742309,0.056 T0.685578,0.060 T0.630770,0.0685 T0.580770,0.0825 T0.543270,0.1045 T0.528847,0.133 V0.647 H0.530770 Q0.596155,0.645,0.659616,0.638 T0.782693,0.6165 T0.893270,0.5805 T1,0.531 V0.623 Q0.934616,0.644,0.880770,0.6595 T0.769232,0.685 T0.650963,0.700 T0.528847,0.707 V0.787 Q0.528847,0.802,0.543270,0.8155 T0.580770,0.8375 T0.630770,0.8515 T0.685578,0.860 T0.742309,0.864 T0.800001,0.865 H1 V0.924 H0.800001 Q0.746155,0.924,0.692309,0.9205 T0.587501,0.907 T0.494232,0.879 T0.430770,0.835 L0.173078,0.920 Q0.165386,0.922,0.157693,0.923 T0.142308,0.924 Z M0.2,0.841 L0.415385,0.770 V0.150 L0.2,0.079 V0.841 Z M1,0.698 Q0.973077,0.694,0.969231,0.6885 T0.965385,0.677 Q0.965385,0.672,0.969231,0.6665 T1,0.657 V0.698 Z"},"🯂":{type:3,data:"M0,0.623 V0.531 Q0.044231,0.512,0.0625,0.4905 T0.092308,0.4465 T0.108654,0.4005 T0.113462,0.354 V0.351 Q0.113462,0.345,0.117308,0.3395 T0.129808,0.3305 T0.148846,0.3245 T0.171154,0.323 H0.501923 Q0.532692,0.323,0.563462,0.3185 T0.617308,0.303 T0.651923,0.2765 T0.663462,0.2435 V0.241 Q0.663462,0.219,0.657692,0.197 T0.639423,0.1545 T0.604808,0.115 T0.549615,0.082 T0.475577,0.0615 T0.392308,0.055 H0 V-0.004 H1 V0.055 H0.667308 Q0.694231,0.071,0.713462,0.09 T0.746154,0.129 T0.766346,0.1705 T0.775,0.213 H1 V0.316 Q0.971154,0.305,0.955769,0.2965 T0.920192,0.2825 T0.876923,0.2745 T0.830769,0.272 H0.773077 Q0.767308,0.297,0.743269,0.319 T0.680769,0.355 T0.595192,0.375 T0.501923,0.381 H0.227308 Q0.223462,0.415,0.211,0.4485 T0.172692,0.5135 T0.108269,0.573 T0,0.623 Z M0.611538,0.924 H0 V0.865 H0.611538 Q0.642308,0.865,0.673077,0.8605 T0.727885,0.845 T0.762308,0.8185 T0.773077,0.787 V0.785 Q0.773077,0.769,0.762308,0.7535 T0.727885,0.727 T0.673077,0.7115 T0.611538,0.707 H0.059615 Q0.048077,0.707,0.037115,0.7045 T0,0.694 V0.653 Q0.026923,0.648,0.037115,0.646 T0.059615,0.644 H0.722692 Q0.753462,0.644,0.784231,0.6395 T0.839038,0.624 T0.873846,0.5975 T0.884615,0.566 V0.564 Q0.884615,0.548,0.873846,0.532 T0.839038,0.5055 T0.784231,0.49 T0.722692,0.4855 H0.392308 Q0.380769,0.4855,0.370192,0.483 T0.351923,0.4765 T0.339423,0.467 T0.334615,0.4555 T0.339423,0.444 T0.351923,0.4345 T0.370192,0.428 T0.392308,0.4255 H0.832692 Q0.855769,0.4255,0.878846,0.4235 T0.922115,0.416 T0.957692,0.4015 T1,0.3815 V0.4685 Q0.975,0.4705,0.966346,0.4725 T0.95,0.4765 Q0.961538,0.4835,0.969231,0.4915 T1,0.5075 V0.6205 Q0.965385,0.6455,0.926923,0.665 T0.84,0.6935 Q0.866923,0.7115,0.877596,0.7345 T0.894231,0.7855 V0.787 Q0.894231,0.815,0.876923,0.8425 T0.820192,0.8895 T0.726923,0.916 T0.611538,0.924 Z"},"🯃":{type:3,data:"M0,0.473 V0.386 Q0.025490,0.378,0.028431,0.3695 T0.031373,0.352 V0.35 Q0.031373,0.342,0.028431,0.333 T0,0.316 V0.213 H0.652941 Q0.684314,0.213,0.715686,0.2085 T0.770588,0.193 T0.804902,0.1665 T0.815686,0.135 V0.133 Q0.815686,0.117,0.804902,0.101 T0.770588,0.0745 T0.715686,0.0595 T0.652941,0.055 H0 V-0.004 H0.652941 Q0.707843,-0.004,0.761765,0.004 T0.856863,0.031 T0.915686,0.0775 T0.933333,0.133 V0.135 Q0.933333,0.163,0.915686,0.1905 T0.856863,0.237 T0.761765,0.264 T0.652941,0.272 H0.109804 Q0.131373,0.29,0.140196,0.31 T0.149020,0.35 V0.352 Q0.149020,0.37,0.142157,0.388 T0.118627,0.4225 T0.076471,0.452 T0,0.473 Z M0,0.625 V0.513 Q0.029412,0.526,0.032353,0.54 T0.035294,0.568 V0.57 Q0.035294,0.584,0.032353,0.598 T0,0.625 Z"},"🯄":{type:3,data:"M0.019231,1.085 V-0.165 H0.980769 V1.085 H0.019231 Z M0.446154,0.527 H0.553846 Q0.553846,0.511,0.5625,0.495 T0.591346,0.466 T0.631731,0.4405 T0.666346,0.4135 T0.688462,0.3825 T0.696154,0.35 Q0.696154,0.33,0.682692,0.311 T0.641346,0.2785 T0.575,0.259 T0.498077,0.253 T0.421154,0.259 T0.356731,0.279 T0.315385,0.3125 T0.301923,0.352 V0.357 H0.409615 V0.354 Q0.409615,0.345,0.414423,0.335 T0.431731,0.318 T0.4625,0.3075 T0.498077,0.304 Q0.517308,0.304,0.534615,0.307 T0.564423,0.3165 T0.582692,0.332 T0.588462,0.35 Q0.588462,0.366,0.572115,0.3805 T0.535577,0.4075 T0.496154,0.4335 T0.465385,0.4625 T0.45,0.4945 T0.446154,0.527 Z M0.5,0.667 Q0.519231,0.667,0.5375,0.664 T0.569231,0.654 T0.588462,0.637 T0.594231,0.617 T0.588462,0.5975 T0.569231,0.581 T0.5375,0.571 T0.5,0.568 T0.4625,0.571 T0.430769,0.581 T0.411538,0.5975 T0.405769,0.617 T0.411538,0.637 T0.430769,0.654 T0.4625,0.664 T0.5,0.667 Z",scaleType:1},"🯅":{type:5,data:{d:"M.44,.425 L.44,.51 L.44,.56 L.19,.685 L.26,.72 L.5,.605 L.74,.72 L.81,.685 L.56,.56 L.56,.51 L.56,.425 Z M.17,.46 L.17,.51 L.83,.51 L.83,.46 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯆":{type:5,data:{d:"M.44,.425 L.44,.46 L.23,.385 L.19,.43 L.44,.51 L.44,.56 L.29,.71 L.38,.735 L.5,.605 L.61,.735 L.7,.71 L.56,.56 L.56,.51 L.81,.43 L.77,.385 L.56,.46 L.56,.425 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯇":{type:5,data:{d:"M.44,.425 L.44,.56 L.29,.71 L.38,.735 L.5,.605 L.74,.72 L.81,.685 L.56,.56 L.56,.425 Z M.18,.53 L.23,.575 L.81,.43 L.77,.385 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯈":{type:5,data:{d:"M.44,.425 L.44,.56 L.19,.685 L.26,.72 L.5,.605 L.62,.735 L.71,.71 L.56,.56 L.56,.425 Z M.23,.385 L.18,.43 L.77,.575 L.81,.53 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯉":{type:5,data:{d:"M.44,.425 L.45,.495 L.15,.645 L.34,.645 L.34,.7 L.44,.7 L.44,.645 L.56,.645 L.56,.7 L.66,.7 L.66,.645 L.84,.645 L.54,.495 L.56,.425 Z M.39,.6 L.5,.55 L.60,.6 Z M.17,.46 L.17,.51 L.83,.51 L.83,.46 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯊":{type:5,data:{d:"M.26,.375 L.5,.255 L.74,.375 L.74,.665 L.5,.55 L.26,.665 Z M.37,.395 L.37,.54 L.5,.475 L.63,.54 L.63,.395 L.5,.33 Z",type:0},scaleType:1},"🯋":{type:5,data:{d:"M.09,.41 L.32,.295 L.5,.375 L.68,.295 L.91,.41 L.75,.5 L.91,.59 L.68,.705 L.5,.625 L.32,.705 L.09,.59 L.25,.5 Z M.24,.41 L.39,.5 L.24,.59 L.32,.63 L.5,.555 L.68,.63 L.76,.59 L.61,.5 L.76,.41 L.68,.37 L.5,.445 L.32,.37 Z",type:0},scaleType:1},"🯌":{type:5,data:{d:"M.55,.305 L.88,.305 L.88,.355 L.65,.355 L.65,.47 L.88,.47 L.88,.52 L.55,.52 Z",type:0},scaleType:1},"🯍":{type:5,data:{d:"M.38,.39 L.5,.33 L.62,.39 L.62,.53 L.5,.47 L.38,.53 Z",type:0},scaleType:1},"🯎":{type:3,data:"M0,0 L0.6667,0 L0.6667,1 L0,1 Z"},"🯏":{type:3,data:"M0,0 L0.3333,0 L0.3333,1 L0,1 Z"},"🯐":{type:2,data:"M1,.5 L0,1",strokeWidth:1},"🯑":{type:2,data:"M1,0 L0,.5",strokeWidth:1},"🯒":{type:2,data:"M0,0 L1,.5",strokeWidth:1},"🯓":{type:2,data:"M0,.5 L1,1",strokeWidth:1},"🯔":{type:2,data:"M0,0 L.5,1",strokeWidth:1},"🯕":{type:2,data:"M.5,0 L1,1",strokeWidth:1},"🯖":{type:2,data:"M1,0 L.5,1",strokeWidth:1},"🯗":{type:2,data:"M.5,0 L0,1",strokeWidth:1},"🯘":{type:2,data:"M0,0 L.5,.5 L1,0",strokeWidth:1},"🯙":{type:2,data:"M1,0 L.5,.5 L1,1",strokeWidth:1},"🯚":{type:2,data:"M0,1 L.5,.5 L1,1",strokeWidth:1},"🯛":{type:2,data:"M0,0 L.5,.5 L0,1",strokeWidth:1},"🯜":{type:2,data:"M0,0 L.5,1 L1,0",strokeWidth:1},"🯝":{type:2,data:"M1,0 L0,.5 L1,1",strokeWidth:1},"🯞":{type:2,data:"M0,1 L.5,0 L1,1",strokeWidth:1},"🯟":{type:2,data:"M0,0 L1,.5 L0,1",strokeWidth:1},"🯠":{type:5,data:{d:"M0,0 C0,.276,.224,.5,.5,.5 C.776,.5,1,.276,1,0",type:1}},"🯡":{type:5,data:{d:"M1,0 C.724,0,.5,.224,.5,.5 C.5,.776,.724,1,1,1",type:1}},"🯢":{type:5,data:{d:"M0,1 C0,.724,.224,.5,.5,.5 C.776,.5,1,.724,1,1",type:1}},"🯣":{type:5,data:{d:"M0,0 C.276,0,.5,.224,.5,.5 C.5,.776,.276,1,0,1",type:1}},"🯤":{type:0,data:[{x:2,y:0,w:4,h:4}]},"🯥":{type:0,data:[{x:2,y:4,w:4,h:4}]},"🯦":{type:0,data:[{x:0,y:2,w:4,h:4}]},"🯧":{type:0,data:[{x:4,y:2,w:4,h:4}]},"🯨":{type:5,data:{d:"M0,0 C0,.276,.224,.5,.5,.5 C.776,.5,1,.276,1,0 Z",type:0}},"🯩":{type:5,data:{d:"M1,0 C.724,0,.5,.224,.5,.5 C.5,.776,.724,1,1,1 Z",type:0}},"🯪":{type:5,data:{d:"M0,1 C0,.724,.224,.5,.5,.5 C.776,.5,1,.724,1,1 Z",type:0}},"🯫":{type:5,data:{d:"M0,0 C.276,0,.5,.224,.5,.5 C.5,.776,.276,1,0,1 Z",type:0}},"🯬":{type:5,data:{d:"M1,0 L.5,0 C.5,.276,.724,.5,1,.5 Z",type:0}},"🯭":{type:5,data:{d:"M0,1 L.5,1 C.5,.724,.276,.5,0,.5 Z",type:0}},"🯮":{type:5,data:{d:"M1,1 L1,.5 C.724,.5,.5,.724,.5,1 Z",type:0}},"🯯":{type:5,data:{d:"M0,0 L0,.5 C.276,.5,.5,.276,.5,0 Z",type:0}},"🯰":{type:5,data:{d:el(126),type:0},scaleType:1},"🯱":{type:5,data:{d:el(48),type:0},scaleType:1},"🯲":{type:5,data:{d:el(109),type:0},scaleType:1},"🯳":{type:5,data:{d:el(121),type:0},scaleType:1},"🯴":{type:5,data:{d:el(51),type:0},scaleType:1},"🯵":{type:5,data:{d:el(91),type:0},scaleType:1},"🯶":{type:5,data:{d:el(95),type:0},scaleType:1},"🯷":{type:5,data:{d:el(114),type:0},scaleType:1},"🯸":{type:5,data:{d:el(127),type:0},scaleType:1},"🯹":{type:5,data:{d:el(123),type:0},scaleType:1},"🯺":{type:5,data:{d:"M.5,.175 C.2,.175,.15,.305,.15,.435 L.05,.63 L.35,.63 C.35,.682,.42,.76,.5,.76 C.58,.76,.65,.682,.65,.63 L.95,.63 L.85,.435 C.85,.305,.8,.175,.5,.175 Z",type:0},scaleType:1},...Object.fromEntries(Array.from({length:256},(e,t)=>[String.fromCodePoint(10240+t),{type:6,data:t}]))},uk=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function hr(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],n=[0,3/8,5/8];for(let a=0;a<3;a++){let l=e>>a*2&1,c=e>>a*2+1&1;l&&c?t.push(`M0,${n[a]} L1,${n[a]} L1,${n[a]+r[a]} L0,${n[a]+r[a]} Z`):l?t.push(`M0,${n[a]} L${.5},${n[a]} L${.5},${n[a]+r[a]} L0,${n[a]+r[a]} Z`):c&&t.push(`M${.5},${n[a]} L1,${n[a]} L1,${n[a]+r[a]} L${.5},${n[a]+r[a]} Z`)}return t.join(" ")}}}function el(e){let t=[];if(e&64){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.2125} L${r+.075},${.175} L${n-.075},${.175} L${n},${.2125} L${n-.075},${.25} L${r+.075},${.25} Z`)}if(e&32){let r=.7999999999999999,n=.95-.15/2,a=.95,l=.175+.075+.015,c=.5-.015;t.push(`M${n},${l} L${a},${l+.0375} L${a},${c-.0375} L${n},${c} L${r},${c-.0375} L${r},${l+.0375} Z`)}if(e&16){let r=.7999999999999999,n=.95-.15/2,a=.95,l=.5+.015,c=.825-.075-.015;t.push(`M${n},${l} L${a},${l+.0375} L${a},${c-.0375} L${n},${c} L${r},${c-.0375} L${r},${l+.0375} Z`)}if(e&8){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.7875} L${r+.075},${.75} L${n-.075},${.75} L${n},${.7875} L${n-.075},${.825} L${r+.075},${.825} Z`)}if(e&4&&t.push(`M${.125},${.515} L${.2},${.515+.0375} L${.2},${.735-.0375} L${.125},${.735} L${.05},${.735-.0375} L${.05},${.515+.0375} Z`),e&2&&t.push(`M${.125},${.265} L${.2},${.265+.0375} L${.2},${.485-.0375} L${.125},${.485} L${.05},${.485-.0375} L${.05},${.265+.0375} Z`),e&1){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.5} L${r+.075},${.4625} L${n-.075},${.4625} L${n},${.5} L${n-.075},${.5375} L${r+.075},${.5375} Z`)}return t.join(" ")}var Pi=0,mi=0,tl=!1,Sl=!1,Jd=!1,Ea,yu=0,dk=class{constructor(e,t,r,n,a,l){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=n,this._coreBrowserService=a,this._themeService=l,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,n,a){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,mi=0,Pi=0,Sl=!1,tl=!1,Jd=!1,Ea=this._themeService.colors,yu=0;let l=e.getCode();if(l!==0&&e.extended.underlineStyle===4){let c=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));yu=t*n%(Math.round(c)*2)}if(yu===0&&uk.has(l)&&(yu=t*n%2*2+r*a%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",c=>{c.backgroundColorRGB&&(mi=c.backgroundColorRGB.rgba>>8&16777215,Sl=!0),c.foregroundColorRGB&&(Pi=c.foregroundColorRGB.rgba>>8&16777215,tl=!0)}),Jd=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Jd){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:mi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:mi=(this.result.fg&16777215)<<8|255;break;default:mi=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:mi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:mi=(this.result.bg&16777215)<<8|255;break}mi=Gc.blend(mi,(this._coreBrowserService.isFocused?Ea.selectionBackgroundOpaque:Ea.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else mi=(this._coreBrowserService.isFocused?Ea.selectionBackgroundOpaque:Ea.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Sl=!0,Ea.selectionForeground&&(Pi=Ea.selectionForeground.rgba>>8&16777215,tl=!0),K3(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Pi=(this._coreBrowserService.isFocused?Ea.selectionBackgroundOpaque:Ea.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Pi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Pi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Pi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Pi=(this.result.fg&16777215)<<8|255;break;default:Pi=this._themeService.colors.foreground.rgba}Pi=Gc.blend(Pi,(this._coreBrowserService.isFocused?Ea.selectionBackgroundOpaque:Ea.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}tl=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",c=>{c.backgroundColorRGB&&(mi=c.backgroundColorRGB.rgba>>8&16777215,Sl=!0),c.foregroundColorRGB&&(Pi=c.foregroundColorRGB.rgba>>8&16777215,tl=!0)}),Sl&&(Jd?mi=e.bg&-16777216&-134217729|mi|50331648:mi=e.bg&-16777216|mi|50331648),tl&&(Pi=e.fg&-16777216&-67108865|Pi|50331648),this.result.fg&67108864&&(Sl&&!tl&&((this.result.bg&50331648)===0?Pi=this.result.fg&-134217728|Ea.background.rgba>>8&16777215&16777215|50331648:Pi=this.result.fg&-134217728|this.result.bg&67108863,tl=!0),!Sl&&tl&&((this.result.fg&50331648)===0?mi=this.result.bg&-67108864|Ea.foreground.rgba>>8&16777215&16777215|50331648:mi=this.result.bg&-67108864|this.result.fg&67108863,Sl=!0)),Ea=void 0,this.result.bg=Sl?mi:this.result.bg,this.result.fg=tl?Pi:this.result.fg,this.result.ext&=536870911,this.result.ext|=yu<<29&3758096384}},hk=.5,X3=X_||J_?"bottom":"ideographic",fk=typeof OffscreenCanvas>"u"?void 0:(e,t)=>new OffscreenCanvas(e,t),pk=(e,t)=>{let r=document.createElement("canvas");return r.width=e,r.height=t,r};function mk(e,t,r=fk,n=pk){return r?.(e,t)??n(e,t)}function gk(e,t,r,n,a,l,c,h,p,m,x,b,y=0){let w=ck[t];if(w){let C=Array.isArray(w)?w:[w];for(let S of C)xk(e,S,r,n,a,l,c,h,p,m,x,b,y);return!0}return!1}function xk(e,t,r,n,a,l,c,h,p,m,x,b,y=0){let w=a,C=l,S=r,I=n;switch(t.scaleType===1&&(w=c,C=h,S=r+(a-c)/2,I=n+(l-h)/2),t.clipPath&&(e.save(),Sk(e,t.clipPath,S,I,w,C)),t.type){case 0:bk(e,t.data,S,I,w,C);break;case 1:Tk(e,t.data,S,I,w,C,y);break;case 2:Ck(e,t.data,S,I,w,C,m,x,t.strokeWidth);break;case 3:yk(e,t.data,S,I,w,C,m,t.strokeWidth);break;case 4:Ak(e,t.data,S,I,w,C,m,b);break;case 5:Lk(e,t.data,S,I,w,C,p,m,x);break;case 6:vk(e,t.data,S,I,w,C);break}t.clipPath&&e.restore()}function bk(e,t,r,n,a,l){for(let c=0;c<t.length;c++){let h=t[c],p=a/8,m=l/8;e.fillRect(r+h.x*p,n+h.y*m,h.w*p,h.h*m)}}var k2=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function vk(e,t,r,n,a,l){let c=a/8,h=l*.1,p=l*.8/8,m=Math.min(c,p);for(let x=0;x<8;x++)if(t&1<<x){let b=k2[x*2],y=k2[x*2+1],w=r+(b+1)*c,C=n+h+(y+1)*p;e.beginPath(),e.arc(w,C,m,0,Math.PI*2),e.fill()}}function yk(e,t,r,n,a,l,c,h){let p=typeof t=="string"?t:t(0,0);e.beginPath();let m=0,x=0,b=0,y=0,w="";for(let C of p.split(" ")){let S=C[0],I=C.substring(1).split(",");if(S==="Z"){e.closePath(),w=S;continue}if(S==="V"){let Q=n+parseFloat(I[0])*l;e.lineTo(m,Q),x=Q,b=m,y=x,w=S;continue}if(S==="H"){let Q=r+parseFloat(I[0])*a;e.lineTo(Q,x),m=Q,b=m,y=x,w=S;continue}if(!I[0]||!I[1])continue;if(S==="A"){let Q=parseFloat(I[0])*a,W=parseFloat(I[1])*l,B=parseFloat(I[2])*Math.PI/180,U=parseInt(I[3],10),K=parseInt(I[4],10),re=r+parseFloat(I[5])*a,H=n+parseFloat(I[6])*l;wk(e,m,x,Q,W,B,U,K,re,H),m=re,x=H;continue}let N=I.map((Q,W)=>{let B=parseFloat(Q);return W%2===0?r+B*a:n+B*l});if(S==="M")e.moveTo(N[0],N[1]),m=N[0],x=N[1],b=m,y=x;else if(S==="L")e.lineTo(N[0],N[1]),m=N[0],x=N[1],b=m,y=x;else if(S==="Q")e.quadraticCurveTo(N[0],N[1],N[2],N[3]),b=N[0],y=N[1],m=N[2],x=N[3];else if(S==="T"){let Q,W;w==="Q"||w==="T"?(Q=2*m-b,W=2*x-y):(Q=m,W=x),e.quadraticCurveTo(Q,W,N[0],N[1]),b=Q,y=W,m=N[0],x=N[1]}else S==="C"&&(e.bezierCurveTo(N[0],N[1],N[2],N[3],N[4],N[5]),b=N[2],y=N[3],m=N[4],x=N[5]);w=S}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*h,e.stroke()):e.fill()}function wk(e,t,r,n,a,l,c,h,p,m){if(n===0||a===0){e.lineTo(p,m);return}n=Math.abs(n),a=Math.abs(a);let x=Math.cos(l),b=Math.sin(l),y=(t-p)/2,w=(r-m)/2,C=x*y+b*w,S=-b*y+x*w,I=n*n,N=a*a,Q=C*C,W=S*S,B=Q/I+W/N;if(B>1){let Be=Math.sqrt(B);n*=Be,a*=Be,I=n*n,N=a*a}let U=(I*N-I*W-N*Q)/(I*W+N*Q);U<0&&(U=0);let K=(c===h?-1:1)*Math.sqrt(U),re=K*(n*S/a),H=K*-(a*C/n),Oe=x*re-b*H+(t+p)/2,ne=b*re+x*H+(r+m)/2,ce=(C-re)/n,Ne=(S-H)/a,Me=(-C-re)/n,be=(-S-H)/a,V=Math.atan2(Ne,ce),Ke=Math.atan2(be,Me)-V;h===0&&Ke>0?Ke-=2*Math.PI:h===1&&Ke<0&&(Ke+=2*Math.PI);let he=V+Ke;e.ellipse(Oe,ne,n,a,l,V,he,h===0)}function Ak(e,t,r,n,a,l,c,h){e.save(),e.fillRect(r,n,a,l),h&&(e.fillStyle=h,e.strokeStyle=h),e.lineWidth=c,e.lineCap="square",e.beginPath();for(let p of t.d.split(" ")){let m=p[0],x=p.substring(1).split(",");if(!x[0]||!x[1]){m==="Z"&&e.closePath();continue}let b=x.map((y,w)=>{let C=parseFloat(y);return w%2===0?r+C*a:n+C*l});m==="M"?e.moveTo(b[0],b[1]):m==="L"&&e.lineTo(b[0],b[1])}t.type===1?e.stroke():e.fill(),e.restore()}var I2=new Map;function Tk(e,t,r,n,a,l,c=0){let h=I2.get(t);h||(h=new Map,I2.set(t,h));let p=e.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let m=h.get(p);if(!m){let y=t[0].length,w=t.length,C=mk(y,w),S=Ys(C.getContext("2d")),I=new ImageData(y,w),N,Q,W,B;if(p.startsWith("#"))N=parseInt(p.slice(1,3),16),Q=parseInt(p.slice(3,5),16),W=parseInt(p.slice(5,7),16),B=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[N,Q,W,B]=p.substring(5,p.length-1).split(",").map(U=>parseFloat(U));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let U=0;U<w;U++)for(let K=0;K<y;K++)I.data[(U*y+K)*4]=N,I.data[(U*y+K)*4+1]=Q,I.data[(U*y+K)*4+2]=W,I.data[(U*y+K)*4+3]=t[U][K]*(B*255);S.putImageData(I,0,0),m=Ys(e.createPattern(C,null)),h.set(p,m)}let x=c>>1&1,b=c&1;x!==0||b!==0?m.setTransform(new DOMMatrix().translateSelf(-x,-b)):m.setTransform(new DOMMatrix),e.fillStyle=m,e.fillRect(r,n,a,l)}function Ck(e,t,r,n,a,l,c,h,p){e.save(),e.beginPath(),e.rect(r,n,a,l),e.clip(),e.beginPath();let m;if(typeof t=="function"){let b=.15/l*a;m=t(.15,b)}else m=t;let x={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let b of m.split(" ")){let y=b[0];if(y==="Z"){e.closePath(),x.lastCommand=y;continue}let w=J3[y];if(!w){h.error(`Could not find drawing instructions for "${y}"`);continue}let C=b.substring(1).split(",");!C[0]||!C[1]||(w(e,e6(C,a,l,r,n,!0,c,0,0,!1),x),x.lastCommand=y)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function Sk(e,t,r,n,a,l){e.beginPath();for(let c of t.split(" ")){let h=c[0];if(h==="Z"){e.closePath();continue}let p=c.substring(1).split(",");if(!p[0]||!p[1])continue;let m=r+parseFloat(p[0])*a,x=n+parseFloat(p[1])*l;h==="M"?e.moveTo(m,x):h==="L"&&e.lineTo(m,x)}e.clip()}function Lk(e,t,r,n,a,l,c,h,p){let m=new Path2D;m.rect(r,n,a,l),e.clip(m),e.beginPath();let x=c/12;e.lineWidth=h*x;let b={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let y of t.d.split(" ")){let w=y[0];if(w==="Z"){e.closePath(),b.lastCommand=w;continue}let C=J3[w];if(!C){p.error(`Could not find drawing instructions for "${w}"`);continue}let S=y.substring(1).split(",");!S[0]||!S[1]||(C(e,e6(S,a,l,r,n,!1,h,(t.leftPadding??0)*(x/2),(t.rightPadding??0)*(x/2)),b),b.lastCommand=w)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function E2(e,t,r=0){return Math.max(Math.min(e,t),r)}var J3={C:(e,t,r)=>{e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),r.lastControlX=t[2],r.lastControlY=t[3],r.currentX=t[4],r.currentY=t[5]},L:(e,t,r)=>{e.lineTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},M:(e,t,r)=>{e.moveTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},Q:(e,t,r)=>{e.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.lastControlX=t[0],r.lastControlY=t[1],r.currentX=t[2],r.currentY=t[3]},T:(e,t,r)=>{let n,a;r.lastCommand==="Q"||r.lastCommand==="T"?(n=2*r.currentX-r.lastControlX,a=2*r.currentY-r.lastControlY):(n=r.currentX,a=r.currentY),e.quadraticCurveTo(n,a,t[0],t[1]),r.lastControlX=n,r.lastControlY=a,r.currentX=t[0],r.currentY=t[1]}};function e6(e,t,r,n,a,l,c,h=0,p=0,m=!0){let x=e.map(b=>parseFloat(b)||parseInt(b));if(x.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<x.length;b+=2){if(x[b]*=t-h*c-p*c,l&&x[b]!==0){let y=Math.round(x[b]+.5)-.5;x[b]=m?E2(y,t,0):y}x[b]+=n+h*c}for(let b=1;b<x.length;b+=2){if(x[b]*=r,l&&x[b]!==0){let y=Math.round(x[b]+.5)-.5;x[b]=m?E2(y,r,0):y}x[b]+=a}return x}var N2=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},R2=class{constructor(){this._data=new N2}set(e,t,r,n,a){this._data.get(e,t)||this._data.set(e,t,new N2),this._data.get(e,t).set(r,n,a)}get(e,t,r,n){return this._data.get(e,t)?.get(r,n)}clear(){this._data.clear()}},t6=class{constructor(e){this._tasks=[],this._i=0,this._logService=e}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t,r=0,n=e.timeRemaining(),a;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),a=e.timeRemaining(),r*1.5>a){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=a}this.clear()}},_k=class extends t6{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let r=performance.now()+t;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},kk=class extends t6{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Ik="requestIdleCallback"in globalThis?kk:_k,E0=class r6{constructor(){this.fg=0,this.bg=0,this.extended=new n6}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new r6;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},n6=class s6{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new s6(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.payload===void 0}},Ho=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return ci(()=>{});let a={fn:t,thisArgs:r};this._listeners=this._listeners.slice(),this._listeners.push(a);let l=ci(()=>{let c=this._listeners.indexOf(a);c!==-1&&(this._listeners=this._listeners.slice(),this._listeners.splice(c,1))});return n&&(Array.isArray(n)?n.push(l):n.add(l)),l},this._event)}fire(t){if(this._disposed||!this._listeners.length)return;if(this._listeners.length===1){this._listeners[0].fn.call(this._listeners[0].thisArgs,t);return}let r=this._listeners;for(let n=0,a=r.length;n<a;++n)r[n].fn.call(r[n].thisArgs,t)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},zc;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,m)=>l(x=>h.call(p,c(x)),void 0,m)}e.map=r;function n(...l){return(c,h,p)=>{let m=new V3;for(let x of l)m.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(m):p.add(m)),m}}e.any=n;function a(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=a})(zc||={});var M2={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},wu=2,Au,uc=class dc{constructor(t,r,n,a){this._document=t,this._config=r,this._unicodeService=n,this._logService=a,this._didWarmUp=!1,this._cacheMap=new R2,this._cacheMapCombined=new R2,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new E0,this._textureSize=512,this._onAddTextureAtlasCanvas=new Ho,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Ho,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._pageLayoutVersion=0,this._createNewPage(),this._tmpCanvas=a6(t,this._config.deviceCellWidth*4+wu*2,this._config.deviceCellHeight+wu*2),this._tmpCtx=Ys(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose(),this._onRemoveTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new Ik(this._logService);for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let n=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,n)}})}get pageLayoutVersion(){return this._pageLayoutVersion}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1,this._pageLayoutVersion++}}_createNewPage(){if(dc.maxAtlasPages&&this._pages.length>=Math.max(4,dc.maxAtlasPages)){let r=this._pages.filter(m=>m.canvas.width*2<=(dc.maxTextureSize||4096)).sort((m,x)=>x.canvas.width!==m.canvas.width?x.canvas.width-m.canvas.width:x.percentageUsed-m.percentageUsed),n=-1,a=0;for(let m=0;m<r.length;m++)if(r[m].canvas.width!==a)n=m,a=r[m].canvas.width;else if(m-n===3)break;let l=r.slice(n,n+4);if(l.length<4||l.some(m=>m.canvas.width!==l[0].canvas.width)){this._evictAllPages();let m=new jc(this._document,this._textureSize);return this._pages.push(m),this._activePages.push(m),this._onAddTextureAtlasCanvas.fire(m.canvas),m}let c=l.map(m=>m.glyphs[0].texturePage).sort((m,x)=>m-x),h=this.pages.length-l.length,p=this._mergePages(l,h);p.version=++jc.nextVersion;for(let m=c.length-1;m>=0;m--)this._deletePage(c[m]);this.pages.push(p),this._pageLayoutVersion++,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new jc(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let n=t[0].canvas.width*2,a=new jc(this._document,n,t);for(let[l,c]of t.entries()){let h=l*c.canvas.width%n,p=Math.floor(l/2)*c.canvas.height;a.ctx.drawImage(c.canvas,h,p);for(let x of c.glyphs)x.texturePage=r,x.sizeClipSpace.x=x.size.x/n,x.sizeClipSpace.y=x.size.y/n,x.texturePosition.x+=h,x.texturePosition.y+=p,x.texturePositionClipSpace.x=x.texturePosition.x/n,x.texturePositionClipSpace.y=x.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let m=this._activePages.indexOf(c);m!==-1&&this._activePages.splice(m,1)}return a}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let n=this._pages[r];for(let a of n.glyphs)a.texturePage--;n.version=++jc.nextVersion}}_evictAllPages(){let t=performance.now(),r=this._pages.length;for(let n of this._pages)this._onRemoveTextureAtlasCanvas.fire(n.canvas),n.canvas.remove();this._pages.length=0,this._activePages.length=0,this._overflowSizePage=void 0,this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1,this._pageLayoutVersion++,this._logService.debug(`Evicted ${r} WebGL atlas pages in ${(performance.now()-t).toFixed(2)}ms`)}getRasterizedGlyphCombinedChar(t,r,n,a,l,c){return this._getFromCacheMap(this._cacheMapCombined,t,r,n,a,l,c)}getRasterizedGlyph(t,r,n,a,l,c){return this._getFromCacheMap(this._cacheMap,t,r,n,a,l,c)}_getFromCacheMap(t,r,n,a,l,c,h){return Au=t.get(r,n,a,l),Au||(Au=this._drawToCache(r,n,a,l,c,h),t.set(r,n,a,l,Au)),Au}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,n,a){if(this._config.allowTransparency)return yo;let l;switch(t){case 16777216:case 33554432:l=this._getColorFromAnsiIndex(r);break;case 50331648:let c=E0.toColorRGB(r);l=ya.toColor(c[0],c[1],c[2]);break;default:n?l=Gu.opaque(this._config.colors.foreground):l=this._config.colors.background;break}return this._config.allowTransparency||(l=Gu.opaque(l)),l}_getForegroundColor(t,r,n,a,l,c,h,p,m,x){let b=this._getMinimumContrastColor(t,r,n,a,l,c,h,m,p,x);if(b)return b;let y;switch(l){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&m&&c<8&&(c+=8),y=this._getColorFromAnsiIndex(c);break;case 50331648:let w=E0.toColorRGB(c);y=ya.toColor(w[0],w[1],w[2]);break;default:h?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=Gu.opaque(y)),p&&(y=Gu.multiplyOpacity(y,hk)),y}_resolveBackgroundRgba(t,r,n){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,n,a){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&a&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,n,a,l,c,h,p,m,x){if(this._config.minimumContrastRatio===1||x)return;let b=this._getContrastCache(m),y=b.getColor(t,a);if(y!==void 0)return y??void 0;let w=this._resolveBackgroundRgba(r,n,h),C=this._resolveForegroundRgba(l,c,h,p),S=Gc.ensureContrastRatio(w,C,this._config.minimumContrastRatio/(m?2:1));if(!S){b.setColor(t,a,null);return}let I=ya.toColor(S>>24&255,S>>16&255,S>>8&255);return b.setColor(t,a,I),I}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,n,a,l,c){let h=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+wu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let m=Math.min(this._config.deviceCellHeight+wu*4,this._textureSize);if(this._tmpCanvas.height<m&&(this._tmpCanvas.height=m),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=a,!!this._workAttributeData.isInvisible())return M2;let x=!!this._workAttributeData.isBold(),b=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),w=!!this._workAttributeData.isItalic(),C=!!this._workAttributeData.isUnderline(),S=!!this._workAttributeData.isStrikethrough(),I=!!this._workAttributeData.isOverline(),N=this._workAttributeData.getFgColor(),Q=this._workAttributeData.getFgColorMode(),W=this._workAttributeData.getBgColor(),B=this._workAttributeData.getBgColorMode();if(b){let X=N;N=W,W=X;let He=Q;Q=B,B=He}let U=this._getBackgroundColor(B,W,b,y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=U.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let K=x?this._config.fontWeightBold:this._config.fontWeight,re=w?"italic":"";this._tmpCtx.font=`${re} ${K} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=X3;let H=h.length===1&&j1(h.charCodeAt(0)),Oe=h.length===1&&rk(h.charCodeAt(0)),ne=this._getForegroundColor(r,B,W,n,Q,N,b,y,x,K3(h.charCodeAt(0)));this._tmpCtx.fillStyle=ne.css;let ce=Oe?0:wu*2,Ne=!1;if(this._config.customGlyphs!==!1){let X=this._workAttributeData.getUnderlineVariantOffset();Ne=gk(this._tmpCtx,h,ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,U.css,X)}let Me=!H,be;if(typeof t=="number"?be=this._unicodeService.wcwidth(t):be=this._unicodeService.getStringCellWidth(t),C){this._tmpCtx.save();let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),He=X%2===1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Me=!1,this._tmpCtx.strokeStyle=`rgb(${E0.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Me=!1;let nt=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&nt<8&&(nt+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(nt).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let je=ce,ve=Math.ceil(ce+this._config.deviceCharHeight)-He-(l?X*2:0),Fe=ve+X*2,lt=this._workAttributeData.getUnderlineVariantOffset(),ye=0,de=0;for(let nt=0;nt<be;nt++){let Xe=!1;this._tmpCtx.save(),ye=ve,de=Fe;let pt=je+nt*this._config.deviceCellWidth,xe=je+(nt+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(pt,ve),this._tmpCtx.lineTo(xe,ve),this._tmpCtx.moveTo(pt,Fe),this._tmpCtx.lineTo(xe,Fe);break;case 3:ye=this._config.deviceCharHeight+1,de=ye+3*this._config.devicePixelRatio;let mt=new Path2D;mt.rect(pt,ye,this._config.deviceCellWidth,de-ye),this._tmpCtx.clip(mt);let It=this._config.deviceCellWidth,At=de-ye,Nt=It/6,oe=At/3,F=[[0,2,1,3,2.4,3,0,.6],[5.5,0,2.5,3,1.1,3,4.1,0],[4,0,6,2,6,.6,5.4,0]];for(let Lt of F){this._tmpCtx.beginPath();for(let Lr=0;Lr<Lt.length;Lr+=2){let Qr=pt+Lt[Lr]*Nt,Pt=de-Lt[Lr+1]*oe;Lr===0?this._tmpCtx.moveTo(Qr,Pt):this._tmpCtx.lineTo(Qr,Pt)}this._tmpCtx.closePath(),this._tmpCtx.fill()}Xe=!0;break;case 4:let we=lt===0?0:lt>=X?X*2-lt:X-lt;lt>=X||we===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(pt+we,ve),this._tmpCtx.lineTo(xe,ve)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(pt,ve),this._tmpCtx.lineTo(pt+we,ve),this._tmpCtx.moveTo(pt+we+X,ve),this._tmpCtx.lineTo(xe,ve)),lt=lk(xe-pt,X,lt);break;case 5:let Qe=.6,tt=.3,it=xe-pt,Rt=Math.floor(Qe*it),Xt=Math.floor(tt*it),Zt=it-Rt-Xt;this._tmpCtx.setLineDash([Rt,Xt,Zt]),this._tmpCtx.moveTo(pt,ve),this._tmpCtx.lineTo(xe,ve);break;default:this._tmpCtx.moveTo(pt,ve),this._tmpCtx.lineTo(xe,ve);break}Xe||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Ne&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let nt=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in nt&&nt.actualBoundingBoxDescent>0){this._tmpCtx.save();let Xe=new Path2D;Xe.rect(je,ye-Math.ceil(X/2),this._config.deviceCellWidth*be,de-ye+Math.ceil(X/2)),this._tmpCtx.clip(Xe),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=U.css,this._tmpCtx.strokeText(h,ce,ce+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(I){let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),He=X%2===1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ce,ce+He),this._tmpCtx.lineTo(ce+this._config.deviceCharWidth*be,ce+He),this._tmpCtx.stroke()}if(Ne||this._tmpCtx.fillText(h,ce,ce+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let X=Ap(this._tmpCtx.getImageData(ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight),U,ne,Me);if(X)for(let He=1;He<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=U.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,ce,ce+this._config.deviceCharHeight-He),X=Ap(this._tmpCtx.getImageData(ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight),U,ne,Me),!!X);He++);}if(S){let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),He=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ce,ce+Math.floor(this._config.deviceCharHeight/2)-He),this._tmpCtx.lineTo(ce+this._config.deviceCharWidth*be,ce+Math.floor(this._config.deviceCharHeight/2)-He),this._tmpCtx.stroke()}this._tmpCtx.restore();let V=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),Ke;if(this._config.allowTransparency?Ke=Ek(V):Ke=Ap(V,U,ne,Me),Ke)return M2;let he=this._findGlyphBoundingBox(V,this._workBoundingBox,p,Oe,Ne,ce),Be,ae;for(;;){if(this._activePages.length===0){let X=this._createNewPage();Be=X,ae=X.currentRow,ae.height=he.size.y;break}Be=this._activePages[this._activePages.length-1],ae=Be.currentRow;for(let X of this._activePages)he.size.y<=X.currentRow.height&&(Be=X,ae=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(let He of this._activePages[X].fixedRows)He.height<=ae.height&&he.size.y<=He.height&&(Be=this._activePages[X],ae=He);if(he.size.x>this._textureSize){this._overflowSizePage||(dc.maxAtlasPages&&this._pages.length>=dc.maxAtlasPages&&this._evictAllPages(),this._overflowSizePage=new jc(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._pageLayoutVersion++,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),Be=this._overflowSizePage,ae=this._overflowSizePage.currentRow,ae.x+he.size.x>=Be.canvas.width&&(ae.x=0,ae.y+=ae.height,ae.height=0);break}if(ae.y+he.size.y>=Be.canvas.height||ae.height>he.size.y+2){let X=!1;if(Be.currentRow.y+Be.currentRow.height+he.size.y>=Be.canvas.height){let He;for(let je of this._activePages)if(je.currentRow.y+je.currentRow.height+he.size.y<je.canvas.height){He=je;break}if(He)Be=He;else if(dc.maxAtlasPages&&this._pages.length>=dc.maxAtlasPages&&ae.y+he.size.y<=Be.canvas.height&&ae.height>=he.size.y&&ae.x+he.size.x<=Be.canvas.width)X=!0;else{let je=this._createNewPage();Be=je,ae=je.currentRow,ae.height=he.size.y,X=!0}}X||(Be.currentRow.height>0&&Be.fixedRows.push(Be.currentRow),ae={x:0,y:Be.currentRow.y+Be.currentRow.height,height:he.size.y},Be.fixedRows.push(ae),Be.currentRow={x:0,y:ae.y+ae.height,height:0})}if(ae.x+he.size.x<=Be.canvas.width)break;ae===Be.currentRow?(ae.x=0,ae.y+=ae.height,ae.height=0):Be.fixedRows.splice(Be.fixedRows.indexOf(ae),1)}return he.texturePage=this._pages.indexOf(Be),he.texturePosition.x=ae.x,he.texturePosition.y=ae.y,he.texturePositionClipSpace.x=ae.x/Be.canvas.width,he.texturePositionClipSpace.y=ae.y/Be.canvas.height,he.sizeClipSpace.x/=Be.canvas.width,he.sizeClipSpace.y/=Be.canvas.height,ae.height=Math.max(ae.height,he.size.y),ae.x+=he.size.x,Be.ctx.putImageData(V,he.texturePosition.x-this._workBoundingBox.left,he.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,he.size.x,he.size.y),Be.addGlyph(he),Be.version=++jc.nextVersion,he}_findGlyphBoundingBox(t,r,n,a,l,c){r.top=0;let h=a?this._config.deviceCellHeight:this._tmpCanvas.height,p=a?this._config.deviceCellWidth:n,m=!1;for(let x=0;x<h;x++){for(let b=0;b<p;b++){let y=x*this._tmpCanvas.width*4+b*4+3;if(t.data[y]!==0){r.top=x,m=!0;break}}if(m)break}r.left=0,m=!1;for(let x=0;x<c+p;x++){for(let b=0;b<h;b++){let y=b*this._tmpCanvas.width*4+x*4+3;if(t.data[y]!==0){r.left=x,m=!0;break}}if(m)break}r.right=p,m=!1;for(let x=c+p-1;x>=c;x--){for(let b=0;b<h;b++){let y=b*this._tmpCanvas.width*4+x*4+3;if(t.data[y]!==0){r.right=x,m=!0;break}}if(m)break}r.bottom=h,m=!1;for(let x=h-1;x>=0;x--){for(let b=0;b<p;b++){let y=x*this._tmpCanvas.width*4+b*4+3;if(t.data[y]!==0){r.bottom=x,m=!0;break}}if(m)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+c+(a||l?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+c+(a||l?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},i6=class Rm{constructor(t,r,n){if(this._usedPixels=0,this._glyphs=[],this.version=++Rm.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=a6(t,r,r),this.ctx=Ys(this.canvas.getContext("2d",{alpha:!0})),n)if(n.length===4)this._glyphs=this._glyphs.concat(n[0].glyphs,n[1].glyphs,n[2].glyphs,n[3].glyphs),this._usedPixels=n[0]._usedPixels+n[1]._usedPixels+n[2]._usedPixels+n[3]._usedPixels;else for(let a=0;a<n.length;++a)this._glyphs=this._glyphs.concat(n[a].glyphs),this._usedPixels+=n[a]._usedPixels}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version=++Rm.nextVersion}};i6.nextVersion=0;var jc=i6;function Ap(e,t,r,n){let a=t.rgba>>>24,l=t.rgba>>>16&255,c=t.rgba>>>8&255,h=r.rgba>>>24,p=r.rgba>>>16&255,m=r.rgba>>>8&255,x=Math.floor((Math.abs(a-h)+Math.abs(l-p)+Math.abs(c-m))/12),b=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===a&&e.data[y+1]===l&&e.data[y+2]===c||n&&Math.abs(e.data[y]-a)+Math.abs(e.data[y+1]-l)+Math.abs(e.data[y+2]-c)<x?e.data[y+3]=0:b=!1;return b}function Ek(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function a6(e,t,r){let n=e.createElement("canvas");return n.width=t,n.height=r,n}function Nk(e,t,r,n,a,l,c,h,p=!0){let m={foreground:l.foreground,background:l.background,cursor:yo,cursorAccent:yo,selectionForeground:yo,selectionBackgroundTransparent:yo,selectionBackgroundOpaque:yo,selectionInactiveBackgroundTransparent:yo,selectionInactiveBackgroundOpaque:yo,overviewRulerBorder:yo,scrollbarSliderBackground:yo,scrollbarSliderHoverBackground:yo,scrollbarSliderActiveBackground:yo,ansi:l.ansi.slice(),contrastCache:l.contrastCache,halfContrastCache:l.halfContrastCache};return{customGlyphs:p,devicePixelRatio:c,deviceMaxTextureSize:h,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:n,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:m}}function j2(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.deviceMaxTextureSize===t.deviceMaxTextureSize&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCellWidth===t.deviceCellWidth&&e.deviceCellHeight===t.deviceCellHeight&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function Rk(e){return(e&50331648)===16777216||(e&50331648)===33554432}var To=[];function o6(e,t,r,n,a,l,c,h,p,m=!0){let x=Nk(n,a,l,c,t,r,h,p,m);for(let C=0;C<To.length;C++){let S=To[C],I=S.ownedBy.indexOf(e);if(I>=0){if(j2(S.config,x))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),To.splice(C,1)):S.ownedBy.splice(I,1);break}}for(let C=0;C<To.length;C++){let S=To[C];if(j2(S.config,x))return S.ownedBy.push(e),S.atlas}let b=e._core,y=b._logService,w={atlas:new uc(document,x,b.unicodeService,y),config:x,ownedBy:[e]};return To.push(w),w.atlas}function D2(e){for(let t=0;t<To.length;t++){let r=To[t].ownedBy.indexOf(e);if(r!==-1){To[t].ownedBy.length===1?(To[t].atlas.dispose(),To.splice(t,1)):To[t].ownedBy.splice(r,1);break}}}var Mk=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._isIdlePaused=!1,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&(this._restartInterval(),this._resetIdleTimer())}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}restartBlinkAnimation(){this._isIdlePaused&&this._resetIdleTimer(),!this.isPaused&&(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},e)}pause(){this.isCursorVisible=!0,this._isIdlePaused=!1,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this._resetIdleTimer(),this.restartBlinkAnimation()}_resetIdleTimer(){this._isIdlePaused=!1,this._idleTimeout&&this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_stopBlinkingDueToIdle(){this.isCursorVisible=!0,this._isIdlePaused=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0,this._renderCallback()}};function Q2(e,t,r){let n=new t.ResizeObserver(a=>{let l=a.find(p=>p.target===e);if(!l)return;if(!("devicePixelContentBoxSize"in l)){n?.disconnect(),n=void 0;return}let c=l.devicePixelContentBoxSize[0].inlineSize,h=l.devicePixelContentBoxSize[0].blockSize;c>0&&h>0&&r(c,h)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return ci(()=>n?.disconnect())}function jk(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Dk=class l6 extends E0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n6,this.combinedData=""}static fromCharData(t){let r=new l6;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?jk(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(n-55296)*1024+a-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(t){if(this.getFgColorMode()!==t.getFgColorMode()||this.getFgColor()!==t.getFgColor()||this.getBgColorMode()!==t.getBgColorMode()||this.getBgColor()!==t.getBgColor()||this.isInverse()!==t.isInverse()||this.isBold()!==t.isBold()||this.isUnderline()!==t.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=this.isUnderlineColorDefault(),n=t.isUnderlineColorDefault();if(!(r&&n)&&(r!==n||this.getUnderlineColor()!==t.getUnderlineColor()||this.getUnderlineColorMode()!==t.getUnderlineColorMode()))return!1}return!(this.isOverline()!==t.isOverline()||this.isBlink()!==t.isBlink()||this.isInvisible()!==t.isInvisible()||this.isItalic()!==t.isItalic()||this.isDim()!==t.isDim()||this.isStrikethrough()!==t.isStrikethrough())}},Qk=class extends Xc{constructor(e,t,r){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=r,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",n=>{this.setIntervalDuration(n)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(ci(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(this._interval!==void 0)return;let e=this._blinkOn;this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),e||this._renderCallback();return}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){this._interval!==void 0&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},c6=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function u6(e,t,r,n){let a=Ys(e.createProgram());if(e.attachShader(a,Ys(B2(e,e.VERTEX_SHADER,t,n))),e.attachShader(a,Ys(B2(e,e.FRAGMENT_SHADER,r,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;n.error(e.getProgramInfoLog(a)),e.deleteProgram(a)}function B2(e,t,r,n){let a=Ys(e.createShader(t));if(e.shaderSource(a,r),e.compileShader(a),e.getShaderParameter(a,e.COMPILE_STATUS))return a;n.error(e.getShaderInfoLog(a)),e.deleteShader(a)}function Bk(e,t){let r=Math.min(e.length*2,t),n=new Float32Array(r);for(let a=0;a<e.length;a++)n[a]=e[a];return n}var Pk=class{constructor(t){this.texture=t,this.version=-1}},Ok=`#version 300 es
61
+ layout (location = 0) in vec2 a_unitquad;
62
+ layout (location = 1) in vec2 a_cellpos;
63
+ layout (location = 2) in vec2 a_offset;
64
+ layout (location = 3) in vec2 a_size;
65
+ layout (location = 4) in float a_texpage;
66
+ layout (location = 5) in vec2 a_texcoord;
67
+ layout (location = 6) in vec2 a_texsize;
68
+
69
+ uniform mat4 u_projection;
70
+ uniform vec2 u_resolution;
71
+
72
+ out vec2 v_texcoord;
73
+ flat out int v_texpage;
74
+
75
+ void main() {
76
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
77
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
78
+ v_texpage = int(a_texpage);
79
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
80
+ }`;function Fk(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
81
+ precision lowp float;
82
+
83
+ in vec2 v_texcoord;
84
+ flat in int v_texpage;
85
+
86
+ uniform sampler2D u_texture[${e}];
87
+
88
+ out vec4 outColor;
89
+
90
+ void main() {
91
+ if (v_texpage == 0) {
92
+ outColor = texture(u_texture[0], v_texcoord);
93
+ } ${t}
94
+ }`}var Rs=0,gs,Tp=0,Tu=0,$k=class extends Xc{constructor(t,r,n,a,l){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._optionsService=a,this._logService=l,this._lastSeenPageLayoutVersion=-1,this._pageOverflowWarned=!1,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let c=this._gl;uc.maxAtlasPages===void 0&&(uc.maxAtlasPages=Math.min(32,Ys(c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS))),uc.maxTextureSize=Ys(c.getParameter(c.MAX_TEXTURE_SIZE))),this._program=Ys(u6(c,Ok,Fk(uc.maxAtlasPages),this._logService)),this._register(ci(()=>c.deleteProgram(this._program))),this._projectionLocation=Ys(c.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ys(c.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ys(c.getUniformLocation(this._program,"u_texture"));let h=this._vertexArrayObject=c.createVertexArray();this._register(ci(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),m=c.createBuffer();this._register(ci(()=>c.deleteBuffer(m))),c.bindBuffer(c.ARRAY_BUFFER,m),c.bufferData(c.ARRAY_BUFFER,p,c.STATIC_DRAW),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=c.createBuffer();this._register(ci(()=>c.deleteBuffer(b))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Ys(c.createBuffer()),this._register(ci(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,2,c.FLOAT,!1,44,0),c.vertexAttribDivisor(2,1),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,c.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(3,1),c.enableVertexAttribArray(4),c.vertexAttribPointer(4,1,c.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(4,1),c.enableVertexAttribArray(5),c.vertexAttribPointer(5,2,c.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(5,1),c.enableVertexAttribArray(6),c.vertexAttribPointer(6,2,c.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(6,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.useProgram(this._program);let y=new Int32Array(uc.maxAtlasPages);for(let w=0;w<uc.maxAtlasPages;w++)y[w]=w;c.uniform1iv(this._textureLocation,y),c.uniformMatrix4fv(this._projectionLocation,!1,c6),this._atlasTextures=[];for(let w=0;w<uc.maxAtlasPages;w++){let C=new Pk(Ys(c.createTexture()));this._register(ci(()=>c.deleteTexture(C.texture))),c.activeTexture(c.TEXTURE0+w),c.bindTexture(c.TEXTURE_2D,C.texture),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,1,1,0,c.RGBA,c.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[w]=C}c.enable(c.BLEND),c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.pageLayoutVersion!==this._lastSeenPageLayoutVersion?(this._lastSeenPageLayoutVersion=this._atlas.pageLayoutVersion,!0):!1:!0}updateCell(t,r,n,a,l,c,h,p,m){this._updateCell(this._vertices.attributes,t,r,n,a,l,c,h,p,m)}_updateCell(t,r,n,a,l,c,h,p,m,x){if(Rs=(n*this._terminal.cols+r)*11,a===0||a===void 0){t.fill(0,Rs,Rs+11-1-2);return}this._atlas&&(p&&p.length>1?gs=this._atlas.getRasterizedGlyphCombinedChar(p,l,c,h,!1,this._terminal.element):gs=this._atlas.getRasterizedGlyph(a,l,c,h,!1,this._terminal.element),Tp=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),l!==x&&gs.offset.x>Tp?(Tu=gs.offset.x-Tp,t[Rs]=-(gs.offset.x-Tu)+this._dimensions.device.char.left,t[Rs+1]=-gs.offset.y+this._dimensions.device.char.top,t[Rs+2]=(gs.size.x-Tu)/this._dimensions.device.canvas.width,t[Rs+3]=gs.size.y/this._dimensions.device.canvas.height,t[Rs+4]=gs.texturePage,t[Rs+5]=gs.texturePositionClipSpace.x+Tu/this._atlas.pages[gs.texturePage].canvas.width,t[Rs+6]=gs.texturePositionClipSpace.y,t[Rs+7]=gs.sizeClipSpace.x-Tu/this._atlas.pages[gs.texturePage].canvas.width,t[Rs+8]=gs.sizeClipSpace.y):(t[Rs]=-gs.offset.x+this._dimensions.device.char.left,t[Rs+1]=-gs.offset.y+this._dimensions.device.char.top,t[Rs+2]=gs.size.x/this._dimensions.device.canvas.width,t[Rs+3]=gs.size.y/this._dimensions.device.canvas.height,t[Rs+4]=gs.texturePage,t[Rs+5]=gs.texturePositionClipSpace.x,t[Rs+6]=gs.texturePositionClipSpace.y,t[Rs+7]=gs.sizeClipSpace.x,t[Rs+8]=gs.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&ak(a,m,gs.size.x,this._dimensions.device.cell.width)&&(t[Rs+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*11;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count!==r?this._vertices.attributesBuffers[n]=new Float32Array(r):this._vertices.attributesBuffers[n].fill(0);this._vertices.count=r,n=0;for(let a=0;a<t.rows;a++)for(let l=0;l<t.cols;l++)this._vertices.attributes[n+9]=l/t.cols,this._vertices.attributes[n+10]=a/t.rows,n+=11}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),t.uniform2f(this._resolutionLocation,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],a=0;for(let c=0;c<t.lineLengths.length;c++){let h=c*this._terminal.cols*11,p=this._vertices.attributes.subarray(h,h+t.lineLengths[c]*11);n.set(p,a),a+=p.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,n.subarray(0,a),r.STREAM_DRAW);let l=Math.min(this._atlas.pages.length,this._atlasTextures.length);this._atlas.pages.length>this._atlasTextures.length&&!this._pageOverflowWarned&&(this._pageOverflowWarned=!0,this._logService.warn(`Atlas page count (${this._atlas.pages.length}) exceeds the renderer's texture capacity (${this._atlasTextures.length}), some glyphs will not render correctly`));for(let c=0;c<l;c++)this._atlas.pages[c].version!==this._atlasTextures[c].version&&this._bindAtlasPageTexture(r,this._atlas,c);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,a/11)}setAtlas(t){this._atlas=t,this._lastSeenPageLayoutVersion=-1,this.invalidateAtlasTextures()}invalidateAtlasTextures(){for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(t,r,n){t.activeTexture(t.TEXTURE0+n),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[n].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[n].canvas),this._atlasTextures[n].version=r.pages[n].version}setDimensions(t){this._dimensions=t}},Uk=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,r,n,a=!1){if(this.selectionStart=r,this.selectionEnd=n,!r||!n||r[0]===n[0]&&r[1]===n[1]){this.clear();return}let l=t.buffers.active.ydisp,c=r[1]-l,h=n[1]-l,p=Math.max(c,0),m=Math.min(h,t.rows-1);if(p>=t.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,this.startCol=r[0],this.endCol=n[0]}isCellSelected(t,r,n){return this.hasSelection?(n-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&n>=this.viewportCappedStartRow&&r<this.endCol&&n<=this.viewportCappedEndRow:r<this.startCol&&n>=this.viewportCappedStartRow&&r>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol):!1}};function zk(){return new Uk}var Hk=2147483648,Wk=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=zk()}resize(t,r){let n=t*r*4;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Gk=`#version 300 es
95
+ layout (location = 0) in vec2 a_position;
96
+ layout (location = 1) in vec2 a_size;
97
+ layout (location = 2) in vec4 a_color;
98
+ layout (location = 3) in vec2 a_unitquad;
99
+
100
+ uniform mat4 u_projection;
101
+
102
+ out vec4 v_color;
103
+
104
+ void main() {
105
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
106
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
107
+ v_color = a_color;
108
+ }`,qk=`#version 300 es
109
+ precision lowp float;
110
+
111
+ in vec4 v_color;
112
+
113
+ out vec4 outColor;
114
+
115
+ void main() {
116
+ outColor = v_color;
117
+ }`,ul=8,Cp=ul*Float32Array.BYTES_PER_ELEMENT,Vk=20*ul,P2=class{constructor(){this.attributes=new Float32Array(Vk),this.count=0}},Ll=0,O2=0,F2=0,$2=0,U2=0,z2=0,H2=0,Zk=class extends Xc{constructor(t,r,n,a,l){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._themeService=a,this._logService=l,this._vertices=new P2,this._verticesCursor=new P2;let c=this._gl;this._program=Ys(u6(c,Gk,qk,this._logService)),this._register(ci(()=>c.deleteProgram(this._program))),this._projectionLocation=Ys(c.getUniformLocation(this._program,"u_projection"));let h=this._vertexArrayObject=c.createVertexArray();this._register(ci(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),m=c.createBuffer();this._register(ci(()=>c.deleteBuffer(m))),c.bindBuffer(c.ARRAY_BUFFER,m),c.bufferData(c.ARRAY_BUFFER,p,c.STATIC_DRAW),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=c.createBuffer();this._register(ci(()=>c.deleteBuffer(b))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Ys(c.createBuffer()),this._register(ci(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,Cp,0),c.vertexAttribDivisor(0,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,Cp,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,4,c.FLOAT,!1,Cp,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this._register(this._themeService.onChangeColors(y=>{this._updateCachedColors(y),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,c6),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,t.attributes,r.DYNAMIC_DRAW),r.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let r=this._terminal,n=this._vertices,a=1,l,c,h,p,m,x,b,y,w,C,S;for(l=0;l<r.rows;l++){for(h=-1,p=0,m=0,x=!1,c=0;c<r.cols;c++)b=(l*r.cols+c)*4,y=t.cells[b+1],w=t.cells[b+2],C=!!(w&67108864),(y!==p||w!==m&&(x||C))&&((p!==0||x&&m!==0)&&(S=a++*ul,this._updateRectangle(n,S,m,p,h,c,l)),h=c,p=y,m=w,x=C);(p!==0||x&&m!==0)&&(S=a++*ul,this._updateRectangle(n,S,m,p,h,r.cols,l))}n.count=a}updateCursor(t){let r=this._verticesCursor,n=t.cursor;if(!n||n.style==="block"){r.count=0;return}let a,l=0;(n.style==="bar"||n.style==="outline")&&(a=l++*ul,this._addRectangleFloat(r.attributes,a,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(a=l++*ul,this._addRectangleFloat(r.attributes,a,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(a=l++*ul,this._addRectangleFloat(r.attributes,a,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),a=l++*ul,this._addRectangleFloat(r.attributes,a,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=l}_updateRectangle(t,r,n,a,l,c,h){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Ll=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Ll=(n&16777215)<<8;break;default:Ll=this._themeService.colors.foreground.rgba}else switch(a&50331648){case 16777216:case 33554432:Ll=this._themeService.colors.ansi[a&255].rgba;break;case 50331648:Ll=(a&16777215)<<8;break;default:Ll=this._themeService.colors.background.rgba}t.attributes.length<r+ul&&(t.attributes=Bk(t.attributes,(this._terminal.rows*this._terminal.cols+1)*ul)),O2=l*this._dimensions.device.cell.width,F2=h*this._dimensions.device.cell.height,$2=(Ll>>24&255)/255,U2=(Ll>>16&255)/255,z2=(Ll>>8&255)/255,H2=1,this._addRectangle(t.attributes,r,O2,F2,(c-l)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,$2,U2,z2,H2)}_addRectangle(t,r,n,a,l,c,h,p,m,x){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=a/this._dimensions.device.canvas.height,t[r+2]=l/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=h,t[r+5]=p,t[r+6]=m,t[r+7]=x}_addRectangleFloat(t,r,n,a,l,c,h){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=a/this._dimensions.device.canvas.height,t[r+2]=l/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=h[0],t[r+5]=h[1],t[r+6]=h[2],t[r+7]=h[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},Yk=class extends Xc{constructor(e,t,r,n,a,l,c,h){super(),this._container=t,this._alpha=a,this._coreBrowserService=l,this._optionsService=c,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(p=>{this._refreshCharAtlas(e,p),this.reset(e)})),this._register(ci(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ys(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,n=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=o6(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,r,n){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,n){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=X3,this._clipCell(r,n,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let n=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${n} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Kk=class extends Yk{constructor(t,r,n,a,l,c,h){super(n,t,"link",r,!0,l,c,h),this._register(a.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(a.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&Rk(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Xk=class{constructor(e,t,r,n){this._node=e,this._type=t,this._handler=r,this._options=n,e.addEventListener(t,r,n)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Sp(e,t,r,n){return new Xk(e,t,r,n)}var Jk=class extends Xc{constructor(e,t,r,n,a,l,c,h,p,m=!0,x){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=n,this._coreService=a,this._decorationService=l,this._logService=c,this._optionsService=h,this._themeService=p,this._customGlyphs=m,this._cursorBlinkStateManager=this._register(new vu),this._charAtlasDisposable=this._register(new vu),this._observerDisposable=this._register(new vu),this._model=new Wk,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new Dk,this._rectangleRenderer=this._register(new vu),this._glyphRenderer=this._register(new vu),this._onChangeTextureAtlas=this._register(new Ho),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Ho),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Ho),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Ho),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Ho),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let b={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",b),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new dk(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Kk(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=ok(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new Qk(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Sp(this._canvas,"webglcontextlost",y=>{this._logService.debug("webglcontextlost event received"),y.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._logService.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(y)},3e3)})),this._register(Sp(this._canvas,"webglcontextrestored",y=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,D2(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Q2(this._canvas,this._coreBrowserService.window,(y,w)=>this._setCanvasDevicePixelDimensions(y,w)),this._register(this._coreBrowserService.onWindowChange(y=>{this._observerDisposable.value=Q2(this._canvas,y,(w,C)=>this._setCanvasDevicePixelDimensions(w,C))})),this._register(Sp(this._coreBrowserService.mainDocument,"mousedown",()=>this._cursorBlinkStateManager.value?.restartBlinkAnimation())),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ci(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let y of this._renderLayers)y.dispose();this._canvas.parentElement?.removeChild(this._canvas),D2(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._resetBlinkingRowState();for(let r of this._renderLayers)r.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1),this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1,sync:!0})}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleViewportVisibilityChange(e){this._textBlinkStateManager.setViewportVisible(e)}handleSelectionChanged(e,t,r){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Zk(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new $k(this._terminal,this._gl,this.dimensions,this._optionsService,this._logService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=o6(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize,this._customGlyphs);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=Y_(zc.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),zc.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._resetBlinkingRowState(),this._textBlinkStateManager.setNeedsBlinkInViewport(!1),this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let a of this._renderLayers)a.handleGridChanged(this._terminal,e,t);if(!this._glyphRenderer.value||!this._rectangleRenderer.value)return;this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t);let r=!1,n=0;for(;this._charAtlas&&this._glyphRenderer.value.beginFrame()&&n++<32;)r=!0,this._clearModel(!0),this._updateModel(0,this._terminal.rows-1);r&&this._glyphRenderer.value.invalidateAtlasTextures(),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor()}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Mk(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,n=this._workCell,a,l,c,h,p,m,x,b,y,w,C,S,I,N,Q,W,B;e=W2(e,r.rows-1,0),t=W2(t,r.rows-1,0);let U=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",K=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,re=K-r.buffer.ydisp,H=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),Oe=-1,ne=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ce=!1;for(l=e;l<=t;l++){c=l+r.buffer.ydisp;let Ne=r.buffer.lines.get(c);if(!Ne){for(this._model.lineLengths[l]=0,W=0;W<r.cols;W++)B=(l*r.cols+W)*4,ce=!0,this._nullModelCell(W,l,B,0,0,0);this._setRowBlinkState(l,!1);continue}h=Ne;let Me=!1;for(this._model.lineLengths[l]=0,C=K===c,x=0,p=this._characterJoinerService.getJoinedCharacters(c),W=0;W<r.cols;W++){if(a=this._cellColorResolver.result.bg,h.loadCell(W,n),W===0&&(a=this._cellColorResolver.result.bg),m=!1,b=W>=x,y=W,p.length>0&&W===p[0][0]&&b){w=p.shift();let be=this._model.selection.isCellSelected(this._terminal,w[0],c);for(Q=w[0]+1;Q<w[1];Q++)b&&=be===this._model.selection.isCellSelected(this._terminal,Q,c);b&&=!C||H<w[0]||H>=w[1],b?(m=!0,n=new eI(n,h.translateToString(!0,w[0],w[1]),w[1]-w[0]),y=w[1]-1):x=w[1]}if(S=n.getChars(),I=n.getCode(),Q=(l*r.cols+W)*4,!Me&&n.isBlink()&&(Me=!0),this._cellColorResolver.resolve(n,W,c,this.dimensions.device.cell.width,this.dimensions.device.cell.height),ne&&c===K&&(W===H&&(this._model.cursor={x:H,y:re,width:n.getWidth(),style:this._coreBrowserService.isFocused?U:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},Oe=H+n.getWidth()-1),W>=H&&W<=Oe&&(this._coreBrowserService.isFocused&&U==="block"||this._coreBrowserService.isFocused===!1&&r.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),this._textBlinkStateManager.isEnabled&&!this._textBlinkStateManager.isBlinkOn&&n.isBlink()&&(this._cellColorResolver.result.fg|=1073741824),I!==0&&(this._model.lineLengths[l]=W+1),!(this._model.cells[Q]===I&&this._model.cells[Q+1]===this._cellColorResolver.result.bg&&this._model.cells[Q+2]===this._cellColorResolver.result.fg&&this._model.cells[Q+3]===this._cellColorResolver.result.ext)&&(ce=!0,S.length>1&&(I|=Hk),this._model.cells[Q]=I,this._model.cells[Q+1]=this._cellColorResolver.result.bg,this._model.cells[Q+2]=this._cellColorResolver.result.fg,this._model.cells[Q+3]=this._cellColorResolver.result.ext,N=n.getWidth(),this._glyphRenderer.value.updateCell(W,l,I,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,S,N,a),m)){for(n=this._workCell,W++;W<=y;W++)B=(l*r.cols+W)*4,this._nullModelCell(W,l,B,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);W--}}this._setRowBlinkState(l,Me)}ce&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,n,a,l){this._glyphRenderer.value.updateCell(e,t,0,n,a,l,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=n,this._model.cells[r+2]=a,this._model.cells[r+3]=l}_resetBlinkingRowState(){this._rowHasBlinkingCells=new Array(this._terminal.rows).fill(!1),this._rowHasBlinkingCellsCount=0}_setRowBlinkState(e,t){this._rowHasBlinkingCells[e]!==t&&(this._rowHasBlinkingCells[e]=t,this._rowHasBlinkingCellsCount+=t?1:-1)}_updateTextBlinkState(){this._textBlinkStateManager.setNeedsBlinkInViewport(this._rowHasBlinkingCellsCount>0)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1,sync:!0}))}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},eI=class extends E0{constructor(t,r,n){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function W2(e,t,r=0){return Math.max(Math.min(e,t),r)}var tI=class extends Xc{constructor(e){if(Y3&&ek()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("WebGL2 is only supported on Safari 16 and above")}super(),this._onChangeTextureAtlas=this._register(new Ho),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Ho),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Ho),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Ho),this.onContextLoss=this._onContextLoss.event,this._customGlyphs=e?.customGlyphs??!0,this._preserveDrawingBuffer=e?.preserveDrawingBuffer}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let r=t.coreService,n=t.optionsService,a=t,l=a._renderService,c=a._characterJoinerService,h=a._charSizeService,p=a._coreBrowserService,m=a._decorationService,x=a._logService,b=a._themeService;this._renderer=this._register(new Jk(e,c,h,p,r,m,x,n,b,this._customGlyphs,this._preserveDrawingBuffer)),this._register(zc.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(zc.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(zc.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(zc.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this._register(ci(()=>{if(this._terminal._core._store._isDisposed)return;let y=this._terminal._core._renderService;y.setRenderer(this._terminal._core._createRenderer()),y.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var rI=class{constructor(t,r,n,a={}){this._terminal=t,this._regex=r,this._handler=n,this._options=a}provideLinks(t,r){let n=sI.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(n))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(n,a)=>{if(this._options.hover){let{range:l}=r;this._options.hover(n,a,l)}},r))}};function nI(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var sI=class Ih{static computeLink(t,r,n,a){let l=r.flags.includes("g")?r.flags:`${r.flags}g`,c=new RegExp(r.source,l),[h,p]=Ih._getWindowedLineStrings(t-1,n),m=h.join(""),x,b=[];for(;x=c.exec(m);){let y=x[0];if(!nI(y))continue;let[w,C]=Ih._mapStrIdx(n,p,0,x.index),[S,I]=Ih._mapStrIdx(n,w,C,y.length);if(w===-1||C===-1||S===-1||I===-1)continue;let N={start:{x:C+1,y:w+1},end:{x:I,y:S+1}};b.push({range:N,text:y,activate:a})}return b}static _getWindowedLineStrings(t,r){let n,a=t,l=t,c,h,p=[];if(n=r.buffer.active.getLine(t)){let m=n.translateToString(!0);if(n.isWrapped&&m[0]!==" "){for(c=0;(n=r.buffer.active.getLine(--a))&&c<2048&&(h=n.translateToString(!0),c+=h.length,p.push(h),!(!n.isWrapped||h.indexOf(" ")!==-1)););p.reverse()}for(p.push(m),c=0;(n=r.buffer.active.getLine(++l))&&n.isWrapped&&c<2048&&(h=n.translateToString(!0),c+=h.length,p.push(h),h.indexOf(" ")===-1););}return[p,a]}static _mapStrIdx(t,r,n,a){let l=t.buffer.active,c=l.getNullCell(),h=n;for(;a;){let p=l.getLine(r);if(!p)return[-1,-1];for(let m=h;m<p.length;++m){p.getCell(m,c);let x=c.getChars();if(c.getWidth()&&(a-=x.length||1,m===p.length-1&&x==="")){let b=l.getLine(r+1);b&&b.isWrapped&&(b.getCell(0,c),c.getWidth()===2&&(a+=1))}if(a<0)return[r,m]}r++,h=0}return[r,h]}},iI=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function aI(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var oI=class{constructor(t=aI,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,n=r.urlRegex??iI;this._linkProvider=this._terminal.registerLinkProvider(new rI(this._terminal,n,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function lI(e,t){if(e?.capabilities?.webWorkspace===!0)return(r,n)=>{try{const a=new URL(n);if(a.protocol!=="http:"&&a.protocol!=="https:")return;e.openExternal?e.openExternal(a.href).catch(()=>{}):t(a.href)}catch{}}}const Lp=8,G2=4096,cI=/https?:\/\/[^\s"'!*(){}|\\^<>`,。;!?、“”‘’]*/giu,uI=/^( *)([^\s"'!*(){}|\\^<>`,。;!?、“”‘’]+)/u;function dI(e,t){const r=e.buffer.active.getLine(t);if(!r)return;let n="";const a=[],l=[];for(let c=0;c<r.length;c++){const h=r.getCell(c);if(!h||!h.getWidth())continue;const p=h.getChars()||" ";n+=p;for(let m=0;m<p.length;m++)a.push({x:c+1,y:t+1}),l.push({x:c+h.getWidth(),y:t+1})}return{line:r,text:n.trimEnd(),starts:a,ends:l}}function hI(e,t=(r,n)=>{window.open(n,"_blank","noopener")}){return{provideLinks(r,n){const a=Math.max(0,r-Lp),l=Math.min(e.buffer.active.length-1,r+Lp-1),c=Array.from({length:l-a+1},(p,m)=>dI(e,a+m)),h=[];for(let p=0;p<c.length;p++){const m=c[p];if(m)for(const x of m.text.matchAll(new RegExp(cI))){let b=x[0];const y=m.ends.slice(x.index,x.index+b.length);let w=x.index+b.length,C=m,S=p;for(;w===C.text.length&&S+1<c.length&&S-p<Lp-1&&b.length<G2;){const I=c[S+1],N=I?.text.match(uI);if(!I||!N||/^https?:\/\//iu.test(N[2]))break;const Q=N[1].length,W=N[2];if(I.line.isWrapped&&Q>0)break;if(!I.line.isWrapped){const B=y.at(-1).x-1,U=I.starts[Q]?.x;if(U===void 0)break;const K=C.line.getCell(B),re=I.line.getCell(U-1),H=I.ends[Q+W.length-1].x-U+1,Oe=C.line.length-B-1;if(!K||!re||K.isFgDefault()||re.isFgDefault()||K.getFgColorMode()!==re.getFgColorMode()||K.getFgColor()!==re.getFgColor()||Oe>=Math.max(8,Q+H)||!/[/.?#%&=_~\-\d]/u.test(W)&&W.length<16&&!/^[)\]}]/u.test(I.text.slice(Q+W.length)))break}b+=W,y.push(...I.ends.slice(Q,Q+W.length)),w=Q+W.length,C=I,S++}if(!(S===p||r<a+p+1||r>a+S+1||b.length>G2)){for(b=b.replace(/[,:.!?]+$/u,"");b.endsWith("]")&&(b.match(/\]/g)?.length??0)>(b.match(/\[/g)?.length??0);)b=b.slice(0,-1);if(/^https?:\/\/[^/?#]+/iu.test(b)){try{const I=new URL(b);if(!["http:","https:"].includes(I.protocol)||!I.hostname)continue}catch{continue}h.push({text:b,range:{start:m.starts[x.index],end:y[b.length-1]},activate:t})}}}}n(h.length?h:void 0)}}}function q2(e){return{dispose:e}}var fI=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},pI=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return q2(()=>{});let a={fn:t,thisArgs:r};this._listeners.push(a);let l=q2(()=>{let c=this._listeners.indexOf(a);c!==-1&&this._listeners.splice(c,1)});return n&&(Array.isArray(n)?n.push(l):n.add(l)),l},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:n}=this._listeners[0];r.call(n,t);return}default:{let r=this._listeners.slice();for(let{fn:n,thisArgs:a}of r)n.call(a,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},mI;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,m)=>l(x=>h.call(p,c(x)),void 0,m)}e.map=r;function n(...l){return(c,h,p)=>{let m=new fI;for(let x of l)m.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(m):p.add(m)),m}}e.any=n;function a(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=a})(mI||={});var V2=class Eh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new pI,this.onChange=this._onChange.event}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t,this._active||(this.activeVersion=t.version)}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,a=t.length;for(let l=0;l<a;++l){let c=t.charCodeAt(l);if(55296<=c&&c<=56319){if(++l>=a)return r+this.wcwidth(c);let m=t.charCodeAt(l);56320<=m&&m<=57343?c=(c-55296)*1024+m-56320+65536:r+=this.wcwidth(m)}let h=this.charProperties(c,n),p=Eh.extractWidth(h);Eh.extractShouldJoin(h)&&(p-=Eh.extractWidth(n)),r+=p,n=h}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},_p=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],gI=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],kp=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],xI=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],_l;function Z2(e,t){let r=0,n=t.length-1,a;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(a=r+n>>1,e>t[a][1])r=a+1;else if(e<t[a][0])n=a-1;else return!0;return!1}var bI=class{constructor(){if(this.version="11",!_l){_l=new Uint8Array(65536),_l.fill(1),_l[0]=0,_l.fill(0,1,32),_l.fill(0,127,160);for(let e=0;e<_p.length;++e)_l.fill(0,_p[e][0],_p[e][1]+1);for(let e=0;e<kp.length;++e)_l.fill(2,kp[e][0],kp[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?_l[e]:Z2(e,gI)?0:Z2(e,xI)?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let a=V2.extractWidth(t);a===0?n=!1:a>r&&(r=a)}return V2.createPropertyValue(0,r,n)}},vI=class{activate(e){e.unicode.register(new bI)}dispose(){}};function Kc(e){return{dispose:e}}function Nh(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function yI(...e){return Kc(()=>Nh(e))}var d6=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(t){return this._isDisposed?t.dispose():this._disposables.add(t),t}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let t of this._disposables)t.dispose();this._disposables.clear()}}clear(){for(let t of this._disposables)t.dispose();this._disposables.clear()}},Ld=class{constructor(){this._store=new d6}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Ld.None=Object.freeze({dispose(){}});var sf=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},Mm=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Kc(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let a=Kc(()=>{let l=this._listeners.indexOf(n);l!==-1&&this._listeners.splice(l,1)});return r&&(Array.isArray(r)?r.push(a):r.add(a)),a},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:n}of t)r.call(n,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},wI;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,m)=>l(x=>h.call(p,c(x)),void 0,m)}e.map=r;function n(...l){return(c,h,p)=>{let m=new d6;for(let x of l)m.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(m):p.add(m)),m}}e.any=n;function a(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=a})(wI||={});function h6(e,t=0,r){let n=setTimeout(()=>{e()},t);return Kc(()=>{clearTimeout(n)})}var AI=class extends Ld{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new sf),this._linesCacheDisposables=this._register(new sf),this._lastAccessTimestamp=0,this._register(Kc(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=yI(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._lastAccessTimestamp=Date.now(),this._linesCacheTimeout.value||this._scheduleLinesCacheTimeout(15e3)}_destroyLinesCache(){this._linesCache=void 0,this._lastAccessTimestamp=0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}_scheduleLinesCacheTimeout(e){this._linesCacheTimeout.value=h6(()=>{if(!this._linesCache)return;let t=Date.now()-this._lastAccessTimestamp;if(t>=15e3){this._destroyLinesCache();return}this._scheduleLinesCacheTimeout(15e3-t)},e)}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let r=[],n=[0],a=this._terminal.buffer.active.getLine(e);for(;a;){let l=this._terminal.buffer.active.getLine(e+1),c=l?l.isWrapped:!1,h=a.translateToString(!c&&t);if(c&&l){let p=a.getCell(a.length-1);p&&p.getCode()===0&&p.getWidth()===1&&l.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(r.push(h),c)n.push(n[n.length-1]+h.length);else break;e++,a=l}return[r.join(""),n]}},TI=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(t){this._cachedSearchTerm=t}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(t){this._lastSearchOptions=t}isValidSearchTerm(t){return!!(t&&t.length>0)}didOptionsChange(t){return this._lastSearchOptions?t?this._lastSearchOptions.caseSensitive!==t.caseSensitive||this._lastSearchOptions.regex!==t.regex||this._lastSearchOptions.wholeWord!==t.wholeWord:!1:!0}shouldUpdateHighlighting(t,r){return r?.decorations?this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||this.didOptionsChange(r):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},CI=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,n,a){if(!t||t.length===0){this._terminal.clearSelection();return}if(n>=this._terminal.cols)throw new Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let l={startRow:r,startCol:n},c=this._findInLine(t,l,a);if(!c)for(let h=r+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(l.startRow=h,l.startCol=0,c=this._findInLine(t,l,a),!c);h++);return c}findNextWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let a=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=0,c=0;a&&(n===t?(l=a.end.x,c=a.end.y):(l=a.start.x,c=a.start.y)),this._lineCache.initLinesCache();let h={startRow:c,startCol:l},p=this._findInLine(t,h,r);if(!p)for(let m=c+1;m<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=m,h.startCol=0,p=this._findInLine(t,h,r),!p);m++);if(!p&&c!==0)for(let m=0;m<c&&(h.startRow=m,h.startCol=0,p=this._findInLine(t,h,r),!p);m++);return!p&&a&&(h.startRow=a.start.y,h.startCol=0,p=this._findInLine(t,h,r)),p}findPreviousWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let a=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=this._terminal.buffer.active.baseY+this._terminal.rows-1,c=this._terminal.cols,h=!0;this._lineCache.initLinesCache();let p={startRow:l,startCol:c},m;if(a&&(p.startRow=l=a.start.y,p.startCol=a.start.x,n!==t&&(m=this._findInLine(t,p,r,!1),m||(p.startRow=l=a.end.y,p.startCol=a.end.x))),m??=this._findInLine(t,p,r,h),!m){p.startCol=Math.max(p.startCol,this._terminal.cols);for(let x=l-1;x>=0&&(p.startRow=x,m=this._findInLine(t,p,r,h),!m);x--);}if(!m&&l!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let x=this._terminal.buffer.active.baseY+this._terminal.rows-1;x>=l&&(p.startRow=x,m=this._findInLine(t,p,r,h),!m);x--);return m}_isWholeWord(t,r,n){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t-1]))&&(t+n.length===r.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t+n.length]))}_findInLine(t,r,n={},a=!1){let l=r.startRow,c=r.startCol;if(this._terminal.buffer.active.getLine(l)?.isWrapped){if(a){r.startCol+=this._terminal.cols;return}return r.startRow--,r.startCol+=this._terminal.cols,this._findInLine(t,r,n)}let h=this._lineCache.getLineFromCache(l);h||(h=this._lineCache.translateBufferLineToStringWithWrap(l,!0),this._lineCache.setLineInCache(l,h));let[p,m]=h,x=this._bufferColsToStringOffset(l,c),b=t,y=p;n.regex||(b=n.caseSensitive?t:t.toLowerCase(),y=n.caseSensitive?p:p.toLowerCase());let w=-1;if(n.regex){let C=RegExp(b,n.caseSensitive?"g":"gi"),S;if(a)for(;S=C.exec(y.slice(0,x));)w=C.lastIndex-S[0].length,t=S[0],C.lastIndex-=t.length-1;else S=C.exec(y.slice(x)),S&&S[0].length>0&&(w=x+(C.lastIndex-S[0].length),t=S[0])}else a?x-b.length>=0&&(w=y.lastIndexOf(b,x-b.length)):w=y.indexOf(b,x);if(w>=0){if(n.wholeWord&&!this._isWholeWord(w,y,t))return;let C=0;for(;C<m.length-1&&w>=m[C+1];)C++;let S=C;for(;S<m.length-1&&w+t.length>=m[S+1];)S++;let I=w-m[C],N=w+t.length-m[S],Q=this._stringLengthToBufferSize(l+C,I),W=this._stringLengthToBufferSize(l+S,N)-Q+this._terminal.cols*(S-C);return{term:t,col:Q,row:l+C,size:W}}}_stringLengthToBufferSize(t,r){let n=this._terminal.buffer.active.getLine(t);if(!n)return 0;for(let a=0;a<r;a++){let l=n.getCell(a);if(!l)break;let c=l.getChars();c.length>1&&(r-=c.length-1);let h=n.getCell(a+1);h&&h.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let n=t,a=0,l=this._terminal.buffer.active.getLine(n);for(;r>0&&l;){for(let c=0;c<r&&c<this._terminal.cols;c++){let h=l.getCell(c);if(!h)break;h.getWidth()&&(a+=h.getCode()===0?1:h.getChars().length)}if(n++,l=this._terminal.buffer.active.getLine(n),l&&!l.isWrapped)break;r-=this._terminal.cols}return a}},SI=class extends Ld{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Kc(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let n of t){let a=this._createResultDecorations(n,r,!1);if(a)for(let l of a)this._storeDecoration(l,n)}}createActiveDecoration(t,r){let n=this._createResultDecorations(t,r,!0);if(n)return{decorations:n,match:t,dispose(){Nh(n)}}}clearHighlightDecorations(){Nh(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,r){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:r,dispose(){t.dispose()}})}_applyStyles(t,r,n){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),r&&(t.style.outline=`1px solid ${r}`)),n&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,r,n){let a=[],l=t.col,c=t.size,h=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;c>0;){let m=Math.min(this._terminal.cols-l,c);a.push([h,l,m]),l=0,c-=m,h++}let p=[];for(let m of a){let x=this._terminal.registerMarker(m[0]),b=this._terminal.registerDecoration({marker:x,x:m[1],width:m[2],layer:n?"top":"bottom",backgroundColor:n?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(x.line)?void 0:{color:n?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(b){let y=[];y.push(x),y.push(b.onRender(w=>this._applyStyles(w,n?r.activeMatchBorder:r.matchBorder,!1))),y.push(b.onDispose(()=>Nh(y))),p.push(b)}}return p.length===0?void 0:p}},LI=class extends Ld{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Mm)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,r){this._searchResults=t.slice(0,r)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let r=0;r<this._searchResults.length;r++){let n=this._searchResults[r];if(n.row===t.row&&n.col===t.col&&n.size===t.size)return r}return-1}fireResultsChanged(t){if(!t)return;let r=-1;this._selectedDecoration&&(r=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:r,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},_I=class extends Ld{constructor(t){super(),this._highlightTimeout=this._register(new sf),this._lineCache=this._register(new sf),this._state=new TI,this._resultTracker=this._register(new LI),this._onAfterSearch=this._register(new Mm),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new Mm),this.onBeforeSearch=this._onBeforeSearch.event,this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new AI(t),this._engine=new CI(t,this._lineCache.value),this._decorationManager=new SI(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Kc(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=h6(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,r,n){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let a=this._findNextAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),a}_highlightAllMatches(t,r){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],a,l=this._engine.find(t,0,0,r);for(;l&&(a?.row!==l.row||a?.col!==l.col)&&!(n.length>=this._highlightLimit);){a=l,n.push(a);let c=this._terminal.cols,h=a.col+a.size,p=a.row;h>=c&&(p+=Math.floor(h/c),h=h%c),l=this._engine.find(t,p,h,r)}this._resultTracker.updateResults(n,this._highlightLimit),r.decorations&&this._decorationManager.createHighlightDecorations(n,r.decorations)}_findNextAndSelect(t,r,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let a=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(a,r?.decorations,n?.noScroll)}findPrevious(t,r,n){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let a=this._findPreviousAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),a}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,r,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let a=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(a,r?.decorations,n?.noScroll)}_selectResult(t,r,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),r){let a=this._decorationManager.createActiveDecoration(t,r);a&&(this._resultTracker.selectedDecoration=a)}if(!n&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let a=t.row-this._terminal.buffer.active.viewportY;a-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(a)}return!0}};var yi=0,wi=0,Ai=0,js=0,Xi;(e=>{function t(a,l,c,h){return h!==void 0?`#${Dc(a)}${Dc(l)}${Dc(c)}${Dc(h)}`:`#${Dc(a)}${Dc(l)}${Dc(c)}`}e.toCss=t;function r(a,l,c,h=255){return(a<<24|l<<16|c<<8|h)>>>0}e.toRgba=r;function n(a,l,c,h){return{css:e.toCss(a,l,c,h),rgba:e.toRgba(a,l,c,h)}}e.toColor=n})(Xi||={});var kI;(e=>{function t(p,m){if(js=(m.rgba&255)/255,js===1)return{css:m.css,rgba:m.rgba};let x=m.rgba>>24&255,b=m.rgba>>16&255,y=m.rgba>>8&255,w=p.rgba>>24&255,C=p.rgba>>16&255,S=p.rgba>>8&255;yi=w+Math.round((x-w)*js),wi=C+Math.round((b-C)*js),Ai=S+Math.round((y-S)*js);let I=Xi.toCss(yi,wi,Ai),N=Xi.toRgba(yi,wi,Ai);return{css:I,rgba:N}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,m,x){let b=Rh.ensureContrastRatio(p.rgba,m.rgba,x);if(b)return Xi.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=n;function a(p){let m=(p.rgba|255)>>>0;return[yi,wi,Ai]=Rh.toChannels(m),{css:Xi.toCss(yi,wi,Ai),rgba:m}}e.opaque=a;function l(p,m){return js=Math.round(m*255),[yi,wi,Ai]=Rh.toChannels(p.rgba),{css:Xi.toCss(yi,wi,Ai,js),rgba:Xi.toRgba(yi,wi,Ai,js)}}e.opacity=l;function c(p,m){return js=p.rgba&255,l(p,js*m/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(kI||={});var $i;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return yi=parseInt(a.slice(1,2).repeat(2),16),wi=parseInt(a.slice(2,3).repeat(2),16),Ai=parseInt(a.slice(3,4).repeat(2),16),Xi.toColor(yi,wi,Ai);case 5:return yi=parseInt(a.slice(1,2).repeat(2),16),wi=parseInt(a.slice(2,3).repeat(2),16),Ai=parseInt(a.slice(3,4).repeat(2),16),js=parseInt(a.slice(4,5).repeat(2),16),Xi.toColor(yi,wi,Ai,js);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let l=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return yi=parseInt(l[1],10),wi=parseInt(l[2],10),Ai=parseInt(l[3],10),js=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Xi.toColor(yi,wi,Ai,js);if(a==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[yi,wi,Ai,js]=t.getImageData(0,0,1,1).data,js!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Xi.toRgba(yi,wi,Ai,js),css:a}}e.toColor=n})($i||={});var xa;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,l){let c=n/255,h=a/255,p=l/255,m=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return m*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(xa||={});var Rh;(e=>{function t(c,h){if(js=(h&255)/255,js===1)return h;let p=h>>24&255,m=h>>16&255,x=h>>8&255,b=c>>24&255,y=c>>16&255,w=c>>8&255;return yi=b+Math.round((p-b)*js),wi=y+Math.round((m-y)*js),Ai=w+Math.round((x-w)*js),Xi.toRgba(yi,wi,Ai)}e.blend=t;function r(c,h,p){let m=xa.relativeLuminance(c>>8),x=xa.relativeLuminance(h>>8);if(kl(m,x)<p){if(x<m){let w=n(c,h,p),C=kl(m,xa.relativeLuminance(w>>8));if(C<p){let S=a(c,h,p),I=kl(m,xa.relativeLuminance(S>>8));return C>I?w:S}return w}let b=a(c,h,p),y=kl(m,xa.relativeLuminance(b>>8));if(y<p){let w=n(c,h,p),C=kl(m,xa.relativeLuminance(w>>8));return y>C?b:w}return b}}e.ensureContrastRatio=r;function n(c,h,p){let m=c>>24&255,x=c>>16&255,b=c>>8&255,y=h>>24&255,w=h>>16&255,C=h>>8&255,S=kl(xa.relativeLuminance2(y,w,C),xa.relativeLuminance2(m,x,b));for(;S<p&&(y>0||w>0||C>0);)y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),C-=Math.max(0,Math.ceil(C*.1)),S=kl(xa.relativeLuminance2(y,w,C),xa.relativeLuminance2(m,x,b));return(y<<24|w<<16|C<<8|255)>>>0}e.reduceLuminance=n;function a(c,h,p){let m=c>>24&255,x=c>>16&255,b=c>>8&255,y=h>>24&255,w=h>>16&255,C=h>>8&255,S=kl(xa.relativeLuminance2(y,w,C),xa.relativeLuminance2(m,x,b));for(;S<p&&(y<255||w<255||C<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),S=kl(xa.relativeLuminance2(y,w,C),xa.relativeLuminance2(m,x,b));return(y<<24|w<<16|C<<8|255)>>>0}e.increaseLuminance=a;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(Rh||={});function Dc(e){let t=e.toString(16);return t.length<2?"0"+t:t}function kl(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var II=Object.freeze((()=>{let e=[$i.toColor("#2e3436"),$i.toColor("#cc0000"),$i.toColor("#4e9a06"),$i.toColor("#c4a000"),$i.toColor("#3465a4"),$i.toColor("#75507b"),$i.toColor("#06989a"),$i.toColor("#d3d7cf"),$i.toColor("#555753"),$i.toColor("#ef2929"),$i.toColor("#8ae234"),$i.toColor("#fce94f"),$i.toColor("#729fcf"),$i.toColor("#ad7fa8"),$i.toColor("#34e2e2"),$i.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],a=t[r/6%6|0],l=t[r%6];e.push({css:Xi.toCss(n,a,l),rgba:Xi.toRgba(n,a,l)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:Xi.toCss(n,n,n),rgba:Xi.toRgba(n,n,n)})}return e})());function Y2(e,t,r){return Math.max(t,Math.min(e,r))}function EI(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var f6=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),n=this._buffer.getNullCell(),a=r,l=e.start.y,c=e.end.y,h=e.start.x,p=e.end.x;this._beforeSerialize(c-l,l,c);for(let m=l;m<=c;m++){let x=this._buffer.getLine(m);if(x){let b=m===e.start.y?h:0,y=m===e.end.y?p:x.length;for(let w=b;w<y;w++){let C=x.getCell(w,a===r?n:r);if(!C){console.warn(`Can't get cell at row=${m}, col=${w}`);continue}this._nextCell(C,a,m,w),a=C}}this._rowEnd(m,m===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,n){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function D1(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function dl(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function p6(e,t){if(!e.isUnderline()&&!t.isUnderline())return!0;if(e.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=e.isUnderlineColorDefault(),n=t.isUnderlineColorDefault();return r&&n?!0:r!==n?!1:e.getUnderlineColor()===t.getUnderlineColor()&&e.getUnderlineColorMode()===t.getUnderlineColorMode()}function Q1(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&p6(e,t)&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}function m6(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):D1(e,t)&&dl(e,t)&&Q1(e,t)}var NI=class extends f6{constructor(t,r){super(t),this._terminal=r,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,r,n){this._allRows=new Array(t),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(t,r){this._nullCellCount>0&&!dl(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!r){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let a=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(!l.isWrapped)n=`\r
118
+ `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{n="";let c=a.getCell(a.length-1,this._thisRowLastChar),h=a.getCell(a.length-2,this._thisRowLastSecondChar),p=l.getCell(0,this._nextRowFirstChar),m=p.getWidth()>1,x=!1;(p.getChars()&&m?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&dl(c,p)&&(x=!0),m&&(h.getChars()||h.getWidth()===0)&&dl(c,p)&&dl(h,p)&&(x=!0)),x||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${a.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${a.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){let n=[];if(m6(t,r))return n;let a=!D1(t,r),l=!dl(t,r),c=!Q1(t,r);if(a||l||c)if(t.isAttributeDefault())r.isAttributeDefault()||n.push(0);else{if(a){let h=t.getFgColor();t.isFgRGB()?n.push(38,2,h>>>16&255,h>>>8&255,h&255):t.isFgPalette()?h>=16?n.push(38,5,h):n.push(h&8?90+(h&7):30+(h&7)):n.push(39)}if(l){let h=t.getBgColor();t.isBgRGB()?n.push(48,2,h>>>16&255,h>>>8&255,h&255):t.isBgPalette()?h>=16?n.push(48,5,h):n.push(h&8?100+(h&7):40+(h&7)):n.push(49)}if(c){if(t.isInverse()!==r.isInverse()&&n.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&n.push(t.isBold()?1:22),p6(t,r))t.isUnderline()!==r.isUnderline()&&n.push(t.isUnderline()?4:24);else{let h=t.getUnderlineStyle();if(h===0)n.push(24);else if(h===1&&t.isUnderlineColorDefault())n.push(4);else if(n.push("4:"+h),!t.isUnderlineColorDefault()){let p=t.getUnderlineColor();t.isUnderlineColorRGB()?n.push("58:2::"+(p>>>16&255)+":"+(p>>>8&255)+":"+(p&255)):n.push("58:5:"+p)}}t.isOverline()!==r.isOverline()&&n.push(t.isOverline()?53:55),t.isBlink()!==r.isBlink()&&n.push(t.isBlink()?5:25),t.isInvisible()!==r.isInvisible()&&n.push(t.isInvisible()?8:28),t.isItalic()!==r.isItalic()&&n.push(t.isItalic()?3:23),t.isDim()!==r.isDim()&&n.push(t.isDim()?2:22),t.isStrikethrough()!==r.isStrikethrough()&&n.push(t.isStrikethrough()?9:29)}}return n}_nextCell(t,r,n,a){if(t.getWidth()===0)return;let l=t.getChars()==="",c=this._diffStyle(t,this._cursorStyle);if(l?!dl(this._cursorStyle,t):c.length>0){this._nullCellCount>0&&(dl(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=a,this._currentRow+=`\x1B[${c.join(";")}m`;let h=this._buffer.getLine(n);h!==void 0&&(h.getCell(a,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=a)}l?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(dl(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=a+t.getWidth())}_serializeString(t){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let c=0;c<r;c++)n+=this._allRows[c],c+1<r&&(n+=this._allRowSeparators[c]);if(!t){let c=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,p=c!==this._lastCursorRow||h!==this._lastCursorCol,m=x=>{x>0?n+=`\x1B[${x}C`:x<0&&(n+=`\x1B[${-x}D`)};p&&((x=>{x>0?n+=`\x1B[${x}B`:x<0&&(n+=`\x1B[${-x}A`)})(c-this._lastCursorRow),m(h-this._lastCursorCol))}let a=this._terminal._core._inputHandler._curAttrData,l=this._diffStyle(a,this._cursorStyle);return l.length>0&&(n+=`\x1B[${l.join(";")}m`),n}},RI=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,n){let a=r.length,l=n===void 0?a:Y2(n+t.rows,0,a);return this._serializeBufferByRange(t,r,{start:a-l,end:a-1},!1)}_serializeBufferByRange(t,r,n,a){return new NI(r,t).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:t.cols,y:typeof n.end=="number"?n.end:n.end.line}},a)}_serializeBufferAsHTML(t,r){let n=t.buffer.active,a=new MI(n,t,r),l=r.onlySelection??!1,c=r.range;if(c)return a.serialize({start:{x:c.startCol,y:(c.startLine,c.startLine)},end:{x:t.cols,y:(c.endLine,c.endLine)}});if(!l){let p=n.length,m=r.scrollback,x=m===void 0?p:Y2(m+t.rows,0,p);return a.serialize({start:{x:0,y:p-x},end:{x:t.cols,y:p-1}})}let h=this._terminal?.getSelectionPosition();return h!==void 0?a.serialize({start:{x:h.start.x,y:h.start.y},end:{x:h.end.x,y:h.end.y}}):""}_serializeScrollRegion(t){let r=t._core.buffer,n=r.scrollTop,a=r.scrollBottom;return n!==0||a!==t.rows-1?`\x1B[${n+1};${a+1}r`:""}_serializeModes(t){let r="",n=t.modes;if(n.applicationCursorKeysMode&&(r+="\x1B[?1h"),n.applicationKeypadMode&&(r+="\x1B[?66h"),n.bracketedPasteMode&&(r+="\x1B[?2004h"),n.insertMode&&(r+="\x1B[4h"),n.originMode&&(r+="\x1B[?6h"),n.reverseWraparoundMode&&(r+="\x1B[?45h"),n.sendFocusMode&&(r+="\x1B[?1004h"),n.wraparoundMode===!1&&(r+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":r+="\x1B[?9h";break;case"vt200":r+="\x1B[?1000h";break;case"drag":r+="\x1B[?1002h";break;case"any":r+="\x1B[?1003h";break}return n.showCursor||(r+="\x1B[?25l"),r}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let r=t?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t?.scrollback);if(!t?.excludeAltBuffer&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${n}`}return t?.excludeModes||(r+=this._serializeModes(this._terminal),r+=this._serializeScrollRegion(this._terminal)),r}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t??{})}dispose(){}},MI=class extends f6{constructor(t,r,n){super(t),this._terminal=r,this._options=n,this._currentRow="",this._htmlContent="",r._core._themeService?this._ansiColors=r._core._themeService.colors.ansi:this._ansiColors=II}_beforeSerialize(t,r,n){this._htmlContent+="<html><body><!--StartFragment--><pre>";let a="#000000",l="#ffffff";(this._options.includeGlobalBackground??!1)&&(a=this._terminal.options.theme?.foreground??"#ffffff",l=this._terminal.options.theme?.background??"#000000");let c=[];c.push("color: "+a+";"),c.push("background-color: "+l+";"),c.push("font-family: "+this._terminal.options.fontFamily+";"),c.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+c.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,r){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,r){let n=r?t.getFgColor():t.getBgColor();if(r?t.isFgRGB():t.isBgRGB())return"#"+[n>>16&255,n>>8&255,n&255].map(a=>a.toString(16).padStart(2,"0")).join("");if(r?t.isFgPalette():t.isBgPalette())return this._ansiColors[n].css}_getUnderlineColor(t){if(t.isUnderlineColorDefault())return;let r=t.getUnderlineColor();return t.isUnderlineColorRGB()?"#"+[r>>16&255,r>>8&255,r&255].map(n=>n.toString(16).padStart(2,"0")).join(""):this._ansiColors[r].css}_getUnderlineStyle(t){switch(t.getUnderlineStyle()){case 1:return"underline";case 2:return"underline double";case 3:return"underline wavy";case 4:return"underline dotted";case 5:return"underline dashed";default:return"underline"}}_diffStyle(t,r){let n=[];if(m6(t,r))return;let a=!D1(t,r),l=!dl(t,r),c=!Q1(t,r);if(a||l||c){let h=this._getHexColor(t,!0);h&&n.push("color: "+h+";");let p=this._getHexColor(t,!1);p&&n.push("background-color: "+p+";"),t.isInverse()&&n.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&n.push("font-weight: bold;");let m=[];if(t.isUnderline()&&m.push(this._getUnderlineStyle(t)),t.isOverline()&&m.push("overline"),t.isStrikethrough()&&m.push("line-through"),t.isBlink()&&m.push("blink"),m.length>0&&n.push("text-decoration: "+m.join(" ")+";"),t.isUnderline()){let x=this._getUnderlineColor(t);x&&n.push("text-decoration-color: "+x+";")}return t.isInvisible()&&n.push("visibility: hidden;"),t.isItalic()&&n.push("font-style: italic;"),t.isDim()&&n.push("opacity: 0.5;"),n}}_nextCell(t,r,n,a){if(t.getWidth()===0)return;let l=t.getChars()==="",c=this._diffStyle(t,r);c&&(this._currentRow+=c.length===0?"</span><span>":"</span><span style='"+c.join(" ")+"'>"),l?this._currentRow+=" ":this._currentRow+=EI(t.getChars())}_serializeString(){return this._htmlContent}};const K2=262144;function jI(e,t){return r=>{if(!e())return!0;const n=r.indexOf(";");if(n<0)return!0;const a=r.slice(n+1);if(!a||a==="?"||a.length>4*Math.ceil(K2/3))return!0;let l;try{const c=atob(a);if(c.length>K2)return!0;l=new TextDecoder("utf-8",{fatal:!0}).decode(Uint8Array.from(c,h=>h.charCodeAt(0)))}catch{return!0}return l&&Lh(l,e).then(c=>{!c&&e()&&t()}),!0}}var DI=Object.create,g6=Object.defineProperty,QI=Object.getOwnPropertyDescriptor,BI=Object.getOwnPropertyNames,PI=Object.getPrototypeOf,OI=Object.prototype.hasOwnProperty,J0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},FI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of BI(t))!OI.call(e,a)&&a!==r&&g6(e,a,{get:()=>t[a],enumerable:!(n=QI(t,a))||n.enumerable});return e},eu=(e,t,r)=>(r=e!=null?DI(PI(e)):{},FI(!e||!e.__esModule?g6(r,"default",{value:e,enumerable:!0}):r,e)),B1=J0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn("BE platform detected. This version of node-sixel works only on LE properly.");function t(w){return w&255}e.red=t;function r(w){return w>>>8&255}e.green=r;function n(w){return w>>>16&255}e.blue=n;function a(w){return w>>>24&255}e.alpha=a;function l(w,C,S,I=255){return((I&255)<<24|(S&255)<<16|(C&255)<<8|w&255)>>>0}e.toRGBA8888=l;function c(w){return[w&255,w>>8&255,w>>16&255,w>>>24]}e.fromRGBA8888=c;function h(w,C){let S=t(w),I=r(w),N=n(w),Q=Number.MAX_SAFE_INTEGER,W=-1;for(let B=0;B<C.length;++B){let U=S-C[B][0],K=I-C[B][1],re=N-C[B][2],H=U*U+K*K+re*re;if(!H)return B;H<Q&&(Q=H,W=B)}return W}e.nearestColorIndex=h;function p(w,C,S){return Math.max(w,Math.min(S,C))}function m(w,C,S){return S<0&&(S+=1),S>1&&(S-=1),S*6<1?C+(w-C)*6*S:S*2<1?w:S*3<2?C+(w-C)*(4-S*6):C}function x(w,C,S){if(!S){let Q=Math.round(C*255);return l(Q,Q,Q)}let I=C<.5?C*(1+S):C+S-C*S,N=2*C-I;return l(p(0,255,Math.round(m(I,N,w+1/3)*255)),p(0,255,Math.round(m(I,N,w)*255)),p(0,255,Math.round(m(I,N,w-1/3)*255)))}function b(w,C,S){return(4278190080|Math.round(S/100*255)<<16|Math.round(C/100*255)<<8|Math.round(w/100*255))>>>0}e.normalizeRGB=b;function y(w,C,S){return x((w+240%360)/360,C/100,S/100)}e.normalizeHLS=y,e.PALETTE_VT340_COLOR=new Uint32Array([b(0,0,0),b(20,20,80),b(80,13,13),b(20,80,20),b(80,20,80),b(20,80,80),b(80,80,20),b(53,53,53),b(26,26,26),b(33,33,60),b(60,26,26),b(33,60,33),b(60,33,60),b(33,60,60),b(60,60,33),b(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46),b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let w=[l(0,0,0),l(205,0,0),l(0,205,0),l(205,205,0),l(0,0,238),l(205,0,205),l(0,250,205),l(229,229,229),l(127,127,127),l(255,0,0),l(0,255,0),l(255,255,0),l(92,92,255),l(255,0,255),l(0,255,255),l(255,255,255)],C=[0,95,135,175,215,255];for(let S=0;S<6;++S)for(let I=0;I<6;++I)for(let N=0;N<6;++N)w.push(l(C[S],C[I],C[N]));for(let S=8;S<=238;S+=10)w.push(l(S,S,S));return new Uint32Array(w)})(),e.DEFAULT_BACKGROUND=l(0,0,0,255),e.DEFAULT_FOREGROUND=l(255,255,255,255)}),x6=J0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=r;var t=n=>{if(Uint8Array.fromBase64)return Uint8Array.fromBase64(n);if(typeof Buffer<"u")return Buffer.from(n,"base64");let a=atob(n),l=new Uint8Array(a.length);for(let c=0;c<l.length;++c)l[c]=a.charCodeAt(c);return l};function r(n){if(n.d){let{t:a,s:l,d:c}=n,h,p,m=WebAssembly;return a===0?l?x=>new m.Instance(p||(p=new m.Module(h||(h=t(c)))),x):x=>p?m.instantiate(p,x):m.instantiate(h||(h=t(c)),x).then(b=>(p=b.module)&&b.instance):a===1?l?()=>p||(p=new m.Module(h||(h=t(c)))):()=>p?Promise.resolve(p):m.compile(h||(h=t(c))).then(x=>p=x):l?()=>h||(h=t(c)):()=>Promise.resolve(h||(h=t(c)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(n)}}),b6=J0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=x6(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqLBgKZBAEKf0GIKCgCAEGgKGohAUGEKCgCACIDQaAoaiEAQYAoKAIAQQFrQXxxIgRBoChqIQUgBEEQayADSgRAIARBkChqIQMDQCABIABBA2otAABBAnQoAoAgIABBAmotAABBAnQoAoAYIABBAWotAABBAnQoAoAQIAAtAABBAnQoAoAIcnJyIgY2AgAgAUEDaiAAQQdqLQAAQQJ0KAKAICAAQQZqLQAAQQJ0KAKAGCAAQQVqLQAAQQJ0KAKAECAAQQRqLQAAQQJ0KAKACHJyciIHNgIAIAFBBmogAEELai0AAEECdCgCgCAgAEEKai0AAEECdCgCgBggAEEJai0AAEECdCgCgBAgAEEIai0AAEECdCgCgAhycnIiCDYCACABQQlqIABBD2otAABBAnQoAoAgIABBDmotAABBAnQoAoAYIABBDWotAABBAnQoAoAQIABBDGotAABBAnQoAoAIcnJyIgk2AgAgAiAGciAHciAIciAJciECIAFBDGohASAAQRBqIgAgA0kNAAsLIAAgBUkEQANAIAEgAEEDai0AAEECdCgCgCAgAEECai0AAEECdCgCgBggAEEBai0AAEECdCgCgBAgAC0AAEECdCgCgAhycnIiAzYCACACIANyIQIgAUEDaiEBIABBBGoiACAFSQ0ACwtBfyEAIAJB////B00Ef0GEKCAENgIAQYgoIAFBoChrNgIAQQAFQX8LC+0BAQR/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQX8hAxAADQFBgCgoAgAhAUGEKCgCACEAC0F/IQMgASAAayIBQQJIDQAgAC0AoShBAnQoAoAQIAAtAKAoQQJ0KAKACHIhAgJ/IAFBBEYEQEEDQQQgAC0AoyhBPUYbIAAtAKIoQT1GayEBC0EBIAFBA0kNABogAC0AoihBAnQoAoAYIAJyIQJBAiABQQRHDQAaIAAtAKMoQQJ0KAKAICACciECQQMLIQEgAkH///8HSw0AQQAhA0GIKCgCACIAIAI2AKAoQYgoIAAgAWo2AgALIAML"}),n=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map(h=>h.charCodeAt(0))),a=new Uint32Array(1024);a.fill(4278190080);for(let h=0;h<n.length;++h)a[n[h]]=h<<2;for(let h=0;h<n.length;++h)a[256+n[h]]=h>>4|(h<<4&255)<<8;for(let h=0;h<n.length;++h)a[512+n[h]]=h>>2<<8|(h<<6&255)<<16;for(let h=0;h<n.length;++h)a[768+n[h]]=h<<16;var l=new Uint8Array(0),c=class{constructor(h,p,m){if(this._inst=null,this._ended=!0,this._bytes=0,this.keepSize=h??1048576,this.maxBytes=p??4294901760,this._bytes=m??32768,this._bytes>this.maxBytes||this.maxBytes>4294901760)throw new Error("invalid byte settings")}get data8(){return this._inst?this._d.subarray(0,this._m32[1282]):l}release(){this._inst&&(this._bytes>this.keepSize?this._inst=this._m32=this._d=this._mem=null:(this._m32[1280]=0,this._m32[1281]=0,this._m32[1282]=0))}init(h,p){if(this.maxBytes=h??this.maxBytes,this._bytes=p??Math.min(this._bytes,this.maxBytes),this._bytes>this.maxBytes||this.maxBytes>4294901760)throw Error("invalid byte settings");let m=this._m32,x=this._bytes+5152;this._inst?this._mem.buffer.byteLength<x&&(this._mem.grow(Math.ceil((x-this._mem.buffer.byteLength)/65536)),m=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(x/65536)}),this._inst=r({env:{memory:this._mem}}),m=new Uint32Array(this._mem.buffer,0),m.set(a,256),this._d=new Uint8Array(this._mem.buffer,5152)),m[1280]=0,m[1281]=0,m[1282]=0,this._m32=m,this._ended=!1}_realloc(h){let p=this._m32[1280]+h;if(this._bytes<p){if(p>this.maxBytes)return-3;let m=this._bytes;for(;(m*=2)<p;);if(m=Math.min(m,this.maxBytes),m<p)return-3;if(m+5152>this._mem.buffer.byteLength){let x=Math.ceil((m+5152-this._mem.buffer.byteLength)/65536);this._mem.grow(x),this._m32=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)}this._bytes=m}return 0}put(h){if(!this._inst||this._ended)return-2;if(this._realloc(h.length))return-3;let p=this._m32;return this._d.set(h,p[1280]),p[1280]+=h.length,p[1280]-p[1281]>=131072?this._inst.exports.dec():0}end(){return this._ended=!0,this._inst?this._inst.exports.end():-2}get loadedBytes(){return this._inst?this._m32[1280]:0}get freeBytes(){return this._inst?this.maxBytes-this._m32[1280]:0}};e.default=c}),$I=J0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=x6(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),n=class{constructor(a){this.keepSize=a,this.width=0,this.height=0}decode(a){this.width=a[4]<<24|a[5]<<16|a[6]<<8|a[7],this.height=a[8]<<24|a[9]<<16|a[10]<<8|a[11];let l=this.width*this.height,c=l*4,h=a.length,p=Math.max(c,h)+(Math.min(c,h)>>1)+4096;this._inst?this._mem.buffer.byteLength<p&&(this._mem.grow(Math.ceil((p-this._mem.buffer.byteLength)/65536)),this._d=null):(this._mem=new WebAssembly.Memory({initial:Math.ceil(p/65536)}),this._inst=r({env:{memory:this._mem}})),this._d||(this._d=new Uint8Array(this._mem.buffer));let m=this._mem.buffer.byteLength-h&-256;return this._d.set(a,m),this._inst.exports.dec(m,h,l),this._d.subarray(1024,1024+c)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=n}),UI=J0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LIMITS=void 0,e.LIMITS={CHUNK_SIZE:16384,PALETTE_SIZE:4096,MAX_WIDTH:16384,BYTES:"AGFzbQEAAAABJAdgAAF/YAJ/fwBgA39/fwF/YAF/AX9gAABgBH9/f38AYAF/AAIlAgNlbnYLaGFuZGxlX2JhbmQAAwNlbnYLbW9kZV9wYXJzZWQAAwMTEgQAAAAAAQQBAQUBAAACAgAGAwQFAXABBwcFBAEBBwcGCAF/AUGAihoLB9wBDgZtZW1vcnkCABFnZXRfc3RhdGVfYWRkcmVzcwADEWdldF9jaHVua19hZGRyZXNzAAQOZ2V0X3AwX2FkZHJlc3MABRNnZXRfcGFsZXR0ZV9hZGRyZXNzAAYEaW5pdAALBmRlY29kZQAMDWN1cnJlbnRfd2lkdGgADQ5jdXJyZW50X2hlaWdodAAOGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtfaW5pdGlhbGl6ZQACCXN0YWNrU2F2ZQARDHN0YWNrUmVzdG9yZQASCnN0YWNrQWxsb2MAEwkMAQBBAQsGCgcJDxACDAEBCq5UEgMAAQsFAEGgCAsGAEGQiQELBgBBsIkCCwUAQZAJC+okAQh/QeQIKAIAIQVB4AgoAgAhA0HoCCgCACEIIAFBkIkBaiIJQf8BOgAAIAAgAUgEQCAAQZCJAWohBgNAIAMhBCAGQQFqIQECQCAGLQAAQf8AcSIDQTBrQQlLBEAgASEGDAELQewIKAIAQQJ0QewIaiICKAIAIQADQCACIAMgAEEKbGpBMGsiADYCACABLQAAIQMgAUEBaiIGIQEgA0H/AHEiA0Ewa0EKSQ0ACwsCQAJAAkACQAJAAkACQAJ/AkACQCADQT9rIgBBP00EQCAERQ0BIARBIUYEQAJAQfAIKAIAIgFBASABGyIHIAhqIgFB1AgoAgAiA0gNACADQf//AEoNAANAIANBAnQiAkGgiQJqIgRBoAgpAwA3AwAgAkGoiQJqQaAIKQMANwMAIAJBsIkCakGgCCkDADcDACACQbiJAmpBoAgpAwA3AwAgAkHAiQJqQaAIKQMANwMAIAJByIkCakGgCCkDADcDACACQdCJAmpBoAgpAwA3AwAgAkHYiQJqQaAIKQMANwMAIAJB4IkCakGgCCkDADcDACACQeiJAmpBoAgpAwA3AwAgAkHwiQJqQaAIKQMANwMAIAJB+IkCakGgCCkDADcDACACQYCKAmpBoAgpAwA3AwAgAkGIigJqQaAIKQMANwMAIAJBkIoCakGgCCkDADcDACACQZiKAmpBoAgpAwA3AwAgAkGgigJqQaAIKQMANwMAIAJBqIoCakGgCCkDADcDACACQbCKAmpBoAgpAwA3AwAgAkG4igJqQaAIKQMANwMAIAJBwIoCakGgCCkDADcDACACQciKAmpBoAgpAwA3AwAgAkHQigJqQaAIKQMANwMAIAJB2IoCakGgCCkDADcDACACQeCKAmpBoAgpAwA3AwAgAkHoigJqQaAIKQMANwMAIAJB8IoCakGgCCkDADcDACACQfiKAmpBoAgpAwA3AwAgAkGAiwJqQaAIKQMANwMAIAJBiIsCakGgCCkDADcDACACQZCLAmpBoAgpAwA3AwAgAkGYiwJqQaAIKQMANwMAIAJBoIsCakGgCCkDADcDACACQaiLAmpBoAgpAwA3AwAgAkGwiwJqQaAIKQMANwMAIAJBuIsCakGgCCkDADcDACACQcCLAmpBoAgpAwA3AwAgAkHIiwJqQaAIKQMANwMAIAJB0IsCakGgCCkDADcDACACQdiLAmpBoAgpAwA3AwAgAkHgiwJqQaAIKQMANwMAIAJB6IsCakGgCCkDADcDACACQfCLAmpBoAgpAwA3AwAgAkH4iwJqQaAIKQMANwMAIAJBgIwCakGgCCkDADcDACACQYiMAmpBoAgpAwA3AwAgAkGQjAJqQaAIKQMANwMAIAJBmIwCakGgCCkDADcDACACQaCMAmpBoAgpAwA3AwAgAkGojAJqQaAIKQMANwMAIAJBsIwCakGgCCkDADcDACACQbiMAmpBoAgpAwA3AwAgAkHAjAJqQaAIKQMANwMAIAJByIwCakGgCCkDADcDACACQdCMAmpBoAgpAwA3AwAgAkHYjAJqQaAIKQMANwMAIAJB4IwCakGgCCkDADcDACACQeiMAmpBoAgpAwA3AwAgAkHwjAJqQaAIKQMANwMAIAJB+IwCakGgCCkDADcDACACQYCNAmpBoAgpAwA3AwAgAkGIjQJqQaAIKQMANwMAIAJBkI0CakGgCCkDADcDACACQZiNAmpBoAgpAwA3AwAgAkGwiQZqIARBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBEGABPwKAABB1AgoAgBBAnRB0IkOaiAEQYAE/AoAAEHUCCgCAEECdEHgiRJqIARBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBEGABPwKAABB1AhB1AgoAgAiAkGAAWoiAzYCACABIANIDQEgAkGA/wBIDQALCwJAIABFDQAgCEH//wBLDQBBgIABIAhrIAcgAUH//wBLGyECAkAgAEEBcUUNACACRQ0AIAhBAnRBoIkCaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBAnFFDQAgAkUNACAIQQJ0QbCJBmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsCQCAAQQRxRQ0AIAJFDQAgCEECdEHAiQpqIQMgAiEEIAJBB3EiBwRAA0AgAyAFNgIAIANBBGohAyAEQQFrIQQgB0EBayIHDQALCyACQQFrQQdJDQADQCADIAU2AhwgAyAFNgIYIAMgBTYCFCADIAU2AhAgAyAFNgIMIAMgBTYCCCADIAU2AgQgAyAFNgIAIANBIGohAyAEQQhrIgQNAAsLAkAgAEEIcUUNACACRQ0AIAhBAnRB0IkOaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBEHFFDQAgAkUNACAIQQJ0QeCJEmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsgAEEgcUUNACACRQ0AIAJBAWshByAIQQJ0QfCJFmohAyACQQdxIgQEQANAIAMgBTYCACADQQRqIQMgAkEBayECIARBAWsiBA0ACwsgB0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgAkEIayICDQALC0HcCEHcCCgCACAAcjYCACAGQQFqIgIgBi0AAEH/AHEiA0E/ayIAQT9LDQQaDAMLAkBB7AgoAgAiBEEBRgRAQfAIKAIAIgNBzAgoAgAiAUkNASADIAFwIQMMAQtB+AgoAgAhAkH0CCgCACEBAkACQCAEQQVHDQAgAUEBRw0AIAJB6QJODQQMAQsgAkHkAEoNA0H8CCgCAEHkAEoNA0GACSgCAEHkAEoNAwsCQCABRQ0AIAFBAkoNACACQfwIKAIAQYAJKAIAIAFBAnRBiAhqKAIAEQIAIQFB8AgoAgAiA0HMCCgCACICTwR/IAMgAnAFIAMLQQJ0QZAJaiABNgIAC0HwCCgCACIDQcwIKAIAIgFJDQAgAyABcCEDCyADQQJ0QZAJaigCACEFDAELIANB/QBxQSFHBEAgCCEBIAYhAgwECyAEQSNHDQQCQEHsCCgCACICQQFGBEBB8AgoAgAiAUHMCCgCACIASQ0BIAEgAHAhAQwBC0H4CCgCACEBQfQIKAIAIQACQAJAIAJBBUcNACAAQQFHDQAgAUHpAkgNAQwHCyABQeQASg0GQfwIKAIAQeQASg0GQYAJKAIAQeQASg0GCwJAIABFDQAgAEECSg0AIAFB/AgoAgBBgAkoAgAgAEECdEGICGooAgARAgAhAEHwCCgCACIBQcwIKAIAIgJPBH8gASACcAUgAQtBAnRBkAlqIAA2AgALQfAIKAIAIgFBzAgoAgAiAEkNACABIABwIQELIAFBAnRBkAlqKAIAIQUMBAsgCCEBIAYhAgtB1AgoAgAhBgNAAkAgASAGSA0AIAZB//8ASg0AIAZBAnQiBEGgiQJqIgZBoAgpAwA3AwAgBEGoiQJqQaAIKQMANwMAIARBsIkCakGgCCkDADcDACAEQbiJAmpBoAgpAwA3AwAgBEHAiQJqQaAIKQMANwMAIARByIkCakGgCCkDADcDACAEQdCJAmpBoAgpAwA3AwAgBEHYiQJqQaAIKQMANwMAIARB4IkCakGgCCkDADcDACAEQeiJAmpBoAgpAwA3AwAgBEHwiQJqQaAIKQMANwMAIARB+IkCakGgCCkDADcDACAEQYCKAmpBoAgpAwA3AwAgBEGIigJqQaAIKQMANwMAIARBkIoCakGgCCkDADcDACAEQZiKAmpBoAgpAwA3AwAgBEGgigJqQaAIKQMANwMAIARBqIoCakGgCCkDADcDACAEQbCKAmpBoAgpAwA3AwAgBEG4igJqQaAIKQMANwMAIARBwIoCakGgCCkDADcDACAEQciKAmpBoAgpAwA3AwAgBEHQigJqQaAIKQMANwMAIARB2IoCakGgCCkDADcDACAEQeCKAmpBoAgpAwA3AwAgBEHoigJqQaAIKQMANwMAIARB8IoCakGgCCkDADcDACAEQfiKAmpBoAgpAwA3AwAgBEGAiwJqQaAIKQMANwMAIARBiIsCakGgCCkDADcDACAEQZCLAmpBoAgpAwA3AwAgBEGYiwJqQaAIKQMANwMAIARBoIsCakGgCCkDADcDACAEQaiLAmpBoAgpAwA3AwAgBEGwiwJqQaAIKQMANwMAIARBuIsCakGgCCkDADcDACAEQcCLAmpBoAgpAwA3AwAgBEHIiwJqQaAIKQMANwMAIARB0IsCakGgCCkDADcDACAEQdiLAmpBoAgpAwA3AwAgBEHgiwJqQaAIKQMANwMAIARB6IsCakGgCCkDADcDACAEQfCLAmpBoAgpAwA3AwAgBEH4iwJqQaAIKQMANwMAIARBgIwCakGgCCkDADcDACAEQYiMAmpBoAgpAwA3AwAgBEGQjAJqQaAIKQMANwMAIARBmIwCakGgCCkDADcDACAEQaCMAmpBoAgpAwA3AwAgBEGojAJqQaAIKQMANwMAIARBsIwCakGgCCkDADcDACAEQbiMAmpBoAgpAwA3AwAgBEHAjAJqQaAIKQMANwMAIARByIwCakGgCCkDADcDACAEQdCMAmpBoAgpAwA3AwAgBEHYjAJqQaAIKQMANwMAIARB4IwCakGgCCkDADcDACAEQeiMAmpBoAgpAwA3AwAgBEHwjAJqQaAIKQMANwMAIARB+IwCakGgCCkDADcDACAEQYCNAmpBoAgpAwA3AwAgBEGIjQJqQaAIKQMANwMAIARBkI0CakGgCCkDADcDACAEQZiNAmpBoAgpAwA3AwAgBEGwiQZqIAZBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBkGABPwKAABB1AgoAgBBAnRB0IkOaiAGQYAE/AoAAEHUCCgCAEECdEHgiRJqIAZBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBkGABPwKAABB1AhB1AgoAgBBgAFqIgY2AgALIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiAFNgIAIABBAXZBAXEgAWxBAnRBsIkGaiAFNgIAIABBAnZBAXEgAWxBAnRBwIkKaiAFNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiAFNgIAIABBBHZBAXEgAWxBAnRB4IkSaiAFNgIAIABBBXYgAWxBAnRB8IkWaiAFNgIAQdQIKAIAIQYLIAFBAWohAUHcCEHcCCgCACAAcjYCACACLQAAIQAgAkEBaiIEIQIgAEH/AHEiA0E/ayIAQcAASQ0ACyAECyECQQAhBCACIQYgASEIIANB/QBxQSFGDQELIANBJGsOCgEDAwMDAwMDAwIDC0HsCEIBNwIADAQLQdgIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbNgIADAILQegIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbIgA2AgBB2AggADYCACAAQQRrEAAEQEHoCEEENgIAQdgIQQQ2AgBB0AhBATYCAA8LEAgMAQsCQCADQTtHDQBB7AgoAgAiAEEHSg0AQewIIABBAWo2AgAgAEECdEHwCGpBADYCAAsgAiEGIAQhAyABIQgMAQtBBCEIIAIhBiAEIQMLIAYgCUkNAAsLQeQIIAU2AgBB4AggAzYCAEHoCCAINgIAC9ELAgF+CH9B2AhCBDcDAEGojQJBoAgpAwAiADcDAEGgjQIgADcDAEGYjQIgADcDAEGQjQIgADcDAEGIjQIgADcDAEGAjQIgADcDAEH4jAIgADcDAEHwjAIgADcDAEHojAIgADcDAEHgjAIgADcDAEHYjAIgADcDAEHQjAIgADcDAEHIjAIgADcDAEHAjAIgADcDAEG4jAIgADcDAEGwjAIgADcDAEGojAIgADcDAEGgjAIgADcDAEGYjAIgADcDAEGQjAIgADcDAEGIjAIgADcDAEGAjAIgADcDAEH4iwIgADcDAEHwiwIgADcDAEHoiwIgADcDAEHgiwIgADcDAEHYiwIgADcDAEHQiwIgADcDAEHIiwIgADcDAEHAiwIgADcDAEG4iwIgADcDAEGwiwIgADcDAEGoiwIgADcDAEGgiwIgADcDAEGYiwIgADcDAEGQiwIgADcDAEGIiwIgADcDAEGAiwIgADcDAEH4igIgADcDAEHwigIgADcDAEHoigIgADcDAEHgigIgADcDAEHYigIgADcDAEHQigIgADcDAEHIigIgADcDAEHAigIgADcDAEG4igIgADcDAEGwigIgADcDAEGoigIgADcDAEGgigIgADcDAEGYigIgADcDAEGQigIgADcDAEGIigIgADcDAEGAigIgADcDAEH4iQIgADcDAEHwiQIgADcDAEHoiQIgADcDAEHgiQIgADcDAEHYiQIgADcDAEHQiQIgADcDAEHIiQIgADcDAEHAiQIgADcDAEG4iQIgADcDAEGwiQIgADcDAEGoCCgCACIEQf8AakGAAW0hCAJAIARBgQFIDQBBASEBIAhBAiAIQQJKG0EBayICQQFxIQMgBEGBAk4EQCACQX5xIQIDQCABQQl0IgdBEHJBoIkCakGwiQJBgAT8CgAAIAdBsI0CakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsLIANFDQAgAUEJdEEQckGgiQJqQbCJAkGABPwKAAALAkAgBEEBSA0AIAhBASAIQQFKGyIDQQFxIQUCQCADQQFrIgdFBEBBACEBDAELIANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQbCJBmpBsIkCQYAE/AoAACAGQZAEckGwiQZqQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACwsgBQRAIAFBCXRBEHJBsIkGakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEFIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiBkEQckHAiQpqQbCJAkGABPwKAAAgBkGQBHJBwIkKakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAFBEAgAUECdEHAiQpqQbCJAkGABPwKAAALIARBAUgNACADQQFxIQUgBwR/IANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQdCJDmpBsIkCQYAE/AoAACAGQZAEckHQiQ5qQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACyABQQd0QQRyBUEECyEBIAUEQCABQQJ0QdCJDmpBsIkCQYAE/AoAAAsgBEEBSA0AIANBAXEhBSAHBH8gA0H+////B3EhAkEAIQEDQCABQQl0IgZBEHJB4IkSakGwiQJBgAT8CgAAIAZBkARyQeCJEmpBsIkCQYAE/AoAACABQQJqIQEgAkECayICDQALIAFBB3RBBHIFQQQLIQEgBQRAIAFBAnRB4IkSakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEEIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiA0EQckHwiRZqQbCJAkGABPwKAAAgA0GQBHJB8IkWakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAERQ0AIAFBAnRB8IkWakGwiQJBgAT8CgAAC0HUCCAIQQd0QQRyNgIAC58TAgh/AX5B5AgoAgAhA0HgCCgCACECQegIKAIAIQcgAUGQiQFqIglB/wE6AAAgACABSARAIABBkIkBaiEIA0AgAiEEIAhBAWohAQJAIAgtAABB/wBxIgJBMGtBCUsEQCABIQgMAQtB7AgoAgBBAnRB7AhqIgUoAgAhAANAIAUgAiAAQQpsakEwayIANgIAIAEtAAAhAiABQQFqIgghASACQf8AcSICQTBrQQpJDQALCwJAAkACQAJAAkACQAJ/AkAgAkE/ayIAQT9NBEAgBEUNASAEQSFGBEBB8AgoAgAiAUEBIAEbIgQgB2ohAQJAIABFDQAgB0H//wBLDQBBgIABIAdrIAQgAUH//wBLGyEFAkAgAEEBcUUNACAHQQJ0QaCJAmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEECcUUNACAHQQJ0QbCJBmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEEcUUNACAHQQJ0QcCJCmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEIcUUNACAHQQJ0QdCJDmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEQcUUNACAHQQJ0QeCJEmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLIABBIHFFDQAgBUEBayEEIAdBAnRB8IkWaiEAIAVBB3EiAgRAA0AgACADNgIAIABBBGohACAFQQFrIQUgAkEBayICDQALCyAEQQdJDQADQCAAIAM2AhwgACADNgIYIAAgAzYCFCAAIAM2AhAgACADNgIMIAAgAzYCCCAAIAM2AgQgACADNgIAIABBIGohACAFQQhrIgUNAAsLIAhBAWoiBSAILQAAQf8AcSICQT9rIgBBP00NAxoMBAsCQEHsCCgCACIFQQFGBEBB8AgoAgAiAUHMCCgCACIESQ0BIAEgBHAhAQwBC0H4CCgCACEEQfQIKAIAIQECQAJAIAVBBUcNACABQQFHDQAgBEHpAk4NBAwBCyAEQeQASg0DQfwIKAIAQeQASg0DQYAJKAIAQeQASg0DCwJAIAFFDQAgAUECSg0AIARB/AgoAgBBgAkoAgAgAUECdEGICGooAgARAgAhBEHwCCgCACIBQcwIKAIAIgVPBH8gASAFcAUgAQtBAnRBkAlqIAQ2AgALQfAIKAIAIgFBzAgoAgAiBEkNACABIARwIQELIAFBAnRBkAlqKAIAIQMMAQsgAkH9AHFBIUcEQCAHIQEgAiEADAQLIARBI0cNBAJAQewIKAIAIgRBAUYEQEHwCCgCACIBQcwIKAIAIgBJDQEgASAAcCEBDAELQfgIKAIAIQFB9AgoAgAhAAJAAkAgBEEFRw0AIABBAUcNACABQekCSA0BDAcLIAFB5ABKDQZB/AgoAgBB5ABKDQZBgAkoAgBB5ABKDQYLAkAgAEUNACAAQQJKDQAgAUH8CCgCAEGACSgCACAAQQJ0QYgIaigCABECACEAQfAIKAIAIgFBzAgoAgAiBE8EfyABIARwBSABC0ECdEGQCWogADYCAAtB8AgoAgAiAUHMCCgCACIASQ0AIAEgAHAhAQsgAUECdEGQCWooAgAhAwwECyAHIQEgCAshBQNAIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiADNgIAIABBAXZBAXEgAWxBAnRBsIkGaiADNgIAIABBAnZBAXEgAWxBAnRBwIkKaiADNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiADNgIAIABBBHZBAXEgAWxBAnRB4IkSaiADNgIAIABBBXYgAWxBAnRB8IkWaiADNgIACyABQQFqIQEgBS0AACEAIAVBAWoiBCEFIABB/wBxIgJBP2siAEHAAEkNAAsgBCEFC0EAIQQgBSEIIAEhByACIQAgAkH9AHFBIUYNAQtBBCEHIAQhAiAAQSRrDgoDAgICAgICAgIBAgtB7AhCATcCAAwCC0GoCCgCAEEEaxAABEBB0AhBATYCAA8LAkBBqAgoAgAiBkEFSA0AQaAIKQMAIQogBkEDa0EBdiIBQQdxIQJBACEAIAFBAWtBB08EQCABQfj///8HcSEFA0AgAEEDdCIBQbCJAmogCjcDACABQQhyQbCJAmogCjcDACABQRByQbCJAmogCjcDACABQRhyQbCJAmogCjcDACABQSByQbCJAmogCjcDACABQShyQbCJAmogCjcDACABQTByQbCJAmogCjcDACABQThyQbCJAmogCjcDACAAQQhqIQAgBUEIayIFDQALCyACRQ0AA0AgAEEDdEGwiQJqIAo3AwAgAEEBaiEAIAJBAWsiAg0ACwtBwIkGQbCJAiAGQQJ0IgD8CgAAQdCJCkGwiQIgAPwKAABB4IkOQbCJAiAA/AoAAEHwiRJBsIkCIAD8CgAAQYCKFkGwiQIgAPwKAAAgBCECDAELAkAgAEE7Rw0AQewIKAIAIgBBB0oNAEHsCCAAQQFqNgIAIABBAnRB8AhqQQA2AgALIAEhBwsgCCAJSQ0ACwtB5AggAzYCAEHgCCACNgIAQegIIAc2AgAL4gcCBX8BfgJAQdAIAn8CQAJAIAAgAU4NACABQZCJAWohBiAAQZCJAWohBQNAIAUtAAAiA0H/AHEhAgJAAkACQAJAAkACQAJAQeAIKAIAIgRBIkcEQCAEDQcgAkEiRgRAQewIQgE3AgBB4AhBIjYCAAwICyACQT9rQcAASQ0GIANBIWsiAkEMTQ0BDAULAkAgAkEwayIEQQlNBEBB7AgoAgBBAnRB7AhqIgIgBCACKAIAQQpsajYCAAwBC0HsCCgCACEEIAJBO0YEQCAEQQdKDQFB7AggBEEBajYCACAEQQJ0QfAIakEANgIADAELIARBBEYEQEHECEECNgIAQbAIQfAIKQMANwMAQbgIQfgIKAIAIgI2AgBBvAhB/AgoAgAiBDYCAEHICEECQQFBwAgoAgAiAxs2AgBBrAggBEEAIAMbNgIAQagIIAJBgIABIAJBgIABSBtBBGpBACADGzYCAEHgCEEANgIADAoLIAJBP2tBwABJDQQLIANBIWsiAkEMTQ0BDAILQQEgAnRBjSBxRQ0DDAQLQQEgAnRBjSBxDQELIANBoQFrIgJBDEsNA0EBIAJ0QY0gcUUNAwtBxAhCgYCAgBA3AgBBsAhB8AgoAgBBAEHsCCgCACICQQBKGzYCAEG0CEH0CCgCAEEAIAJBAUobNgIAQbgIQfgIKAIAQQAgAkECShs2AgBB4AhBADYCAEG8CEEANgIADAQLIANBoQFrIgJBDEsNAUEBIAJ0QY0gcUUNAQtBxAhCgYCAgBA3AgBBsAhCADcDAEG4CEIANwMADAMLIAVBAWoiBSAGSQ0ACwsCQEHICCgCAA4DAwEAAQsCQEGoCCgCACIFQQVIDQBBoAgpAwAhByAFQQNrQQF2IgNBB3EhBEEAIQIgA0EBa0EHTwRAIANB+P///wdxIQYDQCACQQN0IgNBsIkCaiAHNwMAIANBCHJBsIkCaiAHNwMAIANBEHJBsIkCaiAHNwMAIANBGHJBsIkCaiAHNwMAIANBIHJBsIkCaiAHNwMAIANBKHJBsIkCaiAHNwMAIANBMHJBsIkCaiAHNwMAIANBOHJBsIkCaiAHNwMAIAJBCGohAiAGQQhrIgYNAAsLIARFDQADQCACQQN0QbCJAmogBzcDACACQQFqIQIgBEEBayIEDQALC0HAiQZBsIkCIAVBAnQiA/wKAABB0IkKQbCJAiAD/AoAAEHgiQ5BsIkCIAP8CgAAQfCJEkGwiQIgA/wKAABBgIoWQbCJAiAD/AoAAEECDAELEAhByAgoAgALEAEiAjYCACACDQAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLdABB6AhBBDYCAEHkCCAANgIAQewIQgE3AgBBxAhCADcCAEHACCADNgIAQdwIQgA3AgBBqAhCADcDAEGwCEIANwMAQbgIQgA3AwBBzAggAkGAICACQYAgSRs2AgBBoAggAa1CgYCAgBB+NwMAQdAIQQA2AgALIwBB0AgoAgBFBEAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLWgECfwJAAkACQEHICCgCAEEBaw4CAAECC0HYCEHoCCgCACIAQdgIKAIAIgEgACABShsiAEGAgAEgAEGAgAFIGyIANgIAIABBBGsPC0GoCCgCAEEEayEACyAAC0IBAX8Cf0EGQdwIKAIAIgBBIHENABpBBSAAQRBxDQAaQQQgAEEIcQ0AGkEDIABBBHENABpBAiAAQQFxIABBAnEbCwu9BQEFfQJ/IAJFBEAgAUH/AWxBMmpB5ABtIgBBCHQgAHIgAEEQdHIMAQsgArJDAADIQpUhBiAAQfABarJDAAC0Q5UhBQJ9IAGyQwAAyEKVIgNDAAAAP10EQCADIAZDAACAP5KUDAELIAYgA0MAAIA/IAaTlJILIQcgAyADkiEGAkAgBUOrqqo+kiIEQwAAAABdBEAgBEMAAIA/kiEEDAELIARDAACAP15FDQAgBEMAAIC/kiEECyAGIAeTIQMgBUMAAAAAXSEAAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQECQCAABEAgBUMAAIA/kiEEDAELIAUiBEMAAIA/XkUNACAFQwAAgL+SIQQLIAVDq6qqvpIiBUMAAAAAXSECAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQACQCACBEAgBUMAAIA/kiEFDAELIAVDAACAP15FDQAgBUMAAIC/kiEFCwJAIAVDq6oqPl0EQCADIAcgA5NDAADAQJQgBZSSIQcMAQsgBUMAAAA/XQ0AIAVDq6oqP11FBEAgAyEHDAELIAMgByADkyAFQwAAwMCUQwAAgECSlJIhBwsgAEEIdAJ/IAdDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALQRB0ciABcgtBgICAeHILNwAgAEH/AWxBMmpB5ABtIAFB/wFsQTJqQeQAbUEIdHIgAkH/AWxBMmpB5ABtQRB0ckGAgIB4cgsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwsYAQBBgAgLEQEAAAACAAAAAwAAAAQAAAAF"}}),zI=J0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=B1(),r=UI();function n(w){if(typeof Buffer<"u")return Buffer.from(w,"base64");let C=atob(w),S=new Uint8Array(C.length);for(let I=0;I<S.length;++I)S[I]=C.charCodeAt(I);return S}var a=n(r.LIMITS.BYTES),l,c=new Uint32Array,h=class{constructor(){this.bandHandler=w=>1,this.modeHandler=w=>1}handle_band(w){return this.bandHandler(w)}mode_parsed(w){return this.modeHandler(w)}},p={memoryLimit:2048*65536,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:r.LIMITS.PALETTE_SIZE,truncate:!0};function m(w){let C=new h,S={env:{handle_band:C.handle_band.bind(C),mode_parsed:C.mode_parsed.bind(C)}};return WebAssembly.instantiate(l||a,S).then(I=>(l=l||I.module,new x(w,I.instance||I,C)))}e.DecoderAsync=m;var x=class{constructor(w,C,S){if(this._PIXEL_OFFSET=r.LIMITS.MAX_WIDTH+4,this._canvas=c,this._bandWidths=[],this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},p,w),this._opts.paletteLimit>r.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${r.LIMITS.PALETTE_SIZE}`);if(C)S.bandHandler=this._handle_band.bind(this),S.modeHandler=this._initCanvas.bind(this);else{let I=l||(l=new WebAssembly.Module(a));C=new WebAssembly.Instance(I,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=C,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),r.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),r.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(w){if(w===2){let C=this.width*this.height;if(C>this._canvas.length){if(this._opts.memoryLimit&&C*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(C)}this._maxWidth=this._width}else if(w===1)if(this._level===2){let C=Math.min(this._rasterWidth,r.LIMITS.MAX_WIDTH)*this._rasterHeight;if(C>this._canvas.length){if(this._opts.memoryLimit&&C*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(C)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(w,C){let S=w+C;if(S>this._canvas.length){if(this._opts.memoryLimit&&S*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let I=new Uint32Array(Math.ceil(S/65536)*65536);I.set(this._canvas),this._canvas=I}}_handle_band(w){let C=this._PIXEL_OFFSET,S=this._lastOffset;if(this._mode===2){let I=this.height-this._currentHeight,N=0;for(;N<6&&I>0;)this._canvas.set(this._pSrc.subarray(C*N,C*N+w),S+w*N),N++,I--;this._lastOffset+=w*N,this._currentHeight+=N}else if(this._mode===1){this._realloc(S,w*6),this._maxWidth=Math.max(this._maxWidth,w),this._minWidth=Math.min(this._minWidth,w);for(let I=0;I<6;++I)this._canvas.set(this._pSrc.subarray(C*I,C*I+w),S+w*I);this._bandWidths.push(w),this._lastOffset+=w*6,this._currentHeight+=6}return 0}get width(){return this._mode!==1?this._width:Math.max(this._maxWidth,this._wasm.current_width())}get height(){return this._mode!==1?this._height:this._wasm.current_width()?this._bandWidths.length*6+this._wasm.current_height():this._bandWidths.length*6}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(w=this._opts.fillColor,C=this._opts.palette,S=this._opts.paletteLimit,I=this._opts.truncate){this._wasm.init(this._opts.sixelColor,w,S,I?1:0),C&&this._palette.set(C.subarray(0,r.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(w,C=0,S=w.length){let I=C;for(;I<S;){let N=Math.min(S-I,r.LIMITS.CHUNK_SIZE);this._chunk.set(w.subarray(I,I+=N)),this._wasm.decode(0,N)}}decodeString(w,C=0,S=w.length){let I=C;for(;I<S;){let N=Math.min(S-I,r.LIMITS.CHUNK_SIZE);for(let Q=0,W=I;Q<N;++Q,++W)this._chunk[Q]=w.charCodeAt(W);I+=N,this._wasm.decode(0,N)}}get data32(){if(this._mode===0||!this.width||!this.height)return c;let w=this._wasm.current_width();if(this._mode===2){let C=this.height-this._currentHeight;if(C>0){let S=this._PIXEL_OFFSET,I=this._lastOffset,N=0;for(;N<6&&C>0;)this._canvas.set(this._pSrc.subarray(S*N,S*N+w),I+w*N),N++,C--;C&&this._canvas.fill(this._fillColor,I+w*N)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let N=!1;if(w)if(w!==this._minWidth)N=!0;else{let Q=this._PIXEL_OFFSET,W=this._lastOffset;this._realloc(W,w*6);for(let B=0;B<6;++B)this._canvas.set(this._pSrc.subarray(Q*B,Q*B+w),W+w*B)}if(!N)return this._canvas.subarray(0,this.width*this.height)}let C=new Uint32Array(this.width*this.height);C.fill(this._fillColor);let S=0,I=0;for(let N=0;N<this._bandWidths.length;++N){let Q=this._bandWidths[N];for(let W=0;W<6;++W)C.set(this._canvas.subarray(I,I+=Q),S),S+=this.width}if(w){let N=this._PIXEL_OFFSET,Q=this._wasm.current_height();for(let W=0;W<Q;++W)C.set(this._pSrc.subarray(N*W,N*W+w),S+this.width*W)}return C}return c}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=c,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=x;function b(w,C){let S=new x(C);return S.init(),typeof w=="string"?S.decodeString(w):S.decode(w),{width:S.width,height:S.height,data32:S.data32,data8:S.data8}}e.decode=b;async function y(w,C){let S=await m(C);return S.init(),typeof w=="string"?S.decodeString(w):S.decode(w),{width:S.width,height:S.height,data32:S.data32,data8:S.data8}}e.decodeAsync=y});function jm(e){return{dispose:e}}var v6=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},y6=class{constructor(){this._store=new v6}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};y6.None=Object.freeze({dispose(){}});var HI=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},WI=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return jm(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let a=jm(()=>{let l=this._listeners.indexOf(n);l!==-1&&this._listeners.splice(l,1)});return r&&(Array.isArray(r)?r.push(a):r.add(a)),a},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:n}of t)r.call(n,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},GI;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,m)=>l(x=>h.call(p,c(x)),void 0,m)}e.map=r;function n(...l){return(c,h,p)=>{let m=new v6;for(let x of l)m.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(m):p.add(m)),m}}e.any=n;function a(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=a})(GI||={});var X2=eu(B1()),q0=class hc extends y6{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new HI),this._oldOpen=this._terminal._core.open,this._terminal._core.open=r=>{this._oldOpen?.call(this._terminal._core,r),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange(r=>{r==="fontSize"&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))}),this._register(jm(()=>{this.removeLayerFromDom(),this.removeLayerFromDom("bottom"),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this._layers.clear(),this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0}))}get canvas(){return this._layers.get("top")?.canvas}static createCanvas(t,r,n){let a=(t??document).createElement("canvas");return a.width=r|0,a.height=n|0,a}static createImageData(t,r,n,a){if(typeof ImageData!="function"){let l=t.createImageData(r,n);return a&&l.data.set(new Uint8ClampedArray(a,0,r*n*4)),l}return a?new ImageData(new Uint8ClampedArray(a,0,r*n*4),r,n):new ImageData(r,n)}static createImageBitmap(t){return typeof createImageBitmap!="function"?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&this.cellSize.height!==-1&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._terminal.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,r,n){let a=t*(this.dimensions?.css.cell.height||0),l=this.dimensions?.css.canvas.width||0,c=(r+1-t)*(this.dimensions?.css.cell.height||0);(!n||n==="top")&&this._layers.get("top")?.clearRect(0,a,l,c),(!n||n==="bottom")&&this._layers.get("bottom")?.clearRect(0,a,l,c)}clearAll(t){if(!t||t==="top"){let r=this._layers.get("top");r?.clearRect(0,0,r.canvas.width,r.canvas.height)}if(!t||t==="bottom"){let r=this._layers.get("bottom");r?.clearRect(0,0,r.canvas.width,r.canvas.height)}}draw(t,r,n,a,l=1){let c=this._layers.get(t.layer);if(!c)return;let{width:h,height:p}=this.cellSize;if(h===-1||p===-1)return;this._rescaleImage(t,h,p);let m=t.actual,x=Math.ceil(m.width/h),b=r%x*h,y=Math.floor(r/x)*p,w=n*h,C=a*p,S=l*h+b>m.width?m.width-b:l*h,I=y+p>m.height?m.height-y:p;c.drawImage(m,Math.floor(b),Math.floor(y),Math.ceil(S),Math.ceil(I),Math.floor(w),Math.floor(C),Math.ceil(S),Math.ceil(I))}extractTile(t,r){let{width:n,height:a}=this.cellSize;if(n===-1||a===-1)return;this._rescaleImage(t,n,a);let l=t.actual,c=Math.ceil(l.width/n),h=r%c*n,p=Math.floor(r/c)*a,m=n+h>l.width?l.width-h:n,x=p+a>l.height?l.height-p:a,b=hc.createCanvas(this.document,m,x),y=b.getContext("2d");if(y)return y.drawImage(l,Math.floor(h),Math.floor(p),Math.floor(m),Math.floor(x),0,0,Math.floor(m),Math.floor(x)),b}drawPlaceholder(t,r,n=1){let a=this._layers.get("top");if(a){let{width:l,height:c}=this.cellSize;if(l===-1||c===-1||(this._placeholder?c>=this._placeholder.height&&this._createPlaceHolder(c+1):this._createPlaceHolder(Math.max(c+1,24)),!this._placeholder))return;a.drawImage(this._placeholderBitmap??this._placeholder,t*l,r*c%2?0:1,l*n,c,t*l,r*c,l*n,c)}}rescaleCanvas(){let t=this.dimensions?.css.canvas.width||0,r=this.dimensions?.css.canvas.height||0;for(let n of this._layers.values())(n.canvas.width!==t||n.canvas.height!==r)&&(n.canvas.width=t,n.canvas.height=r)}_rescaleImage(t,r,n){if(r===t.actualCellSize.width&&n===t.actualCellSize.height)return;let{width:a,height:l}=t.origCellSize;if(r===a&&n===l){t.actual=t.orig,t.actualCellSize.width=a,t.actualCellSize.height=l;return}let c=hc.createCanvas(this.document,Math.ceil(t.orig.width*r/a),Math.ceil(t.orig.height*n/l)),h=c.getContext("2d");h&&(h.drawImage(t.orig,0,0,c.width,c.height),t.actual=c,t.actualCellSize.width=r,t.actualCellSize.height=n)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{for(let r of[...this._layers.keys()])this.removeLayerFromDom(r);this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(t="top"){if(!this.document||!this._terminal._core.screenElement){console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement");return}if(this._layers.has(t))return;let r=hc.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0);r.classList.add(`xterm-image-layer-${t}`);let n=this._terminal._core.screenElement;n.style.isolation="isolate",t==="bottom"?(r.style.zIndex="-1",n.insertBefore(r,n.firstChild)):(r.style.zIndex="0",n.appendChild(r));let a=r.getContext("2d",{alpha:!0});if(!a){r.remove();return}this._layers.set(t,a),this.clearAll(t)}removeLayerFromDom(t="top"){let r=this._layers.get(t);r&&(r.canvas.remove(),this._layers.delete(t))}hasLayer(t){return this._layers.has(t)}_createPlaceHolder(t=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let r=32,n=hc.createCanvas(this.document,r,t),a=n.getContext("2d",{alpha:!1});if(!a)return;let l=hc.createImageData(a,r,t),c=new Uint32Array(l.data.buffer),h=(0,X2.toRGBA8888)(0,0,0),p=(0,X2.toRGBA8888)(255,255,255);c.fill(h);for(let b=0;b<t;++b){let y=b%2,w=b*r;for(let C=0;C<r;C+=2)c[w+C+y]=p}a.putImageData(l,0,0);let m=screen.width+r-1&-32||4096;this._placeholder=hc.createCanvas(this.document,m,t);let x=this._placeholder.getContext("2d",{alpha:!1});if(!x){this._placeholder=void 0;return}for(let b=0;b<m;b+=r)x.drawImage(n,b,0);hc.createImageBitmap(this._placeholder).then(b=>this._placeholderBitmap=b)}get document(){return this._terminal._core._coreBrowserService?.window.document}},Dl={width:7,height:14},Dm=class w6{constructor(t=0,r=0,n=-1,a=-1){this.imageId=n,this.tileId=a,this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new w6(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},eh=new Dm,qI=class{constructor(e,t,r){this._terminal=e,this._renderer=t,this._opts=r,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(n){n instanceof Error&&console.error(n.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){for(let e of this._images.values())e.marker?.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return this._pixelLimit*4/1e6}setLimit(e){if(e<.5||e>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=e/4*1e6>>>0,this._evictOldest(0)}getUsage(){return this._getStoredPixels()*4/1e6}_getStoredPixels(){let e=0;for(let t of this._images.values())t.orig&&(e+=t.orig.width*t.orig.height,t.actual&&t.actual!==t.orig&&(e+=t.actual.width*t.actual.height));return e}_delImg(e){let t=this._images.get(e);t&&(this._images.delete(e),window.ImageBitmap&&t.orig instanceof ImageBitmap&&t.orig.close(),this.onImageDeleted?.(e))}wipeAlternate(){let e=[];for(let[t,r]of this._images.entries())r.bufferType==="alternate"&&(r.marker?.dispose(),e.push(t));for(let t of e)this._delImg(t);this._needsFullClear=!0,this._fullyCleared=!1}deleteImage(e){let t=this._images.get(e);t&&(t.marker?.dispose(),this._delImg(e))}addImage(e,t){this._evictOldest(e.width*e.height);let r=this._renderer.cellSize;(r.width===-1||r.height===-1)&&(r=Dl);let n=Math.ceil(e.width/r.width),a=Math.ceil(e.height/r.height),l=++this._lastId,c=this._terminal._core.buffer,h=this._terminal.cols,p=this._terminal.rows,m=c.x,x=c.y,b=m,y=0;t.scrolling||(c.x=0,c.y=0,b=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y);for(let I=0;I<a;++I){let N=c.lines.get(c.y+c.ybase);for(let Q=0;Q<n&&!(b+Q>=h);++Q)this._writeToCell(N,b+Q,l,I*n+Q),y++;if(t.scrolling)I<a-1&&this._terminal._core._inputHandler.lineFeed();else if(++c.y>=p)break;c.x=b}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y),t.scrolling?t.cursorPos==="iip"?c.x=Math.min(b+n,h):c.x=b:(c.x=m,c.y=x);let w=[];for(let[I,N]of this._images.entries())N.tileCount<1&&(N.marker?.dispose(),w.push(I));for(let I of w)this._delImg(I);let C=this._terminal.registerMarker(0);C?.onDispose(()=>{this._images.get(l)&&this._delImg(l)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let S={orig:e,origCellSize:r,actual:e,actualCellSize:{...r},marker:C||void 0,tileCount:y,bufferType:this._terminal.buffer.active.type,layer:t.layer,zIndex:t.zIndex};return this._images.set(l,S),this.onImageAdded?.(),l}render(e){let t=!1,r=!1;for(let m of this._images.values())if(m.layer==="bottom"?r=!0:t=!0,t&&r)break;if(t&&!this._renderer.hasLayer("top")&&(this._renderer.insertLayerToDom("top"),!this._renderer.hasLayer("top")))return;if(r&&!this._renderer.hasLayer("bottom")&&this._renderer.insertLayerToDom("bottom"),this._renderer.rescaleCanvas(),!this._images.size){this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),this._renderer.hasLayer("top")&&this._renderer.removeLayerFromDom("top"),this._renderer.hasLayer("bottom")&&this._renderer.removeLayerFromDom("bottom");return}!t&&this._renderer.hasLayer("top")&&(this._renderer.clearAll("top"),this._renderer.removeLayerFromDom("top")),!r&&this._renderer.hasLayer("bottom")&&(this._renderer.clearAll("bottom"),this._renderer.removeLayerFromDom("bottom")),this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:n,end:a}=e,l=this._terminal._core.buffer,c=this._terminal._core.cols;this._renderer.clearLines(n,a);let h=[],p=[];for(let m=n;m<=a;++m){let x=l.lines.get(m+l.ydisp);if(!x)return;for(let b=0;b<c;++b){let y;if(x.getBg(b)&268435456)y=x._extendedAttrs[b]??eh;else{let S=x._extendedAttrs[b];if(!S||S.imageId===void 0||S.imageId===-1)continue;y=S}let w=y.imageId;if(w===void 0||w===-1)continue;let C=this._images.get(w);if(y.tileId!==-1){let S=y.tileId,I=b,N=1;for(;++b<c;){let Q=x._extendedAttrs[b];if(!Q||Q.imageId!==w||Q.tileId!==S+N)break;N++}b--,C?C.actual&&h.push({imgSpec:C,tileId:S,col:I,row:m,count:N}):this._opts.showPlaceholder&&p.push({col:I,row:m,count:N}),this._fullyCleared=!1}}}h.sort((m,x)=>m.imgSpec.zIndex-x.imgSpec.zIndex);for(let m of p)this._renderer.drawPlaceholder(m.col,m.row,m.count);for(let m of h)this._renderer.draw(m.imgSpec,m.tileId,m.col,m.row,m.count)}viewportResize(e){if(!this._images.size){this._viewportMetrics=e;return}if(this._viewportMetrics.cols>=e.cols){this._viewportMetrics=e;return}let t=this._terminal._core.buffer,r=t.lines.length,n=this._viewportMetrics.cols-1;for(let a=0;a<r;++a){let l=t.lines.get(a);if(l.getBg(n)&268435456){let c=l._extendedAttrs[n]??eh,h=c.imageId;if(h===void 0||h===-1)continue;let p=this._images.get(h);if(!p)continue;let m=Math.ceil((p.actual?.width||0)/p.actualCellSize.width);if(c.tileId%m+1>=m)continue;let x=!1;for(let w=n+1;w>e.cols;++w)if(l._data[w*3+0]&4194303){x=!0;break}if(x)continue;let b=Math.min(e.cols,m-c.tileId%m+n),y=c.tileId;for(let w=n+1;w<b;++w)this._writeToCell(l,w,h,++y),p.tileCount++}}this._viewportMetrics=e}getImageAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??eh;if(n.imageId&&n.imageId!==-1){let a=this._images.get(n.imageId)?.orig;if(window.ImageBitmap&&a instanceof ImageBitmap){let l=q0.createCanvas(window.document,a.width,a.height);return l.getContext("2d")?.drawImage(a,0,0,a.width,a.height),l}return a}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??eh;if(n.imageId&&n.imageId!==-1&&n.tileId!==-1){let a=this._images.get(n.imageId);if(a)return this._renderer.extractTile(a,n.tileId)}}}_evictOldest(e){let t=this._getStoredPixels(),r=t;for(;this._pixelLimit<r+e&&this._images.size;){let n=this._images.get(++this._lowestId);n&&n.orig&&(r-=n.orig.width*n.orig.height,n.actual&&n.orig!==n.actual&&(r-=n.actual.width*n.actual.height),n.marker?.dispose(),this._delImg(this._lowestId))}return t-r}_writeToCell(e,t,r,n){if(e._data[t*3+2]&268435456){let a=e._extendedAttrs[t];if(a){if(a.imageId!==void 0){let l=this._images.get(a.imageId);l&&l.tileCount--,a.imageId=r,a.tileId=n;return}e._extendedAttrs[t]=new Dm(a.ext,a.urlId,r,n);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new Dm(0,0,r,n)}_evictOnAlternate(){for(let r of this._images.values())r.bufferType==="alternate"&&(r.tileCount=0);let e=this._terminal._core.buffer;for(let r=0;r<this._terminal.rows;++r){let n=e.lines.get(r);if(n){for(let a=0;a<this._terminal.cols;++a)if(n._data[a*3+2]&268435456){let l=n._extendedAttrs[a]?.imageId;if(l){let c=this._images.get(l);c&&c.tileCount++}}}}let t=[];for(let[r,n]of this._images.entries())n.bufferType==="alternate"&&!n.tileCount&&(n.marker?.dispose(),t.push(r));for(let r of t)this._delImg(r)}},VI=eu(b6()),ZI=eu($I());function af(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function Ip(e){let t=0;for(let r=0;r<e.length;++r){if(e[r]<48||e[r]>57)throw new Error("illegal char");t=t*10+e[r]-48}return t}function J2(e){let t=af(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function YI(e){if(typeof Buffer<"u")return Buffer.from(af(e),"base64").toString();let t=atob(af(e)),r=new Uint8Array(t.length);for(let n=0;n<r.length;++n)r[n]=t.charCodeAt(n);return new TextDecoder().decode(r)}var ex={inline:Ip,size:Ip,name:YI,width:J2,height:J2,preserveAspectRatio:Ip},tx=[70,105,108,101],rx=[77,117,108,116,105,112,97,114,116,70,105,108,101],Ep=[70,105,108,101,80,97,114,116],Np=[70,105,108,101,69,110,100],Rp=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],Mp=1024,KI=class{constructor(){this.state=0,this._buffer=new Uint32Array(Mp),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}end(){if(this.state===0){if(this._position===Np.length){for(let t=0;t<Np.length;++t)if(this._buffer[t]!==Np[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===Rp.length){for(let t=0;t<Rp.length;++t)if(this._buffer[t]!==Rp[t])return this._a();return this.fields.type=5,this.state=4,0}return this._a()}return this.state===4?0:this.state===3&&this.fields.type===2?this._storeValue(this._position)?(this.state=4,0):this._a():this._a()}parse(t,r,n){let a=this.state,l=this._position,c=this._buffer;if(a===1||a===4||a===0&&l>14)return-1;for(let h=r;h<n;++h){let p=t[h];switch(p){case 59:if(!this._storeValue(l))return this._a();a=2,l=0;break;case 61:if(a===0){if(c[0]===70){let m=0;for(;m<tx.length;++m)if(c[m]!==tx[m])return this._a();if(this.fields.type=1,l===Ep.length){for(;m<Ep.length;++m)if(c[m]!==Ep[m])return this._a();return this.fields.type=3,this.state=4,h+1}}else if(c[0]===77){for(let m=0;m<rx.length;++m)if(c[m]!==rx[m])return this._a();this.fields.type=2}else return this._a();a=2,l=0}else if(a===2){if(!this._storeKey(l))return this._a();a=3,l=0}else if(a===3){if(l>=Mp)return this._a();c[l++]=p}break;case 58:return a===3&&!this._storeValue(l)?this._a():(this.state=4,h+1);default:if(l>=Mp)return this._a();c[l++]=p}}return this.state=a,this._position=l,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=af(this._buffer.subarray(0,t));return r?(this._key=r,this.fields[r]=null,!0):!1}_storeValue(t){if(this._key){try{let r=this._buffer.slice(0,t);this.fields[this._key]=ex[this._key]?ex[this._key](r):r}catch{return!1}return!0}return!1}},of={mime:"unsupported",width:0,height:0};function XI(e){if(e.length<24)return of;let t=new Uint32Array(e.buffer,e.byteOffset,6);if(t[0]===1196314761&&t[1]===169478669&&t[3]===1380206665)return{mime:"image/png",width:e[16]<<24|e[17]<<16|e[18]<<8|e[19],height:e[20]<<24|e[21]<<16|e[22]<<8|e[23]};if(e[0]===255&&e[1]===216&&e[2]===255){let[r,n]=JI(e);return{mime:"image/jpeg",width:r,height:n}}return t[0]===944130375&&(e[4]===55||e[4]===57)&&e[5]===97?{mime:"image/gif",width:e[7]<<8|e[6],height:e[9]<<8|e[8]}:t[0]===1718185841?{mime:"image/qoi",width:e[4]<<24|e[5]<<16|e[6]<<8|e[7],height:e[8]<<24|e[9]<<16|e[10]<<8|e[11]}:of}function JI(e){let t=e.length,r=4,n=e[r]<<8|e[r+1];for(;;){if(r+=n,r>=t)return[0,0];if(e[r]!==255)return[0,0];if(e[r+1]===192||e[r+1]===194)return r+8<t?[e[r+7]<<8|e[r+8],e[r+5]<<8|e[r+6]]:[0,0];r+=2,n=e[r]<<8|e[r+1]}}var jp={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},eE=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=n,this._aborted=!1,this._hp=new KI,this._header=jp,this._metrics=of,this._isMultipart=!1,this._abortMulti=!1;let a=Math.ceil(this._opts.iipSizeLimit*4/3),l=Math.min(1048576,a);this._dec=new VI.default(4194304,a,l),this._qoiDec=new ZI.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=of,this._hp.reset()}put(e,t,r){if(!this._aborted)if(this._hp.state===4)this._dec.put(e.subarray(t,r))!==0&&(this._dec.release(),this._aborted=!0);else{let n=this._hp.parse(e,t,r);if(n===-1){this._aborted=!0;return}if(n>0){if(this._hp.fields.type===1){if(this._isMultipart&&(this._isMultipart=!1,this._abortMulti=!1,this._dec.release()),this._header=Object.assign({},jp,this._hp.fields),!this._header.inline){this._aborted=!0;return}this._dec.init()}else if(this._abortMulti){this._aborted=!0;return}this._dec.put(e.subarray(n,r))!==0&&(this._dec.release(),this._aborted=!0,this._isMultipart&&(this._abortMulti=!0))}}}end(e){if(this._aborted||this._hp.state!==4&&this._hp.end())return!0;let t=this._hp.fields.type;if(t===3)return!0;if(t===5){let c=Dl.width,h=Dl.height;this._renderer.dimensions&&(c=this._renderer.dimensions.css.canvas.width/this._coreTerminal.cols,h=this._renderer.dimensions.css.canvas.height/this._coreTerminal.rows);let p=this._coreTerminal._core._coreBrowserService?.dpr??1,m=`\x1B]1337;ReportCellSize=${h.toFixed(3)};${c.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(m,!1),!0}if(t===2)return this._header=Object.assign({},jp,this._hp.fields),this._isMultipart=!0,this._abortMulti=!1,this._dec.release(),this._dec.init(),!0;if(t===4&&(!this._isMultipart||(this._isMultipart=!1,this._abortMulti||this._header.type!==2)))return!0;let r=0,n=0,a;if((a=e)&&(a=!this._dec.end())&&(this._metrics=XI(this._dec.data8),(a=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,n=this._metrics.height,(a=r&&n&&r*n<this._opts.pixelLimit)&&([r,n]=this._resize(r,n).map(Math.floor),a=r&&n&&r*n<this._opts.pixelLimit))),!a)return this._dec.release(),!0;let l;if(this._metrics.mime==="image/qoi"){let c=this._qoiDec.decode(this._dec.data8);if(l=new ImageData(new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&n===this._qoiDec.height){this._dec.release();let h=q0.createCanvas(void 0,this._qoiDec.width,this._qoiDec.height);return h.getContext("2d")?.putImageData(l,0,0),this._storage.addImage(h),!0}}else l=new Blob([this._dec.data8],{type:this._metrics.mime});return this._dec.release(),createImageBitmap(l,{resizeWidth:r,resizeHeight:n}).then(c=>(this._storage.addImage(c),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||Dl.width,n=this._renderer.dimensions?.css.cell.height||Dl.height,a=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,l=this._renderer.dimensions?.css.canvas.height||n*this._coreTerminal.rows,c=this._dim(this._header.width,a,r),h=this._dim(this._header.height,l,n);if(!c&&!h){let p=a/e,m=(l-n)/t,x=Math.min(p,m);return x<1?[e*x,t*x]:[e,t]}return c?this._header.preserveAspectRatio||!c||!h?[c,t*c/e]:[c,h]:[e*h/t,h]}_dim(e,t,r){return e==="auto"?0:e.endsWith("%")?parseInt(e.slice(0,-1),10)*t/100:e.endsWith("px")?parseInt(e.slice(0,-2),10):parseInt(e,10)*r}},tE=eu(b6());function nx(e){let t={},r=e.split(",");for(let n of r){let a=n.indexOf("=");if(a===-1)continue;let l=n.substring(0,a),c=n.substring(a+1);if(l==="a"){t.action=c;continue}if(l==="o"){t.compression=c;continue}if(l==="t"){t.transmission=c;continue}if(l==="d"){t.deleteSelector=c;continue}let h=parseInt(c,10);switch(l){case"f":t.format=h;break;case"i":t.id=h;break;case"I":t.imageNumber=h;break;case"s":t.width=h;break;case"v":t.height=h;break;case"x":t.x=h;break;case"y":t.y=h;break;case"w":t.sourceWidth=h;break;case"h":t.sourceHeight=h;break;case"X":t.xOffset=h;break;case"Y":t.yOffset=h;break;case"c":t.columns=h;break;case"r":t.rows=h;break;case"m":t.more=h;break;case"q":t.quiet=h;break;case"C":t.cursorMovement=h;break;case"z":t.zIndex=h;break;case"p":t.placementId=h;break}}return t}var sx=0,rE=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._kittyStorage=r,this._coreTerminal=n,this._aborted=!1,this._decodeError=!1,this._activeDecoder=null,this._inControlData=!0,this._controlData=new Uint32Array(512),this._controlLength=0,this._encodedSizeLimit=0,this._totalEncodedSize=0,this._parsedCommand=null,this._pendingTransmissions=new Map,this._maxEncodedBytes=Math.ceil(this._opts.kittySizeLimit*4/3),this._initialEncodedBytes=Math.min(4194304,this._maxEncodedBytes)}reset(){this._cleanupAllPending(),this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),this._kittyStorage.reset()}dispose(){this.reset()}_removePendingEntry(e){this._pendingTransmissions.delete(e),this._lastPendingKey===e&&(this._lastPendingKey=void 0)}_cleanupAllPending(){for(let e of this._pendingTransmissions.values())e.decoder.release();this._pendingTransmissions.clear(),this._lastPendingKey=void 0}start(){this._aborted=!1,this._decodeError=!1,this._inControlData=!0,this._controlLength=0,this._parsedCommand=null,this._encodedSizeLimit=this._maxEncodedBytes,this._totalEncodedSize=0,this._activeDecoder=null}put(e,t,r){if(!this._aborted)if(!this._inControlData)this._streamPayload(e,t,r);else{let n=r;for(let l=t;l<r;l++)if(e[l]===59){this._inControlData=!1,n=l;break}let a=n-t;if(this._controlLength+a>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,n),this._controlLength),this._controlLength+=a,!this._inControlData){if(this._parsedCommand=nx(this._parseControlDataString()),this._parsedCommand.id!==void 0&&this._parsedCommand.imageNumber!==void 0){this._sendResponse(this._parsedCommand.id,"EINVAL:cannot specify both i and I keys",this._parsedCommand.quiet??0),this._aborted=!0;return}if(this._parsedCommand.action==="d")return;let l=n+1;l<r&&this._streamPayload(e,l,r)}}}_streamPayload(e,t,r){if(this._aborted)return;let n=this._parsedCommand?.id??this._lastPendingKey??0,a=this._pendingTransmissions.get(n),l=a?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,l+this._totalEncodedSize>this._encodedSizeLimit){let c=this._activeDecoder??a?.decoder;c&&c.release(),this._activeDecoder=null,a&&this._removePendingEntry(n),this._aborted=!0;return}this._decodeError||(a?.decoder&&!this._activeDecoder&&(this._activeDecoder=a.decoder),this._activeDecoder||(this._activeDecoder=new tE.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==sx&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,a&&this._removePendingEntry(n)))}end(e){if(this._aborted||!e)return this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),!0;if(this._inControlData)return this._handleNoPayloadCommand();let t=this._parsedCommand;if(t.action==="d")return this._handleDelete(t);let r=t.id??this._lastPendingKey??0,n=t.more===1,a=this._pendingTransmissions.get(r);if(n)return this._activeDecoder&&(a?(a.totalEncodedSize+=this._totalEncodedSize,a.decodeError=a.decodeError||this._decodeError):this._pendingTransmissions.set(r,{cmd:{...t},decoder:this._activeDecoder,totalEncodedSize:this._totalEncodedSize,decodeError:this._decodeError}),this._lastPendingKey=r,this._activeDecoder=null),!0;a&&(this._lastPendingKey=void 0);let l=this._decodeError,c=t,h=this._activeDecoder;a&&(c=a.cmd,h=a.decoder,l=l||a.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);h&&(h.end()!==sx&&(l=!0),p=h.data8),this._activeDecoder=null;let m=this._handleCommandWithBytesAndCmd(c,p,l);return h&&h.release(),m}_parseControlDataString(){let e="";for(let t=0;t<this._controlLength;t++)e+=String.fromCodePoint(this._controlData[t]);return e}_handleNoPayloadCommand(){let e=nx(this._parseControlDataString());if(e.id!==void 0&&e.imageNumber!==void 0)return this._sendResponse(e.id,"EINVAL:cannot specify both i and I keys",e.quiet??0),!0;switch(e.action??"t"){case"d":return this._handleDelete(e);case"q":return this._sendResponse(e.id??0,"OK",e.quiet??0),!0;case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handleCommandWithBytesAndCmd(e,t,r){switch(e.action??"t"){case"t":{let n=this._handleTransmit(e,t,r);return(e.transmission??"d")==="d"&&e.id!==void 0&&(r?this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0):t.length>0&&this._sendResponse(e.id,"OK",e.quiet??0)),n}case"T":return this._handleTransmitDisplay(e,t,r);case"q":return this._handleQuery(e,t,r);case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handlePlacement(e){if(e.id===void 0)return!0;let t=e.id,r=this._kittyStorage.getImage(t);return r?this._displayImage(r,e).then(n=>(this._sendResponse(t,n?"OK":"EINVAL:image rendering failed",e.quiet??0,e.placementId),!0)):(this._sendResponse(t,"ENOENT:image not found",e.quiet??0,e.placementId),!0)}_handleTransmit(e,t,r){return(e.transmission??"d")!=="d"?(e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported transmission medium",e.quiet??0),!0):(r||t.length===0||this._kittyStorage.storeImage(e.id,{data:new Blob([t]),width:e.width??0,height:e.height??0,format:e.format??32,compression:e.compression??""}),!0)}_handleTransmitDisplay(e,t,r){if(r)return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0),!0;this._handleTransmit(e,t,r);let n=e.id??this._kittyStorage.lastImageId,a=this._kittyStorage.getImage(n);if(a){let l=this._displayImage(a,e);return e.id!==void 0?l.then(c=>(this._sendResponse(n,c?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):l.then(()=>!0)}return!0}_handleQuery(e,t,r){let n=e.id??0,a=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(n,"EINVAL:unsupported transmission medium",a),!0;if(r)return this._sendResponse(n,"EINVAL:invalid base64 data",a),!0;if(t.length===0)return this._sendResponse(n,"OK",a),!0;let l=e.format??32;if(l===100)this._sendResponse(n,"OK",a);else{let c=e.width??0,h=e.height??0;if(!c||!h)return this._sendResponse(n,"EINVAL:width and height required for raw pixel data",a),!0;let p=l===32?4:3,m=c*h*p;if(t.length<m)return this._sendResponse(n,"EINVAL:insufficient pixel data",a),!0;this._sendResponse(n,"OK",a)}return!0}_handleDelete(e){switch(e.deleteSelector??"a"){case"a":case"A":this._cleanupAllPending(),this._kittyStorage.deleteAll();break;case"i":case"I":if(e.id!==void 0){let t=this._pendingTransmissions.get(e.id);t&&t.decoder.release(),this._removePendingEntry(e.id),this._kittyStorage.deleteById(e.id)}break}return!0}_sendResponse(e,t,r,n){let a=t==="OK";if(a&&r>=1||!a&&r>=2)return;let l=n?`,p=${n}`:"",c=`\x1B_Gi=${e}${l};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(c)}_displayImage(e,t){return this._decodeAndDisplay(e,t).then(()=>!0).catch(()=>!1)}async _decodeAndDisplay(e,t){let r=await this._createBitmap(e);try{let n=Math.max(0,t.x??0),a=Math.max(0,t.y??0),l=t.sourceWidth||r.width-n,c=t.sourceHeight||r.height-a,h=Math.max(0,r.width-n),p=Math.max(0,r.height-a),m=Math.max(0,Math.min(l,h)),x=Math.max(0,Math.min(c,p));if(m===0||x===0)throw new Error("invalid source rectangle");if(n!==0||a!==0||m!==r.width||x!==r.height){let Oe=await createImageBitmap(r,n,a,m,x);r.close(),r=Oe}let b=this._renderer.dimensions?.css.cell.width||Dl.width,y=this._renderer.dimensions?.css.cell.height||Dl.height,w,C;t.columns!==void 0&&t.rows!==void 0?(w=t.columns,C=t.rows):t.columns!==void 0?(w=t.columns,C=Math.max(1,Math.ceil(r.height/r.width*(w*b)/y))):t.rows!==void 0?(C=t.rows,w=Math.max(1,Math.ceil(r.width/r.height*(C*y)/b))):(w=Math.ceil(r.width/b),C=Math.ceil(r.height/y));let S=r.width,I=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(S=Math.round(w*b),I=Math.round(C*y)),S*I>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let N=this._coreTerminal._core.buffer,Q=N.x,W=N.y,B=N.ybase,U=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(S!==r.width||I!==r.height){let Oe=await createImageBitmap(r,{resizeWidth:S,resizeHeight:I});r.close(),r=Oe}let K=Math.min(Math.max(0,t.xOffset??0),b-1),re=Math.min(Math.max(0,t.yOffset??0),y-1);if(K!==0||re!==0){let Oe=t.columns!==void 0?Math.round(w*b):r.width+K,ne=t.rows!==void 0?Math.round(C*y):r.height+re,ce=q0.createCanvas(window.document,Oe,ne),Ne=ce.getContext("2d");if(!Ne)throw new Error("Failed to create offset canvas context");Ne.drawImage(r,K,re);let Me=await createImageBitmap(ce);if(ce.width=ce.height=0,r.close(),r=Me,S=r.width,I=r.height,S*I>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(w=Math.ceil(r.width/b)),t.rows===void 0&&(C=Math.ceil(r.height/y))}let H=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,U,H),r=void 0,t.cursorMovement===1){let Oe=N.ybase-B;N.x=Q,N.y=Math.max(W-Oe,0)}else N.x=Math.min(Q+w,this._coreTerminal.cols)}catch(n){throw r?.close(),n}}async _createBitmap(e){let t=new Uint8Array(await e.data.arrayBuffer());if(e.compression==="z"&&(t=await this._decompressZlib(t)),e.format===100){let S=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let I=URL.createObjectURL(S),N=new Image;return new Promise((Q,W)=>{N.addEventListener("load",()=>{URL.revokeObjectURL(I);let B=q0.createCanvas(window.document,N.width,N.height);B.getContext("2d")?.drawImage(N,0,0),createImageBitmap(B).then(Q).catch(W)}),N.addEventListener("error",()=>{URL.revokeObjectURL(I),W(new Error("Failed to load image"))}),N.src=I})}return createImageBitmap(S)}let r=e.width,n=e.height;if(!r||!n)throw new Error("Width and height required for raw pixel data");let a=e.format===32?4:3,l=r*n*a;if(t.length<l)throw new Error("Insufficient pixel data");let c=r*n;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,c*4),r,n));let h=new Uint8ClampedArray(c*4),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),m=new Uint32Array(h.buffer),x=c&-4,b=0,y=0;for(let S=0;S<x;S+=4){let I=p[b++],N=p[b++],Q=p[b++];m[y++]=4278190080|I,m[y++]=4278190080|I>>>24|N<<8,m[y++]=4278190080|N>>>16|Q<<16,m[y++]=4278190080|Q>>>8}let w=x*3,C=x*4;for(let S=x;S<c;S++)h[C]=t[w],h[C+1]=t[w+1],h[C+2]=t[w+2],h[C+3]=255,w+=3,C+=4;return createImageBitmap(new ImageData(h,r,n))}async _decompressZlib(e){try{return await this._decompress(e,"deflate")}catch{return await this._decompress(e,"deflate-raw")}}async _decompress(e,t){let r=new DecompressionStream(t),n=r.writable.getWriter();n.write(e),n.close();let a=[],l=r.readable.getReader();for(;;){let{done:m,value:x}=await l.read();if(m)break;a.push(x)}let c=a.reduce((m,x)=>m+x.length,0),h=new Uint8Array(c),p=0;for(let m of a)h.set(m,p),p+=m.length;return h}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},A6=class Qm{constructor(t){this._storage=t,this._nextImageId=1,this._images=new Map,this._kittyIdToStorageId=new Map,this._storageIdToKittyId=new Map,this._handleStorageImageDeleted=r=>{let n=this._storageIdToKittyId.get(r);n!==void 0&&(this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(r),this._images.delete(n))},this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"},this._previousOnImageDeleted=this._storage.onImageDeleted,this._wrappedOnImageDeleted=r=>{this._previousOnImageDeleted?.(r),this._handleStorageImageDeleted(r)},this._storage.onImageDeleted=this._wrappedOnImageDeleted}reset(){this._nextImageId=1,this._images.clear(),this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}dispose(){this.reset(),this._storage.onImageDeleted===this._wrappedOnImageDeleted&&(this._storage.onImageDeleted=this._previousOnImageDeleted)}storeImage(t,r){let n=t??this._nextImageId++,a=this._kittyIdToStorageId.get(n);return a!==void 0&&(this._storage.deleteImage(a),this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(a)),!this._images.has(n)&&this._images.size>=Qm._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(n,{...r,id:n}),n}addImage(t,r,n,a,l){let c=this._kittyIdToStorageId.get(t);c!==void 0&&this._storageIdToKittyId.delete(c),this._addImageOpts.scrolling=n,this._addImageOpts.layer=a,this._addImageOpts.zIndex=l;let h=this._storage.addImage(r,this._addImageOpts);this._kittyIdToStorageId.set(t,h),this._storageIdToKittyId.set(h,t)}getImage(t){return this._images.get(t)}deleteById(t){this._images.delete(t);let r=this._kittyIdToStorageId.get(t);r!==void 0&&(this._storage.deleteImage(r),this._kittyIdToStorageId.delete(t),this._storageIdToKittyId.delete(r))}deleteAll(){this._images.clear();for(let t of this._kittyIdToStorageId.values())this._storage.deleteImage(t);this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}get images(){return this._images}get kittyIdToStorageId(){return this._kittyIdToStorageId}get lastImageId(){return this._nextImageId-1}_evictUndisplayedImages(){for(let[t]of this._images){if(this._images.size<=Qm._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};A6._maxStoredImages=256;var nE=A6,xd=eu(B1()),sE=eu(zI()),iE=4194304,Bm=xd.PALETTE_ANSI_256;Bm.set(xd.PALETTE_VT340_COLOR);var aE=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,sE.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:Bm,paletteLimit:this._opts.sixelPaletteLimit}).then(n=>this._dec=n)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Bm,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:oE(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(t,null,this._opts.sixelPaletteLimit)}}put(e,t,r){if(!(this._aborted||!this._dec)){if(this._size+=r-t,this._size>this._opts.sixelSizeLimit){console.warn("SIXEL: too much data, aborting"),this._aborted=!0,this._dec.release();return}try{this._dec.decode(e,t,r)}catch(n){console.warn(`SIXEL: error while decoding image - ${n}`),this._aborted=!0,this._dec.release()}}}unhook(e){if(this._aborted||!e||!this._dec)return!0;let t=this._dec.width,r=this._dec.height;if(!t||!r)return r&&this._storage.advanceCursor(r),!0;let n=q0.createCanvas(void 0,t,r);return n.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>iE&&this._dec.release(),this._storage.addImage(n),!0}};function oE(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=th(t.foreground.rgba);else if(e.isFgRGB()){let n=e.constructor.toColorRGB(e.getFgColor());r=(0,xd.toRGBA8888)(...n)}else r=th(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=th(t.background.rgba);else if(e.isBgRGB()){let n=e.constructor.toColorRGB(e.getBgColor());r=(0,xd.toRGBA8888)(...n)}else r=th(t.ansi[e.getBgColor()].rgba);return r}function th(e){return xd.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var lE=class{constructor(e,t,r,n){this._storage=e,this._opts=t,this._renderer=r,this._terminal=n,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"vt340"}}addImage(e){this._addImageOpts.scrolling=this._opts.sixelScrolling,this._storage.addImage(e,this._addImageOpts)}advanceCursor(e){if(this._opts.sixelScrolling){let t=this._renderer.cellSize;(t.width===-1||t.height===-1)&&(t=Dl);let r=Math.ceil(e/t.height);for(let n=1;n<r;++n)this._terminal._core._inputHandler.lineFeed()}}},cE=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},ix={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},ax=4096,uE=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new WI,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},ix,t),this._defaultOpts=Object.assign({},ix,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear(),this._onImageAdded.dispose()}_disposeLater(...t){for(let r of t)this._disposables.push(r)}activate(t){if(this._terminal=t,this._renderer=new q0(t),this._storage=new qI(t,this._renderer,this._opts),this._storage.onImageAdded=()=>this._onImageAdded.fire(),this._opts.enableSizeReports){let r=t.options.windowOptions??{};r.getWinSizePixels=!0,r.getCellSizePixels=!0,r.getWinSizeChars=!0,t.options.windowOptions=r}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},r=>this._decset(r)),t.parser.registerCsiHandler({prefix:"?",final:"l"},r=>this._decrst(r)),t.parser.registerCsiHandler({final:"c"},r=>this._da1(r)),t.parser.registerCsiHandler({prefix:"?",final:"S"},r=>this._xtermGraphicsAttributes(r)),t.onRender(r=>this._storage?.render(r)),t.parser.registerCsiHandler({intermediates:"!",final:"p"},()=>this.reset()),t.parser.registerEscHandler({final:"c"},()=>this.reset()),t._core._inputHandler.onRequestReset(()=>this.reset()),t.buffer.onBufferChange(()=>this._storage?.wipeAlternate()),t.onResize(r=>this._storage?.viewportResize(r))),this._opts.sixelSupport){let r=new lE(this._storage,this._opts,this._renderer,t),n=new aE(this._opts,r,t);this._handlers.set("sixel",n),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},n))}if(this._opts.iipSupport){let r=new cE(this._storage),n=new eE(this._opts,this._renderer,r,t);this._handlers.set("iip",n),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,n))}if(this._opts.kittySupport){let r=new nE(this._storage),n=new rE(this._opts,this._renderer,r,t);this._handlers.set("kitty",n),this._disposeLater(r,n,t._core._inputHandler._parser.registerApcHandler({final:"G"},n))}}reset(){this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._storage?.reset();for(let t of this._handlers.values())t.reset();return!1}get storageLimit(){return this._storage?.getLimit()||-1}set storageLimit(t){this._storage?.setLimit(t),this._opts.storageLimit=t}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(t){this._opts.showPlaceholder=t,this._renderer?.showPlaceholder(t)}getImageAtBufferCell(t,r){return this._storage?.getImageAtBufferCell(t,r)}extractTileAtBufferCell(t,r){return this._storage?.extractTileAtBufferCell(t,r)}_report(t){this._terminal?._core.input(t,!1)}_decset(t){for(let r=0;r<t.length;++r)t[r]===80&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let r=0;r<t.length;++r)t[r]===80&&(this._opts.sixelScrolling=!0);return!1}_da1(t){return t[0]?!0:this._opts.sixelSupport?(this._report("\x1B[?62;4;9;22c"),!0):!1}_xtermGraphicsAttributes(t){if(t.length<2)return!0;if(t[0]===1)switch(t[1]){case 1:return this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`);for(let r of this._handlers.values())r.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=ax?(this._opts.sixelPaletteLimit=t[2],this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`\x1B[?${t[0]};2S`),!0;case 4:return this._report(`\x1B[?${t[0]};0;${ax}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}if(t[0]===2)switch(t[1]){case 1:let r=this._renderer?.dimensions?.css.canvas.width,n=this._renderer?.dimensions?.css.canvas.height;if(!r||!n){let l=Dl;r=(this._terminal?.cols||80)*l.width,n=(this._terminal?.rows||24)*l.height}if(r*n<this._opts.pixelLimit)this._report(`\x1B[?${t[0]};0;${r.toFixed(0)};${n.toFixed(0)}S`);else{let l=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`\x1B[?${t[0]};0;${l};${l}S`)}return!0;case 4:let a=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${a};${a}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const m0=new Map;function S0(e){return{name:e,get hasSubscribers(){return(m0.get(e)?.size??0)>0},publish(t){const r=m0.get(e);if(r)for(const n of r)n(t,e)},subscribe(t){const r=m0.get(e)??new Set;r.add(t),m0.set(e,r)},unsubscribe(t){const r=m0.get(e);if(!r)return!1;const n=r.delete(t);return r.size===0&&m0.delete(e),n}}}function dE(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:S0(t.start),end:S0(t.end),asyncStart:S0(t.asyncStart),asyncEnd:S0(t.asyncEnd),error:S0(t.error),traceSync(n,a,l,...c){r.start.publish(a);try{const h=n.apply(l,c);return r.end.publish(a),h}catch(h){throw r.error.publish(h),h}},async tracePromise(n,a,l,...c){r.asyncStart.publish(a);try{const h=await n.apply(l,c);return r.asyncEnd.publish(a),h}catch(h){throw r.error.publish(h),h}},traceCallback(n,a,l,c,...h){r.start.publish(l);try{const p=n.apply(c,h);return r.end.publish(l),p}catch(p){throw r.error.publish(p),p}}};return r}var hE=Object.create,P1=Object.defineProperty,fE=Object.getOwnPropertyDescriptor,pE=Object.getOwnPropertyNames,mE=Object.getPrototypeOf,gE=Object.prototype.hasOwnProperty,T6=e=>{throw TypeError(e)},xE=(e,t,r)=>t in e?P1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bE=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},vE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of pE(t))!gE.call(e,a)&&a!==r&&P1(e,a,{get:()=>t[a],enumerable:!(n=fE(t,a))||n.enumerable});return e},yE=(e,t,r)=>(r=e!=null?hE(mE(e)):{},vE(!e||!e.__esModule?P1(r,"default",{value:e,enumerable:!0}):r,e)),oi=(e,t,r)=>xE(e,typeof t!="symbol"?t+"":t,r),O1=(e,t,r)=>t.has(e)||T6("Cannot "+r),te=(e,t,r)=>(O1(e,t,"read from private field"),r?r.call(e):t.get(e)),dn=(e,t,r)=>t.has(e)?T6("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Cr=(e,t,r,n)=>(O1(e,t,"write to private field"),t.set(e,r),r),Ut=(e,t,r)=>(O1(e,t,"access private method"),r),Dp=(e,t,r,n)=>({set _(a){Cr(e,t,a)},get _(){return te(e,t,n)}}),wE=bE((e,t)=>{var r=(()=>{var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,h=(i,o)=>{for(var u in o)n(i,u,{get:o[u],enumerable:!0})},p=(i,o,u,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of l(o))!c.call(i,f)&&f!==u&&n(i,f,{get:()=>o[f],enumerable:!(d=a(o,f))||d.enumerable});return i},m=i=>p(n({},"__esModule",{value:!0}),i),x={};h(x,{BoundingBox:()=>He,Font:()=>pg,Glyph:()=>Fn,Path:()=>nt,_parse:()=>ct,load:()=>D4,loadSync:()=>Q4,parse:()=>j4});var b=0,y=-3;function w(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function C(i,o){this.source=i,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=o,this.destLen=0,this.ltree=new w,this.dtree=new w}var S=new w,I=new w,N=new Uint8Array(30),Q=new Uint16Array(30),W=new Uint8Array(30),B=new Uint16Array(30),U=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),K=new w,re=new Uint8Array(320);function H(i,o,u,d){var f,g;for(f=0;f<u;++f)i[f]=0;for(f=0;f<30-u;++f)i[f+u]=f/u|0;for(g=d,f=0;f<30;++f)o[f]=g,g+=1<<i[f]}function Oe(i,o){var u;for(u=0;u<7;++u)i.table[u]=0;for(i.table[7]=24,i.table[8]=152,i.table[9]=112,u=0;u<24;++u)i.trans[u]=256+u;for(u=0;u<144;++u)i.trans[24+u]=u;for(u=0;u<8;++u)i.trans[168+u]=280+u;for(u=0;u<112;++u)i.trans[176+u]=144+u;for(u=0;u<5;++u)o.table[u]=0;for(o.table[5]=32,u=0;u<32;++u)o.trans[u]=u}var ne=new Uint16Array(16);function ce(i,o,u,d){var f,g;for(f=0;f<16;++f)i.table[f]=0;for(f=0;f<d;++f)i.table[o[u+f]]++;for(i.table[0]=0,g=0,f=0;f<16;++f)ne[f]=g,g+=i.table[f];for(f=0;f<d;++f)o[u+f]&&(i.trans[ne[o[u+f]]++]=f)}function Ne(i){i.bitcount--||(i.tag=i.source[i.sourceIndex++],i.bitcount=7);var o=i.tag&1;return i.tag>>>=1,o}function Me(i,o,u){if(!o)return u;for(;i.bitcount<24;)i.tag|=i.source[i.sourceIndex++]<<i.bitcount,i.bitcount+=8;var d=i.tag&65535>>>16-o;return i.tag>>>=o,i.bitcount-=o,d+u}function be(i,o){for(;i.bitcount<24;)i.tag|=i.source[i.sourceIndex++]<<i.bitcount,i.bitcount+=8;var u=0,d=0,f=0,g=i.tag;do d=2*d+(g&1),g>>>=1,++f,u+=o.table[f],d-=o.table[f];while(d>=0);return i.tag=g,i.bitcount-=f,o.trans[u+d]}function V(i,o,u){var d,f,g,A,_,E;for(d=Me(i,5,257),f=Me(i,5,1),g=Me(i,4,4),A=0;A<19;++A)re[A]=0;for(A=0;A<g;++A){var M=Me(i,3,0);re[U[A]]=M}for(ce(K,re,0,19),_=0;_<d+f;){var R=be(i,K);switch(R){case 16:var Y=re[_-1];for(E=Me(i,2,3);E;--E)re[_++]=Y;break;case 17:for(E=Me(i,3,3);E;--E)re[_++]=0;break;case 18:for(E=Me(i,7,11);E;--E)re[_++]=0;break;default:re[_++]=R;break}}ce(o,re,0,d),ce(u,re,d,f)}function Ke(i,o,u){for(;;){var d=be(i,o);if(d===256)return b;if(d<256)i.dest[i.destLen++]=d;else{var f,g,A,_;for(d-=257,f=Me(i,N[d],Q[d]),g=be(i,u),A=i.destLen-Me(i,W[g],B[g]),_=A;_<A+f;++_)i.dest[i.destLen++]=i.dest[_]}}}function he(i){for(var o,u,d;i.bitcount>8;)i.sourceIndex--,i.bitcount-=8;if(o=i.source[i.sourceIndex+1],o=256*o+i.source[i.sourceIndex],u=i.source[i.sourceIndex+3],u=256*u+i.source[i.sourceIndex+2],o!==(~u&65535))return y;for(i.sourceIndex+=4,d=o;d;--d)i.dest[i.destLen++]=i.source[i.sourceIndex++];return i.bitcount=0,b}function Be(i,o){var u=new C(i,o),d,f,g;do{switch(d=Ne(u),f=Me(u,2,0),f){case 0:g=he(u);break;case 1:g=Ke(u,S,I);break;case 2:V(u,u.ltree,u.dtree),g=Ke(u,u.ltree,u.dtree);break;default:g=y}if(g!==b)throw new Error("Data error")}while(!d);return u.destLen<u.dest.length?typeof u.dest.slice=="function"?u.dest.slice(0,u.destLen):u.dest.subarray(0,u.destLen):u.dest}Oe(S,I),H(N,Q,4,3),H(W,B,2,1),N[28]=0,Q[28]=258;function ae(i,o,u,d,f){return Math.pow(1-f,3)*i+3*Math.pow(1-f,2)*f*o+3*(1-f)*Math.pow(f,2)*u+Math.pow(f,3)*d}function X(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}X.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},X.prototype.addPoint=function(i,o){typeof i=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=i,this.x2=i),i<this.x1&&(this.x1=i),i>this.x2&&(this.x2=i)),typeof o=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=o,this.y2=o),o<this.y1&&(this.y1=o),o>this.y2&&(this.y2=o))},X.prototype.addX=function(i){this.addPoint(i,null)},X.prototype.addY=function(i){this.addPoint(null,i)},X.prototype.addBezier=function(i,o,u,d,f,g,A,_){let E=[i,o],M=[u,d],R=[f,g],Y=[A,_];this.addPoint(i,o),this.addPoint(A,_);for(let Z=0;Z<=1;Z++){let me=6*E[Z]-12*M[Z]+6*R[Z],ue=-3*E[Z]+9*M[Z]-9*R[Z]+3*Y[Z],Ae=3*M[Z]-3*E[Z];if(ue===0){if(me===0)continue;let kr=-Ae/me;0<kr&&kr<1&&(Z===0&&this.addX(ae(E[Z],M[Z],R[Z],Y[Z],kr)),Z===1&&this.addY(ae(E[Z],M[Z],R[Z],Y[Z],kr)));continue}let Ze=Math.pow(me,2)-4*Ae*ue;if(Ze<0)continue;let ur=(-me+Math.sqrt(Ze))/(2*ue);0<ur&&ur<1&&(Z===0&&this.addX(ae(E[Z],M[Z],R[Z],Y[Z],ur)),Z===1&&this.addY(ae(E[Z],M[Z],R[Z],Y[Z],ur)));let nr=(-me-Math.sqrt(Ze))/(2*ue);0<nr&&nr<1&&(Z===0&&this.addX(ae(E[Z],M[Z],R[Z],Y[Z],nr)),Z===1&&this.addY(ae(E[Z],M[Z],R[Z],Y[Z],nr)))}},X.prototype.addQuad=function(i,o,u,d,f,g){let A=i+.6666666666666666*(u-i),_=o+2/3*(d-o),E=A+1/3*(f-i),M=_+1/3*(g-o);this.addBezier(i,o,A,_,E,M,f,g)};var He=X;function je(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var ve={};function Fe(i,o){let u=Math.floor(i),d=i-u;if(ve[o]||(ve[o]={}),ve[o][d]!==void 0){let g=ve[o][d];return u+g}let f=+(Math.round(d+"e+"+o)+"e-"+o);return ve[o][d]=f,u+f}function lt(i){let o=[[]],u=0,d=0;for(let f=0;f<i.length;f+=1){let g=o[o.length-1],A=i[f],_=g[0],E=g[1],M=g[g.length-1],R=i[f+1];g.push(A),A.type==="M"?(u=A.x,d=A.y):A.type==="L"&&(!R||R.type==="Z")?Math.abs(A.x-u)>1||Math.abs(A.y-d)>1||g.pop():A.type==="L"&&M&&M.x===A.x&&M.y===A.y?g.pop():A.type==="Z"&&(_&&E&&M&&_.type==="M"&&E.type==="L"&&M.type==="L"&&M.x===_.x&&M.y===_.y&&(g.shift(),g[0].type="M"),f+1<i.length&&o.push([]))}return i=[].concat.apply([],o),i}function ye(i){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},i)}function de(i){return parseInt(i)===i&&(i={decimalPlaces:i,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},i)}je.prototype.fromSVG=function(i,o={}){typeof SVGPathElement<"u"&&i instanceof SVGPathElement&&(i=i.getAttribute("d")),o=ye(o),this.commands=[];let u="0123456789",d="MmLlQqCcZzHhVv",f="SsTtAa",g="-+",A={},_=[""],E=!1;function M(ue){return ue.filter(Ae=>Ae.length).map(Ae=>{let Ze=parseFloat(Ae);return(o.decimalPlaces||o.decimalPlaces===0)&&(Ze=Fe(Ze,o.decimalPlaces)),Ze})}function R(ue){if(!this.commands.length)return ue;let Ae=this.commands[this.commands.length-1];for(let Ze=0;Ze<ue.length;Ze++)ue[Ze]+=Ae[Ze&1?"y":"x"];return ue}function Y(){if(A.type===void 0)return;let ue=A.type.toUpperCase(),Ae=ue!=="Z"&&A.type.toUpperCase()!==A.type,Ze=M(_);if(_=[""],!Ze.length&&ue!=="Z")return;Ae&&ue!=="H"&&ue!=="V"&&(Ze=R.apply(this,[Ze]));let ur=this.commands.length&&this.commands[this.commands.length-1].x||0,nr=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(ue){case"M":this.moveTo(...Ze);break;case"L":this.lineTo(...Ze);break;case"V":for(let kr=0;kr<Ze.length;kr++){let zr=0;Ae&&(zr=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(ur,Ze[kr]+zr)}break;case"H":for(let kr=0;kr<Ze.length;kr++){let zr=0;Ae&&(zr=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(Ze[kr]+zr,nr)}break;case"C":this.bezierCurveTo(...Ze);break;case"Q":this.quadraticCurveTo(...Ze);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let kr in this.commands[this.commands.length-1])this.commands[this.commands.length-1][kr]===void 0&&(this.commands[this.commands.length-1][kr]=0)}for(let ue=0;ue<i.length;ue++){let Ae=i.charAt(ue),Ze=_[_.length-1];if(u.indexOf(Ae)>-1)_[_.length-1]+=Ae;else if(g.indexOf(Ae)>-1)if(!A.type&&!this.commands.length&&(A.type="L"),Ae==="-")!A.type||Ze.indexOf("-")>0?E=!0:Ze.length?_.push("-"):_[_.length-1]=Ae;else if(!A.type||Ze.length>0)E=!0;else continue;else if(d.indexOf(Ae)>-1)A.type?(Y.apply(this),A={type:Ae}):A.type=Ae;else{if(f.indexOf(Ae)>-1)throw new Error("Unsupported path command: "+Ae+". Currently supported commands are "+d.split("").join(", ")+".");` ,
119
+ \r\f\v`.indexOf(Ae)>-1?_.push(""):Ae==="."?!A.type||Ze.indexOf(Ae)>-1?E=!0:_[_.length-1]+=Ae:E=!0}if(E)throw new Error("Unexpected character: "+Ae+" at offset "+ue)}Y.apply(this),o.optimize&&(this.commands=lt(this.commands));let Z=o.flipY,me=o.flipYBase;if(Z===!0&&o.flipYBase===void 0){let ue=this.getBoundingBox();me=ue.y1+ue.y2}for(let ue in this.commands){let Ae=this.commands[ue];for(let Ze in Ae)["x","x1","x2"].includes(Ze)?this.commands[ue][Ze]=o.x+Ae[Ze]*o.scale:["y","y1","y2"].includes(Ze)&&(this.commands[ue][Ze]=o.y+(Z?me-Ae[Ze]:Ae[Ze])*o.scale)}return this},je.fromSVG=function(i,o){return new je().fromSVG(i,o)},je.prototype.moveTo=function(i,o){this.commands.push({type:"M",x:i,y:o})},je.prototype.lineTo=function(i,o){this.commands.push({type:"L",x:i,y:o})},je.prototype.curveTo=je.prototype.bezierCurveTo=function(i,o,u,d,f,g){this.commands.push({type:"C",x1:i,y1:o,x2:u,y2:d,x:f,y:g})},je.prototype.quadTo=je.prototype.quadraticCurveTo=function(i,o,u,d){this.commands.push({type:"Q",x1:i,y1:o,x:u,y:d})},je.prototype.close=je.prototype.closePath=function(){this.commands.push({type:"Z"})},je.prototype.extend=function(i){if(i.commands)i=i.commands;else if(i instanceof He){let o=i;this.moveTo(o.x1,o.y1),this.lineTo(o.x2,o.y1),this.lineTo(o.x2,o.y2),this.lineTo(o.x1,o.y2),this.close();return}Array.prototype.push.apply(this.commands,i)},je.prototype.getBoundingBox=function(){let i=new He,o=0,u=0,d=0,f=0;for(let g=0;g<this.commands.length;g++){let A=this.commands[g];switch(A.type){case"M":i.addPoint(A.x,A.y),o=d=A.x,u=f=A.y;break;case"L":i.addPoint(A.x,A.y),d=A.x,f=A.y;break;case"Q":i.addQuad(d,f,A.x1,A.y1,A.x,A.y),d=A.x,f=A.y;break;case"C":i.addBezier(d,f,A.x1,A.y1,A.x2,A.y2,A.x,A.y),d=A.x,f=A.y;break;case"Z":d=o,f=u;break;default:throw new Error("Unexpected path command "+A.type)}}return i.isEmpty()&&i.addPoint(0,0),i},je.prototype.draw=function(i){let o=this._layers;if(o&&o.length){for(let d=0;d<o.length;d++)this.draw.call(o[d],i);return}let u=this._image;if(u){i.drawImage(u.image,u.x,u.y,u.width,u.height);return}i.beginPath();for(let d=0;d<this.commands.length;d+=1){let f=this.commands[d];f.type==="M"?i.moveTo(f.x,f.y):f.type==="L"?i.lineTo(f.x,f.y):f.type==="C"?i.bezierCurveTo(f.x1,f.y1,f.x2,f.y2,f.x,f.y):f.type==="Q"?i.quadraticCurveTo(f.x1,f.y1,f.x,f.y):f.type==="Z"&&this.stroke&&this.strokeWidth&&i.closePath()}this.fill&&(i.fillStyle=this.fill,i.fill()),this.stroke&&(i.strokeStyle=this.stroke,i.lineWidth=this.strokeWidth,i.stroke())},je.prototype.toPathData=function(i){i=de(i);function o(_){let E=Fe(_,i.decimalPlaces);return Math.round(_)===E?""+E:E.toFixed(i.decimalPlaces)}function u(){let _="";for(let E=0;E<arguments.length;E+=1){let M=arguments[E];M>=0&&E>0&&(_+=" "),_+=o(M)}return _}let d=this.commands;i.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=lt(d));let f=i.flipY,g=i.flipYBase;if(f===!0&&g===void 0){let _=new je;_.extend(d);let E=_.getBoundingBox();g=E.y1+E.y2}let A="";for(let _=0;_<d.length;_+=1){let E=d[_];E.type==="M"?A+="M"+u(E.x,f?g-E.y:E.y):E.type==="L"?A+="L"+u(E.x,f?g-E.y:E.y):E.type==="C"?A+="C"+u(E.x1,f?g-E.y1:E.y1,E.x2,f?g-E.y2:E.y2,E.x,f?g-E.y:E.y):E.type==="Q"?A+="Q"+u(E.x1,f?g-E.y1:E.y1,E.x,f?g-E.y:E.y):E.type==="Z"&&(A+="Z")}return A},je.prototype.toSVG=function(i,o){this._layers&&this._layers.length&&console.warn("toSVG() does not support colr font layers yet"),this._image&&console.warn("toSVG() does not support SVG glyphs yet"),o||(o=this.toPathData(i));let u='<path d="';return u+=o,u+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?u+=' fill="none"':u+=' fill="'+this.fill+'"'),this.stroke&&(u+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),u+="/>",u},je.prototype.toDOMElement=function(i,o){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),o||(o=this.toPathData(i));let u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?u.setAttribute("fill","none"):u.setAttribute("fill",this.fill)),this.stroke&&(u.setAttribute("stroke",this.stroke),u.setAttribute("stroke-width",this.strokeWidth)),u};var nt=je;function Xe(i){throw new Error(i)}function pt(i,o){i||Xe(o)}var xe={fail:Xe,argument:pt,assert:pt},mt=32768,It=2147483648,At=-32768,Nt=32767+1/65536,oe={},F={},we={};function Qe(i){return function(){return i}}F.BYTE=function(i){return xe.argument(i>=0&&i<=255,"Byte value should be between 0 and 255."),[i]},we.BYTE=Qe(1),F.CHAR=function(i){return[i.charCodeAt(0)]},we.CHAR=Qe(1),F.CHARARRAY=function(i){(i===null||typeof i>"u")&&(i="",console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));let o=[];for(let u=0;u<i.length;u+=1)o[u]=i.charCodeAt(u);return o},we.CHARARRAY=function(i){return typeof i>"u"?0:i.length},F.USHORT=function(i){return[i>>8&255,i&255]},we.USHORT=Qe(2),F.SHORT=function(i){return i>=mt&&(i=-(2*mt-i)),[i>>8&255,i&255]},we.SHORT=Qe(2),F.UINT24=function(i){return[i>>16&255,i>>8&255,i&255]},we.UINT24=Qe(3),F.ULONG=function(i){return[i>>24&255,i>>16&255,i>>8&255,i&255]},we.ULONG=Qe(4),F.LONG=function(i){return i>=It&&(i=-(2*It-i)),[i>>24&255,i>>16&255,i>>8&255,i&255]},we.LONG=Qe(4),F.FLOAT=function(i){if(i>Nt||i<At)throw new Error(`Value ${i} is outside the range of representable values in 16.16 format`);let o=Math.round(i*65536)<<0;return F.ULONG(o)},we.FLOAT=we.ULONG,F.FIXED=F.ULONG,we.FIXED=we.ULONG,F.FWORD=F.SHORT,we.FWORD=we.SHORT,F.UFWORD=F.USHORT,we.UFWORD=we.USHORT,F.F2DOT14=function(i){return F.USHORT(i*16384)},we.F2DOT14=we.USHORT,F.LONGDATETIME=function(i){return[0,0,0,0,i>>24&255,i>>16&255,i>>8&255,i&255]},we.LONGDATETIME=Qe(8),F.TAG=function(i){return xe.argument(i.length===4,"Tag should be exactly 4 ASCII characters."),[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]},we.TAG=Qe(4),F.Card8=F.BYTE,we.Card8=we.BYTE,F.Card16=F.USHORT,we.Card16=we.USHORT,F.OffSize=F.BYTE,we.OffSize=we.BYTE,F.SID=F.USHORT,we.SID=we.USHORT,F.NUMBER=function(i){return i>=-107&&i<=107?[i+139]:i>=108&&i<=1131?(i=i-108,[(i>>8)+247,i&255]):i>=-1131&&i<=-108?(i=-i-108,[(i>>8)+251,i&255]):i>=-32768&&i<=32767?F.NUMBER16(i):F.NUMBER32(i)},we.NUMBER=function(i){return F.NUMBER(i).length},F.NUMBER16=function(i){return[28,i>>8&255,i&255]},we.NUMBER16=Qe(3),F.NUMBER32=function(i){return[29,i>>24&255,i>>16&255,i>>8&255,i&255]},we.NUMBER32=Qe(5),F.REAL=function(i){let o=i.toString(),u=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(u){let g=parseFloat("1e"+((u[2]?+u[2]:0)+u[1].length));o=(Math.round(i*g)/g).toString()}let d="";for(let g=0,A=o.length;g<A;g+=1){let _=o[g];_==="e"?d+=o[++g]==="-"?"c":"b":_==="."?d+="a":_==="-"?d+="e":d+=_}d+=d.length&1?"f":"ff";let f=[30];for(let g=0,A=d.length;g<A;g+=2)f.push(parseInt(d.substr(g,2),16));return f},we.REAL=function(i){return F.REAL(i).length},F.NAME=F.CHARARRAY,we.NAME=we.CHARARRAY,F.STRING=F.CHARARRAY,we.STRING=we.CHARARRAY,oe.UTF8=function(i,o,u){let d=[],f=u;for(let g=0;g<f;g++,o+=1)d[g]=i.getUint8(o);return String.fromCharCode.apply(null,d)},oe.UTF16=function(i,o,u){let d=[],f=u/2;for(let g=0;g<f;g++,o+=2)d[g]=i.getUint16(o);return String.fromCharCode.apply(null,d)},F.UTF16=function(i){let o=[];for(let u=0;u<i.length;u+=1){let d=i.charCodeAt(u);o[o.length]=d>>8&255,o[o.length]=d&255}return o},we.UTF16=function(i){return i.length*2};var tt={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};oe.MACSTRING=function(i,o,u,d){let f=tt[d];if(f===void 0)return;let g="";for(let A=0;A<u;A++){let _=i.getUint8(o+A);_<=127?g+=String.fromCharCode(_):g+=f[_&127]}return g};var it=typeof WeakMap=="function"&&new WeakMap,Rt,Xt=function(i){if(!Rt){Rt={};for(let f in tt)Rt[f]=new String(f)}let o=Rt[i];if(o===void 0)return;if(it){let f=it.get(o);if(f!==void 0)return f}let u=tt[i];if(u===void 0)return;let d={};for(let f=0;f<u.length;f++)d[u.charCodeAt(f)]=f+128;return it&&it.set(o,d),d};F.MACSTRING=function(i,o){let u=Xt(o);if(u===void 0)return;let d=[];for(let f=0;f<i.length;f++){let g=i.charCodeAt(f);if(g>=128&&(g=u[g],g===void 0))return;d[f]=g}return d},we.MACSTRING=function(i,o){let u=F.MACSTRING(i,o);return u!==void 0?u.length:0};function Zt(i){return i>=-128&&i<=127}function Lt(i,o,u){let d=0,f=i.length;for(;o<f&&d<64&&i[o]===0;)++o,++d;return u.push(128|d-1),o}function Lr(i,o,u){let d=0,f=i.length,g=o;for(;g<f&&d<64;){let A=i[g];if(!Zt(A)||A===0&&g+1<f&&i[g+1]===0)break;++g,++d}u.push(d-1);for(let A=o;A<g;++A)u.push(i[A]+256&255);return g}function Qr(i,o,u){let d=0,f=i.length,g=o;for(;g<f&&d<64;){let A=i[g];if(A===0||Zt(A)&&g+1<f&&Zt(i[g+1]))break;++g,++d}u.push(64|d-1);for(let A=o;A<g;++A){let _=i[A];u.push(_+65536>>8&255,_+256&255)}return g}F.VARDELTAS=function(i){let o=0,u=[];for(;o<i.length;){let d=i[o];d===0?o=Lt(i,o,u):d>=-128&&d<=127?o=Lr(i,o,u):o=Qr(i,o,u)}return u},F.INDEX=function(i){let o=1,u=[o],d=[];for(let _=0;_<i.length;_+=1){let E=F.OBJECT(i[_]);Array.prototype.push.apply(d,E),o+=E.length,u.push(o)}if(d.length===0)return[0,0];let f=[],g=1+Math.floor(Math.log(o)/Math.log(2))/8|0,A=[void 0,F.BYTE,F.USHORT,F.UINT24,F.ULONG][g];for(let _=0;_<u.length;_+=1){let E=A(u[_]);Array.prototype.push.apply(f,E)}return Array.prototype.concat(F.Card16(i.length),F.OffSize(g),f,d)},we.INDEX=function(i){return F.INDEX(i).length},F.DICT=function(i){let o=[],u=Object.keys(i),d=u.length;for(let f=0;f<d;f+=1){let g=parseInt(u[f],0),A=i[g],_=F.OPERAND(A.value,A.type),E=F.OPERATOR(g);for(let M=0;M<_.length;M++)o.push(_[M]);for(let M=0;M<E.length;M++)o.push(E[M])}return o},we.DICT=function(i){return F.DICT(i).length},F.OPERATOR=function(i){return i<1200?[i]:[12,i-1200]},F.OPERAND=function(i,o){let u=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){xe.argument(i.length===o.length,"Not enough arguments given for type"+o);let f=F.OPERAND(i[d],o[d]);for(let g=0;g<f.length;g++)u.push(f[g])}else if(o==="SID"){let d=F.NUMBER(i);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="offset"){let d=F.NUMBER32(i);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="number"){let d=F.NUMBER(i);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="real"){let d=F.REAL(i);for(let f=0;f<d.length;f++)u.push(d[f])}else throw new Error("Unknown operand type "+o);return u},F.OP=F.BYTE,we.OP=we.BYTE;var Pt=typeof WeakMap=="function"&&new WeakMap;F.CHARSTRING=function(i){if(Pt){let d=Pt.get(i);if(d!==void 0)return d}let o=[],u=i.length;for(let d=0;d<u;d+=1){let f=i[d],g=F[f.type](f.value);for(let A=0;A<g.length;A++)o.push(g[A])}return Pt&&Pt.set(i,o),o},we.CHARSTRING=function(i){return F.CHARSTRING(i).length},F.OBJECT=function(i){let o=F[i.type];return xe.argument(o!==void 0,"No encoding function for type "+i.type),o(i.value)},we.OBJECT=function(i){let o=we[i.type];return xe.argument(o!==void 0,"No sizeOf function for type "+i.type),o(i.value)},F.TABLE=function(i){let o=[],u=(i.fields||[]).length,d=[],f=[];for(let g=0;g<u;g+=1){let A=i.fields[g],_=F[A.type];xe.argument(_!==void 0,"No encoding function for field type "+A.type+" ("+A.name+")");let E=i[A.name];E===void 0&&(E=A.value);let M=_(E);if(A.type==="TABLE")E.fields!==null&&(f.push(o.length),d.push(M)),o.push(0,0);else for(let R=0;R<M.length;R++)o.push(M[R])}for(let g=0;g<d.length;g+=1){let A=f[g],_=o.length;xe.argument(_<65536,"Table "+i.tableName+" too big."),o[A]=_>>8,o[A+1]=_&255;for(let E=0;E<d[g].length;E++)o.push(d[g][E])}return o},we.TABLE=function(i){let o=0,u=(i.fields||[]).length;for(let d=0;d<u;d+=1){let f=i.fields[d],g=we[f.type];xe.argument(g!==void 0,"No sizeOf function for field type "+f.type+" ("+f.name+")");let A=i[f.name];A===void 0&&(A=f.value),o+=g(A),f.type==="TABLE"&&(o+=2)}return o},F.RECORD=F.TABLE,we.RECORD=we.TABLE,F.LITERAL=function(i){return i},we.LITERAL=function(i){return i.length};function Dt(i,o,u){if(o&&o.length)for(let d=0;d<o.length;d+=1){let f=o[d];this[f.name]=f.value}if(this.tableName=i,this.fields=o,u){let d=Object.keys(u);for(let f=0;f<d.length;f+=1){let g=d[f],A=u[g];this[g]!==void 0&&(this[g]=A)}}}Dt.prototype.encode=function(){return F.TABLE(this)},Dt.prototype.sizeOf=function(){return we.TABLE(this)};function pr(i,o,u){u===void 0&&(u=o.length);let d=new Array(o.length+1);d[0]={name:i+"Count",type:"USHORT",value:u};for(let f=0;f<o.length;f++)d[f+1]={name:i+f,type:"USHORT",value:o[f]};return d}function pe(i,o,u){let d=o.length,f=new Array(d+1);f[0]={name:i+"Count",type:"USHORT",value:d};for(let g=0;g<d;g++)f[g+1]={name:i+g,type:"TABLE",value:u(o[g],g)};return f}function Ge(i,o,u){let d=o.length,f=[];f[0]={name:i+"Count",type:"USHORT",value:d};for(let g=0;g<d;g++)f=f.concat(u(o[g],g));return f}function at(i){i.format===1?Dt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(pr("glyph",i.glyphs))):i.format===2?Dt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Ge("rangeRecord",i.ranges,function(o,u){return[{name:"startGlyphID"+u,type:"USHORT",value:o.start},{name:"endGlyphID"+u,type:"USHORT",value:o.end},{name:"startCoverageIndex"+u,type:"USHORT",value:o.index}]}))):xe.assert(!1,"Coverage format must be 1 or 2.")}at.prototype=Object.create(Dt.prototype),at.prototype.constructor=at;function Mt(i){Dt.call(this,"scriptListTable",Ge("scriptRecord",i,function(o,u){let d=o.script,f=d.defaultLangSys;return xe.assert(!!f,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+u,type:"TAG",value:o.tag},{name:"script"+u,type:"TABLE",value:new Dt("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Dt("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(pr("featureIndex",f.featureIndexes)))}].concat(Ge("langSys",d.langSysRecords,function(g,A){let _=g.langSys;return[{name:"langSysTag"+A,type:"TAG",value:g.tag},{name:"langSys"+A,type:"TABLE",value:new Dt("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:_.reqFeatureIndex}].concat(pr("featureIndex",_.featureIndexes)))}]})))}]}))}Mt.prototype=Object.create(Dt.prototype),Mt.prototype.constructor=Mt;function er(i){Dt.call(this,"featureListTable",Ge("featureRecord",i,function(o,u){let d=o.feature;return[{name:"featureTag"+u,type:"TAG",value:o.tag},{name:"feature"+u,type:"TABLE",value:new Dt("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(pr("lookupListIndex",d.lookupListIndexes)))}]}))}er.prototype=Object.create(Dt.prototype),er.prototype.constructor=er;function J(i,o){Dt.call(this,"lookupListTable",pe("lookup",i,function(u){let d=o[u.lookupType];return xe.assert(!!d,"Unable to write GSUB lookup type "+u.lookupType+" tables."),new Dt("lookupTable",[{name:"lookupType",type:"USHORT",value:u.lookupType},{name:"lookupFlag",type:"USHORT",value:u.lookupFlag}].concat(pe("subtable",u.subtables,d)))}))}J.prototype=Object.create(Dt.prototype),J.prototype.constructor=J;function bt(i){i.format===1?Dt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:i.startGlyph}].concat(pr("glyph",i.classes))):i.format===2?Dt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Ge("rangeRecord",i.ranges,function(o,u){return[{name:"startGlyphID"+u,type:"USHORT",value:o.start},{name:"endGlyphID"+u,type:"USHORT",value:o.end},{name:"class"+u,type:"USHORT",value:o.classId}]}))):xe.assert(!1,"Class format must be 1 or 2.")}bt.prototype=Object.create(Dt.prototype),bt.prototype.constructor=bt;var Ce={Table:Dt,Record:Dt,Coverage:at,ClassDef:bt,ScriptList:Mt,FeatureList:er,LookupList:J,ushortList:pr,tableList:pe,recordList:Ge};function lr(i,o){return i.getUint8(o)}function Ve(i,o){return i.getUint16(o,!1)}function zt(i,o){return i.getInt16(o,!1)}function Jt(i,o){return(i.getUint16(o)<<8)+i.getUint8(o+2)}function Wr(i,o){return i.getUint32(o,!1)}function yn(i,o){return i.getInt32(o,!1)}function Ar(i,o){let u=i.getInt16(o,!1),d=i.getUint16(o+2,!1);return u+d/65535}function Jr(i,o){let u="";for(let d=o;d<o+4;d+=1)u+=String.fromCharCode(i.getInt8(d));return u}function Fr(i,o,u){let d=0;for(let f=0;f<u;f+=1)d<<=8,d+=i.getUint8(o+f);return d}function $r(i,o,u){let d=[];for(let f=o;f<u;f+=1)d.push(i.getUint8(f));return d}function an(i){let o="";for(let u=0;u<i.length;u+=1)o+=String.fromCharCode(i[u]);return o}var An={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},gt={LONG_WORDS:32768,WORD_DELTA_COUNT_MASK:32767,SHARED_POINT_NUMBERS:32768,COUNT_MASK:4095,EMBEDDED_PEAK_TUPLE:32768,INTERMEDIATE_REGION:16384,PRIVATE_POINT_NUMBERS:8192,TUPLE_INDEX_MASK:4095,POINTS_ARE_WORDS:128,POINT_RUN_COUNT_MASK:127,DELTAS_ARE_ZERO:128,DELTAS_ARE_WORDS:64,DELTA_RUN_COUNT_MASK:63,INNER_INDEX_BIT_COUNT_MASK:15,MAP_ENTRY_SIZE_MASK:48};function fe(i,o){this.data=i,this.offset=o,this.relativeOffset=0}fe.prototype.parseByte=function(){let i=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,i},fe.prototype.parseChar=function(){let i=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,i},fe.prototype.parseCard8=fe.prototype.parseByte,fe.prototype.parseUShort=function(){let i=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,i},fe.prototype.parseCard16=fe.prototype.parseUShort,fe.prototype.parseSID=fe.prototype.parseUShort,fe.prototype.parseOffset16=fe.prototype.parseUShort,fe.prototype.parseShort=function(){let i=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,i},fe.prototype.parseF2Dot14=function(){let i=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,i},fe.prototype.parseUInt24=function(){let i=Jt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,i},fe.prototype.parseULong=function(){let i=Wr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},fe.prototype.parseLong=function(){let i=yn(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},fe.prototype.parseOffset32=fe.prototype.parseULong,fe.prototype.parseFixed=function(){let i=Ar(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},fe.prototype.parseString=function(i){let o=this.data,u=this.offset+this.relativeOffset,d="";this.relativeOffset+=i;for(let f=0;f<i;f++)d+=String.fromCharCode(o.getUint8(u+f));return d},fe.prototype.parseTag=function(){return this.parseString(4)},fe.prototype.parseLongDateTime=function(){let i=Wr(this.data,this.offset+this.relativeOffset+4);return i-=2082844800,this.relativeOffset+=8,i},fe.prototype.parseVersion=function(i){let o=Ve(this.data,this.offset+this.relativeOffset),u=Ve(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,i===void 0&&(i=4096),o+u/i/10},fe.prototype.skip=function(i,o){o===void 0&&(o=1),this.relativeOffset+=An[i]*o},fe.prototype.parseULongList=function(i){i===void 0&&(i=this.parseULong());let o=new Array(i),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<i;f++)o[f]=u.getUint32(d),d+=4;return this.relativeOffset+=i*4,o},fe.prototype.parseOffset16List=fe.prototype.parseUShortList=function(i){i===void 0&&(i=this.parseUShort());let o=new Array(i),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<i;f++)o[f]=u.getUint16(d),d+=2;return this.relativeOffset+=i*2,o},fe.prototype.parseShortList=function(i){let o=new Array(i),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<i;f++)o[f]=u.getInt16(d),d+=2;return this.relativeOffset+=i*2,o},fe.prototype.parseByteList=function(i){let o=new Array(i),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<i;f++)o[f]=u.getUint8(d++);return this.relativeOffset+=i,o},fe.prototype.parseList=function(i,o){o||(o=i,i=this.parseUShort());let u=new Array(i);for(let d=0;d<i;d++)u[d]=o.call(this);return u},fe.prototype.parseList32=function(i,o){o||(o=i,i=this.parseULong());let u=new Array(i);for(let d=0;d<i;d++)u[d]=o.call(this);return u},fe.prototype.parseRecordList=function(i,o){o||(o=i,i=this.parseUShort());let u=new Array(i),d=Object.keys(o);for(let f=0;f<i;f++){let g={};for(let A=0;A<d.length;A++){let _=d[A],E=o[_];g[_]=E.call(this)}u[f]=g}return u},fe.prototype.parseRecordList32=function(i,o){o||(o=i,i=this.parseULong());let u=new Array(i),d=Object.keys(o);for(let f=0;f<i;f++){let g={};for(let A=0;A<d.length;A++){let _=d[A],E=o[_];g[_]=E.call(this)}u[f]=g}return u},fe.prototype.parseTupleRecords=function(i,o){let u=[];for(let d=0;d<i;d++){let f=[];for(let g=0;g<o;g++)f.push(this.parseF2Dot14());u.push(f)}return u},fe.prototype.parseStruct=function(i){if(typeof i=="function")return i.call(this);{let o=Object.keys(i),u={};for(let d=0;d<o.length;d++){let f=o[d],g=i[f];u[f]=g.call(this)}return u}},fe.prototype.parseValueRecord=function(i){if(i===void 0&&(i=this.parseUShort()),i===0)return;let o={};return i&1&&(o.xPlacement=this.parseShort()),i&2&&(o.yPlacement=this.parseShort()),i&4&&(o.xAdvance=this.parseShort()),i&8&&(o.yAdvance=this.parseShort()),i&16&&(o.xPlaDevice=void 0,this.parseShort()),i&32&&(o.yPlaDevice=void 0,this.parseShort()),i&64&&(o.xAdvDevice=void 0,this.parseShort()),i&128&&(o.yAdvDevice=void 0,this.parseShort()),o},fe.prototype.parseValueRecordList=function(){let i=this.parseUShort(),o=this.parseUShort(),u=new Array(o);for(let d=0;d<o;d++)u[d]=this.parseValueRecord(i);return u},fe.prototype.parsePointer=function(i){let o=this.parseOffset16();if(o>0)return new fe(this.data,this.offset+o).parseStruct(i)},fe.prototype.parsePointer32=function(i){let o=this.parseOffset32();if(o>0)return new fe(this.data,this.offset+o).parseStruct(i)},fe.prototype.parseListOfLists=function(i){let o=this.parseOffset16List(),u=o.length,d=this.relativeOffset,f=new Array(u);for(let g=0;g<u;g++){let A=o[g];if(A===0){f[g]=void 0;continue}if(this.relativeOffset=A,i){let _=this.parseOffset16List(),E=new Array(_.length);for(let M=0;M<_.length;M++)this.relativeOffset=A+_[M],E[M]=i.call(this);f[g]=E}else f[g]=this.parseUShortList()}return this.relativeOffset=d,f},fe.prototype.parseCoverage=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort(),u=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(u)};if(o===2){let d=new Array(u);for(let f=0;f<u;f++)d[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:d}}throw new Error("0x"+i.toString(16)+": Coverage format must be 1 or 2.")},fe.prototype.parseClassDef=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();return o===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:o===2?{format:2,ranges:this.parseRecordList({start:fe.uShort,end:fe.uShort,classId:fe.uShort})}:(console.warn(`0x${i.toString(16)}: This font file uses an invalid ClassDef format of ${o}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:o})},fe.list=function(i,o){return function(){return this.parseList(i,o)}},fe.list32=function(i,o){return function(){return this.parseList32(i,o)}},fe.recordList=function(i,o){return function(){return this.parseRecordList(i,o)}},fe.recordList32=function(i,o){return function(){return this.parseRecordList32(i,o)}},fe.pointer=function(i){return function(){return this.parsePointer(i)}},fe.pointer32=function(i){return function(){return this.parsePointer32(i)}},fe.tag=fe.prototype.parseTag,fe.byte=fe.prototype.parseByte,fe.uShort=fe.offset16=fe.prototype.parseUShort,fe.uShortList=fe.prototype.parseUShortList,fe.uInt24=fe.prototype.parseUInt24,fe.uLong=fe.offset32=fe.prototype.parseULong,fe.uLongList=fe.prototype.parseULongList,fe.fixed=fe.prototype.parseFixed,fe.f2Dot14=fe.prototype.parseF2Dot14,fe.struct=fe.prototype.parseStruct,fe.coverage=fe.prototype.parseCoverage,fe.classDef=fe.prototype.parseClassDef;var Vr={reserved:fe.uShort,reqFeatureIndex:fe.uShort,featureIndexes:fe.uShortList};fe.prototype.parseScriptList=function(){return this.parsePointer(fe.recordList({tag:fe.tag,script:fe.pointer({defaultLangSys:fe.pointer(Vr),langSysRecords:fe.recordList({tag:fe.tag,langSys:fe.pointer(Vr)})})}))||[]},fe.prototype.parseFeatureList=function(){return this.parsePointer(fe.recordList({tag:fe.tag,feature:fe.pointer({featureParams:fe.offset16,lookupListIndexes:fe.uShortList})}))||[]},fe.prototype.parseLookupList=function(i){return this.parsePointer(fe.list(fe.pointer(function(){let o=this.parseUShort();xe.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let u=this.parseUShort(),d=u&16;return{lookupType:o,lookupFlag:u,subtables:this.parseList(fe.pointer(i[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},fe.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let i=this.parseUShort(),o=this.parseUShort();return xe.argument(i===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:fe.offset32,featureTableSubstitutionOffset:fe.offset32})})||[]},fe.prototype.parseVariationStore=function(){let i=this.relativeOffset,o=this.parseUShort(),u={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=i+o+2,u},fe.prototype.parseItemVariationStore=function(){let i=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},u=this.parseOffset32(),d=this.parseUShort(),f=this.parseULongList(d);this.relativeOffset=i+u,o.variationRegions=this.parseVariationRegionList();for(let g=0;g<d;g++){let A=f[g];this.relativeOffset=i+A,o.itemVariationSubtables.push(this.parseItemVariationSubtable())}return o},fe.prototype.parseVariationRegionList=function(){let i=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:fe.recordList(i,{startCoord:fe.f2Dot14,peakCoord:fe.f2Dot14,endCoord:fe.f2Dot14})})},fe.prototype.parseItemVariationSubtable=function(){let i=this.parseUShort(),o=this.parseUShort(),u=this.parseUShortList(),d=u.length;return{regionIndexes:u,deltaSets:i&&d?this.parseDeltaSets(i,o,d):[]}},fe.prototype.parseDeltaSetIndexMap=function(){let i=this.parseByte(),o=this.parseByte(),u=[],d=0;switch(i){case 0:d=this.parseUShort();break;case 1:d=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${i}`)}if(!d)return{format:i,entryFormat:o};let f=(o&gt.INNER_INDEX_BIT_COUNT_MASK)+1,g=((o&gt.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let A=0;A<d;A++){let _;if(g===1)_=this.parseByte();else if(g===2)_=this.parseUShort();else if(g===3)_=this.parseUInt24();else if(g===4)_=this.parseULong();else throw new Error(`Invalid entry size of ${g}`);let E=_>>f,M=_&(1<<f)-1;u.push({outerIndex:E,innerIndex:M})}return{format:i,entryFormat:o,map:u}},fe.prototype.parseDeltaSets=function(i,o,u){let d=Array.from({length:i},()=>[]),f=o&gt.LONG_WORDS,g=o&gt.WORD_DELTA_COUNT_MASK;if(g>u)throw Error("wordCount must be less than or equal to regionIndexCount");let A=(f?this.parseLong:this.parseShort).bind(this),_=(f?this.parseShort:this.parseChar).bind(this);for(let E=0;E<i;E++)for(let M=0;M<u;M++)M<g?d[E].push(A()):d[E].push(_());return d},fe.prototype.parseTupleVariationStoreList=function(i,o,u){let d=this.parseUShort(),f=this.parseUShort()&1,g=this.parseOffset32(),A=(f?this.parseULong:this.parseUShort).bind(this),_={},E=A();f||(E*=2);let M;for(let R=0;R<d;R++){M=A(),f||(M*=2);let Y=M-E;_[R]=Y?this.parseTupleVariationStore(g+E,i,o,u,R):void 0,E=M}return _},fe.prototype.parseTupleVariationStore=function(i,o,u,d,f){let g=this.relativeOffset;this.relativeOffset=i,u==="cvar"&&(this.relativeOffset+=4);let A=this.parseUShort(),_=!!(A&gt.SHARED_POINT_NUMBERS),E=A&gt.COUNT_MASK,M=this.parseOffset16(),R=[],Y=[];for(let ue=0;ue<E;ue++){let Ae=this.parseTupleVariationHeader(o,u);R.push(Ae)}this.relativeOffset!==i+M&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${i+M}, actually ${this.relativeOffset}`),this.relativeOffset=i+M),_&&(Y=this.parsePackedPointNumbers());let Z=this.relativeOffset;for(let ue=0;ue<E;ue++){let Ae=R[ue];Ae.privatePoints=[],this.relativeOffset=Z,u==="cvar"&&!Ae.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),Ae.flags.privatePointNumbers&&(Ae.privatePoints=this.parsePackedPointNumbers()),delete Ae.flags;let Ze=this.offset,ur=this.relativeOffset,nr=kr=>{let zr,Qn,Xn=()=>{let Jn=0;if(u==="gvar"){if(Jn=Ae.privatePoints.length||Y.length,!Jn){let Zs=d.get(f);Zs.path,Jn=Zs.points.length,Jn+=4}}else u==="cvar"&&(Jn=d.length);this.offset=Ze,this.relativeOffset=ur,zr=this.parsePackedDeltas(Jn),u==="gvar"&&(Qn=this.parsePackedDeltas(Jn))};return{configurable:!0,get:function(){return zr===void 0&&Xn(),kr==="deltasY"?Qn:zr},set:function(Jn){zr===void 0&&Xn(),kr==="deltasY"?Qn=Jn:zr=Jn}}};Object.defineProperty(Ae,"deltas",nr.call(this,"deltas")),u==="gvar"&&Object.defineProperty(Ae,"deltasY",nr.call(this,"deltasY")),Z+=Ae.variationDataSize,delete Ae.variationDataSize}this.relativeOffset=g;let me={headers:R};return me.sharedPoints=Y,me},fe.prototype.parseTupleVariationHeader=function(i,o){let u=this.parseUShort(),d=this.parseUShort(),f=!!(d&gt.EMBEDDED_PEAK_TUPLE),g=!!(d&gt.INTERMEDIATE_REGION),A=!!(d&gt.PRIVATE_POINT_NUMBERS),_=f?void 0:d&gt.TUPLE_INDEX_MASK,E=f?this.parseTupleRecords(1,i)[0]:void 0,M=g?this.parseTupleRecords(1,i)[0]:void 0,R=g?this.parseTupleRecords(1,i)[0]:void 0,Y={variationDataSize:u,peakTuple:E,intermediateStartTuple:M,intermediateEndTuple:R,flags:{embeddedPeakTuple:f,intermediateRegion:g,privatePointNumbers:A}};return o==="gvar"&&(Y.sharedTupleRecordsIndex=_),Y},fe.prototype.parsePackedPointNumbers=function(){let i=this.parseByte(),o=[],u=i;if(i>=128){let f=this.parseByte();u=(i&gt.POINT_RUN_COUNT_MASK)<<8|f}let d=0;for(;o.length<u;){let f=this.parseByte(),g=!!(f&gt.POINTS_ARE_WORDS),A=(f&gt.POINT_RUN_COUNT_MASK)+1;for(let _=0;_<A&&o.length<u;_++){let E;g?E=this.parseUShort():E=this.parseByte(),d=d+E,o.push(d)}}return o},fe.prototype.parsePackedDeltas=function(i){let o=[];for(;o.length<i;){let u=this.parseByte(),d=!!(u&gt.DELTAS_ARE_ZERO),f=!!(u&gt.DELTAS_ARE_WORDS),g=(u&gt.DELTA_RUN_COUNT_MASK)+1;for(let A=0;A<g&&o.length<i;A++)d?o.push(0):f?o.push(this.parseShort()):o.push(this.parseChar())}return o};var ct={getByte:lr,getCard8:lr,getUShort:Ve,getCard16:Ve,getShort:zt,getUInt24:Jt,getULong:Wr,getFixed:Ar,getTag:Jr,getOffset:Fr,getBytes:$r,bytesToString:an,Parser:fe},Ue=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Tr={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},wt={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Tn={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function Nr(i,o,u){switch(i){case 0:if(o===65535)return"und";if(u)return u[o];break;case 1:return Tr[o];case 3:return Tn[o]}}var cn="utf-16",Ie={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},ht={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function Je(i,o,u){switch(i){case 0:return cn;case 1:return ht[u]||Ie[o];case 3:if(o===1||o===10)return cn;break}}var _r={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function Zr(i){return _r[i]}function Gr(i,o,u){let d={},f=new ct.Parser(i,o),g=f.parseUShort(),A=f.parseUShort(),_=f.offset+f.parseUShort();for(let E=0;E<A;E++){let M=f.parseUShort(),R=f.parseUShort(),Y=f.parseUShort(),Z=f.parseUShort(),me=Ue[Z]||Z,ue=f.parseUShort(),Ae=f.parseUShort(),Ze=Nr(M,Y,u),ur=Je(M,R,Y),nr=Zr(M);if(ur!==void 0&&Ze!==void 0&&nr!==void 0){let kr;if(ur===cn?kr=oe.UTF16(i,_+Ae,ue):kr=oe.MACSTRING(i,_+Ae,ue,ur),kr){let zr=d[nr];zr===void 0&&(zr=d[nr]={});let Qn=zr[me];Qn===void 0&&(Qn=zr[me]={}),Qn[Ze]=kr}}}return g===1&&f.parseUShort(),d}function Ir(i){let o={};for(let u in i)o[i[u]]=parseInt(u);return o}function es(i,o,u,d,f,g){return new Ce.Record("NameRecord",[{name:"platformID",type:"USHORT",value:i},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:u},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:f},{name:"offset",type:"USHORT",value:g}])}function Ft(i,o){let u=i.length,d=o.length-u+1;e:for(let f=0;f<d;f++)for(;f<d;f++){for(let g=0;g<u;g++)if(o[f+g]!==i[g])continue e;return f}return-1}function hn(i,o){let u=Ft(i,o);if(u<0){u=o.length;let d=0,f=i.length;for(;d<f;++d)o.push(i[d])}return u}function ee(i,o){let u=Ir(_r),d=Ir(Tr),f=Ir(Tn),g=[],A=[];for(let E in i){let M,R=[],Y={},Z=Ir(Ue),me=u[E];for(let ue in i[E]){let Ae=Z[ue];if(Ae===void 0&&(Ae=ue),M=parseInt(Ae),isNaN(M))throw new Error('Name table entry "'+ue+'" does not exist, see nameTableNames for complete list.');Y[M]=i[E][ue],R.push(M)}for(let ue=0;ue<R.length;ue++){M=R[ue];let Ae=Y[M];for(let Ze in Ae){let ur=Ae[Ze];if(me===1||me===0){let nr=d[Ze],kr=wt[nr],zr=Je(me,kr,nr),Qn=F.MACSTRING(ur,zr);if(me===0&&(nr=o.indexOf(Ze),nr<0&&(nr=o.length,o.push(Ze)),kr=4,Qn=F.UTF16(ur)),Qn!==void 0){let Xn=hn(Qn,A);g.push(es(me,kr,nr,M,Qn.length,Xn))}}if(me===3){let nr=f[Ze];if(nr!==void 0){let kr=F.UTF16(ur),zr=hn(kr,A);g.push(es(3,1,nr,M,kr.length,zr))}}}}}g.sort(function(E,M){return E.platformID-M.platformID||E.encodingID-M.encodingID||E.languageID-M.languageID||E.nameID-M.nameID});let _=new Ce.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:g.length},{name:"stringOffset",type:"USHORT",value:6+g.length*12}]);for(let E=0;E<g.length;E++)_.fields.push({name:"record_"+E,type:"RECORD",value:g[E]});return _.fields.push({name:"strings",type:"LITERAL",value:A}),_}function Ye(i,o,u=[]){if(o<256&&o in Ue){if(u.length&&!u.includes(parseInt(o)))return;o=Ue[o]}for(let d in i)for(let f in i[d])if(f===o||parseInt(f)===o)return i[d][f]}var qt={parse:Gr,make:ee,getNameByID:Ye};function Gt(i,o,u,d){i.length=o.parseUShort(),i.language=o.parseUShort()-1;let f=o.parseByteList(i.length),g=Object.assign({},f),A=Je(u,d,i.language),_=tt[A];for(let E=0;E<_.length;E++)g[_.charCodeAt(E)]=f[128+E];i.glyphIndexMap=g}function Yr(i,o,u){o.parseUShort(),i.length=o.parseULong(),i.language=o.parseULong();let d;i.groupCount=d=o.parseULong(),i.glyphIndexMap={};for(let f=0;f<d;f+=1){let g=o.parseULong(),A=o.parseULong(),_=o.parseULong();for(let E=g;E<=A;E+=1)i.glyphIndexMap[E]=_,u===12&&_++}}function Br(i,o,u,d,f){i.length=o.parseUShort(),i.language=o.parseUShort();let g;i.segCount=g=o.parseUShort()>>1,o.skip("uShort",3),i.glyphIndexMap={};let A=new ct.Parser(u,d+f+14),_=new ct.Parser(u,d+f+16+g*2),E=new ct.Parser(u,d+f+16+g*4),M=new ct.Parser(u,d+f+16+g*6),R=d+f+16+g*8;for(let Y=0;Y<g-1;Y+=1){let Z,me=A.parseUShort(),ue=_.parseUShort(),Ae=E.parseShort(),Ze=M.parseUShort();for(let ur=ue;ur<=me;ur+=1)Ze!==0?(R=M.offset+M.relativeOffset-2,R+=Ze,R+=(ur-ue)*2,Z=ct.getUShort(u,R),Z!==0&&(Z=Z+Ae&65535)):Z=ur+Ae&65535,i.glyphIndexMap[ur]=Z}}function Er(i,o){let u={};o.skip("uLong");let d=o.parseULong();for(let f=0;f<d;f+=1){let g=o.parseUInt24(),A={varSelector:g},_=o.parseOffset32(),E=o.parseOffset32(),M=o.relativeOffset;_&&(o.relativeOffset=_,A.defaultUVS=o.parseStruct({ranges:function(){return o.parseRecordList32({startUnicodeValue:o.parseUInt24,additionalCount:o.parseByte})}})),E&&(o.relativeOffset=E,A.nonDefaultUVS=o.parseStruct({uvsMappings:function(){let R={},Y=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let Z=0;Z<Y.length;Z+=1)R[Y[Z].unicodeValue]=Y[Z];return R}})),u[g]=A,o.relativeOffset=M}i.varSelectorList=u}function ar(i,o){let u={};u.version=ct.getUShort(i,o),xe.argument(u.version===0,"cmap table version should be 0."),u.numTables=ct.getUShort(i,o+2);let d=null,f=-1,g=-1,A=null,_=null,E=[0,1,2,3,4,6],M=[0,1,10];for(let Y=u.numTables-1;Y>=0;Y-=1)if(A=ct.getUShort(i,o+4+Y*8),_=ct.getUShort(i,o+4+Y*8+2),A===3&&M.includes(_)||A===0&&E.includes(_)||A===1&&_===0){if(g>0)continue;if(g=ct.getULong(i,o+4+Y*8+4),d)break}else if(A===0&&_===5){if(f=ct.getULong(i,o+4+Y*8+4),d=new ct.Parser(i,o+f),d.parseUShort()!==14)f=-1,d=null;else if(g>0)break}if(g===-1)throw new Error("No valid cmap sub-tables found.");let R=new ct.Parser(i,o+g);if(u.format=R.parseUShort(),u.format===0)Gt(u,R,A,_);else if(u.format===12||u.format===13)Yr(u,R,u.format);else if(u.format===4)Br(u,R,i,o,g);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+u.format+", platformId "+A+", encodingId "+_+").");return d&&Er(u,d),u}function br(i,o,u){i.segments.push({end:o,start:o,delta:-(o-u),offset:0,glyphIndex:u})}function Hn(i){i.segments.push({end:65535,start:65535,delta:1,offset:0})}function Qs(i){if(i.length===0)return i;let o=[i[0]];for(let u=1;u<i.length;u++){let d=o[o.length-1],f=i[u];d.end+1===f.start&&d.delta===f.delta&&f.end!==65535?d.end=f.end:o.push(f)}return o}function hs(i){let o=!0,u;for(u=i.length-1;u>0;u-=1)if(i.get(u).unicode>65535){o=!1;break}let d=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:o?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:o?12:20}];o||d.push({name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}),d.push({name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0});let f=new Ce.Table("cmap",d);for(f.segments=[],u=0;u<i.length;u+=1){let me=i.get(u);for(let ue=0;ue<me.unicodes.length;ue+=1)br(f,me.unicodes[ue],u)}f.segments.sort(function(me,ue){return me.start-ue.start}),f.segments=Qs(f.segments),Hn(f);let g=f.segments.length,A=0,_=[],E=[],M=[],R=[],Y=[],Z=[];for(u=0;u<g;u+=1){let me=f.segments[u];me.end<=65535&&me.start<=65535?(_.push({name:"end_"+u,type:"USHORT",value:me.end}),E.push({name:"start_"+u,type:"USHORT",value:me.start}),M.push({name:"idDelta_"+u,type:"SHORT",value:me.delta}),R.push({name:"idRangeOffset_"+u,type:"USHORT",value:me.offset}),me.glyphId!==void 0&&Y.push({name:"glyph_"+u,type:"USHORT",value:me.glyphId})):A+=1,!o&&me.glyphIndex!==void 0&&(Z.push({name:"cmap12Start_"+u,type:"ULONG",value:me.start}),Z.push({name:"cmap12End_"+u,type:"ULONG",value:me.end}),Z.push({name:"cmap12Glyph_"+u,type:"ULONG",value:me.glyphIndex}))}f.segCountX2=(g-A)*2,f.searchRange=Math.pow(2,Math.floor(Math.log(g-A)/Math.log(2)))*2,f.entrySelector=Math.log(f.searchRange/2)/Math.log(2),f.rangeShift=f.segCountX2-f.searchRange;for(let me=0;me<_.length;me++)f.fields.push(_[me]);f.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let me=0;me<E.length;me++)f.fields.push(E[me]);for(let me=0;me<M.length;me++)f.fields.push(M[me]);for(let me=0;me<R.length;me++)f.fields.push(R[me]);for(let me=0;me<Y.length;me++)f.fields.push(Y[me]);if(f.cmap4Length=14+_.length*2+2+E.length*2+M.length*2+R.length*2+Y.length*2,!o){let me=16+Z.length*4;f.cmap12Offset=20+f.cmap4Length,f.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:me},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:Z.length/3});for(let ue=0;ue<Z.length;ue++)f.fields.push(Z[ue])}return f}var xs={parse:ar,make:hs},On=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],En=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Bs=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],bs=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],Ur=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Pr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],kt=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function ks(i){this.font=i}ks.prototype.charToGlyphIndex=function(i){let o=i.codePointAt(0),u=this.font.glyphs;if(u)for(let d=0;d<u.length;d+=1){let f=u.get(d);for(let g=0;g<f.unicodes.length;g+=1)if(f.unicodes[g]===o)return d}return null};function Yt(i){this.cmap=i}Yt.prototype.charToGlyphIndex=function(i){return this.cmap.glyphIndexMap[i.codePointAt(0)]||0};function q(i,o){this.encoding=i,this.charset=o}q.prototype.charToGlyphIndex=function(i){let o=i.codePointAt(0),u=this.encoding[o];return this.charset.indexOf(u)};function ke(i){switch(i.version){case 1:this.names=kt.slice();break;case 2:this.names=new Array(i.numberOfGlyphs);for(let o=0;o<i.numberOfGlyphs;o++)i.glyphNameIndex[o]<kt.length?this.names[o]=kt[i.glyphNameIndex[o]]:this.names[o]=i.names[i.glyphNameIndex[o]-kt.length];break;case 2.5:this.names=new Array(i.numberOfGlyphs);for(let o=0;o<i.numberOfGlyphs;o++)this.names[o]=kt[o+i.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}ke.prototype.nameToGlyphIndex=function(i){return this.names.indexOf(i)},ke.prototype.glyphIndexToName=function(i){return this.names[i]};function rt(i){let o,u=i.tables.cmap.glyphIndexMap,d=Object.keys(u);for(let f=0;f<d.length;f+=1){let g=d[f],A=u[g];o=i.glyphs.get(A),o.addUnicode(parseInt(g))}for(let f=0;f<i.glyphs.length;f+=1)o=i.glyphs.get(f),i.cffEncoding?o.name=i.cffEncoding.charset[f]:i.glyphNames.names&&(o.name=i.glyphNames.glyphIndexToName(f))}function or(i){i._IndexToUnicodeMap={};let o=i.tables.cmap.glyphIndexMap,u=Object.keys(o);for(let d=0;d<u.length;d+=1){let f=u[d],g=o[f];i._IndexToUnicodeMap[g]===void 0?i._IndexToUnicodeMap[g]={unicodes:[parseInt(f)]}:i._IndexToUnicodeMap[g].unicodes.push(parseInt(f))}}function $t(i,o){o.lowMemory?or(i):rt(i)}function cr(i,o,u,d,f){i.beginPath(),i.moveTo(o,u),i.lineTo(d,f),i.stroke()}var Et={line:cr};function fn(i,o){let u=new fe(i,o),d=u.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let f=u.parseShort(),g=u.parseShort(),A=u.parseShort(),_=u.parseOffset32(),E=u.parseUShortList(g);u.relativeOffset=_;let M=u.parseULongList(A);return u.relativeOffset=_,{version:d,numPaletteEntries:f,colorRecords:M,colorRecordIndices:E}}function Ts({version:i=0,numPaletteEntries:o=0,colorRecords:u=[],colorRecordIndices:d=[0]}){return xe.argument(i===0,"Only CPALv0 are supported."),xe.argument(u.length,"No colorRecords given."),xe.argument(d.length,"No colorRecordIndices given."),d.length>1&&xe.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new Ce.Table("CPAL",[{name:"version",type:"USHORT",value:i},{name:"numPaletteEntries",type:"USHORT",value:o||u.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:u.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((f,g)=>({name:"colorRecordIndices_"+g,type:"USHORT",value:f})),...u.map((f,g)=>({name:"colorRecords_"+g,type:"ULONG",value:f}))])}function _i(i){var o=(i&4278190080)>>24,u=(i&16711680)>>16,d=(i&65280)>>8,f=i&255;return o=o+256&255,u=u+256&255,d=d+256&255,f=(f+256&255)/255,{b:o,g:u,r:d,a:f}}function Ps(i,o,u=0,d="hexa"){if(o==65535)return"currentColor";let f=i&&i.tables&&i.tables.cpal;if(!f)return"currentColor";if(u>f.colorRecordIndices.length-1)throw new Error(`Palette index out of range (colorRecordIndices.length: ${f.colorRecordIndices.length}, index: ${o})`);if(o>f.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${f.numPaletteEntries}, index: ${o})`);let g=f.colorRecordIndices[u]+o;if(g>f.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${f.colorRecords.length}, lookupIndex: ${g})`);let A=_i(f.colorRecords[g]);return d==="bgra"?A:qr(A,d)}function Wn(i){return("0"+parseInt(i).toString(16)).slice(-2)}function wa(i){let o=i.r/255,u=i.g/255,d=i.b/255,f=Math.max(o,u,d),g=Math.min(o,u,d),A,_,E=(f+g)/2;if(f===g)A=_=0;else{let M=f-g;switch(_=E>.5?M/(2-f-g):M/(f+g),f){case o:A=(u-d)/M+(u<d?6:0);break;case u:A=(d-o)/M+2;break;case d:A=(o-u)/M+4;break}A/=6}return{h:A*360,s:_*100,l:E*100}}function di(i){let{h:o,s:u,l:d,a:f}=i;o=o%360,u/=100,d/=100;let g=(1-Math.abs(2*d-1))*u,A=g*(1-Math.abs(o/60%2-1)),_=d-g/2,E=0,M=0,R=0;return 0<=o&&o<60?(E=g,M=A,R=0):60<=o&&o<120?(E=A,M=g,R=0):120<=o&&o<180?(E=0,M=g,R=A):180<=o&&o<240?(E=0,M=A,R=g):240<=o&&o<300?(E=A,M=0,R=g):300<=o&&o<=360&&(E=g,M=0,R=A),{r:Math.round((E+_)*255),g:Math.round((M+_)*255),b:Math.round((R+_)*255),a:f}}function Gn(i){return parseInt(`0x${Wn(i.b)}${Wn(i.g)}${Wn(i.r)}${Wn(i.a*255)}`,16)}function ls(i,o="hexa"){let u=o=="raw"||o=="cpal",d=Number.isInteger(i),f=!0;if(d&&u||i==="currentColor")return i;if(typeof i=="object"){if(o=="bgra")return i;if(u)return Gn(i)}else if(!d&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(i.trim())){switch(i=i.trim().substring(1),i.length){case 3:i={r:parseInt(i[0].repeat(2),16),g:parseInt(i[1].repeat(2),16),b:parseInt(i[2].repeat(2),16),a:1};break;case 4:i={r:parseInt(i[0].repeat(2),16),g:parseInt(i[1].repeat(2),16),b:parseInt(i[2].repeat(2),16),a:parseInt(i[3].repeat(2),16)/255};break;case 6:i={r:parseInt(i[0]+i[1],16),g:parseInt(i[2]+i[3],16),b:parseInt(i[4]+i[5],16),a:1};break;case 8:i={r:parseInt(i[0]+i[1],16),g:parseInt(i[2]+i[3],16),b:parseInt(i[4]+i[5],16),a:parseInt(i[6]+i[7],16)/255};break}if(o=="bgra")return i}else if(typeof document<"u"&&/^[a-z]+$/i.test(i)){let g=document.createElement("canvas").getContext("2d");g.fillStyle=i;let A=qr(g.fillStyle,"hexa");A==="#000000ff"&&i.toLowerCase()!=="black"?f=!1:i=A}else{i=i.trim();let g=/rgba?\(\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(g.test(i)){let A=i.match(g).filter(_=>typeof _<"u");i={r:Math.round(parseFloat(A[1])/(A[2]?.39215686274509803:1)),g:Math.round(parseFloat(A[3])/(A[4]?.39215686274509803:1)),b:Math.round(parseFloat(A[5])/(A[6]?.39215686274509803:1)),a:A[7]?parseFloat(A[7])/(A[8]?100:1):1}}else{let A=/hsla?\(\s*(?:(\d*\.\d+|\d+)(deg|turn|))\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(A.test(i)){let _=i.match(A).filter(E=>typeof E<"u");i=di({h:parseFloat(_[1])*(_[2]==="turn"?360:1),s:parseFloat(_[3]),l:parseFloat(_[4]),a:_[5]?parseFloat(_[5])/(_[6]?100:1):1})}else f=!1}}if(!f)throw new Error(`Invalid color format: ${i}`);return qr(i,o)}function qr(i,o="hexa"){if(i==="currentColor")return i;if(Number.isInteger(i)){if(o=="raw"||o=="cpal")return i;i=_i(i)}else typeof i!="object"&&(i=ls(i,"bgra"));let u=["hsl","hsla"].includes(o)?wa(i):null;switch(o){case"rgba":return`rgba(${i.r}, ${i.g}, ${i.b}, ${parseFloat(i.a.toFixed(3))})`;case"rgb":return`rgb(${i.r}, ${i.g}, ${i.b})`;case"hex":case"hex6":case"hex-6":return`#${Wn(i.r)}${Wn(i.g)}${Wn(i.b)}`;case"hexa":case"hex8":case"hex-8":return`#${Wn(i.r)}${Wn(i.g)}${Wn(i.b)}${Wn(i.a*255)}`;case"hsl":return`hsl(${u.h.toFixed(2)}, ${u.s.toFixed(2)}%, ${u.l.toFixed(2)}%)`;case"hsla":return`hsla(${u.h.toFixed(2)}, ${u.s.toFixed(2)}%, ${u.l.toFixed(2)}%, ${parseFloat(i.a.toFixed(3))})`;case"bgra":return i;case"raw":case"cpal":return Gn(i);default:throw new Error("Unknown color format: "+o)}}var qn={parse:fn,make:Ts,getPaletteColor:Ps,parseColor:ls,formatColor:qr};function en(i,o){let u=o||new nt;return{configurable:!0,get:function(){return typeof u=="function"&&(u=u()),u},set:function(d){u=d}}}function Ht(i){this.bindConstructorValues(i)}Ht.prototype.bindConstructorValues=function(i){if(this.index=i.index||0,i.name===".notdef"?i.unicode=void 0:i.name===".null"&&(i.unicode=0),i.unicode===0&&i.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=i.name||null,this.unicode=i.unicode,this.unicodes=i.unicodes||(i.unicode!==void 0?[i.unicode]:[]),"xMin"in i&&(this.xMin=i.xMin),"yMin"in i&&(this.yMin=i.yMin),"xMax"in i&&(this.xMax=i.xMax),"yMax"in i&&(this.yMax=i.yMax),"advanceWidth"in i&&(this.advanceWidth=i.advanceWidth),"leftSideBearing"in i&&(this.leftSideBearing=i.leftSideBearing),"points"in i&&(this.points=i.points),Object.defineProperty(this,"path",en(this,i.path))},Ht.prototype.addUnicode=function(i){this.unicodes.length===0&&(this.unicode=i),this.unicodes.push(i)},Ht.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Ht.prototype.getPath=function(i,o,u,d,f){i=i!==void 0?i:0,o=o!==void 0?o:0,u=u!==void 0?u:72,d=Object.assign({},f&&f.defaultRenderOptions,d);let g,A,_=d.xScale,E=d.yScale,M=1/(this.path.unitsPerEm||1e3)*u,R=this;f&&f.variation&&(R=f.variation.getTransform(this,d.variation),g=R.path.commands),d.hinting&&f&&f.hinting&&(A=R.path&&f.hinting.exec(R,u,d)),A?(g=f.hinting.getCommands(A),i=Math.round(i),o=Math.round(o),_=E=1):(g=R.path.commands,_===void 0&&(_=M),E===void 0&&(E=M));let Y=new nt;if(d.drawSVG){let Z=this.getSvgImage(f);if(Z){let me=new nt;return me._image={image:Z.image,x:i+Z.leftSideBearing*M,y:o-Z.baseline*M,width:Z.image.width*M,height:Z.image.height*M},Y._layers=[me],Y}}if(d.drawLayers){let Z=this.getLayers(f);if(Z&&Z.length){Y._layers=[];for(let me=0;me<Z.length;me+=1){let ue=Z[me],Ae=Ps(f,ue.paletteIndex,d.usePalette);Ae==="currentColor"?Ae=d.fill||"black":Ae=qr(Ae,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:Ae}),Y._layers.push(this.getPath.call(ue.glyph,i,o,u,d,f))}return Y}}Y.fill=d.fill||this.path.fill,Y.stroke=this.path.stroke,Y.strokeWidth=this.path.strokeWidth*M;for(let Z=0;Z<g.length;Z+=1){let me=g[Z];me.type==="M"?Y.moveTo(i+me.x*_,o+-me.y*E):me.type==="L"?Y.lineTo(i+me.x*_,o+-me.y*E):me.type==="Q"?Y.quadraticCurveTo(i+me.x1*_,o+-me.y1*E,i+me.x*_,o+-me.y*E):me.type==="C"?Y.curveTo(i+me.x1*_,o+-me.y1*E,i+me.x2*_,o+-me.y2*E,i+me.x*_,o+-me.y*E):me.type==="Z"&&Y.stroke&&Y.strokeWidth&&Y.closePath()}return Y},Ht.prototype.getLayers=function(i){if(!i)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return i.layers.get(this.index)},Ht.prototype.getSvgImage=function(i){if(!i)throw new Error("The font object is required to read the svg table in order to get the image.");return i.svgImages.get(this.index)},Ht.prototype.getContours=function(i=null){if(this.points===void 0&&!i)return[];let o=[],u=[],d=i||this.points;for(let f=0;f<d.length;f+=1){let g=d[f];u.push(g),g.lastPointOfContour&&(o.push(u),u=[])}return xe.argument(u.length===0,"There are still points left in the current contour."),o},Ht.prototype.getMetrics=function(){let i=this.path.commands,o=[],u=[];for(let f=0;f<i.length;f+=1){let g=i[f];g.type!=="Z"&&(o.push(g.x),u.push(g.y)),(g.type==="Q"||g.type==="C")&&(o.push(g.x1),u.push(g.y1)),g.type==="C"&&(o.push(g.x2),u.push(g.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,u),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,u),leftSideBearing:this.leftSideBearing};return isFinite(d.xMin)||(d.xMin=0),isFinite(d.xMax)||(d.xMax=this.advanceWidth),isFinite(d.yMin)||(d.yMin=0),isFinite(d.yMax)||(d.yMax=0),d.rightSideBearing=this.advanceWidth-d.leftSideBearing-(d.xMax-d.xMin),d},Ht.prototype.draw=function(i,o,u,d,f,g){f=Object.assign({},g&&g.defaultRenderOptions,f),this.getPath(o,u,d,f,g).draw(i)},Ht.prototype.drawPoints=function(i,o,u,d,f,g){if(f=Object.assign({},g&&g.defaultRenderOptions,f),f.drawLayers){let Y=this.getLayers(g);if(Y&&Y.length){for(let Z=0;Z<Y.length;Z+=1)Y[Z].glyph.index!==this.index&&this.drawPoints.call(Y[Z].glyph,i,o,u,d);return}}function A(Y,Z,me,ue){i.beginPath();for(let Ae=0;Ae<Y.length;Ae+=1)i.moveTo(Z+Y[Ae].x*ue,me+Y[Ae].y*ue),i.arc(Z+Y[Ae].x*ue,me+Y[Ae].y*ue,2,0,Math.PI*2,!1);i.fill()}o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:24;let _=1/this.path.unitsPerEm*d,E=[],M=[],R=this.path.commands;g&&g.variation&&(R=g.variation.getTransform(this,f.variation).path.commands);for(let Y=0;Y<R.length;Y+=1){let Z=R[Y];Z.x!==void 0&&E.push({x:Z.x,y:-Z.y}),Z.x1!==void 0&&M.push({x:Z.x1,y:-Z.y1}),Z.x2!==void 0&&M.push({x:Z.x2,y:-Z.y2})}i.fillStyle="blue",A(E,o,u,_),i.fillStyle="red",A(M,o,u,_)},Ht.prototype.drawMetrics=function(i,o,u,d){let f;o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:24,f=1/this.path.unitsPerEm*d,i.lineWidth=1,i.strokeStyle="black",Et.line(i,o,-1e4,o,1e4),Et.line(i,-1e4,u,1e4,u);let g=this.xMin||0,A=this.yMin||0,_=this.xMax||0,E=this.yMax||0,M=this.advanceWidth||0;i.strokeStyle="blue",Et.line(i,o+g*f,-1e4,o+g*f,1e4),Et.line(i,o+_*f,-1e4,o+_*f,1e4),Et.line(i,-1e4,u+-A*f,1e4,u+-A*f),Et.line(i,-1e4,u+-E*f,1e4,u+-E*f),i.strokeStyle="green",Et.line(i,o+M*f,-1e4,o+M*f,1e4)},Ht.prototype.toPathData=function(i,o){i=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},i);let u=this;o&&o.variation&&(u=o.variation.getTransform(this,i.variation));let d=u.points&&i.pointsTransform?i.pointsTransform(u.points):u.path;return i.pathTransform&&(d=i.pathTransform(d)),d.toPathData(i)},Ht.prototype.fromSVG=function(i,o={}){return this.path.fromSVG(i,o)},Ht.prototype.toSVG=function(i,o){let u=this.toPathData.apply(this,[i,o]);return this.path.toSVG(i,u)},Ht.prototype.toDOMElement=function(i,o){i=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},i);let u=this.path;return o&&o.variation&&(u=o.variation.getTransform(this,i.variation).path),u.toDOMElement(i)};var Fn=Ht;function jr(i,o,u){Object.defineProperty(i,o,{get:function(){return typeof i[u]>"u"&&i.path,i[u]},set:function(d){i[u]=d},enumerable:!0,configurable:!0})}function mr(i,o){if(this.font=i,this.glyphs={},Array.isArray(o))for(let u=0;u<o.length;u++){let d=o[u];d.path.unitsPerEm=i.unitsPerEm,this.glyphs[u]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(mr.prototype[Symbol.iterator]=function(){let i=-1;return{next:(function(){i++;let o=i>=this.length-1;return{value:this.get(i),done:o}}).bind(this)}}),mr.prototype.get=function(i){if(this.font._push&&this.glyphs[i]===void 0){this.font._push(i),typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]());let o=this.glyphs[i],u=this.font._IndexToUnicodeMap[i];if(u)for(let d=0;d<u.unicodes.length;d++)o.addUnicode(u.unicodes[d]);this.font.cffEncoding?o.name=this.font.cffEncoding.charset[i]:this.font.glyphNames.names&&(o.name=this.font.glyphNames.glyphIndexToName(i)),this.glyphs[i].advanceWidth=this.font._hmtxTableData[i].advanceWidth,this.glyphs[i].leftSideBearing=this.font._hmtxTableData[i].leftSideBearing}else typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]());return this.glyphs[i]},mr.prototype.push=function(i,o){this.glyphs[i]=o,this.length++};function Dr(i,o){return new Fn({index:o,font:i})}function wn(i,o,u,d,f,g){return function(){let A=new Fn({index:o,font:i});return A.path=function(){u(A,d,f);let _=g(i.glyphs,A);return _.unitsPerEm=i.unitsPerEm,_},jr(A,"numberOfContours","_numberOfContours"),jr(A,"xMin","_xMin"),jr(A,"xMax","_xMax"),jr(A,"yMin","_yMin"),jr(A,"yMax","_yMax"),jr(A,"points","_points"),A}}function Ln(i,o,u,d,f){return function(){let g=new Fn({index:o,font:i});return g.path=function(){let A=u(i,g,d,f);return A.unitsPerEm=i.unitsPerEm,A},g}}var Vn={GlyphSet:mr,glyphLoader:Dr,ttfGlyphLoader:wn,cffGlyphLoader:Ln};function Zn(i,o){if(i===o)return!0;if(Array.isArray(i)&&Array.isArray(o)){if(i.length!==o.length)return!1;for(let u=0;u<i.length;u+=1)if(!Zn(i[u],o[u]))return!1;return!0}else return!1}var cs=10;function ts(i){let o;return i.length<1240?o=107:i.length<33900?o=1131:o=32768,o}function Cn(i,o,u,d){let f=[],g=[],A=d>1?ct.getULong(i,o):ct.getCard16(i,o),_=d>1?4:2,E,M;if(A!==0){let R=ct.getByte(i,o+_);E=o+(A+1)*R+_;let Y=o+_+1;for(let Z=0;Z<A+1;Z+=1)f.push(ct.getOffset(i,Y,R)),Y+=R;M=E+f[A]}else M=o+_;for(let R=0;R<f.length-1;R+=1){let Y=ct.getBytes(i,E+f[R],E+f[R+1]);u&&(Y=u(Y,i,o,d)),g.push(Y)}return{objects:g,startOffset:o,endOffset:M}}function ki(i,o,u){let d=[],f=u>1?ct.getULong(i,o):ct.getCard16(i,o),g=u>1?4:2,A,_;if(f!==0){let E=ct.getByte(i,o+g);A=o+(f+1)*E+g;let M=o+g+1;for(let R=0;R<f+1;R+=1)d.push(ct.getOffset(i,M,E)),M+=E;_=A+d[f]}else _=o+g;return{offsets:d,startOffset:o,endOffset:_}}function Cs(i,o,u,d,f,g){let A=g>1?ct.getULong(u,d):ct.getCard16(u,d),_=g>1?4:2,E=0;if(A!==0){let R=ct.getByte(u,d+_);E=d+(A+1)*R+_}let M=ct.getBytes(u,E+o[i],E+o[i+1]);return f&&(M=f(M)),M}function _n(i){let o="",u=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=i.parseByte(),f=d>>4,g=d&15;if(f===15||(o+=u[f],g===15))break;o+=u[g]}return parseFloat(o)}function Nn(i,o){let u,d,f,g;if(o===28)return u=i.parseByte(),d=i.parseByte(),u<<8|d;if(o===29)return u=i.parseByte(),d=i.parseByte(),f=i.parseByte(),g=i.parseByte(),u<<24|d<<16|f<<8|g;if(o===30)return _n(i);if(o>=32&&o<=246)return o-139;if(o>=247&&o<=250)return u=i.parseByte(),(o-247)*256+u+108;if(o>=251&&o<=254)return u=i.parseByte(),-(o-251)*256-u-108;throw new Error("Invalid b0 "+o)}function Kr(i){let o={};for(let u=0;u<i.length;u+=1){let d=i[u][0],f=i[u][1],g;if(f.length===1?g=f[0]:g=f,Object.prototype.hasOwnProperty.call(o,d)&&!isNaN(o[d]))throw new Error("Object "+o+" already has key "+d);o[d]=g}return o}function Ss(i,o,u,d){o=o!==void 0?o:0;let f=new ct.Parser(i,o),g=[],A=[];u=u!==void 0?u:i.byteLength;let _=d<2?22:28;for(;f.relativeOffset<u;){let E=f.parseByte();if(E<_){if(E===12&&(E=1200+f.parseByte()),d>1&&E===23){le(A);continue}g.push([E,A]),A=[]}else A.push(Nn(f,E,d))}return Kr(g)}function pn(i,o){return o<=390?o=On[o]:i?o=i[o-391]:o=void 0,o}function $(i,o,u){let d={},f;for(let g=0;g<o.length;g+=1){let A=o[g];if(Array.isArray(A.type)){let _=[];_.length=A.type.length;for(let E=0;E<A.type.length;E++)f=i[A.op]!==void 0?i[A.op][E]:void 0,f===void 0&&(f=A.value!==void 0&&A.value[E]!==void 0?A.value[E]:null),A.type[E]==="SID"&&(f=pn(u,f)),_[E]=f;d[A.name]=_}else f=i[A.op],f===void 0&&(f=A.value!==void 0?A.value:null),A.type==="SID"&&(f=pn(u,f)),d[A.name]=f}return d}function _e(i,o){let u={};if(u.formatMajor=ct.getCard8(i,o),u.formatMinor=ct.getCard8(i,o+1),u.formatMajor>2)throw new Error(`Unsupported CFF table version ${u.formatMajor}.${u.formatMinor}`);return u.size=ct.getCard8(i,o+2),u.formatMajor<2?(u.offsetSize=ct.getCard8(i,o+3),u.startOffset=o,u.endOffset=o+4):(u.topDictLength=ct.getCard16(i,o+3),u.endOffset=o+8),u}var Pe=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],We=[{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"charStrings",op:17,type:"offset"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"vstore",op:24,type:"offset"}],qe=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],ft=[{name:"blueValues",op:6,type:"delta"},{name:"otherBlues",op:7,type:"delta"},{name:"familyBlues",op:7,type:"delta"},{name:"familyBlues",op:8,type:"delta"},{name:"familyOtherBlues",op:9,type:"delta"},{name:"blueScale",op:1209,type:"number",value:.039625},{name:"blueShift",op:1210,type:"number",value:7},{name:"blueFuzz",op:1211,type:"number",value:1},{name:"stdHW",op:10,type:"number"},{name:"stdVW",op:11,type:"number"},{name:"stemSnapH",op:1212,type:"number"},{name:"stemSnapV",op:1213,type:"number"},{name:"languageGroup",op:1217,type:"number",value:0},{name:"expansionFactor",op:1218,type:"number",value:.06},{name:"vsindex",op:22,type:"number",value:0},{name:"subrs",op:19,type:"offset"}],Ct=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function Qt(i,o,u,d){let f=Ss(i,o,i.byteLength,d);return $(f,d>1?We:Pe,u)}function st(i,o,u,d,f){let g=Ss(i,o,u,f);return $(g,f>1?ft:qe,d)}function vt(i,o,u){let d=Ss(i,o,void 0,u);return $(d,Ct)}function sr(i,o,u){let d=[];for(let f=0;f<u.length;f++){let g=new DataView(new Uint8Array(u[f]).buffer),A=vt(g,0,2),_=A.private[0],E=A.private[1];if(_!==0&&E!==0){let M=st(i,E+o,_,[],2);if(M.subrs){let R=E+M.subrs,Y=Cn(i,R+o,void 0,2);A._subrs=Y.objects,A._subrsBias=ts(A._subrs)}A._privateDict=M}d.push(A)}return d}function yt(i,o,u,d,f){let g=[];for(let A=0;A<u.length;A+=1){let _=new DataView(new Uint8Array(u[A]).buffer),E=Qt(_,0,d,f);E._subrs=[],E._subrsBias=0,E._defaultWidthX=0,E._nominalWidthX=0;let M=f<2?E.private[0]:0,R=f<2?E.private[1]:0;if(M!==0&&R!==0){let Y=st(i,R+o,M,d,f);if(E._defaultWidthX=Y.defaultWidthX,E._nominalWidthX=Y.nominalWidthX,Y.subrs!==0){let Z=R+Y.subrs,me=Cn(i,Z+o,void 0,f);E._subrs=me.objects,E._subrsBias=ts(E._subrs)}E._privateDict=Y}g.push(E)}return g}function P(i,o,u,d,f){let g,A,_=new ct.Parser(i,o);u-=1;let E=[".notdef"],M=_.parseCard8();if(M===0)for(let R=0;R<u;R+=1)g=_.parseSID(),f?E.push(g):E.push(pn(d,g)||g);else if(M===1)for(;E.length<=u;){g=_.parseSID(),A=_.parseCard8();for(let R=0;R<=A;R+=1)f?E.push("cid"+("00000"+g).slice(-5)):E.push(pn(d,g)||g),g+=1}else if(M===2)for(;E.length<=u;){g=_.parseSID(),A=_.parseCard16();for(let R=0;R<=A;R+=1)f?E.push("cid"+("00000"+g).slice(-5)):E.push(pn(d,g)||g),g+=1}else throw new Error("Unknown charset format "+M);return E}function G(i,o){let u,d={},f=new ct.Parser(i,o),g=f.parseCard8();if(g===0){let A=f.parseCard8();for(let _=0;_<A;_+=1)u=f.parseCard8(),d[u]=_}else if(g===1){let A=f.parseCard8();u=1;for(let _=0;_<A;_+=1){let E=f.parseCard8(),M=f.parseCard8();for(let R=E;R<=E+M;R+=1)d[R]=u,u+=1}}else throw new Error("Unknown encoding format "+g);return d}function le(i){let o=i.pop();for(;i.length>o;)i.pop()}function ge(i,o){let u=i.tables.cff&&i.tables.cff.topDict&&i.tables.cff.topDict.paintType||0;return u===2&&(o.fill=null,o.stroke="black",o.strokeWidth=i.tables.cff.topDict.strokeWidth||0),u}function $e(i,o,u,d,f){let g,A,_,E,M=new nt,R=[],Y=0,Z=!1,me=!1,ue=0,Ae=0,Ze,ur,nr,kr,zr=0,Qn=[],Xn,Jn=0,Zs=i.tables.cff2||i.tables.cff;if(nr=Zs.topDict._defaultWidthX,kr=Zs.topDict._nominalWidthX,f=f||i.variation&&i.variation.get(),o.getBlendPath||(o.getBlendPath=function(Kt){return $e(i,o,u,d,Kt)}),i.isCIDFont||d>1){let Kt=Zs.topDict._fdSelect?Zs.topDict._fdSelect[o.index]:0,tr=Zs.topDict._fdArray[Kt];Ze=tr._subrs,ur=tr._subrsBias,d>1?(Qn=Zs.topDict._vstore.itemVariationStore,zr=tr._privateDict.vsindex):(nr=tr._defaultWidthX,kr=tr._nominalWidthX)}else Ze=Zs.topDict._subrs,ur=Zs.topDict._subrsBias;let Po=ge(i,M),Hr=nr;function Va(Kt,tr){me&&Po!==2&&M.closePath(),M.moveTo(Kt,tr),me=!0}function ca(){let Kt;Kt=(R.length&1)!==0,Kt&&!Z&&(Hr=R.shift()+kr),Y+=R.length>>1,R.length=0,Z=!0}function dr(Kt){let tr,Vi,sc,Ud,Ec,Oo,ua,co,Zi,Za,da,ha,Us=0;for(;Us<Kt.length;){let ho=Kt[Us];switch(Us+=1,ho){case 1:ca();break;case 3:ca();break;case 4:R.length>1&&!Z&&(Hr=R.shift()+kr,Z=!0),Ae+=R.pop(),Va(ue,Ae);break;case 5:for(;R.length>0;)ue+=R.shift(),Ae+=R.shift(),M.lineTo(ue,Ae);break;case 6:for(;R.length>0&&(ue+=R.shift(),M.lineTo(ue,Ae),R.length!==0);)Ae+=R.shift(),M.lineTo(ue,Ae);break;case 7:for(;R.length>0&&(Ae+=R.shift(),M.lineTo(ue,Ae),R.length!==0);)ue+=R.shift(),M.lineTo(ue,Ae);break;case 8:for(;R.length>0;)g=ue+R.shift(),A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ue=_+R.shift(),Ae=E+R.shift(),M.curveTo(g,A,_,E,ue,Ae);break;case 10:if(Ec=R.pop()+ur,Oo=Ze[Ec],Oo){if(Jn>=cs){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Jn++,dr(Oo),Jn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(ho=Kt[Us],Us+=1,ho){case 35:g=ue+R.shift(),A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ua=_+R.shift(),co=E+R.shift(),Zi=ua+R.shift(),Za=co+R.shift(),da=Zi+R.shift(),ha=Za+R.shift(),ue=da+R.shift(),Ae=ha+R.shift(),R.shift(),M.curveTo(g,A,_,E,ua,co),M.curveTo(Zi,Za,da,ha,ue,Ae);break;case 34:g=ue+R.shift(),A=Ae,_=g+R.shift(),E=A+R.shift(),ua=_+R.shift(),co=E,Zi=ua+R.shift(),Za=E,da=Zi+R.shift(),ha=Ae,ue=da+R.shift(),M.curveTo(g,A,_,E,ua,co),M.curveTo(Zi,Za,da,ha,ue,Ae);break;case 36:g=ue+R.shift(),A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ua=_+R.shift(),co=E,Zi=ua+R.shift(),Za=E,da=Zi+R.shift(),ha=Za+R.shift(),ue=da+R.shift(),M.curveTo(g,A,_,E,ua,co),M.curveTo(Zi,Za,da,ha,ue,Ae);break;case 37:g=ue+R.shift(),A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ua=_+R.shift(),co=E+R.shift(),Zi=ua+R.shift(),Za=co+R.shift(),da=Zi+R.shift(),ha=Za+R.shift(),Math.abs(da-ue)>Math.abs(ha-Ae)?ue=da+R.shift():Ae=ha+R.shift(),M.curveTo(g,A,_,E,ua,co),M.curveTo(Zi,Za,da,ha,ue,Ae);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+ho),R.length=0}break;case 14:if(d>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(R.length>=4){let Nc=Ur[R.pop()],f0=Ur[R.pop()],zd=R.pop(),Hd=R.pop();if(Nc&&f0){o.isComposite=!0,o.components=[];let xg=i.cffEncoding.charset.indexOf(Nc),bg=i.cffEncoding.charset.indexOf(f0);o.components.push({glyphIndex:bg,dx:0,dy:0}),o.components.push({glyphIndex:xg,dx:Hd,dy:zd}),M.extend(i.glyphs.get(bg).path);let B4=i.glyphs.get(xg),rp=JSON.parse(JSON.stringify(B4.path.commands));for(let np=0;np<rp.length;np+=1){let Jo=rp[np];Jo.type!=="Z"&&(Jo.x+=Hd,Jo.y+=zd),(Jo.type==="Q"||Jo.type==="C")&&(Jo.x1+=Hd,Jo.y1+=zd),Jo.type==="C"&&(Jo.x2+=Hd,Jo.y2+=zd)}M.extend(rp)}}else R.length>0&&!Z&&(Hr=R.shift()+kr,Z=!0);me&&Po!==2&&(M.closePath(),me=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}zr=R.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}Xn||(Xn=i.variation&&f&&i.variation.process.getBlendVector(Qn,zr,f));var is=R.pop(),Ia=Xn?Xn.length:Qn.itemVariationSubtables[zr].regionIndexes.length,uo=is*Ia,Fo=R.length-uo,Tl=Fo-is;if(Xn)for(let Nc=0;Nc<is;Nc++){var gg=R[Tl+Nc];for(let f0=0;f0<Ia;f0++)gg+=Xn[f0]*R[Fo++];R[Tl+Nc]=gg}for(;uo--;)R.pop();break;case 18:ca();break;case 19:case 20:ca(),Us+=Y+7>>3;break;case 21:R.length>2&&!Z&&(Hr=R.shift()+kr,Z=!0),Ae+=R.pop(),ue+=R.pop(),Va(ue,Ae);break;case 22:R.length>1&&!Z&&(Hr=R.shift()+kr,Z=!0),ue+=R.pop(),Va(ue,Ae);break;case 23:ca();break;case 24:for(;R.length>2;)g=ue+R.shift(),A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ue=_+R.shift(),Ae=E+R.shift(),M.curveTo(g,A,_,E,ue,Ae);ue+=R.shift(),Ae+=R.shift(),M.lineTo(ue,Ae);break;case 25:for(;R.length>6;)ue+=R.shift(),Ae+=R.shift(),M.lineTo(ue,Ae);g=ue+R.shift(),A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ue=_+R.shift(),Ae=E+R.shift(),M.curveTo(g,A,_,E,ue,Ae);break;case 26:for(R.length&1&&(ue+=R.shift());R.length>0;)g=ue,A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ue=_,Ae=E+R.shift(),M.curveTo(g,A,_,E,ue,Ae);break;case 27:for(R.length&1&&(Ae+=R.shift());R.length>0;)g=ue+R.shift(),A=Ae,_=g+R.shift(),E=A+R.shift(),ue=_+R.shift(),Ae=E,M.curveTo(g,A,_,E,ue,Ae);break;case 28:tr=Kt[Us],Vi=Kt[Us+1],R.push((tr<<24|Vi<<16)>>16),Us+=2;break;case 29:if(Ec=R.pop()+i.gsubrsBias,Oo=i.gsubrs[Ec],Oo){if(Jn>=cs){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Jn++,dr(Oo),Jn--}break;case 30:for(;R.length>0&&(g=ue,A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ue=_+R.shift(),Ae=E+(R.length===1?R.shift():0),M.curveTo(g,A,_,E,ue,Ae),R.length!==0);)g=ue+R.shift(),A=Ae,_=g+R.shift(),E=A+R.shift(),Ae=E+R.shift(),ue=_+(R.length===1?R.shift():0),M.curveTo(g,A,_,E,ue,Ae);break;case 31:for(;R.length>0&&(g=ue+R.shift(),A=Ae,_=g+R.shift(),E=A+R.shift(),Ae=E+R.shift(),ue=_+(R.length===1?R.shift():0),M.curveTo(g,A,_,E,ue,Ae),R.length!==0);)g=ue,A=Ae+R.shift(),_=g+R.shift(),E=A+R.shift(),ue=_+R.shift(),Ae=E+(R.length===1?R.shift():0),M.curveTo(g,A,_,E,ue,Ae);break;default:ho<32?console.log("Glyph "+o.index+": unknown operator "+ho):ho<247?R.push(ho-139):ho<251?(tr=Kt[Us],Us+=1,R.push((ho-247)*256+tr+108)):ho<255?(tr=Kt[Us],Us+=1,R.push(-(ho-251)*256-tr-108)):(tr=Kt[Us],Vi=Kt[Us+1],sc=Kt[Us+2],Ud=Kt[Us+3],Us+=4,R.push((tr<<24|Vi<<16|sc<<8|Ud)/65536))}}}return dr(u),i.variation&&f&&(M.commands=M.commands.map(Kt=>{let tr=Object.keys(Kt);for(let Vi=0;Vi<tr.length;Vi++){let sc=tr[Vi];sc!=="type"&&(Kt[sc]=Math.round(Kt[sc]))}return Kt})),Z&&(o.advanceWidth=Hr),M}function ot(i,o,u,d,f){let g=[],A,_=new ct.Parser(i,o),E=_.parseCard8();if(E===0)for(let M=0;M<u;M++){if(A=_.parseCard8(),A>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+A+" (FD count "+d+")");g.push(A)}else if(E===3||f>1&&E===4){let M=E===4?_.parseULong():_.parseCard16(),R=E===4?_.parseULong():_.parseCard16();if(R!==0)throw new Error(`CFF Table CID Font FDSelect format ${E} range has bad initial GID ${R}`);let Y;for(let Z=0;Z<M;Z++){if(A=E===4?_.parseUShort():_.parseCard8(),Y=E===4?_.parseULong():_.parseCard16(),A>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+A+" (FD count "+d+")");if(Y>u)throw new Error(`CFF Table CID Font FDSelect format ${f} range has bad GID ${Y}`);for(;R<Y;R++)g.push(A);R=Y}if(Y!==u)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+Y)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+E);return g}function xt(i,o,u,d){let f,g=_e(i,o);g.formatMajor===2?f=u.tables.cff2={}:f=u.tables.cff={};let A=g.formatMajor>1?null:Cn(i,g.endOffset,ct.bytesToString),_=g.formatMajor>1?null:Cn(i,A.endOffset),E=g.formatMajor>1?null:Cn(i,_.endOffset,ct.bytesToString),M=Cn(i,g.formatMajor>1?o+g.size+g.topDictLength:E.endOffset,void 0,g.formatMajor);u.gsubrs=M.objects,u.gsubrsBias=ts(u.gsubrs);let R;if(g.formatMajor>1){let Z=o+g.size,me=ct.getBytes(i,Z,Z+g.topDictLength);R=yt(i,0,[me],void 0,g.formatMajor)[0]}else{let Z=yt(i,o,_.objects,E.objects,g.formatMajor);if(Z.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+Z.length);R=Z[0]}if(f.topDict=R,R._privateDict&&(u.defaultWidthX=R._privateDict.defaultWidthX,u.nominalWidthX=R._privateDict.nominalWidthX),g.formatMajor<2&&R.ros[0]!==void 0&&R.ros[1]!==void 0&&(u.isCIDFont=!0),g.formatMajor>1){let Z=R.fdArray,me=R.fdSelect;if(!Z)throw new Error("This is a CFF2 font, but FDArray information is missing");let ue=Cn(i,o+Z,null,g.formatMajor),Ae=sr(i,o,ue.objects);R._fdArray=Ae,me&&(R._fdSelect=ot(i,o+me,u.numGlyphs,Ae.length,g.formatMajor))}else if(u.isCIDFont){let Z=R.fdArray,me=R.fdSelect;if(Z===0||me===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");Z+=o;let ue=Cn(i,Z),Ae=yt(i,o,ue.objects,E.objects,g.formatMajor);R._fdArray=Ae,me+=o,R._fdSelect=ot(i,me,u.numGlyphs,Ae.length,g.formatMajor)}if(g.formatMajor<2){let Z=o+R.private[1],me=st(i,Z,R.private[0],E.objects,g.formatMajor);if(u.defaultWidthX=me.defaultWidthX,u.nominalWidthX=me.nominalWidthX,me.subrs!==0){let ue=Z+me.subrs,Ae=Cn(i,ue);u.subrs=Ae.objects,u.subrsBias=ts(u.subrs)}else u.subrs=[],u.subrsBias=0}let Y;if(d.lowMemory?(Y=ki(i,o+R.charStrings,g.formatMajor),u.nGlyphs=Y.offsets.length-(g.formatMajor>1?1:0)):(Y=Cn(i,o+R.charStrings,null,g.formatMajor),u.nGlyphs=Y.objects.length),g.formatMajor>1&&u.tables.maxp&&u.nGlyphs!==u.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${u.nGlyphs}) must correspond to the glyph count in the maxp table (${u.tables.maxp.numGlyphs})`),g.formatMajor<2){let Z=[],me=[];R.charset===0?Z=En:R.charset===1?Z=Bs:R.charset===2?Z=bs:Z=P(i,o+R.charset,u.nGlyphs,E.objects,u.isCIDFont),R.encoding===0?me=Ur:R.encoding===1?me=Pr:me=G(i,o+R.encoding),u.cffEncoding=new q(me,Z),u.encoding=u.encoding||u.cffEncoding}if(u.glyphs=new Vn.GlyphSet(u),d.lowMemory)u._push=function(Z){let me=Cs(Z,Y.offsets,i,o+R.charStrings,void 0,g.formatMajor);u.glyphs.push(Z,Vn.cffGlyphLoader(u,Z,$e,me,g.formatMajor))};else for(let Z=0;Z<u.nGlyphs;Z+=1){let me=Y.objects[Z];u.glyphs.push(Z,Vn.cffGlyphLoader(u,Z,$e,me,g.formatMajor))}if(R.vstore){let Z=new ct.Parser(i,o+R.vstore);R._vstore=Z.parseVariationStore()}}function Tt(i,o){let u,d=On.indexOf(i);return d>=0&&(u=d),d=o.indexOf(i),d>=0?u=d+On.length:(u=On.length+o.length,o.push(i)),u}function Rr(){return new Ce.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function mn(i){let o=new Ce.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let u=0;u<i.length;u+=1)o.names.push({name:"name_"+u,type:"NAME",value:i[u]});return o}function St(i,o,u){let d={};for(let f=0;f<i.length;f+=1){let g=i[f],A=o[g.name];A!==void 0&&!Zn(A,g.value)&&(g.type==="SID"&&(A=Tt(A,u)),d[g.op]={name:g.name,type:g.type,value:A})}return d}function tn(i,o,u){let d=new Ce.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=St(u>1?We:Pe,i,o),d}function rn(i){let o=new Ce.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:i}],o}function Os(i){let o=new Ce.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let u=0;u<i.length;u+=1)o.strings.push({name:"string_"+u,type:"STRING",value:i[u]});return o}function kn(){return new Ce.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function on(i,o){let u=new Ce.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<i.length;d+=1){let f=i[d],g=Tt(f,o);u.fields.push({name:"glyph_"+d,type:"SID",value:g})}return u}function gr(i,o){let u=[],d=i.path;o<2&&u.push({name:"width",type:"NUMBER",value:i.advanceWidth});let f=0,g=0;for(let A=0;A<d.commands.length;A+=1){let _,E,M=d.commands[A];if(M.type==="Q"){let R=.3333333333333333,Y=2/3;M={type:"C",x:M.x,y:M.y,x1:Math.round(R*f+Y*M.x1),y1:Math.round(R*g+Y*M.y1),x2:Math.round(R*M.x+Y*M.x1),y2:Math.round(R*M.y+Y*M.y1)}}if(M.type==="M")_=Math.round(M.x-f),E=Math.round(M.y-g),u.push({name:"dx",type:"NUMBER",value:_}),u.push({name:"dy",type:"NUMBER",value:E}),u.push({name:"rmoveto",type:"OP",value:21}),f=Math.round(M.x),g=Math.round(M.y);else if(M.type==="L")_=Math.round(M.x-f),E=Math.round(M.y-g),u.push({name:"dx",type:"NUMBER",value:_}),u.push({name:"dy",type:"NUMBER",value:E}),u.push({name:"rlineto",type:"OP",value:5}),f=Math.round(M.x),g=Math.round(M.y);else if(M.type==="C"){let R=Math.round(M.x1-f),Y=Math.round(M.y1-g),Z=Math.round(M.x2-M.x1),me=Math.round(M.y2-M.y1);_=Math.round(M.x-M.x2),E=Math.round(M.y-M.y2),u.push({name:"dx1",type:"NUMBER",value:R}),u.push({name:"dy1",type:"NUMBER",value:Y}),u.push({name:"dx2",type:"NUMBER",value:Z}),u.push({name:"dy2",type:"NUMBER",value:me}),u.push({name:"dx",type:"NUMBER",value:_}),u.push({name:"dy",type:"NUMBER",value:E}),u.push({name:"rrcurveto",type:"OP",value:8}),f=Math.round(M.x),g=Math.round(M.y)}}return o<2&&u.push({name:"endchar",type:"OP",value:14}),u}function Vt(i,o){let u=new Ce.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<i.length;d+=1){let f=i.get(d),g=gr(f,o);u.charStrings.push({name:f.name,type:"CHARSTRING",value:g})}return u}function Yn(i,o,u){let d=new Ce.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=St(u>1?ft:qe,i,o),d}function vs(i,o){let u=new Ce.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),d=1/o.unitsPerEm,f={version:o.version,fullName:o.fullName,familyName:o.familyName,weight:o.weightName,fontBBox:o.fontBBox||[0,0,0,0],fontMatrix:[d,0,0,d,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},g=o&&o.topDict||{};g.paintType&&(f.paintType=g.paintType,f.strokeWidth=g.strokeWidth||0);let A={},_=[],E;for(let Z=1;Z<i.length;Z+=1)E=i.get(Z),_.push(E.name);let M=[];u.header=Rr(),u.nameIndex=mn([o.postScriptName]);let R=tn(f,M);u.topDictIndex=rn(R),u.globalSubrIndex=kn(),u.charsets=on(_,M),u.charStringsIndex=Vt(i,1),u.privateDict=Yn(A,M),u.stringIndex=Os(M);let Y=u.header.sizeOf()+u.nameIndex.sizeOf()+u.topDictIndex.sizeOf()+u.stringIndex.sizeOf()+u.globalSubrIndex.sizeOf();return f.charset=Y,f.encoding=0,f.charStrings=f.charset+u.charsets.sizeOf(),f.private[1]=f.charStrings+u.charStringsIndex.sizeOf(),R=tn(f,M),u.topDictIndex=rn(R),u}var Ii={parse:xt,make:vs};function hi(i,o){let u={},d=new ct.Parser(i,o);return u.version=d.parseVersion(),u.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,u.checkSumAdjustment=d.parseULong(),u.magicNumber=d.parseULong(),xe.argument(u.magicNumber===1594834165,"Font header has wrong magic number."),u.flags=d.parseUShort(),u.unitsPerEm=d.parseUShort(),u.created=d.parseLongDateTime(),u.modified=d.parseLongDateTime(),u.xMin=d.parseShort(),u.yMin=d.parseShort(),u.xMax=d.parseShort(),u.yMax=d.parseShort(),u.macStyle=d.parseUShort(),u.lowestRecPPEM=d.parseUShort(),u.fontDirectionHint=d.parseShort(),u.indexToLocFormat=d.parseShort(),u.glyphDataFormat=d.parseShort(),u}function qo(i){let o=Math.round(new Date().getTime()/1e3)+2082844800,u=o,d=i.macStyle||0;return i.createdTimestamp&&(u=i.createdTimestamp+2082844800),new Ce.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:u},{name:"modified",type:"LONGDATETIME",value:o},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:d},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],i)}var ei={parse:hi,make:qo};function Pa(i,o){let u={},d=new ct.Parser(i,o);return u.version=d.parseVersion(),u.ascender=d.parseShort(),u.descender=d.parseShort(),u.lineGap=d.parseShort(),u.advanceWidthMax=d.parseUShort(),u.minLeftSideBearing=d.parseShort(),u.minRightSideBearing=d.parseShort(),u.xMaxExtent=d.parseShort(),u.caretSlopeRise=d.parseShort(),u.caretSlopeRun=d.parseShort(),u.caretOffset=d.parseShort(),d.relativeOffset+=8,u.metricDataFormat=d.parseShort(),u.numberOfHMetrics=d.parseUShort(),u}function Rn(i){return new Ce.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],i)}var Ei={parse:Pa,make:Rn};function ea(i,o,u,d,f){let g,A,_=new ct.Parser(i,o);for(let E=0;E<d;E+=1){E<u&&(g=_.parseUShort(),A=_.parseShort());let M=f.get(E);M.advanceWidth=g,M.leftSideBearing=A}}function _o(i,o,u,d,f){i._hmtxTableData={};let g,A,_=new ct.Parser(o,u);for(let E=0;E<f;E+=1)E<d&&(g=_.parseUShort(),A=_.parseShort()),i._hmtxTableData[E]={advanceWidth:g,leftSideBearing:A}}function rs(i,o,u,d,f,g,A){A.lowMemory?_o(i,o,u,d,f):ea(o,u,d,f,g)}function ns(i){let o=new Ce.Table("hmtx",[]);for(let u=0;u<i.length;u+=1){let d=i.get(u),f=d.advanceWidth||0,g=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+u,type:"USHORT",value:f}),o.fields.push({name:"leftSideBearing_"+u,type:"SHORT",value:g})}return o}var Ws={parse:rs,make:ns};function Gs(i){let o=new Ce.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:i.length}]),u="",d=12+i.length*4;for(let f=0;f<i.length;++f){let g=u.indexOf(i[f]);g<0&&(g=u.length,u+=i[f]),o.fields.push({name:"offset "+f,type:"USHORT",value:d+g}),o.fields.push({name:"length "+f,type:"USHORT",value:i[f].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:u}),o}function ys(i,o){let u=new ct.Parser(i,o),d=u.parseULong();xe.argument(d===1,"Unsupported ltag table version."),u.skip("uLong",1);let f=u.parseULong(),g=[];for(let A=0;A<f;A++){let _="",E=o+u.parseUShort(),M=u.parseUShort();for(let R=E;R<E+M;++R)_+=String.fromCharCode(i.getInt8(R));g.push(_)}return g}var Ls={make:Gs,parse:ys};function fs(i,o){let u={},d=new ct.Parser(i,o);return u.version=d.parseVersion(),u.numGlyphs=d.parseUShort(),u.version===1&&(u.maxPoints=d.parseUShort(),u.maxContours=d.parseUShort(),u.maxCompositePoints=d.parseUShort(),u.maxCompositeContours=d.parseUShort(),u.maxZones=d.parseUShort(),u.maxTwilightPoints=d.parseUShort(),u.maxStorage=d.parseUShort(),u.maxFunctionDefs=d.parseUShort(),u.maxInstructionDefs=d.parseUShort(),u.maxStackElements=d.parseUShort(),u.maxSizeOfInstructions=d.parseUShort(),u.maxComponentElements=d.parseUShort(),u.maxComponentDepth=d.parseUShort()),u}function nn(i){return new Ce.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:i}])}var qs={parse:fs,make:nn},Ni=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function Ri(i){for(let o=0;o<Ni.length;o+=1){let u=Ni[o];if(i>=u.begin&&i<u.end)return o}return-1}function Mi(i,o){let u={},d=new ct.Parser(i,o);u.version=d.parseUShort(),u.xAvgCharWidth=d.parseShort(),u.usWeightClass=d.parseUShort(),u.usWidthClass=d.parseUShort(),u.fsType=d.parseUShort(),u.ySubscriptXSize=d.parseShort(),u.ySubscriptYSize=d.parseShort(),u.ySubscriptXOffset=d.parseShort(),u.ySubscriptYOffset=d.parseShort(),u.ySuperscriptXSize=d.parseShort(),u.ySuperscriptYSize=d.parseShort(),u.ySuperscriptXOffset=d.parseShort(),u.ySuperscriptYOffset=d.parseShort(),u.yStrikeoutSize=d.parseShort(),u.yStrikeoutPosition=d.parseShort(),u.sFamilyClass=d.parseShort(),u.panose=[];for(let f=0;f<10;f++)u.panose[f]=d.parseByte();return u.ulUnicodeRange1=d.parseULong(),u.ulUnicodeRange2=d.parseULong(),u.ulUnicodeRange3=d.parseULong(),u.ulUnicodeRange4=d.parseULong(),u.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),u.fsSelection=d.parseUShort(),u.usFirstCharIndex=d.parseUShort(),u.usLastCharIndex=d.parseUShort(),u.sTypoAscender=d.parseShort(),u.sTypoDescender=d.parseShort(),u.sTypoLineGap=d.parseShort(),u.usWinAscent=d.parseUShort(),u.usWinDescent=d.parseUShort(),u.version>=1&&(u.ulCodePageRange1=d.parseULong(),u.ulCodePageRange2=d.parseULong()),u.version>=2&&(u.sxHeight=d.parseShort(),u.sCapHeight=d.parseShort(),u.usDefaultChar=d.parseUShort(),u.usBreakChar=d.parseUShort(),u.usMaxContent=d.parseUShort()),u}function ro(i){return new Ce.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],i)}var gl={parse:Mi,make:ro,unicodeRanges:Ni,getUnicodeRange:Ri};function ko(i,o){let u={},d=new ct.Parser(i,o);switch(u.version=d.parseVersion(),u.italicAngle=d.parseFixed(),u.underlinePosition=d.parseShort(),u.underlineThickness=d.parseShort(),u.isFixedPitch=d.parseULong(),u.minMemType42=d.parseULong(),u.maxMemType42=d.parseULong(),u.minMemType1=d.parseULong(),u.maxMemType1=d.parseULong(),u.version){case 1:u.names=kt.slice();break;case 2:u.numberOfGlyphs=d.parseUShort(),u.glyphNameIndex=new Array(u.numberOfGlyphs);for(let f=0;f<u.numberOfGlyphs;f++)u.glyphNameIndex[f]=d.parseUShort();u.names=[];for(let f=0;f<u.numberOfGlyphs;f++)if(u.glyphNameIndex[f]>=kt.length){let g=d.parseChar();u.names.push(d.parseString(g))}break;case 2.5:u.numberOfGlyphs=d.parseUShort(),u.offset=new Array(u.numberOfGlyphs);for(let f=0;f<u.numberOfGlyphs;f++)u.offset[f]=d.parseChar();break}return u}function Tc(i){let{italicAngle:o=Math.round((i.italicAngle||0)*65536),underlinePosition:u=0,underlineThickness:d=0,isFixedPitch:f=0,minMemType42:g=0,maxMemType42:A=0,minMemType1:_=0,maxMemType1:E=0}=i.tables.post||{};return new Ce.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:u},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:f},{name:"minMemType42",type:"ULONG",value:g},{name:"maxMemType42",type:"ULONG",value:A},{name:"minMemType1",type:"ULONG",value:_},{name:"maxMemType1",type:"ULONG",value:E}])}var Vo={parse:ko,make:Tc},Mn=new Array(9);Mn[1]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(fe.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(fe.coverage),substitute:this.parseOffset16List()};xe.assert(!1,"0x"+i.toString(16)+": lookup type 1 format must be 1 or 2.")},Mn[2]=function(){let i=this.parseUShort();return xe.argument(i===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(fe.coverage),sequences:this.parseListOfLists()}},Mn[3]=function(){let i=this.parseUShort();return xe.argument(i===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(fe.coverage),alternateSets:this.parseListOfLists()}},Mn[4]=function(){let i=this.parseUShort();return xe.argument(i===1,"GSUB ligature table identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(fe.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Aa={sequenceIndex:fe.uShort,lookupListIndex:fe.uShort};Mn[5]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(fe.coverage),ruleSets:this.parseListOfLists(function(){let u=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(u-1),lookupRecords:this.parseRecordList(d,Aa)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(fe.coverage),classDef:this.parsePointer(fe.classDef),classSets:this.parseListOfLists(function(){let u=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(u-1),lookupRecords:this.parseRecordList(d,Aa)}})};if(o===3){let u=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(u,fe.pointer(fe.coverage)),lookupRecords:this.parseRecordList(d,Aa)}}xe.assert(!1,"0x"+i.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Mn[6]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(fe.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Aa)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(fe.coverage),backtrackClassDef:this.parsePointer(fe.classDef),inputClassDef:this.parsePointer(fe.classDef),lookaheadClassDef:this.parsePointer(fe.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Aa)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(fe.pointer(fe.coverage)),inputCoverage:this.parseList(fe.pointer(fe.coverage)),lookaheadCoverage:this.parseList(fe.pointer(fe.coverage)),lookupRecords:this.parseRecordList(Aa)};xe.assert(!1,"0x"+i.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Mn[7]=function(){let i=this.parseUShort();xe.argument(i===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),u=new fe(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:Mn[o].call(u)}},Mn[8]=function(){let i=this.parseUShort();return xe.argument(i===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(fe.coverage),backtrackCoverage:this.parseList(fe.pointer(fe.coverage)),lookaheadCoverage:this.parseList(fe.pointer(fe.coverage)),substitutes:this.parseUShortList()}};function xl(i,o){o=o||0;let u=new fe(i,o),d=u.parseVersion(1);return xe.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(Mn)}:{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(Mn),variations:u.parseFeatureVariationsList()}}var ta=new Array(9);ta[1]=function(i){if(i.substFormat===1)return new Ce.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ce.Coverage(i.coverage)},{name:"deltaGlyphID",type:"SHORT",value:i.deltaGlyphId}]);if(i.substFormat===2)return new Ce.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Ce.Coverage(i.coverage)}].concat(Ce.ushortList("substitute",i.substitute)));xe.fail("Lookup type 1 substFormat must be 1 or 2.")},ta[2]=function(i){return xe.assert(i.substFormat===1,"Lookup type 2 substFormat must be 1."),new Ce.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ce.Coverage(i.coverage)}].concat(Ce.tableList("seqSet",i.sequences,function(o){return new Ce.Table("sequenceSetTable",Ce.ushortList("sequence",o))})))},ta[3]=function(i){return xe.assert(i.substFormat===1,"Lookup type 3 substFormat must be 1."),new Ce.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ce.Coverage(i.coverage)}].concat(Ce.tableList("altSet",i.alternateSets,function(o){return new Ce.Table("alternateSetTable",Ce.ushortList("alternate",o))})))},ta[4]=function(i){return xe.assert(i.substFormat===1,"Lookup type 4 substFormat must be 1."),new Ce.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ce.Coverage(i.coverage)}].concat(Ce.tableList("ligSet",i.ligatureSets,function(o){return new Ce.Table("ligatureSetTable",Ce.tableList("ligature",o,function(u){return new Ce.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:u.ligGlyph}].concat(Ce.ushortList("component",u.components,u.components.length+1)))}))})))},ta[5]=function(i){if(i.substFormat===1)return new Ce.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Ce.Coverage(i.coverage)}].concat(Ce.tableList("sequenceRuleSet",i.ruleSets,function(o){return o?new Ce.Table("sequenceRuleSetTable",Ce.tableList("sequenceRule",o,function(u){let d=Ce.ushortList("seqLookup",[],u.lookupRecords.length).concat(Ce.ushortList("inputSequence",u.input,u.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let f=0;f<u.lookupRecords.length;f++){let g=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:g.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:g.lookupListIndex})}return new Ce.Table("sequenceRuleTable",d)})):new Ce.Table("NULL",null)})));if(i.substFormat===2)return new Ce.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Ce.Coverage(i.coverage)},{name:"classDef",type:"TABLE",value:new Ce.ClassDef(i.classDef)}].concat(Ce.tableList("classSeqRuleSet",i.classSets,function(o){return o?new Ce.Table("classSeqRuleSetTable",Ce.tableList("classSeqRule",o,function(u){let d=Ce.ushortList("classes",u.classes,u.classes.length+1).concat(Ce.ushortList("seqLookupCount",[],u.lookupRecords.length));for(let f=0;f<u.lookupRecords.length;f++){let g=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:g.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:g.lookupListIndex})}return new Ce.Table("classSeqRuleTable",d)})):new Ce.Table("NULL",null)})));if(i.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:i.substFormat}];o.push({name:"inputGlyphCount",type:"USHORT",value:i.coverages.length}),o.push({name:"substitutionCount",type:"USHORT",value:i.lookupRecords.length});for(let u=0;u<i.coverages.length;u++){let d=i.coverages[u];o.push({name:"inputCoverage"+u,type:"TABLE",value:new Ce.Coverage(d)})}for(let u=0;u<i.lookupRecords.length;u++){let d=i.lookupRecords[u];o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:d.lookupListIndex})}return new Ce.Table("contextualSubstitutionTable",o)}xe.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},ta[6]=function(i){if(i.substFormat===1)return new Ce.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Ce.Coverage(i.coverage)}].concat(Ce.tableList("chainRuleSet",i.chainRuleSets,function(o){return new Ce.Table("chainRuleSetTable",Ce.tableList("chainRule",o,function(u){let d=Ce.ushortList("backtrackGlyph",u.backtrack,u.backtrack.length).concat(Ce.ushortList("inputGlyph",u.input,u.input.length+1)).concat(Ce.ushortList("lookaheadGlyph",u.lookahead,u.lookahead.length)).concat(Ce.ushortList("substitution",[],u.lookupRecords.length));for(let f=0;f<u.lookupRecords.length;f++){let g=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:g.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:g.lookupListIndex})}return new Ce.Table("chainRuleTable",d)}))})));if(i.substFormat===2)xe.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(i.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:i.substFormat}];o.push({name:"backtrackGlyphCount",type:"USHORT",value:i.backtrackCoverage.length});for(let u=0;u<i.backtrackCoverage.length;u++){let d=i.backtrackCoverage[u];o.push({name:"backtrackCoverage"+u,type:"TABLE",value:new Ce.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:i.inputCoverage.length});for(let u=0;u<i.inputCoverage.length;u++){let d=i.inputCoverage[u];o.push({name:"inputCoverage"+u,type:"TABLE",value:new Ce.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:i.lookaheadCoverage.length});for(let u=0;u<i.lookaheadCoverage.length;u++){let d=i.lookaheadCoverage[u];o.push({name:"lookaheadCoverage"+u,type:"TABLE",value:new Ce.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:i.lookupRecords.length});for(let u=0;u<i.lookupRecords.length;u++){let d=i.lookupRecords[u];o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:d.lookupListIndex})}return new Ce.Table("chainContextTable",o)}xe.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function Oa(i){return new Ce.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Ce.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new Ce.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new Ce.LookupList(i.lookups,ta)}])}var jn={parse:xl,make:Oa};function ra(i,o){let u=new ct.Parser(i,o),d=u.parseULong();xe.argument(d===1,"Unsupported META table version."),u.parseULong(),u.parseULong();let f=u.parseULong(),g={};for(let A=0;A<f;A++){let _=u.parseTag(),E=u.parseULong(),M=u.parseULong();if(_==="appl"||_==="bild")continue;let R=oe.UTF8(i,o+E,M);g[_]=R}return g}function ji(i){let o=Object.keys(i).length,u="",d=16+o*12,f=new Ce.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:d},{name:"numTags",type:"ULONG",value:o}]);for(let g in i){let A=u.length;u+=i[g],f.fields.push({name:"tag "+g,type:"TAG",value:g}),f.fields.push({name:"offset "+g,type:"ULONG",value:d+A}),f.fields.push({name:"length "+g,type:"ULONG",value:i[g].length})}return f.fields.push({name:"stringPool",type:"CHARARRAY",value:u}),f}var Io={parse:ra,make:ji};function Ul(i,o){let u=new fe(i,o),d=u.parseUShort();d!==0&&console.warn("Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.");let f=u.parseUShort(),g=u.parseOffset32(),A=u.parseOffset32(),_=u.parseUShort();u.relativeOffset=g;let E=u.parseRecordList(f,{glyphID:fe.uShort,firstLayerIndex:fe.uShort,numLayers:fe.uShort});u.relativeOffset=A;let M=u.parseRecordList(_,{glyphID:fe.uShort,paletteIndex:fe.uShort});return{version:d,baseGlyphRecords:E,layerRecords:M}}function zl({version:i=0,baseGlyphRecords:o=[],layerRecords:u=[]}){xe.argument(i===0,"Only COLRv0 supported.");let d=14,f=d+o.length*6;return new Ce.Table("COLR",[{name:"version",type:"USHORT",value:i},{name:"numBaseGlyphRecords",type:"USHORT",value:o.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:f},{name:"numLayerRecords",type:"USHORT",value:u.length},...o.map((g,A)=>[{name:"glyphID_"+A,type:"USHORT",value:g.glyphID},{name:"firstLayerIndex_"+A,type:"USHORT",value:g.firstLayerIndex},{name:"numLayers_"+A,type:"USHORT",value:g.numLayers}]).flat(),...u.map((g,A)=>[{name:"LayerGlyphID_"+A,type:"USHORT",value:g.glyphID},{name:"paletteIndex_"+A,type:"USHORT",value:g.paletteIndex}]).flat()])}var bl={parse:Ul,make:zl};function Di(i,o){return[{name:"tag_"+i,type:"TAG",value:o.tag},{name:"minValue_"+i,type:"FIXED",value:o.minValue<<16},{name:"defaultValue_"+i,type:"FIXED",value:o.defaultValue<<16},{name:"maxValue_"+i,type:"FIXED",value:o.maxValue<<16},{name:"flags_"+i,type:"USHORT",value:0},{name:"nameID_"+i,type:"USHORT",value:o.axisNameID}]}function ti(i,o,u){let d={},f=new ct.Parser(i,o);d.tag=f.parseTag(),d.minValue=f.parseFixed(),d.defaultValue=f.parseFixed(),d.maxValue=f.parseFixed(),f.skip("uShort",1);let g=f.parseUShort();return d.axisNameID=g,d.name=Ye(u,g),d}function na(i,o,u,d={}){let f=[{name:"nameID_"+i,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+i,type:"USHORT",value:0}];for(let g=0;g<u.length;++g){let A=u[g].tag;f.push({name:"axis_"+i+" "+A,type:"FIXED",value:o.coordinates[A]<<16})}return d&&d.postScriptNameID&&f.push({name:"postScriptNameID_",type:"USHORT",value:o.postScriptNameID!==void 0?o.postScriptNameID:65535}),f}function sa(i,o,u,d,f){let g={},A=new ct.Parser(i,o),_=A.parseUShort();g.subfamilyNameID=_,g.name=Ye(d,_,[2,17]),A.skip("uShort",1),g.coordinates={};for(let M=0;M<u.length;++M)g.coordinates[u[M].tag]=A.parseFixed();if(A.relativeOffset===f)return g.postScriptNameID=void 0,g.postScriptName=void 0,g;let E=A.parseUShort();return g.postScriptNameID=E==65535?void 0:E,g.postScriptName=g.postScriptNameID!==void 0?Ye(d,E,[6]):"",g}function ia(i,o){let u=new Ce.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:i.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:i.instances.length},{name:"instanceSize",type:"USHORT",value:4+i.axes.length*4}]);u.offsetToData=u.sizeOf();for(let f=0;f<i.axes.length;f++)u.fields=u.fields.concat(Di(f,i.axes[f],o));let d={};for(let f=0;f<i.instances.length;f++)if(i.instances[f].postScriptNameID!==void 0){u.instanceSize+=2,d.postScriptNameID=!0;break}for(let f=0;f<i.instances.length;f++)u.fields=u.fields.concat(na(f,i.instances[f],i.axes,d));return u}function ri(i,o,u){let d=new ct.Parser(i,o),f=d.parseULong();xe.argument(f===65536,"Unsupported fvar table version.");let g=d.parseOffset16();d.skip("uShort",1);let A=d.parseUShort(),_=d.parseUShort(),E=d.parseUShort(),M=d.parseUShort(),R=[];for(let me=0;me<A;me++)R.push(ti(i,o+g+me*_,u));let Y=[],Z=o+g+A*_;for(let me=0;me<E;me++)Y.push(sa(i,Z+me*M,R,u,M));return{axes:R,instances:Y}}var Zo={make:ia,parse:ri},vl={tag:fe.tag,nameID:fe.uShort,ordering:fe.uShort},Qi=new Array(5);Qi[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Qi[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Qi[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Qi[4]=function(){let i=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(i,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function Fa(){let i=this.parseUShort(),o=Qi[i],u={format:i};return o===void 0?(console.warn(`Unknown axis value table format ${i}`),u):Object.assign(u,this.parseStruct(o.bind(this)))}function gn(i,o,u){o||(o=0);let d=new ct.Parser(i,o),f=d.parseUShort(),g=d.parseUShort();f!==1&&console.warn(`Unsupported STAT table version ${f}.${g}`);let A=[f,g],_=d.parseUShort(),E=d.parseUShort(),M=d.parseOffset32(),R=d.parseUShort(),Y=d.parseOffset32(),Z=f>1||g>0?d.parseUShort():void 0;u!==void 0&&xe.argument(E>=u.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),R>0&&xe.argument(E>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let me=[];for(let Ze=0;Ze<E;Ze++)d.offset=o+M,d.relativeOffset=Ze*_,me.push(d.parseStruct(vl));d.offset=o,d.relativeOffset=Y;let ue=d.parseUShortList(R),Ae=[];for(let Ze=0;Ze<R;Ze++)d.offset=o+Y,d.relativeOffset=ue[Ze],Ae.push(Fa.apply(d));return{version:A,axes:me,values:Ae,elidedFallbackNameID:Z}}var Is=new Array(5);Is[1]=function(i,o){return[{name:`format${i}`,type:"USHORT",value:1},{name:`axisIndex${i}`,type:"USHORT",value:o.axisIndex},{name:`flags${i}`,type:"USHORT",value:o.flags},{name:`valueNameID${i}`,type:"USHORT",value:o.valueNameID},{name:`value${i}`,type:"FLOAT",value:o.value}]},Is[2]=function(i,o){return[{name:`format${i}`,type:"USHORT",value:2},{name:`axisIndex${i}`,type:"USHORT",value:o.axisIndex},{name:`flags${i}`,type:"USHORT",value:o.flags},{name:`valueNameID${i}`,type:"USHORT",value:o.valueNameID},{name:`nominalValue${i}`,type:"FLOAT",value:o.nominalValue},{name:`rangeMinValue${i}`,type:"FLOAT",value:o.rangeMinValue},{name:`rangeMaxValue${i}`,type:"FLOAT",value:o.rangeMaxValue}]},Is[3]=function(i,o){return[{name:`format${i}`,type:"USHORT",value:3},{name:`axisIndex${i}`,type:"USHORT",value:o.axisIndex},{name:`flags${i}`,type:"USHORT",value:o.flags},{name:`valueNameID${i}`,type:"USHORT",value:o.valueNameID},{name:`value${i}`,type:"FLOAT",value:o.value},{name:`linkedValue${i}`,type:"FLOAT",value:o.linkedValue}]},Is[4]=function(i,o){let u=[{name:`format${i}`,type:"USHORT",value:4},{name:`axisCount${i}`,type:"USHORT",value:o.axisValues.length},{name:`flags${i}`,type:"USHORT",value:o.flags},{name:`valueNameID${i}`,type:"USHORT",value:o.valueNameID}];for(let d=0;d<o.axisValues.length;d++)u=u.concat([{name:`format${i}axisIndex${d}`,type:"USHORT",value:o.axisValues[d].axisIndex},{name:`format${i}value${d}`,type:"FLOAT",value:o.axisValues[d].value}]);return u};function Fs(i,o){return new Ce.Record("axisRecord_"+i,[{name:"axisTag_"+i,type:"TAG",value:o.tag},{name:"axisNameID_"+i,type:"USHORT",value:o.nameID},{name:"axisOrdering_"+i,type:"USHORT",value:o.ordering}])}function Ta(i,o){let u=o.format,d=Is[u];xe.argument(d!==void 0,`Unknown axis value table format ${u}`);let f=d(i,o);return new Ce.Table("axisValueTable_"+i,f)}function aa(i){let o=new Ce.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:i.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:i.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:i.elidedFallbackNameID}]);o.designAxesOffset=o.offsetToAxisValueOffsets=o.sizeOf();for(let g=0;g<i.axes.length;g++){let A=Fs(g,i.axes[g]);o.offsetToAxisValueOffsets+=A.sizeOf(),o.fields=o.fields.concat(A.fields)}let u=[],d=[],f=i.values.length*2;for(let g=0;g<i.values.length;g++){let A=Ta(g,i.values[g]);u.push({name:"offset_"+g,type:"USHORT",value:f}),f+=A.sizeOf(),d=d.concat(A.fields)}return o.fields=o.fields.concat(u),o.fields=o.fields.concat(d),o}var Ca={make:aa,parse:gn};function $s(i,o){return new Ce.Record("axisValueMap_"+i,[{name:"fromCoordinate_"+i,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+i,type:"F2DOT14",value:o.toCoordinate}])}function $a(i,o){let u=new Ce.Record("segmentMap_"+i,[{name:"positionMapCount_"+i,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let f=0;f<o.axisValueMaps.length;f++){let g=$s(`${i}_${f}`,o.axisValueMaps[f]);d=d.concat(g.fields)}return u.fields=u.fields.concat(d),u}function Eo(i,o){xe.argument(i.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let u=new Ce.Table("avar",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:0},{name:"reserved",type:"USHORT",value:0},{name:"axisCount",type:"USHORT",value:i.axisSegmentMaps.length}]);for(let d=0;d<i.axisSegmentMaps.length;d++){let f=$a(d,i.axisSegmentMaps[d]);u.fields=u.fields.concat(f.fields)}return u}function oa(i,o,u){o||(o=0);let d=new fe(i,o),f=d.parseUShort(),g=d.parseUShort();f!==1&&console.warn(`Unsupported avar table version ${f}.${g}`),d.skip("uShort",1);let A=d.parseUShort();xe.argument(A===u.axes.length,"avar axis count must correspond to fvar axis count");let _=[];for(let E=0;E<A;E++){let M=[],R=d.parseUShort();for(let Y=0;Y<R;Y++){let Z=d.parseF2Dot14(),me=d.parseF2Dot14();M.push({fromCoordinate:Z,toCoordinate:me})}_.push({axisValueMaps:M})}return{version:[f,g],axisSegmentMaps:_}}var _s={make:Eo,parse:oa};function Gi(i,o,u,d){let f=new ct.Parser(i,o),g=f.parseTupleVariationStore(f.relativeOffset,u.axes.length,"cvar",d),A=f.parseUShort(),_=f.parseUShort();return A!==1&&console.warn(`Unsupported cvar table version ${A}.${_}`),{version:[A,_],...g}}function No(){console.warn("Writing of cvar tables is not yet supported.")}var ss={make:No,parse:Gi};function qi(i,o,u,d){let f=new ct.Parser(i,o),g=f.parseUShort(),A=f.parseUShort();g!==1&&console.warn(`Unsupported gvar table version ${g}.${A}`);let _=f.parseUShort();_!==u.axes.length&&console.warn(`axisCount ${_} in gvar table does not match the number of axes ${u.axes.length} in the fvar table!`);let E=f.parseUShort(),M=f.parsePointer32(function(){return this.parseTupleRecords(E,_)}),R=f.parseTupleVariationStoreList(_,"gvar",d);return{version:[g,A],sharedTuples:M,glyphVariations:R}}function Ro(){console.warn("Writing of gvar tables is not yet supported.")}var fi={make:Ro,parse:qi};function no(i,o){let u={},d=new ct.Parser(i,o);u.version=d.parseUShort(),xe.argument(u.version<=1,"Unsupported gasp table version."),u.numRanges=d.parseUShort(),u.gaspRanges=[];for(let f=0;f<u.numRanges;f++)u.gaspRanges[f]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return u}function Yo(i){let o=new Ce.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:i.numRanges}]);for(let u in i.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:i.gaspRanges[u].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:i.gaspRanges[u].rangeGaspBehavior});return o}var so={parse:no,make:Yo};function Mo(i,o){let u=new Map,d=i.buffer,f=new fe(i,o);if(f.parseUShort()!==0)return u;f.relativeOffset=f.parseOffset32();let g=i.byteOffset+o+f.relativeOffset,A=f.parseUShort(),_=new Map;for(let E=0;E<A;E++){let M=f.parseUShort(),R=f.parseUShort(),Y=g+f.parseOffset32(),Z=f.parseULong(),me=_.get(Y);me===void 0&&(me=new Uint8Array(d,Y,Z),_.set(Y,me));for(let ue=M;ue<=R;ue++)u.set(ue,me)}return u}function Sa(i){let o=Array.from(i.keys()).sort(),u=[],d=[],f=new Map,g=0,A={endGlyphID:null};for(let Z=0,me=o.length;Z<me;Z++){let ue=o[Z],Ae=i.get(ue),Ze=f.get(Ae);Ze===void 0&&(Ze=g,d.push(Ae),f.set(Ae,Ze),g+=Ae.byteLength),ue-1===A.endGlyphID&&Ze===A.svgDocOffset?A.endGlyphID=ue:(A={startGlyphID:ue,endGlyphID:ue,svgDocOffset:Ze,svgDocLength:Ae.byteLength},u.push(A))}let _=u.length,E=d.length,M=2+_*12,R=new Array(4+_*4+E),Y=0;R[Y++]={name:"version",type:"USHORT",value:0},R[Y++]={name:"svgDocumentListOffset",type:"ULONG",value:10},R[Y++]={name:"reserved",type:"ULONG",value:0},R[Y++]={name:"numEntries",type:"USHORT",value:_};for(let Z=0;Z<_;Z++){let me="documentRecord_"+Z,{startGlyphID:ue,endGlyphID:Ae,svgDocOffset:Ze,svgDocLength:ur}=u[Z];R[Y++]={name:me+"_startGlyphID",type:"USHORT",value:ue},R[Y++]={name:me+"_endGlyphID",type:"USHORT",value:Ae},R[Y++]={name:me+"_svgDocOffset",type:"ULONG",value:M+Ze},R[Y++]={name:me+"_svgDocLength",type:"ULONG",value:ur}}for(let Z=0;Z<E;Z++)R[Y++]={name:"svgDoc_"+Z,type:"LITERAL",value:d[Z]};return new Ce.Table("SVG ",R)}var ni={make:Sa,parse:Mo};function ws(i){return Math.log(i)/Math.log(2)|0}function se(i){for(;i.length%4!==0;)i.push(0);let o=0;for(let u=0;u<i.length;u+=4)o+=(i[u]<<24)+(i[u+1]<<16)+(i[u+2]<<8)+i[u+3];return o%=Math.pow(2,32),o}function Re(i,o,u,d){return new Ce.Record("Table Record",[{name:"tag",type:"TAG",value:i!==void 0?i:""},{name:"checkSum",type:"ULONG",value:o!==void 0?o:0},{name:"offset",type:"ULONG",value:u!==void 0?u:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function et(i){let o=new Ce.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);o.tables=i,o.numTables=i.length;let u=Math.pow(2,ws(o.numTables));o.searchRange=16*u,o.entrySelector=ws(u),o.rangeShift=o.numTables*16-o.searchRange;let d=[],f=[],g=o.sizeOf()+Re().sizeOf()*o.numTables;for(;g%4!==0;)g+=1,f.push({name:"padding",type:"BYTE",value:0});for(let A=0;A<i.length;A+=1){let _=i[A];xe.argument(_.tableName.length===4,"Table name"+_.tableName+" is invalid.");let E=_.sizeOf(),M=Re(_.tableName,se(_.encode()),g,E);for(d.push({name:M.tag+" Table Record",type:"RECORD",value:M}),f.push({name:_.tableName+" table",type:"RECORD",value:_}),g+=E,xe.argument(!isNaN(g),"Something went wrong calculating the offset.");g%4!==0;)g+=1,f.push({name:"padding",type:"BYTE",value:0})}return d.sort(function(A,_){return A.value.tag>_.value.tag?1:-1}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(f),o}function _t(i,o,u){for(let d=0;d<o.length;d+=1){let f=i.charToGlyphIndex(o[d]);if(f>0)return i.glyphs.get(f).getMetrics()}return u}function ze(i){let o=0;for(let u=0;u<i.length;u+=1)o+=i[u];return o/i.length}function k(i){let o=[],u=[],d=[],f=[],g=[],A=[],_=[],E,M=0,R=0,Y=0,Z=0,me=0;for(let is=0;is<i.glyphs.length;is+=1){let Ia=i.glyphs.get(is),uo=Ia.unicode|0;if(isNaN(Ia.advanceWidth))throw new Error("Glyph "+Ia.name+" ("+is+"): advanceWidth is not a number.");(E>uo||E===void 0)&&uo>0&&(E=uo),M<uo&&(M=uo);let Fo=gl.getUnicodeRange(uo);if(Fo<32)R|=1<<Fo;else if(Fo<64)Y|=1<<Fo-32;else if(Fo<96)Z|=1<<Fo-64;else if(Fo<123)me|=1<<Fo-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Ia.name===".notdef")continue;let Tl=Ia.getMetrics();o.push(Tl.xMin),u.push(Tl.yMin),d.push(Tl.xMax),f.push(Tl.yMax),A.push(Tl.leftSideBearing),_.push(Tl.rightSideBearing),g.push(Ia.advanceWidth)}let ue={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,u),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,f),advanceWidthMax:Math.max.apply(null,g),advanceWidthAvg:ze(g),minLeftSideBearing:Math.min.apply(null,A),maxLeftSideBearing:Math.max.apply(null,A),minRightSideBearing:Math.min.apply(null,_)};ue.ascender=i.ascender,ue.descender=i.descender;let Ae=0;i.weightClass>=600&&(Ae|=i.macStyleValues.BOLD),i.italicAngle<0&&(Ae|=i.macStyleValues.ITALIC);let Ze=ei.make({flags:3,unitsPerEm:i.unitsPerEm,xMin:ue.xMin,yMin:ue.yMin,xMax:ue.xMax,yMax:ue.yMax,lowestRecPPEM:3,macStyle:Ae,createdTimestamp:i.createdTimestamp}),ur=Ei.make({ascender:ue.ascender,descender:ue.descender,advanceWidthMax:ue.advanceWidthMax,minLeftSideBearing:ue.minLeftSideBearing,minRightSideBearing:ue.minRightSideBearing,xMaxExtent:ue.maxLeftSideBearing+(ue.xMax-ue.xMin),numberOfHMetrics:i.glyphs.length}),nr=qs.make(i.glyphs.length),kr=gl.make(Object.assign({xAvgCharWidth:Math.round(ue.advanceWidthAvg),usFirstCharIndex:E,usLastCharIndex:M,ulUnicodeRange1:R,ulUnicodeRange2:Y,ulUnicodeRange3:Z,ulUnicodeRange4:me,sTypoAscender:ue.ascender,sTypoDescender:ue.descender,sTypoLineGap:0,usWinAscent:ue.yMax,usWinDescent:Math.abs(ue.yMin),ulCodePageRange1:1,sxHeight:_t(i,"xyvw",{yMax:Math.round(ue.ascender/2)}).yMax,sCapHeight:_t(i,"HIKLEFJMNTZBDPRAGOQSUVWXY",ue).yMax,usDefaultChar:i.hasChar(" ")?32:0,usBreakChar:i.hasChar(" ")?32:0},i.tables.os2)),zr=Ws.make(i.glyphs),Qn=xs.make(i.glyphs),Xn=i.getEnglishName("fontFamily"),Jn=i.getEnglishName("fontSubfamily"),Zs=Xn+" "+Jn,Po=i.getEnglishName("postScriptName");Po||(Po=Xn.replace(/\s/g,"")+"-"+Jn);let Hr={};for(let is in i.names)Hr[is]=i.names[is];Hr.unicode=Hr.unicode||{},Hr.macintosh=Hr.macintosh||{},Hr.windows=Hr.windows||{};let Va=i.names.unicode||{},ca=i.names.macintosh||{},dr=i.names.windows||{};for(let is in Hr){if(Hr[is]=Hr[is]||{},!Hr[is].uniqueID){let Ia=i.getEnglishName("manufacturer")||"";Hr[is].uniqueID={en:`${Ia}: ${Zs}`}}Hr[is].postScriptName||(Hr[is].postScriptName={en:Po})}Hr.unicode.preferredFamily||(Hr.unicode.preferredFamily=Va.fontFamily||ca.fontFamily||dr.fontFamily),Hr.macintosh.preferredFamily||(Hr.macintosh.preferredFamily=ca.fontFamily||Va.fontFamily||dr.fontFamily),Hr.windows.preferredFamily||(Hr.windows.preferredFamily=dr.fontFamily||Va.fontFamily||ca.fontFamily),Hr.unicode.preferredSubfamily||(Hr.unicode.preferredSubfamily=Va.fontSubfamily||ca.fontSubfamily||dr.fontSubfamily),Hr.macintosh.preferredSubfamily||(Hr.macintosh.preferredSubfamily=ca.fontSubfamily||Va.fontSubfamily||dr.fontSubfamily),Hr.windows.preferredSubfamily||(Hr.windows.preferredSubfamily=dr.fontSubfamily||Va.fontSubfamily||ca.fontSubfamily);let Kt=[],tr=qt.make(Hr,Kt),Vi=Kt.length>0?Ls.make(Kt):void 0,sc=Vo.make(i),Ud=Ii.make(i.glyphs,{version:i.getEnglishName("version"),fullName:Zs,familyName:Xn,weightName:Jn,postScriptName:Po,unitsPerEm:i.unitsPerEm,fontBBox:[0,ue.yMin,ue.ascender,ue.advanceWidthMax],topDict:i.tables.cff&&i.tables.cff.topDict||{}}),Ec=i.metas&&Object.keys(i.metas).length>0?Io.make(i.metas):void 0,Oo=[Ze,ur,nr,kr,tr,Qn,sc,Ud,zr];Vi&&Oo.push(Vi);let ua={gsub:jn,cpal:qn,colr:bl,stat:Ca,avar:_s,cvar:ss,fvar:Zo,gvar:fi,gasp:so,svg:ni},co={avar:[i.tables.fvar],fvar:[i.names]};for(let is in ua){let Ia=i.tables[is];if(Ia){let uo=ua[is].make.call(i,Ia,...co[is]||[]);uo&&Oo.push(uo)}}Ec&&Oo.push(Ec);let Zi=et(Oo),Za=Zi.encode(),da=se(Za),ha=Zi.fields,Us=!1;for(let is=0;is<ha.length;is+=1)if(ha[is].name==="head table"){ha[is].value.checkSumAdjustment=2981146554-da,Us=!0;break}if(!Us)throw new Error("Could not find head table with checkSum to adjust.");return Zi}var j={make:et,fontToTable:k,computeCheckSum:se};function O(i,o){let u=0,d=i.length-1;for(;u<=d;){let f=u+d>>>1,g=i[f].tag;if(g===o)return f;g<o?u=f+1:d=f-1}return-u-1}function z(i,o){let u=0,d=i.length-1;for(;u<=d;){let f=u+d>>>1,g=i[f];if(g===o)return f;g<o?u=f+1:d=f-1}return-u-1}function Te(i,o){let u,d=0,f=i.length-1;for(;d<=f;){let g=d+f>>>1;u=i[g];let A=u.start;if(A===o)return u;A<o?d=g+1:f=g-1}if(d>0)return u=i[d-1],o>u.end?0:u}function Se(i,o){this.font=i,this.tableName=o}Se.prototype={searchTag:O,binSearch:z,getTable:function(i){let o=this.font.tables[this.tableName];return!o&&i&&(o=this.font.tables[this.tableName]=this.createDefaultTable()),o},getScriptNames:function(){let i=this.getTable();return i?i.scripts.map(function(o){return o.tag}):[]},getDefaultScriptName:function(){let i=this.getTable();if(!i)return;let o=!1;for(let u=0;u<i.scripts.length;u++){let d=i.scripts[u].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(i,o){let u=this.getTable(o);if(u){i=i||"DFLT";let d=u.scripts,f=O(u.scripts,i);if(f>=0)return d[f].script;if(o){let g={tag:i,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-f,0,g),g.script}}},getLangSysTable:function(i,o,u){let d=this.getScriptTable(i,u);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let f=O(d.langSysRecords,o);if(f>=0)return d.langSysRecords[f].langSys;if(u){let g={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-f,0,g),g.langSys}}},getFeatureTable:function(i,o,u,d){let f=this.getLangSysTable(i,o,d);if(f){let g,A=f.featureIndexes,_=this.font.tables[this.tableName].features;for(let E=0;E<A.length;E++)if(g=_[A[E]],g.tag===u)return g.feature;if(d){let E=_.length;return xe.assert(E===0||u>=_[E-1].tag,"Features must be added in alphabetical order."),g={tag:u,feature:{params:0,lookupListIndexes:[]}},_.push(g),A.push(E),g.feature}}},getLookupTables:function(i,o,u,d,f){let g=this.getFeatureTable(i,o,u,f),A=[];if(g){let _,E=g.lookupListIndexes,M=this.font.tables[this.tableName].lookups;for(let R=0;R<E.length;R++)_=M[E[R]],_.lookupType===d&&A.push(_);if(A.length===0&&f){_={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let R=M.length;return M.push(_),E.push(R),[_]}}return A},getGlyphClass:function(i,o){switch(i.format){case 1:return i.startGlyph<=o&&o<i.startGlyph+i.classes.length?i.classes[o-i.startGlyph]:0;case 2:{let u=Te(i.ranges,o);return u?u.classId:0}}},getCoverageIndex:function(i,o){switch(i.format){case 1:{let u=z(i.glyphs,o);return u>=0?u:-1}case 2:{let u=Te(i.ranges,o);return u?u.index+o-u.start:-1}}},expandCoverage:function(i){if(i.format===1)return i.glyphs;{let o=[],u=i.ranges;for(let d=0;d<u.length;d++){let f=u[d],g=f.start,A=f.end;for(let _=g;_<=A;_++)o.push(_)}return o}}};var Le=Se;function ut(i){Le.call(this,i,"gpos")}ut.prototype=Le.prototype,ut.prototype.init=function(){let i=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(i)},ut.prototype.getKerningValue=function(i,o,u){for(let d=0;d<i.length;d++){let f=i[d].subtables;for(let g=0;g<f.length;g++){let A=f[g],_=this.getCoverageIndex(A.coverage,o);if(!(_<0))switch(A.posFormat){case 1:{let E=A.pairSets[_];for(let M=0;M<E.length;M++){let R=E[M];if(R.secondGlyph===u)return R.value1&&R.value1.xAdvance||0}break}case 2:{let E=this.getGlyphClass(A.classDef1,o),M=this.getGlyphClass(A.classDef2,u),R=A.classRecords[E][M];return R.value1&&R.value1.xAdvance||0}}}}return 0},ut.prototype.getKerningTables=function(i,o){if(this.font.tables.gpos)return this.getLookupTables(i,o,"kern",2)};var Wt=ut;function fr(i,o){let u=i.length;if(u!==o.length)return!1;for(let d=0;d<u;d++)if(i[d]!==o[d])return!1;return!0}function yr(i,o,u){let d=0,f=i.length-1,g=null;for(;d<=f;){let A=Math.floor((d+f)/2),_=i[A],E=_[o];if(E<u)d=A+1;else if(E>u)f=A-1;else{g=_;break}}return g}function us(i,o,u){let d=0,f=i.length-1;for(;d<=f;){let g=Math.floor((d+f)/2),A=i[g];if(A[o]<u)d=g+1;else if(A[o]>u)f=g-1;else return g}return-1}function ps(i,o,u){let d=0,f=i.length,g=(A,_)=>A[o]-_[o];for(;d<f;){let A=d+f>>>1;g(i[A],u)<0?d=A+1:f=A}return i.splice(d,0,u),d}function Kn(i){return i[0]===31&&i[1]===139&&i[2]===8}function rr(i){let o=new DataView(i.buffer,i.byteOffset,i.byteLength),u=10,d=i.byteLength-8,f=o.getInt8(3);if(f&4&&(u+=2+o.getUint16(u,!0)),f&8)for(;u<d&&i[u++]!==0;);if(f&16)for(;u<d&&i[u++]!==0;);if(f&2&&(u+=2),u>=d)throw new Error("Can't find compressed blocks");let g=o.getUint32(o.byteLength-4,!0);return Be(i.subarray(u,d),new Uint8Array(g))}function un(i){return{x:i.x,y:i.y,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour}}function ms(i){return{glyphIndex:i.glyphIndex,xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:i.dx,dy:i.dy}}function xn(i){Le.call(this,i,"gsub")}function io(i,o,u){let d=i.subtables;for(let f=0;f<d.length;f++){let g=d[f];if(g.substFormat===o)return g}if(u)return d.push(u),u}xn.prototype=Le.prototype,xn.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},xn.prototype.getSingle=function(i,o,u){let d=[],f=this.getLookupTables(o,u,i,1);for(let g=0;g<f.length;g++){let A=f[g].subtables;for(let _=0;_<A.length;_++){let E=A[_],M=this.expandCoverage(E.coverage),R;if(E.substFormat===1){let Y=E.deltaGlyphId;for(R=0;R<M.length;R++){let Z=M[R];d.push({sub:Z,by:Z+Y})}}else{let Y=E.substitute;for(R=0;R<M.length;R++)d.push({sub:M[R],by:Y[R]})}}}return d},xn.prototype.getMultiple=function(i,o,u){let d=[],f=this.getLookupTables(o,u,i,2);for(let g=0;g<f.length;g++){let A=f[g].subtables;for(let _=0;_<A.length;_++){let E=A[_],M=this.expandCoverage(E.coverage),R;for(R=0;R<M.length;R++){let Y=M[R],Z=E.sequences[R];d.push({sub:Y,by:Z})}}}return d},xn.prototype.getAlternates=function(i,o,u){let d=[],f=this.getLookupTables(o,u,i,3);for(let g=0;g<f.length;g++){let A=f[g].subtables;for(let _=0;_<A.length;_++){let E=A[_],M=this.expandCoverage(E.coverage),R=E.alternateSets;for(let Y=0;Y<M.length;Y++)d.push({sub:M[Y],by:R[Y]})}}return d},xn.prototype.getLigatures=function(i,o,u){let d=[],f=this.getLookupTables(o,u,i,4);for(let g=0;g<f.length;g++){let A=f[g].subtables;for(let _=0;_<A.length;_++){let E=A[_],M=this.expandCoverage(E.coverage),R=E.ligatureSets;for(let Y=0;Y<M.length;Y++){let Z=M[Y],me=R[Y];for(let ue=0;ue<me.length;ue++){let Ae=me[ue];d.push({sub:[Z].concat(Ae.components),by:Ae.ligGlyph})}}}}return d},xn.prototype.addSingle=function(i,o,u,d){let f=this.getLookupTables(u,d,i,1,!0)[0],g=io(f,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});xe.assert(g.coverage.format===1,"Single: unable to modify coverage table format "+g.coverage.format);let A=o.sub,_=this.binSearch(g.coverage.glyphs,A);_<0&&(_=-1-_,g.coverage.glyphs.splice(_,0,A),g.substitute.splice(_,0,0)),g.substitute[_]=o.by},xn.prototype.addMultiple=function(i,o,u,d){xe.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let f=this.getLookupTables(u,d,i,2,!0)[0],g=io(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});xe.assert(g.coverage.format===1,"Multiple: unable to modify coverage table format "+g.coverage.format);let A=o.sub,_=this.binSearch(g.coverage.glyphs,A);_<0&&(_=-1-_,g.coverage.glyphs.splice(_,0,A),g.sequences.splice(_,0,0)),g.sequences[_]=o.by},xn.prototype.addAlternate=function(i,o,u,d){let f=this.getLookupTables(u,d,i,3,!0)[0],g=io(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});xe.assert(g.coverage.format===1,"Alternate: unable to modify coverage table format "+g.coverage.format);let A=o.sub,_=this.binSearch(g.coverage.glyphs,A);_<0&&(_=-1-_,g.coverage.glyphs.splice(_,0,A),g.alternateSets.splice(_,0,0)),g.alternateSets[_]=o.by},xn.prototype.addLigature=function(i,o,u,d){let f=this.getLookupTables(u,d,i,4,!0)[0],g=f.subtables[0];g||(g={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},f.subtables[0]=g),xe.assert(g.coverage.format===1,"Ligature: unable to modify coverage table format "+g.coverage.format);let A=o.sub[0],_=o.sub.slice(1),E={ligGlyph:o.by,components:_},M=this.binSearch(g.coverage.glyphs,A);if(M>=0){let R=g.ligatureSets[M];for(let Y=0;Y<R.length;Y++)if(fr(R[Y].components,_))return;R.push(E)}else M=-1-M,g.coverage.glyphs.splice(M,0,A),g.ligatureSets.splice(M,0,[E])},xn.prototype.getFeature=function(i,o,u){if(/ss\d\d/.test(i))return this.getSingle(i,o,u);switch(i){case"aalt":case"salt":return this.getSingle(i,o,u).concat(this.getAlternates(i,o,u));case"dlig":case"liga":case"rlig":return this.getLigatures(i,o,u);case"ccmp":return this.getMultiple(i,o,u).concat(this.getLigatures(i,o,u));case"stch":return this.getMultiple(i,o,u)}},xn.prototype.add=function(i,o,u,d){if(/ss\d\d/.test(i))return this.addSingle(i,o,u,d);switch(i){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(i,o,u,d):this.addAlternate(i,o,u,d);case"dlig":case"liga":case"rlig":return this.addLigature(i,o,u,d);case"ccmp":return o.by instanceof Array?this.addMultiple(i,o,u,d):this.addLigature(i,o,u,d)}};var Es=xn,Hl=class{constructor(i){this.defaultValue=255,this.font=i}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(i){let o=[],u=this.cpal();if(!u)return o;for(let d=0;d<u.colorRecordIndices.length;d++){let f=u.colorRecordIndices[d],g=[];for(let A=f;A<f+u.numPaletteEntries;A++)g.push(qr(u.colorRecords[A],i||"hexa"));o.push(g)}return o}toCPALcolor(i){return Array.isArray(i)?i.map(o=>ls(o,"raw")):ls(i,"raw")}fillPalette(i,o=[],u=this.cpal().numPaletteEntries){return i=Number.isInteger(i)?this.get(i,"raw"):i,Object.assign(Array(u).fill(this.defaultValue),this.toCPALcolor(i).concat(this.toCPALcolor(o)))}extend(i){if(this.ensureCPAL(Array(i).fill(this.defaultValue)))return;let o=this.cpal(),u=o.numPaletteEntries+i,d=this.getAll().map(f=>this.fillPalette(f,[],u));o.numPaletteEntries=u,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(i,o="hexa"){return this.getAll(o)[i]||null}getColor(i,o=0,u="hexa"){return Ps(this.font,i,o,u)}setColor(i,o,u=0){i=parseInt(i),u=parseInt(u);let d=this.getAll("raw"),f=d[u];if(!f)throw Error(`paletteIndex ${u} out of range`);let g=this.cpal(),A=g.numPaletteEntries;Array.isArray(o)||(o=[o]),o.length+i>A&&(this.extend(o.length+i-A),d=this.getAll("raw"),f=d[u]);for(let _=0;_<o.length;_++)f[_+i]=this.toCPALcolor(o[_]);g.colorRecords=d.flat(),this.updateIndices()}add(i){if(this.ensureCPAL(i))return;let o=this.cpal(),u=o.numPaletteEntries;i&&i.length?(i=this.toCPALcolor(i),i.length>u?this.extend(i.length-u):i.length<u&&(i=this.fillPalette(i)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...i)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(u).fill(this.defaultValue)))}delete(i){let o=this.getAll("raw");delete o[i];let u=this.cpal();u.colorRecordIndices.pop(),u.colorRecords=o.flat()}deleteColor(i,o){if(i===o)throw Error("replacementIndex cannot be the same as colorIndex");let u=this.cpal(),d=this.getAll("raw"),f=[];if(o>u.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${u.numPaletteEntries-1}, replacementIndex: ${o})`);for(let _=0;_<d.length;_++){let E=d[_].filter((M,R)=>R!==i);f.push(E)}let g=this.font.tables.colr;if(g){let _=g.layerRecords;for(let E=0;E<_.length;E++){let M=_[E].paletteIndex;if(M>i)_[E].paletteIndex-=1;else if(M===i){let R=0;for(let Y=0;Y<d.length;Y++)if(o>i&&o<=i+d[Y].length){R++;break}_[E].paletteIndex=o-R}}this.font.tables.colr={...g,layerRecords:_}}let A=f.flat();for(let _=0;_<d.length;_++)u.colorRecordIndices[_]-=_;u.numPaletteEntries=Math.max(0,u.numPaletteEntries-1),u.colorRecords=this.toCPALcolor(A)}ensureCPAL(i){return this.cpal()?!1:(!i||!i.length?i=[this.defaultValue]:i=this.toCPALcolor(i),this.font.tables.cpal={version:0,numPaletteEntries:i.length,colorRecords:i,colorRecordIndices:[0]},!0)}updateIndices(){let i=this.cpal(),o=Math.ceil(i.colorRecords.length/i.numPaletteEntries);i.colorRecordIndices=[];for(let u=0;u<o;u++)i.colorRecordIndices.push(u*i.numPaletteEntries)}},La=class{constructor(i){this.font=i}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(i){let o=this.font,u=[],d=o.tables.colr,f=o.tables.cpal;if(!d||!f)return u;let g=yr(d.baseGlyphRecords,"glyphID",i);if(!g)return u;let A=g.firstLayerIndex,_=g.numLayers;for(let E=0;E<_;E++){let M=d.layerRecords[A+E];u.push({glyph:o.glyphs.get(M.glyphID),paletteIndex:M.paletteIndex})}return u}add(i,o,u){let d=this.get(i);o=Array.isArray(o)?o:[o],u===void 0||u===1/0||u>d.length?u=d.length:u<0&&(u=d.length+1+u%(d.length+1),u>=d.length+1&&(u-=d.length+1));let f=[];for(let g=0;g<u;g++){let A=Number.isInteger(d[g].glyph)?d[g].glyph:d[g].glyph.index;f.push({glyphID:A,paletteIndex:d[g].paletteIndex})}for(let g of o){let A=Number.isInteger(g.glyph)?g.glyph:g.glyph.index;f.push({glyphID:A,paletteIndex:g.paletteIndex})}for(let g=u;g<d.length;g++){let A=Number.isInteger(d[g].glyph)?d[g].glyph:d[g].glyph.index;f.push({glyphID:A,paletteIndex:d[g].paletteIndex})}this.updateColrTable(i,f)}setPaletteIndex(i,o,u){let d=this.get(i);d[o]?(d=d.map((f,g)=>({glyphID:f.glyph.index,paletteIndex:g===o?u:f.paletteIndex})),this.updateColrTable(i,d)):console.error("Invalid layer index")}remove(i,o,u=o){let d=this.get(i);d=d.map(f=>({glyphID:f.glyph.index,paletteIndex:f.paletteIndex})),d.splice(o,u-o+1),this.updateColrTable(i,d)}updateColrTable(i,o){this.ensureCOLR();let u=this.font.tables.colr,d=us(u.baseGlyphRecords,"glyphID",i);if(d===-1){let E={glyphID:i,firstLayerIndex:u.layerRecords.length,numLayers:0};d=ps(u.baseGlyphRecords,"glyphID",E)}let f=u.baseGlyphRecords[d],g=f.numLayers,A=o.length,_=A-g;if(_>0){let E=o.slice(g).map(M=>({glyphID:M.glyphID,paletteIndex:M.paletteIndex}));u.layerRecords.splice(f.firstLayerIndex+g,0,...E)}else _<0&&u.layerRecords.splice(f.firstLayerIndex+A,-_);for(let E=0;E<Math.min(g,A);E++)u.layerRecords[f.firstLayerIndex+E]={glyphID:o[E].glyphID,paletteIndex:o[E].paletteIndex};if(f.numLayers=A,_!==0)for(let E=0;E<u.baseGlyphRecords.length;E++){let M=u.baseGlyphRecords[E];E===d||M.firstLayerIndex<f.firstLayerIndex||(u.baseGlyphRecords[E].firstLayerIndex+=_)}}},yl=class{constructor(i){this.font=i,this.cache=new WeakMap}get(i){let o=this.getOrCreateSvgImageCacheEntry(i);return o&&o.image}getAsync(i){let o=this.getOrCreateSvgImageCacheEntry(i);return o&&o.promise}getOrCreateSvgImageCacheEntry(i){let o=this.font.tables.svg;if(o===void 0)return;let u=o.get(i);if(u===void 0)return;let d=this.cache.get(u);d===void 0&&(d=ru(u),this.cache.set(u,d));let f=d.images.get(i);return f===void 0&&(f=e0(this.font,d.template,i),f.promise.then(g=>{if(f.image=g,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(i)}catch(A){console.error("font.onGlyphUpdated",i,A)}}),d.images.set(i,f)),f}};function ru(i){return{template:t0(i).then(nu),images:new Map}}function e0(i,o,u){return{promise:o.then(d=>{let f;typeof d=="string"?f=d:(d[4]=u,f=d.join(""));let g=su(f,i.unitsPerEm);return g.image.decode().then(()=>g)}),image:void 0}}var t0=typeof DecompressionStream=="function"?Hf:zf;function zf(i){try{return Promise.resolve(new TextDecoder().decode(Kn(i)?rr(i):i))}catch(o){return Promise.reject(o)}}function Hf(i){if(Kn(i))return new Response(new Response(i).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(i))}catch(o){return Promise.reject(o)}}function nu(i){let o=i.indexOf("<svg"),u=i.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(i.substring(o,u)))return i;let d=i.lastIndexOf("</svg>");return[i.substring(0,u),"<defs>",i.substring(u,d),'</defs><use href="#glyph',"",'"/>',i.substring(d)]}function su(i,o){let u=new DOMParser().parseFromString(i,"image/svg+xml").documentElement,d=u.viewBox.baseVal,f=u.width.baseVal,g=u.height.baseVal,A=1,_=1;d.width>0&&d.height>0&&(f.unitType===1?(A=f.valueInSpecifiedUnits/d.width,_=g.unitType===1?g.valueInSpecifiedUnits/d.height:A):g.unitType===1?(_=g.valueInSpecifiedUnits/d.height,A=_):o&&(A=o/d.width,_=o/d.height));let E=document.createElement("div");E.style.position="fixed",E.style.visibility="hidden",E.appendChild(u),document.body.appendChild(E);let M=u.getBBox();document.body.removeChild(E);let R=(M.x-d.x)*A,Y=(d.y-M.y)*_,Z=M.width*A,me=M.height*_;u.setAttribute("viewBox",[M.x,M.y,M.width,M.height].join(" ")),A!==1&&u.setAttribute("width",Z),_!==1&&u.setAttribute("height",me);let ue=new Image(Z,me);return ue.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(u.outerHTML),{leftSideBearing:R,baseline:Y,image:ue}}var iu=new WeakMap;function ao(i,o,u,d,f){let g;return(o&d)>0?(g=i.parseByte(),(o&f)===0&&(g=-g),g=u+g):(o&f)>0?g=u:g=u+i.parseShort(),g}function _d(i,o,u){let d=new ct.Parser(o,u);i._numberOfContours=d.parseShort(),i._xMin=d.parseShort(),i._yMin=d.parseShort(),i._xMax=d.parseShort(),i._yMax=d.parseShort();let f,g;if(i._numberOfContours>0){let A=i.endPointIndices=[];for(let E=0;E<i._numberOfContours;E+=1)A.push(d.parseUShort());i.instructionLength=d.parseUShort(),i.instructions=[];for(let E=0;E<i.instructionLength;E+=1)i.instructions.push(d.parseByte());let _=A[A.length-1]+1;f=[];for(let E=0;E<_;E+=1)if(g=d.parseByte(),f.push(g),(g&8)>0){let M=d.parseByte();for(let R=0;R<M;R+=1)f.push(g),E+=1}if(xe.argument(f.length===_,"Bad flags."),A.length>0){let E=[],M;if(_>0){for(let Z=0;Z<_;Z+=1)g=f[Z],M={},M.onCurve=!!(g&1),M.lastPointOfContour=A.indexOf(Z)>=0,E.push(M);let R=0;for(let Z=0;Z<_;Z+=1)g=f[Z],M=E[Z],M.x=ao(d,g,R,2,16),R=M.x;let Y=0;for(let Z=0;Z<_;Z+=1)g=f[Z],M=E[Z],M.y=ao(d,g,Y,4,32),Y=M.y}i.points=E}else i.points=[]}else if(i._numberOfContours===0)i.points=[];else{i.isComposite=!0,i.points=[],i.components=[];let A=!0;for(;A;){f=d.parseUShort();let _={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(f&1)>0?(f&2)>0?(_.dx=d.parseShort(),_.dy=d.parseShort()):_.matchedPoints=[d.parseUShort(),d.parseUShort()]:(f&2)>0?(_.dx=d.parseChar(),_.dy=d.parseChar()):_.matchedPoints=[d.parseByte(),d.parseByte()],(f&8)>0?_.xScale=_.yScale=d.parseF2Dot14():(f&64)>0?(_.xScale=d.parseF2Dot14(),_.yScale=d.parseF2Dot14()):(f&128)>0&&(_.xScale=d.parseF2Dot14(),_.scale01=d.parseF2Dot14(),_.scale10=d.parseF2Dot14(),_.yScale=d.parseF2Dot14()),i.components.push(_),A=!!(f&32)}if(f&256){i.instructionLength=d.parseUShort(),i.instructions=[];for(let _=0;_<i.instructionLength;_+=1)i.instructions.push(d.parseByte())}}}function _a(i,o){let u=[];for(let d=0;d<i.length;d+=1){let f=i[d],g={x:o.xScale*f.x+o.scale10*f.y+o.dx,y:o.scale01*f.x+o.yScale*f.y+o.dy,onCurve:f.onCurve,lastPointOfContour:f.lastPointOfContour};u.push(g)}return u}function Wl(i){let o=[],u=[];for(let d=0;d<i.length;d+=1){let f=i[d];u.push(f),f.lastPointOfContour&&(o.push(u),u=[])}return xe.argument(u.length===0,"There are still points left in the current contour."),o}function au(i){let o=new nt;if(!i)return o;let u=Wl(i);for(let d=0;d<u.length;++d){let f=u[d],g=f[f.length-1],A=f[0];if(g.onCurve)o.moveTo(g.x,g.y);else if(A.onCurve)o.moveTo(A.x,A.y);else{let _={x:(g.x+A.x)*.5,y:(g.y+A.y)*.5};o.moveTo(_.x,_.y)}for(let _=0;_<f.length;++_)if(g=A,A=f[(_+1)%f.length],g.onCurve)o.lineTo(g.x,g.y);else{let E=A;A.onCurve||(E={x:(g.x+A.x)*.5,y:(g.y+A.y)*.5}),o.quadraticCurveTo(g.x,g.y,E.x,E.y)}o.closePath()}return o}function ka(i,o){if(o.isComposite){iu.has(i)||iu.set(i,new Set);let u=iu.get(i);u.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let f=o.components[d];if(u.has(f.glyphIndex))continue;let g=i.get(f.glyphIndex);if(g.getPath(),g.points){let A;if(f.matchedPoints===void 0)A=_a(g.points,f);else{if(f.matchedPoints[0]>o.points.length-1||f.matchedPoints[1]>g.points.length-1)throw Error("Matched points out of range in "+o.name);let _=o.points[f.matchedPoints[0]],E=g.points[f.matchedPoints[1]],M={xScale:f.xScale,scale01:f.scale01,scale10:f.scale10,yScale:f.yScale,dx:0,dy:0};E=_a([E],M)[0],M.dx=_.x-E.x,M.dy=_.y-E.y,A=_a(g.points,M)}o.points=o.points.concat(A)}}}finally{u.delete(o.index)}}return au(o.points)}function kd(i,o,u,d){let f=new Vn.GlyphSet(d);for(let g=0;g<u.length-1;g+=1){let A=u[g],_=u[g+1];A!==_?f.push(g,Vn.ttfGlyphLoader(d,g,_d,i,o+A,ka)):f.push(g,Vn.glyphLoader(d,g))}return f}function wl(i,o,u,d){let f=new Vn.GlyphSet(d);return d._push=function(g){let A=u[g],_=u[g+1];A!==_?f.push(g,Vn.ttfGlyphLoader(d,g,_d,i,o+A,ka)):f.push(g,Vn.glyphLoader(d,g))},f}function Wf(i,o,u,d,f){return f.lowMemory?wl(i,o,u,d):kd(i,o,u,d)}var Ua={getPath:au,parse:Wf},za=class{constructor(i){this.font=i}normalizeCoordTags(i){for(let o in i)if(o.length<4){let u=o.padEnd(4," ");i[u]===void 0&&(i[u]=i[o]),delete i[o]}}getNormalizedCoords(i){i||(i=this.font.variation.get());let o=[];this.normalizeCoordTags(i);for(let u=0;u<this.fvar().axes.length;u++){let d=this.fvar().axes[u],f=i[d.tag];f===void 0&&(f=d.defaultValue),f<d.defaultValue?o.push((f-d.defaultValue+Number.EPSILON)/(d.defaultValue-d.minValue+Number.EPSILON)):o.push((f-d.defaultValue+Number.EPSILON)/(d.maxValue-d.defaultValue+Number.EPSILON))}if(this.avar())for(let u=0;u<this.avar().axisSegmentMaps.length;u++){let d=this.avar().axisSegmentMaps[u];for(let f=0;f<d.axisValueMaps.length;f++){let g=d.axisValueMaps[f];if(f>=1&&o[u]<g.fromCoordinate){let A=d.axisValueMaps[f-1];o[u]=((o[u]-A.fromCoordinate)*(g.toCoordinate-A.toCoordinate)+Number.EPSILON)/(g.fromCoordinate-A.fromCoordinate+Number.EPSILON)+A.toCoordinate;break}}}return o}interpolatePoints(i,o,u){if(i.length===0)return;let d=0;for(;d<i.length;){let f=d,g=d,A=i[g];for(;!A.lastPointOfContour;)A=i[++g];for(;d<=g&&!u[d];)d++;if(d>g)continue;let _=d,E=d;for(d++;d<=g;)u[d]&&(this.deltaInterpolate(E+1,d-1,E,d,o,i),E=d),d++;E===_?this.deltaShift(f,g,E,o,i):(this.deltaInterpolate(E+1,g,E,_,o,i),_>0&&this.deltaInterpolate(f,_-1,E,_,o,i)),d=g+1}}deltaInterpolate(i,o,u,d,f,g){if(i>o)return;let A=["x","y"];for(let E=0;E<A.length;E++){let M=A[E];if(f[u][M]>f[d][M]){var _=u;u=d,d=_}let R=f[u][M],Y=f[d][M],Z=g[u][M],me=g[d][M];if(R!==Y||Z===me){let ue=R===Y?0:(me-Z)/(Y-R);for(let Ae=i;Ae<=o;Ae++){let Ze=f[Ae][M];Ze<=R?Ze+=Z-R:Ze>=Y?Ze+=me-Y:Ze=Z+(Ze-R)*ue,g[Ae][M]=Ze}}}}deltaShift(i,o,u,d,f){let g=f[u].x-d[u].x,A=f[u].y-d[u].y;if(!(g===0&&A===0))for(let _=i;_<=o;_++)_!==u&&(f[_].x+=g,f[_].y+=A)}transformComponents(i,o,u,d,f,g){let A=0;for(let _=0;_<i.components.length;_++){let E=i.components[_],M=this.font.glyphs.get(E.glyphIndex),R=ms(E),Y=d.indexOf(_);Y>-1&&(R.dx+=Math.round(f.deltas[Y]*g),R.dy+=Math.round(f.deltasY[Y]*g));let Z=_a(this.getTransform(M,u).points,R);o.splice(A,Z.length,...Z),A+=M.points.length}}applyTupleVariationStore(i,o,u,d="gvar",f={}){u||(u=this.font.variation.get());let g=this.getNormalizedCoords(u),{headers:A,sharedPoints:_}=i,E=this.fvar().axes.length,M;d==="gvar"?M=o.map(un):d==="cvar"&&(M=[...o]);for(let R=0;R<A.length;R++){let Y=A[R],Z=1;for(let ue=0;ue<E;ue++){let Ae=[0];switch(d){case"gvar":Ae=Y.peakTuple?Y.peakTuple:this.gvar().sharedTuples[Y.sharedTupleRecordsIndex];break;case"cvar":Ae=Y.peakTuple;break}if(Ae[ue]!==0){if(g[ue]===0){Z=0;break}if(Y.intermediateStartTuple)if(g[ue]<Y.intermediateStartTuple[ue]||g[ue]>Y.intermediateEndTuple[ue]){Z=0;break}else g[ue]<Ae[ue]?Z=Z*(g[ue]-Y.intermediateStartTuple[ue]+Number.EPSILON)/(Ae[ue]-Y.intermediateStartTuple[ue]+Number.EPSILON):Z=Z*(Y.intermediateEndTuple[ue]-g[ue]+Number.EPSILON)/(Y.intermediateEndTuple[ue]-Ae[ue]+Number.EPSILON);else{if(g[ue]<Math.min(0,Ae[ue])||g[ue]>Math.max(0,Ae[ue])){Z=0;break}Z=(Z*g[ue]+Number.EPSILON)/(Ae[ue]+Number.EPSILON)}}}if(Z===0)continue;let me=Y.privatePoints.length?Y.privatePoints:_;if(d==="gvar"&&f.glyph&&f.glyph.isComposite)this.transformComponents(f.glyph,M,u,me,Y,Z);else if(me.length===0)for(let ue=0;ue<M.length;ue++){let Ae=M[ue];d==="gvar"?M[ue]={x:Math.round(Ae.x+Y.deltas[ue]*Z),y:Math.round(Ae.y+Y.deltasY[ue]*Z),onCurve:Ae.onCurve,lastPointOfContour:Ae.lastPointOfContour}:d==="cvar"&&(M[ue]=Math.round(Ae+Y.deltas[ue]*Z))}else{let ue;d==="gvar"?ue=M.map(un):d==="cvar"&&(ue=M);let Ae=Array(o.length).fill(!1);for(let Ze=0;Ze<me.length;Ze++){let ur=me[Ze];if(ur<o.length){let nr=ue[ur];d==="gvar"?(Ae[ur]=!0,nr.x+=Y.deltas[Ze]*Z,nr.y+=Y.deltasY[Ze]*Z):d==="cvar"&&(M[ur]=Math.round(nr+Y.deltas[Ze]*Z))}}if(d==="gvar"){this.interpolatePoints(ue,M,Ae);for(let Ze=0;Ze<o.length;Ze++){let ur=ue[Ze].x-M[Ze].x,nr=ue[Ze].y-M[Ze].y;M[Ze].x=Math.round(M[Ze].x+ur),M[Ze].y=Math.round(M[Ze].y+nr)}}}}return M}getTransform(i,o){Number.isInteger(i)&&(i=this.font.glyphs.get(i));let u=i.getBlendPath,d=!!(i.points&&i.points.length),f=i;if(u||d){if(o||(o=this.font.variation.get()),d){let g=this.gvar()&&this.gvar().glyphVariations[i.index];if(g){let A=i.points,_=this.applyTupleVariationStore(g,A,o,"gvar",{glyph:i});f=new Fn(Object.assign({},i,{points:_,path:au(_)}))}}else if(u){let g=i.getBlendPath(o);f=new Fn(Object.assign({},i,{path:g}))}}return this.font.tables.hvar&&(i._advanceWidth=typeof i._advanceWidth<"u"?i._advanceWidth:i.advanceWidth,i.advanceWidth=f.advanceWidth=Math.round(i._advanceWidth+this.getVariableAdjustment(f.index,"hvar","advanceWidth",o)),i._leftSideBearing=typeof i._leftSideBearing<"u"?i._leftSideBearing:i.leftSideBearing,i.leftSideBearing=f.leftSideBearing=Math.round(i._leftSideBearing+this.getVariableAdjustment(f.index,"hvar","lsb",o))),f}getCvarTransform(i){let o=this.font.tables.cvt,u=this.cvar();return!o||!o.length||!u||!u.headers.length?o:this.applyTupleVariationStore(u,o,i,"cvar")}getVariableAdjustment(i,o,u,d){d=d||this.font.variation.get();let f,g,A=this.font.tables[o];if(!A)throw Error(`trying to get variation adjustment from non-existent table "${A}"`);if(!A.itemVariationStore)throw Error(`trying to get variation adjustment from table "${A}" which does not have an itemVariationStore`);let _=A[u]&&A[u].map.length;if(_){let E=i;E>=_&&(E=_-1),{outerIndex:f,innerIndex:g}=A[u].map[E]}else f=0,g=i;return this.getDelta(A.itemVariationStore,f,g,d)}getDelta(i,o,u,d){if(o>=i.itemVariationSubtables.length)return 0;let f=i.itemVariationSubtables[o];if(u>=f.deltaSets.length)return 0;let g=f.deltaSets[u],A=this.getBlendVector(i,o,d),_=0;for(let E=0;E<f.regionIndexes.length;E++)_+=g[E]*A[E];return _}getBlendVector(i,o,u){u||(u=this.font.variation.get());let d=i.itemVariationSubtables[o],f=this.getNormalizedCoords(u),g=[];for(let A=0;A<d.regionIndexes.length;A++){let _=1,E=d.regionIndexes[A],M=i.variationRegions[E].regionAxes;for(let R=0;R<M.length;R++){let Y=M[R],Z;Y.startCoord>Y.peakCoord||Y.peakCoord>Y.endCoord||Y.startCoord<0&&Y.endCoord>0&&Y.peakCoord!==0||Y.peakCoord===0?Z=1:f[R]<Y.startCoord||f[R]>Y.endCoord?Z=0:f[R]===Y.peakCoord?Z=1:f[R]<Y.peakCoord?Z=(f[R]-Y.startCoord+Number.EPSILON)/(Y.peakCoord-Y.startCoord+Number.EPSILON):Z=(Y.endCoord-f[R]+Number.EPSILON)/(Y.endCoord-Y.peakCoord+Number.EPSILON),_*=Z}g[A]=_}return g}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},Gl=class{constructor(i){this.font=i,this.process=new za(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let i=this.getDefaultInstanceIndex();i>-1?this.set(i):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((i,o)=>(i[o.tag]=o.defaultValue,i),{})}getDefaultInstanceIndex(){let i=this.getDefaultCoordinates(),o=this.getInstanceIndex(i);return o<0&&(o=this.fvar().instances.findIndex(u=>u.name&&u.name.en==="Regular")),o}getInstanceIndex(i){return this.fvar().instances.findIndex(o=>Object.keys(i).every(u=>o.coordinates[u]===i[u]))}getInstance(i){return this.fvar().instances&&this.fvar().instances[i]}set(i){let o;if(Number.isInteger(i)){let u=this.getInstance(i);if(!u)throw Error(`Invalid instance index ${i}`);o={...u.coordinates}}else o=i,this.process.normalizeCoordTags(o);o=Object.assign({},this.font.defaultRenderOptions.variation,o),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:o})}get(){return Object.assign({},this.font.defaultRenderOptions.variation)}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},Cc=1e6,r0=64,n0=1e4,Id,Al,s0,ql;function ou(i){this.font=i,this.getCommands=function(o){return Ua.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function jo(i){return i}function Ko(i){return Math.sign(i)*Math.round(Math.abs(i))}function i0(i){return Math.sign(i)*Math.round(Math.abs(i*2))/2}function Gf(i){return Math.sign(i)*(Math.round(Math.abs(i)+.5)-.5)}function Sc(i){return Math.sign(i)*Math.ceil(Math.abs(i))}function Ed(i){return Math.sign(i)*Math.floor(Math.abs(i))}var lu=function(i){let o=this.srPeriod,u=this.srPhase,d=this.srThreshold,f=1;return i<0&&(i=-i,f=-1),i+=d-u,i=Math.trunc(i/o)*o,i+=u,i<0?u*f:i*f},Ha={x:1,y:0,axis:"x",distance:function(i,o,u,d){return(u?i.xo:i.x)-(d?o.xo:o.x)},interpolate:function(i,o,u,d){let f,g,A,_,E,M,R;if(!d||d===this){if(f=i.xo-o.xo,g=i.xo-u.xo,E=o.x-o.xo,M=u.x-u.xo,A=Math.abs(f),_=Math.abs(g),R=A+_,R===0){i.x=i.xo+(E+M)/2;return}i.x=i.xo+(E*_+M*A)/R;return}if(f=d.distance(i,o,!0,!0),g=d.distance(i,u,!0,!0),E=d.distance(o,o,!1,!0),M=d.distance(u,u,!1,!0),A=Math.abs(f),_=Math.abs(g),R=A+_,R===0){Ha.setRelative(i,i,(E+M)/2,d,!0);return}Ha.setRelative(i,i,(E*_+M*A)/R,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(i,o,u,d,f){if(!d||d===this){i.x=(f?o.xo:o.x)+u;return}let g=f?o.xo:o.x,A=f?o.yo:o.y,_=g+u*d.x,E=A+u*d.y;i.x=_+(i.y-E)/d.normalSlope},slope:0,touch:function(i){i.xTouched=!0},touched:function(i){return i.xTouched},untouch:function(i){i.xTouched=!1}},oo={x:0,y:1,axis:"y",distance:function(i,o,u,d){return(u?i.yo:i.y)-(d?o.yo:o.y)},interpolate:function(i,o,u,d){let f,g,A,_,E,M,R;if(!d||d===this){if(f=i.yo-o.yo,g=i.yo-u.yo,E=o.y-o.yo,M=u.y-u.yo,A=Math.abs(f),_=Math.abs(g),R=A+_,R===0){i.y=i.yo+(E+M)/2;return}i.y=i.yo+(E*_+M*A)/R;return}if(f=d.distance(i,o,!0,!0),g=d.distance(i,u,!0,!0),E=d.distance(o,o,!1,!0),M=d.distance(u,u,!1,!0),A=Math.abs(f),_=Math.abs(g),R=A+_,R===0){oo.setRelative(i,i,(E+M)/2,d,!0);return}oo.setRelative(i,i,(E*_+M*A)/R,d,!0)},normalSlope:0,setRelative:function(i,o,u,d,f){if(!d||d===this){i.y=(f?o.yo:o.y)+u;return}let g=f?o.xo:o.x,A=f?o.yo:o.y,_=g+u*d.x,E=A+u*d.y;i.y=E+d.normalSlope*(i.x-_)},slope:Number.POSITIVE_INFINITY,touch:function(i){i.yTouched=!0},touched:function(i){return i.yTouched},untouch:function(i){i.yTouched=!1}};Object.freeze(Ha),Object.freeze(oo);function Vl(i,o){this.x=i,this.y=o,this.axis=void 0,this.slope=o/i,this.normalSlope=-i/o,Object.freeze(this)}Vl.prototype.distance=function(i,o,u,d){return this.x*Ha.distance(i,o,u,d)+this.y*oo.distance(i,o,u,d)},Vl.prototype.interpolate=function(i,o,u,d){let f,g,A,_,E,M,R;if(A=d.distance(i,o,!0,!0),_=d.distance(i,u,!0,!0),f=d.distance(o,o,!1,!0),g=d.distance(u,u,!1,!0),E=Math.abs(A),M=Math.abs(_),R=E+M,R===0){this.setRelative(i,i,(f+g)/2,d,!0);return}this.setRelative(i,i,(f*M+g*E)/R,d,!0)},Vl.prototype.setRelative=function(i,o,u,d,f){d=d||this;let g=f?o.xo:o.x,A=f?o.yo:o.y,_=g+u*d.x,E=A+u*d.y,M=d.normalSlope,R=this.slope,Y=i.x,Z=i.y;i.x=(R*Y-M*_+E-Z)/(R-M),i.y=R*(i.x-Y)+Z},Vl.prototype.touch=function(i){i.xTouched=!0,i.yTouched=!0};function Do(i,o){let u=Math.sqrt(i*i+o*o);return i/=u,o/=u,i===1&&o===0?Ha:i===0&&o===1?oo:new Vl(i,o)}function si(i,o,u,d){this.x=this.xo=Math.round(i*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=u,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}si.prototype.nextTouched=function(i){let o=this.nextPointOnContour;for(;!i.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},si.prototype.prevTouched=function(i){let o=this.prevPointOnContour;for(;!i.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var Zl=Object.freeze(new si(0,0)),Nd={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function Wa(i,o){switch(this.env=i,this.stack=[],this.prog=o,i){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Ha,this.round=Ko}}ou.prototype.exec=function(i,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let u=this.font,d=this._prepState;if(!d||d.ppem!==o){let f=this._fpgmState;if(!f){Wa.prototype=Nd,f=this._fpgmState=new Wa("fpgm",u.tables.fpgm),f.funcs=[],f.font=u,f.instructionCount=0,f.callDepth=0;try{Al(f)}catch(A){console.log("Hinting error in FPGM:"+A),this._errorState=3;return}}Wa.prototype=f,d=this._prepState=new Wa("prep",u.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let g=u.variation&&u.variation.process.getCvarTransform()||u.tables.cvt;if(g){let A=d.cvt=new Array(g.length),_=o/u.unitsPerEm;for(let E=0;E<g.length;E++)A[E]=g[E]*_}else d.cvt=[];try{Al(d)}catch(A){this._errorState<2&&console.log("Hinting error in PREP:"+A),this._errorState=2}}if(!(this._errorState>1))try{return s0(i,d)}catch(f){this._errorState<1&&(console.log("Hinting error:"+f),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},s0=function(i,o){let u=o.ppem/o.font.unitsPerEm,d=u,f=i.components,g,A,_;if(Wa.prototype=o,!f)_=new Wa("glyf",i.instructions),_.instructionCount=0,_.callDepth=0,ql(i,_,u,d),A=_.gZone;else{let E=o.font;A=[],g=[];for(let M=0;M<f.length;M++){let R=f[M],Y=E.glyphs.get(R.glyphIndex);_=new Wa("glyf",Y.instructions),_.instructionCount=0,_.callDepth=0,ql(Y,_,u,d);let Z=Math.round(R.dx*u),me=Math.round(R.dy*d),ue=_.gZone,Ae=_.contours;for(let ur=0;ur<ue.length;ur++){let nr=ue[ur];nr.xTouched=nr.yTouched=!1,nr.xo=nr.x=nr.x+Z,nr.yo=nr.y=nr.y+me}let Ze=A.length;A.push.apply(A,ue);for(let ur=0;ur<Ae.length;ur++)g.push(Ae[ur]+Ze)}i.instructions&&!_.inhibitGridFit&&(_=new Wa("glyf",i.instructions),_.gZone=_.z0=_.z1=_.z2=A,_.contours=g,A.push(new si(0,0),new si(Math.round(i.advanceWidth*u),0)),Al(_),A.length-=2)}return A},ql=function(i,o,u,d){let f=i.points||[],g=f.length,A=o.gZone=o.z0=o.z1=o.z2=[],_=o.contours=[],E;for(let Y=0;Y<g;Y++)E=f[Y],A[Y]=new si(E.x*u,E.y*d,E.lastPointOfContour,E.onCurve);let M,R;for(let Y=0;Y<g;Y++)E=A[Y],M||(M=E,_.push(Y)),E.lastPointOfContour?(E.nextPointOnContour=M,M.prevPointOnContour=E,M=void 0):(R=A[Y+1],E.nextPointOnContour=R,R.prevPointOnContour=E);o.inhibitGridFit||(A.push(new si(0,0),new si(Math.round(i.advanceWidth*u),0)),Al(o),A.length-=2)},Al=function(i){let o=i.prog;if(!o)return;let u=o.length,d;for(i.ip=0;i.ip<u;i.ip++){if(++i.instructionCount>Cc)throw new Error("Hinting instructions exceeded maximum of "+Cc);if(d=Id[o[i.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[i.ip]).toString(16));d(i)}};function a0(i){let o=i.tZone=new Array(i.gZone.length);for(let u=0;u<o.length;u++)o[u]=new si(0,0)}function cu(i,o){let u=i.prog,d=i.ip,f=1,g;do if(g=u[++d],g===88)f++;else if(g===89)f--;else if(g===64)d+=u[d+1]+1;else if(g===65)d+=2*u[d+1]+1;else if(g>=176&&g<=183)d+=g-176+1;else if(g>=184&&g<=191)d+=(g-184+1)*2;else if(o&&f===1&&g===27)break;while(f>0);i.ip=d}function o0(i,o){o.fv=o.pv=o.dpv=i}function l0(i,o){o.pv=o.dpv=i}function Rd(i,o){o.fv=i}function uu(i,o){let u=o.stack,d=u.pop(),f=u.pop(),g=o.z2[d],A=o.z1[f],_,E;i?(_=g.y-A.y,E=A.x-g.x):(_=A.x-g.x,E=A.y-g.y),o.pv=o.dpv=Do(_,E)}function c0(i,o){let u=o.stack,d=u.pop(),f=u.pop(),g=o.z2[d],A=o.z1[f],_,E;i?(_=g.y-A.y,E=A.x-g.x):(_=A.x-g.x,E=A.y-g.y),o.fv=Do(_,E)}function Md(i){let o=i.stack,u=o.pop(),d=o.pop();i.pv=i.dpv=Do(d,u)}function pi(i){let o=i.stack,u=o.pop(),d=o.pop();i.fv=Do(d,u)}function Lc(i){let o=i.stack,u=i.pv;o.push(u.x*16384),o.push(u.y*16384)}function du(i){let o=i.stack,u=i.fv;o.push(u.x*16384),o.push(u.y*16384)}function _c(i){i.fv=i.pv}function Yl(i){let o=i.stack,u=o.pop(),d=o.pop(),f=o.pop(),g=o.pop(),A=o.pop(),_=i.z0,E=i.z1,M=_[u],R=_[d],Y=E[f],Z=E[g],me=i.z2[A],ue=M.x,Ae=M.y,Ze=R.x,ur=R.y,nr=Y.x,kr=Y.y,zr=Z.x,Qn=Z.y,Xn=(ue-Ze)*(kr-Qn)-(Ae-ur)*(nr-zr),Jn=ue*ur-Ae*Ze,Zs=nr*Qn-kr*zr;me.x=(Jn*(nr-zr)-Zs*(ue-Ze))/Xn,me.y=(Jn*(kr-Qn)-Zs*(Ae-ur))/Xn}function Vs(i){i.rp0=i.stack.pop()}function qf(i){i.rp1=i.stack.pop()}function jd(i){i.rp2=i.stack.pop()}function Vf(i){let o=i.stack.pop();switch(i.zp0=o,o){case 0:i.tZone||a0(i),i.z0=i.tZone;break;case 1:i.z0=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function Dd(i){let o=i.stack.pop();switch(i.zp1=o,o){case 0:i.tZone||a0(i),i.z1=i.tZone;break;case 1:i.z1=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function Qd(i){let o=i.stack.pop();switch(i.zp2=o,o){case 0:i.tZone||a0(i),i.z2=i.tZone;break;case 1:i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function T(i){let o=i.stack.pop();switch(i.zp0=i.zp1=i.zp2=o,o){case 0:i.tZone||a0(i),i.z0=i.z1=i.z2=i.tZone;break;case 1:i.z0=i.z1=i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function D(i){i.loop=i.stack.pop(),i.loop>n0&&(i.loop=n0)}function ie(i){i.round=Ko}function De(i){i.round=Gf}function dt(i){let o=i.stack.pop();i.minDis=o/64}function Ot(i){cu(i,!1)}function wr(i){let o=i.stack.pop();i.ip+=o-1}function Dn(i){let o=i.stack.pop();i.cvCutIn=o/64}function bn(i){let o=i.stack;o.push(o[o.length-1])}function ln(i){i.stack.pop()}function ii(i){i.stack.length=0}function Sn(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u),o.push(d)}function Bi(i){let o=i.stack;o.push(o.length)}function Qo(i){let o=i.stack,u=o.pop(),d=o.pop();if(d>n0&&(d=n0),++i.callDepth>r0)throw new Error("Hinting call depth exceeded maximum of "+r0);let f=i.ip,g=i.prog;i.prog=i.funcs[u];for(let A=0;A<d;A++)Al(i);i.ip=f,i.prog=g,i.callDepth--}function Xo(i){let o=i.stack.pop();if(++i.callDepth>r0)throw new Error("Hinting call depth exceeded maximum of "+r0);let u=i.ip,d=i.prog;i.prog=i.funcs[o],Al(i),i.ip=u,i.prog=d,i.callDepth--}function Kl(i){let o=i.stack,u=o.pop();o.push(o[o.length-u])}function $n(i){let o=i.stack,u=o.pop();o.push(o.splice(o.length-u,1)[0])}function kc(i){if(i.env!=="fpgm")throw new Error("FDEF not allowed here");let o=i.stack,u=i.prog,d=i.ip,f=o.pop(),g=d;for(;u[++d]!==45;);i.ip=d,i.funcs[f]=u.slice(g+1,d)}function Ga(i,o){let u=o.stack.pop(),d=o.z0[u],f=o.fv,g=o.pv,A=g.distance(d,Zl);i&&(A=o.round(A)),f.setRelative(d,Zl,A,g),f.touch(d),o.rp0=o.rp1=u}function Bd(i,o){let u=o.z2,d=u.length-2,f,g,A;for(let _=0;_<d;_++)f=u[_],!i.touched(f)&&(g=f.prevTouched(i),g!==f&&(A=f.nextTouched(i),g===A&&i.setRelative(f,f,i.distance(g,g,!1,!0),i,!0),i.interpolate(f,g,A,i)))}function u0(i,o){let u=o.stack,d=i?o.rp1:o.rp2,f=(i?o.z0:o.z1)[d],g=o.fv,A=o.pv,_=o.loop,E=o.z2;for(;_--;){let M=u.pop(),R=E[M],Y=A.distance(f,f,!1,!0);g.setRelative(R,R,Y,A),g.touch(R)}o.loop=1}function J1(i,o){let u=o.stack,d=i?o.rp1:o.rp2,f=(i?o.z0:o.z1)[d],g=o.fv,A=o.pv,_=u.pop(),E=o.z2[o.contours[_]],M=E,R=A.distance(f,f,!1,!0);do M!==f&&g.setRelative(M,M,R,A),M=M.nextPointOnContour;while(M!==E)}function eg(i,o){let u=o.stack,d=i?o.rp1:o.rp2,f=(i?o.z0:o.z1)[d],g=o.fv,A=o.pv,_=u.pop(),E;switch(_){case 0:E=o.tZone;break;case 1:E=o.gZone;break;default:throw new Error("Invalid zone")}let M,R=A.distance(f,f,!1,!0),Y=E.length-2;for(let Z=0;Z<Y;Z++)M=E[Z],g.setRelative(M,M,R,A)}function dv(i){let o=i.stack,u=i.loop,d=i.fv,f=o.pop()/64,g=i.z2;for(;u--;){let A=o.pop(),_=g[A];d.setRelative(_,_,f),d.touch(_)}i.loop=1}function hv(i){let o=i.stack,u=i.rp1,d=i.rp2,f=i.loop,g=i.z0[u],A=i.z1[d],_=i.fv,E=i.dpv,M=i.z2;for(;f--;){let R=o.pop(),Y=M[R];_.interpolate(Y,g,A,E),_.touch(Y)}i.loop=1}function tg(i,o){let u=o.stack,d=u.pop()/64,f=u.pop(),g=o.z1[f],A=o.z0[o.rp0],_=o.fv,E=o.pv;_.setRelative(g,A,d,E),_.touch(g),o.rp1=o.rp0,o.rp2=f,i&&(o.rp0=f)}function fv(i){let o=i.stack,u=i.rp0,d=i.z0[u],f=i.loop,g=i.fv,A=i.pv,_=i.z1;for(;f--;){let E=o.pop(),M=_[E];g.setRelative(M,d,0,A),g.touch(M)}i.loop=1}function pv(i){i.round=i0}function rg(i,o){let u=o.stack,d=u.pop(),f=u.pop(),g=o.z0[f],A=o.fv,_=o.pv,E=o.cvt[d],M=_.distance(g,Zl);i&&(Math.abs(M-E)<o.cvCutIn&&(M=E),M=o.round(M)),A.setRelative(g,Zl,M,_),o.zp0===0&&(g.xo=g.x,g.yo=g.y),A.touch(g),o.rp0=o.rp1=f}function mv(i){let o=i.prog,u=i.ip,d=i.stack,f=o[++u];for(let g=0;g<f;g++)d.push(o[++u]);i.ip=u}function gv(i){let o=i.ip,u=i.prog,d=i.stack,f=u[++o];for(let g=0;g<f;g++){let A=u[++o]<<8|u[++o];A&32768&&(A=-((A^65535)+1)),d.push(A)}i.ip=o}function xv(i){let o=i.stack,u=i.store;u||(u=i.store=[]);let d=o.pop(),f=o.pop();u[f]=d}function bv(i){let o=i.stack,u=i.store,d=o.pop(),f=u&&u[d]||0;o.push(f)}function vv(i){let o=i.stack,u=o.pop(),d=o.pop();i.cvt[d]=u/64}function yv(i){let o=i.stack,u=o.pop();o.push(i.cvt[u]*64)}function ng(i,o){let u=o.stack,d=u.pop(),f=o.z2[d];u.push(o.dpv.distance(f,Zl,i,!1)*64)}function sg(i,o){let u=o.stack,d=u.pop(),f=u.pop(),g=o.z1[d],A=o.z0[f],_=o.dpv.distance(A,g,i,i);o.stack.push(Math.round(_*64))}function wv(i){i.stack.push(i.ppem)}function Av(i){i.autoFlip=!0}function Tv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d<u?1:0)}function Cv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d<=u?1:0)}function Sv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d>u?1:0)}function Lv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d>=u?1:0)}function _v(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u===d?1:0)}function kv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u!==d?1:0)}function Iv(i){let o=i.stack,u=o.pop();o.push(Math.trunc(u)&1?1:0)}function Ev(i){let o=i.stack,u=o.pop();o.push(Math.trunc(u)&1?0:1)}function Nv(i){let o=i.stack.pop(),u;o||cu(i,!0)}function Rv(i){}function Mv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u&&d?1:0)}function jv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u||d?1:0)}function Dv(i){let o=i.stack,u=o.pop();o.push(u?0:1)}function Zf(i,o){let u=o.stack,d=u.pop(),f=o.fv,g=o.pv,A=o.ppem,_=o.deltaBase+(i-1)*16,E=o.deltaShift,M=o.z0;for(let R=0;R<d;R++){let Y=u.pop(),Z=u.pop();if(_+((Z&240)>>4)!==A)continue;let me=(Z&15)-8;me>=0&&me++;let ue=M[Y];f.setRelative(ue,ue,me*E,g)}}function Qv(i){let o=i.stack.pop();i.deltaBase=o}function Bv(i){let o=i.stack.pop();i.deltaShift=Math.pow(.5,o)}function Pv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d+u)}function Ov(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d-u)}function Fv(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d*64/u)}function $v(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d*u/64)}function Uv(i){let o=i.stack,u=o.pop();o.push(Math.abs(u))}function zv(i){let o=i.stack,u=o.pop();o.push(-u)}function Hv(i){let o=i.stack,u=o.pop();o.push(Math.floor(u/64)*64)}function Wv(i){let o=i.stack,u=o.pop();o.push(Math.ceil(u/64)*64)}function Pd(i,o){let u=o.stack,d=u.pop();u.push(o.round(d/64)*64)}function Gv(i){let o=i.stack,u=o.pop(),d=o.pop();i.cvt[d]=u*i.ppem/i.font.unitsPerEm}function Yf(i,o){let u=o.stack,d=u.pop(),f=o.ppem,g=o.deltaBase+(i-1)*16,A=o.deltaShift;for(let _=0;_<d;_++){let E=u.pop(),M=u.pop();if(g+((M&240)>>4)!==f)continue;let R=(M&15)-8;R>=0&&R++;let Y=R*A;o.cvt[E]+=Y}}function qv(i){let o=i.stack.pop();i.round=lu;let u;switch(o&192){case 0:u=.5;break;case 64:u=1;break;case 128:u=2;break;default:throw new Error("invalid SROUND value")}switch(i.srPeriod=u,o&48){case 0:i.srPhase=0;break;case 16:i.srPhase=.25*u;break;case 32:i.srPhase=.5*u;break;case 48:i.srPhase=.75*u;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?i.srThreshold=0:i.srThreshold=(o/8-.5)*u}function Vv(i){let o=i.stack.pop();i.round=lu;let u;switch(o&192){case 0:u=Math.sqrt(2)/2;break;case 64:u=Math.sqrt(2);break;case 128:u=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(i.srPeriod=u,o&48){case 0:i.srPhase=0;break;case 16:i.srPhase=.25*u;break;case 32:i.srPhase=.5*u;break;case 48:i.srPhase=.75*u;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?i.srThreshold=0:i.srThreshold=(o/8-.5)*u}function Zv(i){i.round=jo}function Yv(i){i.round=Sc}function Kv(i){i.round=Ed}function Xv(i){let o=i.stack.pop()}function ig(i,o){let u=o.stack,d=u.pop(),f=u.pop(),g=o.z2[d],A=o.z1[f],_,E;i?(_=g.y-A.y,E=A.x-g.x):(_=A.x-g.x,E=A.y-g.y),o.dpv=Do(_,E)}function Jv(i){let o=i.stack,u=o.pop(),d=0;u&1&&(d=35),u&32&&(d|=4096),o.push(d)}function ey(i){let o=i.stack,u=o.pop(),d=o.pop(),f=o.pop();o.push(d),o.push(u),o.push(f)}function ty(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(Math.max(d,u))}function ry(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(Math.min(d,u))}function ny(i){let o=i.stack.pop()}function sy(i){let o=i.stack.pop(),u=i.stack.pop();switch(o){case 1:i.inhibitGridFit=!!u;return;case 2:i.ignoreCvt=!!u;return;default:throw new Error("invalid INSTCTRL[] selector")}}function Xl(i,o){let u=o.stack,d=o.prog,f=o.ip;for(let g=0;g<i;g++)u.push(d[++f]);o.ip=f}function Jl(i,o){let u=o.ip,d=o.prog,f=o.stack;for(let g=0;g<i;g++){let A=d[++u]<<8|d[++u];A&32768&&(A=-((A^65535)+1)),f.push(A)}o.ip=u}function ir(i,o,u,d,f,g){let A=g.stack,_=i&&A.pop(),E=A.pop(),M=g.rp0,R=g.z0[M],Y=g.z1[E],Z=g.minDis,me=g.fv,ue=g.dpv,Ae,Ze,ur,nr;Ze=Ae=ue.distance(Y,R,!0,!0),ur=Ze>=0?1:-1,Ze=Math.abs(Ze),i&&(nr=g.cvt[_],d&&Math.abs(Ze-nr)<g.cvCutIn&&(Ze=nr)),u&&Ze<Z&&(Ze=Z),d&&(Ze=g.round(Ze)),me.setRelative(Y,R,ur*Ze,ue),me.touch(Y),g.rp1=g.rp0,g.rp2=E,o&&(g.rp0=E)}Id=[o0.bind(void 0,oo),o0.bind(void 0,Ha),l0.bind(void 0,oo),l0.bind(void 0,Ha),Rd.bind(void 0,oo),Rd.bind(void 0,Ha),uu.bind(void 0,0),uu.bind(void 0,1),c0.bind(void 0,0),c0.bind(void 0,1),Md,pi,Lc,du,_c,Yl,Vs,qf,jd,Vf,Dd,Qd,T,D,ie,De,dt,Ot,wr,Dn,void 0,void 0,bn,ln,ii,Sn,Bi,Kl,$n,void 0,void 0,void 0,Qo,Xo,kc,void 0,Ga.bind(void 0,0),Ga.bind(void 0,1),Bd.bind(void 0,oo),Bd.bind(void 0,Ha),u0.bind(void 0,0),u0.bind(void 0,1),J1.bind(void 0,0),J1.bind(void 0,1),eg.bind(void 0,0),eg.bind(void 0,1),dv,hv,tg.bind(void 0,0),tg.bind(void 0,1),fv,pv,rg.bind(void 0,0),rg.bind(void 0,1),mv,gv,xv,bv,vv,yv,ng.bind(void 0,0),ng.bind(void 0,1),void 0,sg.bind(void 0,0),sg.bind(void 0,1),wv,void 0,Av,void 0,void 0,Tv,Cv,Sv,Lv,_v,kv,Iv,Ev,Nv,Rv,Mv,jv,Dv,Zf.bind(void 0,1),Qv,Bv,Pv,Ov,Fv,$v,Uv,zv,Hv,Wv,Pd.bind(void 0,0),Pd.bind(void 0,1),Pd.bind(void 0,2),Pd.bind(void 0,3),void 0,void 0,void 0,void 0,Gv,Zf.bind(void 0,2),Zf.bind(void 0,3),Yf.bind(void 0,1),Yf.bind(void 0,2),Yf.bind(void 0,3),qv,Vv,void 0,void 0,Zv,void 0,Yv,Kv,ln,ln,void 0,void 0,void 0,void 0,void 0,Xv,ig.bind(void 0,0),ig.bind(void 0,1),Jv,void 0,ey,ty,ry,ny,sy,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Xl.bind(void 0,1),Xl.bind(void 0,2),Xl.bind(void 0,3),Xl.bind(void 0,4),Xl.bind(void 0,5),Xl.bind(void 0,6),Xl.bind(void 0,7),Xl.bind(void 0,8),Jl.bind(void 0,1),Jl.bind(void 0,2),Jl.bind(void 0,3),Jl.bind(void 0,4),Jl.bind(void 0,5),Jl.bind(void 0,6),Jl.bind(void 0,7),Jl.bind(void 0,8),ir.bind(void 0,0,0,0,0,0),ir.bind(void 0,0,0,0,0,1),ir.bind(void 0,0,0,0,0,2),ir.bind(void 0,0,0,0,0,3),ir.bind(void 0,0,0,0,1,0),ir.bind(void 0,0,0,0,1,1),ir.bind(void 0,0,0,0,1,2),ir.bind(void 0,0,0,0,1,3),ir.bind(void 0,0,0,1,0,0),ir.bind(void 0,0,0,1,0,1),ir.bind(void 0,0,0,1,0,2),ir.bind(void 0,0,0,1,0,3),ir.bind(void 0,0,0,1,1,0),ir.bind(void 0,0,0,1,1,1),ir.bind(void 0,0,0,1,1,2),ir.bind(void 0,0,0,1,1,3),ir.bind(void 0,0,1,0,0,0),ir.bind(void 0,0,1,0,0,1),ir.bind(void 0,0,1,0,0,2),ir.bind(void 0,0,1,0,0,3),ir.bind(void 0,0,1,0,1,0),ir.bind(void 0,0,1,0,1,1),ir.bind(void 0,0,1,0,1,2),ir.bind(void 0,0,1,0,1,3),ir.bind(void 0,0,1,1,0,0),ir.bind(void 0,0,1,1,0,1),ir.bind(void 0,0,1,1,0,2),ir.bind(void 0,0,1,1,0,3),ir.bind(void 0,0,1,1,1,0),ir.bind(void 0,0,1,1,1,1),ir.bind(void 0,0,1,1,1,2),ir.bind(void 0,0,1,1,1,3),ir.bind(void 0,1,0,0,0,0),ir.bind(void 0,1,0,0,0,1),ir.bind(void 0,1,0,0,0,2),ir.bind(void 0,1,0,0,0,3),ir.bind(void 0,1,0,0,1,0),ir.bind(void 0,1,0,0,1,1),ir.bind(void 0,1,0,0,1,2),ir.bind(void 0,1,0,0,1,3),ir.bind(void 0,1,0,1,0,0),ir.bind(void 0,1,0,1,0,1),ir.bind(void 0,1,0,1,0,2),ir.bind(void 0,1,0,1,0,3),ir.bind(void 0,1,0,1,1,0),ir.bind(void 0,1,0,1,1,1),ir.bind(void 0,1,0,1,1,2),ir.bind(void 0,1,0,1,1,3),ir.bind(void 0,1,1,0,0,0),ir.bind(void 0,1,1,0,0,1),ir.bind(void 0,1,1,0,0,2),ir.bind(void 0,1,1,0,0,3),ir.bind(void 0,1,1,0,1,0),ir.bind(void 0,1,1,0,1,1),ir.bind(void 0,1,1,0,1,2),ir.bind(void 0,1,1,0,1,3),ir.bind(void 0,1,1,1,0,0),ir.bind(void 0,1,1,1,0,1),ir.bind(void 0,1,1,1,0,2),ir.bind(void 0,1,1,1,0,3),ir.bind(void 0,1,1,1,1,0),ir.bind(void 0,1,1,1,1,1),ir.bind(void 0,1,1,1,1,2),ir.bind(void 0,1,1,1,1,3)];var iy=ou;function d0(i){this.char=i,this.state={},this.activeState=null}function Kf(i,o,u){this.contextName=u,this.startIndex=i,this.endOffset=o}function ay(i,o,u){this.contextName=i,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=u}function la(i,o){this.context=i,this.index=o,this.length=i.length,this.current=i[o],this.backtrack=i.slice(0,o),this.lookahead=i.slice(o+1)}function Od(i){this.eventId=i,this.subscribers=[]}function oy(i){let o=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let d=0;d<o.length;d++){let f=o[d];Object.defineProperty(this.events,f,{value:new Od(f)})}if(i)for(let d=0;d<o.length;d++){let f=o[d],g=i[f];typeof g=="function"&&this.events[f].subscribe(g)}let u=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<u.length;d++){let f=u[d];this.events[f].subscribe(this.updateContextsRanges)}}function Ns(i){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],oy.call(this,i)}d0.prototype.setState=function(i,o){return this.state[i]=o,this.activeState={key:i,value:this.state[i]},this.activeState},d0.prototype.getState=function(i){return this.state[i]||null},Ns.prototype.inboundIndex=function(i){return i>=0&&i<this.tokens.length},Ns.prototype.composeRUD=function(i){let o=i.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),u=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(u))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(u)};this.dispatch("composeRUD",[o.filter(d=>!u(d))])},Ns.prototype.replaceRange=function(i,o,u,d){o=o!==null?o:this.tokens.length;let f=u.every(g=>g instanceof d0);if(!isNaN(i)&&this.inboundIndex(i)&&f){let g=this.tokens.splice.apply(this.tokens,[i,o].concat(u));return d||this.dispatch("replaceToken",[i,o,u]),[g,u]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},Ns.prototype.replaceToken=function(i,o,u){if(!isNaN(i)&&this.inboundIndex(i)&&o instanceof d0){let d=this.tokens.splice(i,1,o);return u||this.dispatch("replaceToken",[i,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},Ns.prototype.removeRange=function(i,o,u){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(i,o);return u||this.dispatch("removeRange",[d,i,o]),d},Ns.prototype.removeToken=function(i,o){if(!isNaN(i)&&this.inboundIndex(i)){let u=this.tokens.splice(i,1);return o||this.dispatch("removeToken",[u,i]),u}else return{FAIL:"removeToken: invalid token index."}},Ns.prototype.insertToken=function(i,o,u){return i.every(d=>d instanceof d0)?(this.tokens.splice.apply(this.tokens,[o,0].concat(i)),u||this.dispatch("insertToken",[i,o]),i):{FAIL:"insertToken: invalid token(s)."}},Ns.prototype.registerModifier=function(i,o,u){this.events.newToken.subscribe(function(d,f){let g=[d,f],A=o===null||o.apply(this,g)===!0,_=[d,f];if(A){let E=u.apply(this,_);d.setState(i,E)}}),this.registeredModifiers.push(i)},Od.prototype.subscribe=function(i){return typeof i=="function"?this.subscribers.push(i)-1:{FAIL:`invalid '${this.eventId}' event handler`}},Od.prototype.unsubscribe=function(i){this.subscribers.splice(i,1)},la.prototype.setCurrentIndex=function(i){this.index=i,this.current=this.context[i],this.backtrack=this.context.slice(0,i),this.lookahead=this.context.slice(i+1)},la.prototype.get=function(i){switch(!0){case i===0:return this.current;case(i<0&&Math.abs(i)<=this.backtrack.length):return this.backtrack.slice(i)[0];case(i>0&&i<=this.lookahead.length):return this.lookahead[i-1];default:return null}},Ns.prototype.rangeToText=function(i){if(i instanceof Kf)return this.getRangeTokens(i).map(o=>o.char).join("")},Ns.prototype.getText=function(){return this.tokens.map(i=>i.char).join("")},Ns.prototype.getContext=function(i){return this.registeredContexts[i]||null},Ns.prototype.on=function(i,o){let u=this.events[i];return u?u.subscribe(o):null},Ns.prototype.dispatch=function(i,o){let u=this.events[i];if(u instanceof Od)for(let d=0;d<u.subscribers.length;d++)u.subscribers[d].apply(this,o||[])},Ns.prototype.registerContextChecker=function(i,o,u){if(this.getContext(i))return{FAIL:`context name '${i}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof u!="function")return{FAIL:"missing context end check."};let d=new ay(i,o,u);return this.registeredContexts[i]=d,this.contextCheckers.push(d),d},Ns.prototype.getRangeTokens=function(i){let o=i.startIndex+i.endOffset;return[].concat(this.tokens.slice(i.startIndex,o))},Ns.prototype.getContextRanges=function(i){let o=this.getContext(i);return o?o.ranges:{FAIL:`context checker '${i}' is not registered.`}},Ns.prototype.resetContextsRanges=function(){let i=this.registeredContexts;for(let o in i)if(Object.prototype.hasOwnProperty.call(i,o)){let u=i[o];u.ranges=[]}},Ns.prototype.updateContextsRanges=function(){this.resetContextsRanges();let i=this.tokens.map(o=>o.char);for(let o=0;o<i.length;o++){let u=new la(i,o);this.runContextCheck(u)}this.dispatch("updateContextsRanges",[this.registeredContexts])},Ns.prototype.setEndOffset=function(i,o){let u=this.getContext(o).openRange.startIndex,d=new Kf(u,i,o),f=this.getContext(o).ranges;return d.rangeId=`${o}.${f.length}`,f.push(d),this.getContext(o).openRange=null,d},Ns.prototype.runContextCheck=function(i){let o=i.index;for(let u=0;u<this.contextCheckers.length;u++){let d=this.contextCheckers[u],f=d.contextName,g=this.getContext(f).openRange;if(!g&&d.checkStart(i)&&(g=new Kf(o,null,f),this.getContext(f).openRange=g,this.dispatch("contextStart",[f,o])),g&&d.checkEnd(i)){let A=o-g.startIndex+1,_=this.setEndOffset(A,f);this.dispatch("contextEnd",[f,_])}}},Ns.prototype.tokenize=function(i){this.tokens=[],this.resetContextsRanges();let o=Array.from(i);this.dispatch("start");for(let u=0;u<o.length;u++){let d=o[u],f=new la(o,u);this.dispatch("next",[f]),this.runContextCheck(f);let g=new d0(d);this.tokens.push(g),this.dispatch("newToken",[g,f])}return this.dispatch("end",[this.tokens]),this.tokens};var ly=Ns;function ec(i){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(i)}function ag(i){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(i)}function tc(i){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(i)}function Fd(i){return/[\u0E00-\u0E7F]/.test(i)}function $d(i){return/[A-z]/.test(i)}function cy(i){return/\s/.test(i)}function qa(i){this.font=i,this.features={}}function rc(i){this.id=i.id,this.tag=i.tag,this.substitution=i.substitution}function nc(i,o){if(!i)return-1;switch(o.format){case 1:return o.glyphs.indexOf(i);case 2:{let u=o.ranges;for(let d=0;d<u.length;d++){let f=u[d];if(i>=f.start&&i<=f.end){let g=i-f.start;return f.index+g}}break}default:return-1}return-1}function uy(i,o){return nc(i,o.coverage)===-1?null:i+o.deltaGlyphId}function dy(i,o){let u=nc(i,o.coverage);return u===-1?null:o.substitute[u]}function Xf(i,o){let u=[];for(let d=0;d<i.length;d++){let f=i[d],g=o.current;g=Array.isArray(g)?g[0]:g;let A=nc(g,f);A!==-1&&u.push(A)}return u.length!==i.length?-1:u}function hy(i,o){let u=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(i.context.length<u)return[];let d=Xf(o.inputCoverage,i);if(d===-1)return[];let f=o.inputCoverage.length-1;if(i.lookahead.length<o.lookaheadCoverage.length)return[];let g=i.lookahead.slice(f);for(;g.length&&tc(g[0].char);)g.shift();let A=new la(g,0),_=Xf(o.lookaheadCoverage,A),E=[].concat(i.backtrack);for(E.reverse();E.length&&tc(E[0].char);)E.shift();if(E.length<o.backtrackCoverage.length)return[];let M=new la(E,0),R=Xf(o.backtrackCoverage,M),Y=d.length===o.inputCoverage.length&&_.length===o.lookaheadCoverage.length&&R.length===o.backtrackCoverage.length,Z=[];if(Y)for(let me=0;me<o.lookupRecords.length;me++){let ue=o.lookupRecords[me],Ae=ue.lookupListIndex,Ze=this.getLookupByIndex(Ae);for(let ur=0;ur<Ze.subtables.length;ur++){let nr=Ze.subtables[ur],kr,zr=this.getSubstitutionType(Ze,nr);if(zr==="71"?(zr=this.getSubstitutionType(nr,nr.extension),kr=this.getLookupMethod(nr,nr.extension),nr=nr.extension):kr=this.getLookupMethod(Ze,nr),zr==="12"){let Qn=i.get(ue.sequenceIndex),Xn=kr(Qn);Xn&&Z.push(Xn)}else if(zr==="21"){let Qn=i.get(ue.sequenceIndex),Xn=kr(Qn);Xn&&Z.push(Xn)}else throw new Error(`Substitution type ${zr} is not supported in chaining substitution`)}}return Z}function fy(i,o){let u=i.current,d=nc(u,o.coverage);if(d===-1)return null;let f,g=o.ligatureSets[d];for(let A=0;A<g.length;A++){f=g[A];for(let _=0;_<f.components.length;_++){let E=i.lookahead[_],M=f.components[_];if(E!==M)break;if(_===f.components.length-1)return f}}return null}function py(i,o){let u=i.current;if(nc(u,o.coverage)===-1)return null;for(let d of o.ruleSets)for(let f of d){let g=!0;for(let A=0;A<f.input.length;A++)if(i.lookahead[A]!==f.input[A]){g=!1;break}if(g){let A=[];A.push(u);for(let E=0;E<f.input.length;E++)A.push(f.input[E]);let _=(E,M)=>{let{lookupListIndex:R,sequenceIndex:Y}=M,{subtables:Z}=this.getLookupByIndex(R);for(let me of Z)nc(E[Y],me.coverage)!==-1&&(E[Y]=me.deltaGlyphId)};for(let E=0;E<f.lookupRecords.length;E++){let M=f.lookupRecords[E];_(A,M)}return A}}return null}function my(i,o){if(i.context.length<o.coverages.length)return[];for(let d=0;d<o.coverages.length;d++){let f=i.get(d);if(f=Array.isArray(f)?f[0]:f,nc(f,o.coverages[d])===-1)return[]}let u=[];for(let d=0;d<o.lookupRecords.length;d++){let f=o.lookupRecords[d],g=f.lookupListIndex,A=this.getLookupByIndex(g);for(let _=0;_<A.subtables.length;_++){let E=A.subtables[_],M,R=this.getSubstitutionType(A,E);if(R==="71"?(R=this.getSubstitutionType(E,E.extension),M=this.getLookupMethod(E,E.extension),E=E.extension):M=this.getLookupMethod(A,E),R==="12"){let Y=i.get(f.sequenceIndex),Z=M(Y);Z&&u.push(Z)}else if(R==="21"){let Y=i.get(f.sequenceIndex),Z=M(Y);Z&&u.push(Z)}}}return u}function gy(i,o){let u=nc(i,o.coverage);return u===-1?null:o.sequences[u]}qa.prototype.getDefaultScriptFeaturesIndexes=function(){let i=this.font.tables.gsub.scripts;for(let o=0;o<i.length;o++){let u=i[o];if(u.tag==="DFLT")return u.script.defaultLangSys.featureIndexes}return[]},qa.prototype.getScriptFeaturesIndexes=function(i){if(!this.font.tables.gsub)return[];if(!i)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let u=0;u<o.length;u++){let d=o[u];if(d.tag===i&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let f=d.langSysRecords;if(f)for(let g=0;g<f.length;g++){let A=f[g];if(A.tag===i)return A.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},qa.prototype.mapTagsToFeatures=function(i,o){let u={};for(let d=0;d<i.length;d++){let f=i[d].tag,g=i[d].feature;u[f]=g}this.features[o].tags=u},qa.prototype.getScriptFeatures=function(i){let o=this.features[i];if(Object.prototype.hasOwnProperty.call(this.features,i))return o;let u=this.getScriptFeaturesIndexes(i);if(!u)return null;let d=this.font.tables.gsub;return o=u.map(f=>d.features[f]),this.features[i]=o,this.mapTagsToFeatures(o,i),o},qa.prototype.getSubstitutionType=function(i,o){let u=i.lookupType.toString(),d=o.substFormat.toString();return u+d},qa.prototype.getLookupMethod=function(i,o){let u=this.getSubstitutionType(i,o);switch(u){case"11":return d=>uy.apply(this,[d,o]);case"12":return d=>dy.apply(this,[d,o]);case"63":return d=>hy.apply(this,[d,o]);case"41":return d=>fy.apply(this,[d,o]);case"21":return d=>gy.apply(this,[d,o]);case"51":return d=>py.apply(this,[d,o]);case"53":return d=>my.apply(this,[d,o]);default:throw new Error(`substitutionType : ${u} lookupType: ${i.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},qa.prototype.lookupFeature=function(i){let o=i.contextParams,u=o.index,d=this.getFeature({tag:i.tag,script:i.script});if(!d)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${i.tag}' for script '${i.script}'.`);let f=this.getFeatureLookups(d),g=[].concat(o.context);for(let A=0;A<f.length;A++){let _=f[A],E=this.getLookupSubtables(_);for(let M=0;M<E.length;M++){let R=E[M],Y=this.getSubstitutionType(_,R),Z;Y==="71"?(Y=this.getSubstitutionType(R,R.extension),Z=this.getLookupMethod(R,R.extension),R=R.extension):Z=this.getLookupMethod(_,R);let me;switch(Y){case"11":me=Z(o.current),me&&g.splice(u,1,new rc({id:11,tag:i.tag,substitution:me}));break;case"12":me=Z(o.current),me&&g.splice(u,1,new rc({id:12,tag:i.tag,substitution:me}));break;case"63":me=Z(o),Array.isArray(me)&&me.length&&g.splice(u,1,new rc({id:63,tag:i.tag,substitution:me}));break;case"41":me=Z(o),me&&g.splice(u,1,new rc({id:41,tag:i.tag,substitution:me}));break;case"21":me=Z(o.current),me&&g.splice(u,1,new rc({id:21,tag:i.tag,substitution:me}));break;case"51":case"53":me=Z(o),Array.isArray(me)&&me.length&&g.splice(u,1,new rc({id:parseInt(Y),tag:i.tag,substitution:me}));break}o=new la(g,u),!(Array.isArray(me)&&!me.length)&&(me=null)}}return g.length?g:null},qa.prototype.supports=function(i){if(!i.script)return!1;this.getScriptFeatures(i.script);let o=Object.prototype.hasOwnProperty.call(this.features,i.script);if(!i.tag)return o;let u=this.features[i.script].some(d=>d.tag===i.tag);return o&&u},qa.prototype.getLookupSubtables=function(i){return i.subtables||null},qa.prototype.getLookupByIndex=function(i){return this.font.tables.gsub.lookups[i]||null},qa.prototype.getFeatureLookups=function(i){return i.lookupListIndexes.map(this.getLookupByIndex.bind(this))},qa.prototype.getFeature=function(i){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,i.script)||this.getScriptFeatures(i.script);let o=this.features[i.script];return o?o.tags[i.tag]?this.features[i.script].tags[i.tag]:null:{FAIL:`No feature for script ${i.script}`}};var xy=qa;function by(i){let o=i.current,u=i.get(-1);return u===null&&ec(o)||!ec(u)&&ec(o)}function vy(i){let o=i.get(1);return o===null||!ec(o)}var yy={startCheck:by,endCheck:vy};function wy(i){let o=i.current,u=i.get(-1);return(ec(o)||tc(o))&&!ec(u)}function Ay(i){let o=i.get(1);switch(!0){case o===null:return!0;case(!ec(o)&&!tc(o)):{let u=cy(o);if(!u)return!0;if(u){let d=!1;if(d=i.lookahead.some(f=>ec(f)||tc(f)),!d)return!0}break}default:return!1}}var Ty={startCheck:wy,endCheck:Ay};function Cy(i,o,u){o[u].setState(i.tag,i.substitution)}function Sy(i,o,u){o[u].setState(i.tag,i.substitution)}function Jf(i,o,u){for(let d=0;d<i.substitution.length;d++){let f=i.substitution[d],g=o[u+d];if(Array.isArray(f)){f.length?g.setState(i.tag,f[0]):g.setState("deleted",!0);continue}g.setState(i.tag,f)}}function Ly(i,o,u){let d=o[u];d.setState(i.tag,i.substitution.ligGlyph);let f=i.substitution.components.length;for(let g=0;g<f;g++)d=o[u+g+1],d.setState("deleted",!0)}var og={11:Cy,12:Sy,63:Jf,41:Ly,51:Jf,53:Jf};function _y(i,o,u){i instanceof rc&&og[i.id]&&og[i.id](i,o,u)}var Ic=_y;function ky(i){let o=[].concat(i.backtrack);for(let u=o.length-1;u>=0;u--){let d=o[u],f=ag(d),g=tc(d);if(!f&&!g)return!0;if(f)return!1}return!1}function Iy(i){if(ag(i.current))return!1;for(let o=0;o<i.lookahead.length;o++){let u=i.lookahead[o];if(!tc(u))return!0}return!1}function Ey(i){let o="arab",u=this.featuresTags[o],d=this.tokenizer.getRangeTokens(i);if(d.length===1)return;let f=new la(d.map(A=>A.getState("glyphIndex")),0),g=new la(d.map(A=>A.char),0);for(let A=0;A<d.length;A++){let _=d[A];if(tc(_.char))continue;f.setCurrentIndex(A),g.setCurrentIndex(A);let E=0;ky(g)&&(E|=1),Iy(g)&&(E|=2);let M;switch(E){case 1:M="fina";break;case 2:M="init";break;case 3:M="medi";break}if(u.indexOf(M)===-1)continue;let R=this.query.lookupFeature({tag:M,script:o,contextParams:f});if(R instanceof Error){console.info(R.message);continue}for(let Y=0;Y<R.length;Y++){let Z=R[Y];Z instanceof rc&&(Ic(Z,d,Y),f.context[Y]=Z.substitution)}}}var Ny=Ey;function lg(i,o){let u=i.map(d=>d.activeState.value);return new la(u,o||0)}function Ry(i){let o="arab",u=this.tokenizer.getRangeTokens(i),d=lg(u);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(g.length){for(let A=0;A<g.length;A++){let _=g[A];Ic(_,u,f)}d=lg(u)}}}var My=Ry;function jy(i){return i.index===0&&i.context.length>1}function Dy(i){return i.index===i.context.length-1}var Qy={startCheck:jy,endCheck:Dy};function cg(i,o){let u=i.map(d=>d.activeState.value);return new la(u,o||0)}function By(i){let o="delf",u="ccmp",d=this.tokenizer.getRangeTokens(i),f=cg(d);for(let g=0;g<f.context.length;g++){if(!this.query.getFeature({tag:u,script:o,contextParams:f}))continue;f.setCurrentIndex(g);let A=this.query.lookupFeature({tag:u,script:o,contextParams:f});if(A.length){for(let _=0;_<A.length;_++){let E=A[_];Ic(E,d,g)}f=cg(d)}}}var Py=By;function Oy(i){let o=i.current,u=i.get(-1);return u===null&&$d(o)||!$d(u)&&$d(o)}function Fy(i){let o=i.get(1);return o===null||!$d(o)}var $y={startCheck:Oy,endCheck:Fy};function ug(i,o){let u=i.map(d=>d.activeState.value);return new la(u,o||0)}function Uy(i){let o="latn",u=this.tokenizer.getRangeTokens(i),d=ug(u);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(g.length){for(let A=0;A<g.length;A++){let _=g[A];Ic(_,u,f)}d=ug(u)}}}var zy=Uy;function Hy(i){let o=i.current,u=i.get(-1);return u===null&&Fd(o)||!Fd(u)&&Fd(o)}function Wy(i){let o=i.get(1);return o===null||!Fd(o)}var Gy={startCheck:Hy,endCheck:Wy};function dg(i,o){let u=i.map(d=>d.activeState.value);return new la(u,o||0)}function qy(i){let o="thai",u=this.tokenizer.getRangeTokens(i),d=dg(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"ccmp",script:o,contextParams:d});if(g.length){for(let A=0;A<g.length;A++){let _=g[A];Ic(_,u,f)}d=dg(u,f)}}}var Vy=qy;function hg(i,o){let u=i.map(d=>d.activeState.value);return new la(u,o||0)}function Zy(i){let o="thai",u=this.tokenizer.getRangeTokens(i),d=hg(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(g.length){for(let A=0;A<g.length;A++){let _=g[A];Ic(_,u,f)}d=hg(u,f)}}}var Yy=Zy;function fg(i,o){let u=i.map(d=>d.activeState.value);return new la(u,o||0)}function Ky(i){let o="thai",u=this.tokenizer.getRangeTokens(i),d=fg(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(g.length){for(let A=0;A<g.length;A++){let _=g[A];Ic(_,u,f)}d=fg(u,f)}}}var Xy=Ky;function ep(i){if(i===null)return!1;let o=i.codePointAt(0);return o>=6155&&o<=6157||o>=65024&&o<=65039||o>=917760&&o<=917999}function Jy(i){let o=i.current,u=i.get(1);return u===null&&ep(o)||ep(u)}function e4(i){let o=i.get(1);return o===null||!ep(o)}var t4={startCheck:Jy,endCheck:e4};function r4(i){let o=this.query.font,u=this.tokenizer.getRangeTokens(i);if(u[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=u[0].char.codePointAt(0),f=u[1].char.codePointAt(0),g=o.tables.cmap.varSelectorList[f];if(g!==void 0&&g.nonDefaultUVS){let A=g.nonDefaultUVS.uvsMappings;if(A[d]){let _=A[d].glyphID;o.glyphs.glyphs[_]!==void 0&&u[0].setState("glyphIndex",_)}}}}var n4=r4;function lo(i){this.baseDir=i||"ltr",this.tokenizer=new ly,this.featuresTags={}}lo.prototype.setText=function(i){this.text=i},lo.prototype.contextChecks={ccmpReplacementCheck:Qy,latinWordCheck:$y,arabicWordCheck:yy,arabicSentenceCheck:Ty,thaiWordCheck:Gy,unicodeVariationSequenceCheck:t4};function h0(i){let o=this.contextChecks[`${i}Check`];return this.tokenizer.registerContextChecker(i,o.startCheck,o.endCheck)}function s4(){return h0.call(this,"ccmpReplacement"),h0.call(this,"latinWord"),h0.call(this,"arabicWord"),h0.call(this,"arabicSentence"),h0.call(this,"thaiWord"),h0.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function i4(){let i=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<i.length;o++){let u=i[o],d=this.tokenizer.getRangeTokens(u);this.tokenizer.replaceRange(u.startIndex,u.endOffset,d.reverse())}}lo.prototype.registerFeatures=function(i,o){let u=o.filter(d=>this.query.supports({script:i,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,i)?this.featuresTags[i]=this.featuresTags[i].concat(u):this.featuresTags[i]=u},lo.prototype.applyFeatures=function(i,o){if(!i)throw new Error("No valid font was provided to apply features");this.query||(this.query=new xy(i));for(let u=0;u<o.length;u++){let d=o[u];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},lo.prototype.registerModifier=function(i,o,u){this.tokenizer.registerModifier(i,o,u)};function hu(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function a4(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;hu.call(this);let i=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<i.length;o++){let u=i[o];Ny.call(this,u)}}function o4(){hu.call(this);let i=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<i.length;o++){let u=i[o];Py.call(this,u)}}function l4(){if(!this.hasFeatureEnabled("arab","rlig"))return;hu.call(this);let i=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<i.length;o++){let u=i[o];My.call(this,u)}}function c4(){if(!this.hasFeatureEnabled("latn","liga"))return;hu.call(this);let i=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<i.length;o++){let u=i[o];zy.call(this,u)}}function u4(){let i=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<i.length;o++){let u=i[o];n4.call(this,u)}}function d4(){hu.call(this);let i=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<i.length;o++){let u=i[o];this.hasFeatureEnabled("thai","liga")&&Yy.call(this,u),this.hasFeatureEnabled("thai","rlig")&&Xy.call(this,u),this.hasFeatureEnabled("thai","ccmp")&&Vy.call(this,u)}}lo.prototype.checkContextReady=function(i){return!!this.tokenizer.getContext(i)},lo.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&o4.call(this),this.checkContextReady("arabicWord")&&(a4.call(this),l4.call(this)),this.checkContextReady("latinWord")&&c4.call(this),this.checkContextReady("arabicSentence")&&i4.call(this),this.checkContextReady("thaiWord")&&d4.call(this),this.checkContextReady("unicodeVariationSequence")&&u4.call(this)},lo.prototype.hasFeatureEnabled=function(i,o){return(this.featuresTags[i]||[]).indexOf(o)!==-1},lo.prototype.processText=function(i){(!this.text||this.text!==i)&&(this.setText(i),s4.call(this),this.applyFeaturesToContexts())},lo.prototype.getBidiText=function(i){return this.processText(i),this.tokenizer.getText()},lo.prototype.getTextGlyphs=function(i){this.processText(i);let o=[];for(let u=0;u<this.tokenizer.tokens.length;u++){let d=this.tokenizer.tokens[u];if(d.state.deleted)continue;let f=d.activeState.value;o.push(Array.isArray(f)?f[0]:f)}return o};var h4=lo;function tp(i){return{fontFamily:{en:i.familyName||" "},fontSubfamily:{en:i.styleName||" "},fullName:{en:i.fullName||i.familyName+" "+i.styleName},postScriptName:{en:i.postScriptName||(i.familyName+i.styleName).replace(/\s/g,"")},designer:{en:i.designer||" "},designerURL:{en:i.designerURL||" "},manufacturer:{en:i.manufacturer||" "},manufacturerURL:{en:i.manufacturerURL||" "},license:{en:i.license||" "},licenseURL:{en:i.licenseURL||" "},version:{en:i.version||"Version 0.1"},description:{en:i.description||" "},copyright:{en:i.copyright||" "},trademark:{en:i.trademark||" "}}}function Un(i){if(i=i||{},i.tables=i.tables||{},!i.empty){if(!i.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!i.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!i.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!i.ascender)throw new Error("When creating a new Font object, ascender is required.");if(i.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=tp(i),this.names.macintosh=tp(i),this.names.windows=tp(i),this.unitsPerEm=i.unitsPerEm||1e3,this.ascender=i.ascender,this.descender=i.descender,this.createdTimestamp=i.createdTimestamp,this.italicAngle=i.italicAngle||0,this.weightClass=i.weightClass||0;let o=0;i.fsSelection?o=i.fsSelection:(this.italicAngle<0?o|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(o|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(o|=this.fsSelectionValues.BOLD),o===0&&(o=this.fsSelectionValues.REGULAR)),(!i.panose||!Array.isArray(i.panose))&&(i.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(i.tables,{os2:Object.assign({usWeightClass:i.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:i.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:i.panose[0]||0,bSerifStyle:i.panose[1]||0,bWeight:i.panose[2]||0,bProportion:i.panose[3]||0,bContrast:i.panose[4]||0,bStrokeVariation:i.panose[5]||0,bArmStyle:i.panose[6]||0,bLetterform:i.panose[7]||0,bMidline:i.panose[8]||0,bXHeight:i.panose[9]||0,fsSelection:o},i.tables.os2)})}this.supported=!0,this.glyphs=new Vn.GlyphSet(this,i.glyphs||[]),this.encoding=new ks(this),this.position=new Wt(this),this.substitution=new Es(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,u,d)=>(o[u]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new Gl(this)),!0)}),this.palettes=new Hl(this),this.layers=new La(this),this.svgImages=new yl(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new iy(this):null}})}Un.prototype.hasChar=function(i){return this.encoding.charToGlyphIndex(i)>0},Un.prototype.charToGlyphIndex=function(i){return this.encoding.charToGlyphIndex(i)},Un.prototype.charToGlyph=function(i){let o=this.charToGlyphIndex(i),u=this.glyphs.get(o);return u||(u=this.glyphs.get(0)),u},Un.prototype.updateFeatures=function(i){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(u=>i[u])}:o)},Un.prototype.stringToGlyphIndexes=function(i,o){let u=new h4,d=g=>this.charToGlyphIndex(g.char);u.registerModifier("glyphIndex",null,d);let f=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return u.applyFeatures(this,f),u.getTextGlyphs(i)},Un.prototype.stringToGlyphs=function(i,o){let u=this.stringToGlyphIndexes(i,o),d=u.length,f=new Array(d),g=this.glyphs.get(0);for(let A=0;A<d;A+=1)f[A]=this.glyphs.get(u[A])||g;return f},Un.prototype.nameToGlyphIndex=function(i){return this.glyphNames.nameToGlyphIndex(i)},Un.prototype.nameToGlyph=function(i){let o=this.nameToGlyphIndex(i),u=this.glyphs.get(o);return u||(u=this.glyphs.get(0)),u},Un.prototype.glyphIndexToName=function(i){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(i):""},Un.prototype.getKerningValue=function(i,o){i=i.index||i,o=o.index||o;let u=this.position.defaultKerningTables;return u?this.position.getKerningValue(u,i,o):this.kerningPairs[i+","+o]||0},Un.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]},{script:"thai",tags:["liga","rlig","ccmp"]}],hinting:!1,usePalette:0,drawLayers:!0,drawSVG:!0},Un.prototype.forEachGlyph=function(i,o,u,d,f,g){o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:72,f=Object.assign({},this.defaultRenderOptions,f);let A=1/this.unitsPerEm*d,_=this.stringToGlyphs(i,f),E;if(f.kerning){let M=f.script||this.position.getDefaultScriptName();E=this.position.getKerningTables(M,f.language)}for(let M=0;M<_.length;M+=1){let R=_[M];if(g.call(this,R,o,u,d,f),R.advanceWidth&&(o+=R.advanceWidth*A),f.kerning&&M<_.length-1){let Y=E?this.position.getKerningValue(E,R.index,_[M+1].index):this.getKerningValue(R,_[M+1]);o+=Y*A}f.letterSpacing?o+=f.letterSpacing*d:f.tracking&&(o+=f.tracking/1e3*d)}return o},Un.prototype.getPath=function(i,o,u,d,f){f=Object.assign({},this.defaultRenderOptions,f);let g=new nt;if(g._layers=[],ge(this,g,d),g.stroke){let A=1/(g.unitsPerEm||1e3)*d;g.strokeWidth*=A}return this.forEachGlyph(i,o,u,d,f,(A,_,E,M)=>{let R=A.getPath(_,E,M,f,this);if(f.drawSVG||f.drawLayers){let Y=R._layers;if(Y&&Y.length){for(let Z=0;Z<Y.length;Z++){let me=Y[Z];g._layers.push(me)}return}}g.extend(R)}),g},Un.prototype.getPaths=function(i,o,u,d,f){f=Object.assign({},this.defaultRenderOptions,f);let g=[];return this.forEachGlyph(i,o,u,d,f,function(A,_,E,M){let R=A.getPath(_,E,M,f,this);g.push(R)}),g},Un.prototype.getAdvanceWidth=function(i,o,u){return u=Object.assign({},this.defaultRenderOptions,u),this.forEachGlyph(i,0,0,o,u,function(){})},Un.prototype.draw=function(i,o,u,d,f,g){this.getPath(o,u,d,f,g).draw(i)},Un.prototype.drawPoints=function(i,o,u,d,f,g){g=Object.assign({},this.defaultRenderOptions,g),this.forEachGlyph(o,u,d,f,g,function(A,_,E,M){A.drawPoints(i,_,E,M,g,this)})},Un.prototype.drawMetrics=function(i,o,u,d,f,g){g=Object.assign({},this.defaultRenderOptions,g),this.forEachGlyph(o,u,d,f,g,function(A,_,E,M){A.drawMetrics(i,_,E,M)})},Un.prototype.getEnglishName=function(i){let o=(this.names.unicode||this.names.macintosh||this.names.windows)[i];if(o)return o.en},Un.prototype.validate=function(){let i=[],o=this;function u(f,g){f||(console.warn(`[opentype.js] ${g}`),i.push(g))}function d(f){let g=o.getEnglishName(f);u(g&&g.trim().length>0,"No English "+f+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),u(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let f=this.tables.colr.baseGlyphRecords,g=-1;for(let A=0;A<f.length;A++){let _=f[A].glyphID;if(u(g<f[A].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${_} comes after ${g}`),g>f[A].glyphID)break;g=_}}return i},Un.prototype.toTables=function(){return j.fontToTable(this)},Un.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Un.prototype.toArrayBuffer=function(){let i=this.toTables().encode(),o=new ArrayBuffer(i.length),u=new Uint8Array(o);for(let d=0;d<i.length;d++)u[d]=i[d];return o},Un.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Un.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Un.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Un.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Un.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var pg=Un;function f4(i,o){let u=new ct.Parser(i,o),d=u.parseUShort(),f=u.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${f}`);let g=[d,f],A=u.parsePointer32(function(){return this.parseItemVariationStore()}),_=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),E=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),M=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:g,itemVariationStore:A,advanceWidth:_,lsb:E,rsb:M}}function p4(){console.warn("Writing of hvar tables is not yet supported.")}var m4={make:p4,parse:f4},g4=function(){return{coverage:this.parsePointer(fe.coverage),attachPoints:this.parseList(fe.pointer(fe.uShortList))}},x4=function(){var i=this.parseUShort();if(xe.argument(i===1||i===2||i===3,"Unsupported CaretValue table version."),i===1)return{coordinate:this.parseShort()};if(i===2)return{pointindex:this.parseShort()};if(i===3)return{coordinate:this.parseShort()}},b4=function(){return this.parseList(fe.pointer(x4))},v4=function(){return{coverage:this.parsePointer(fe.coverage),ligGlyphs:this.parseList(fe.pointer(b4))}},y4=function(){return this.parseUShort(),this.parseList(fe.pointer(fe.coverage))};function w4(i,o){o=o||0;let u=new fe(i,o),d=u.parseVersion(1);xe.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var f={version:d,classDef:u.parsePointer(fe.classDef),attachList:u.parsePointer(g4),ligCaretList:u.parsePointer(v4),markAttachClassDef:u.parsePointer(fe.classDef)};return d>=1.2&&(f.markGlyphSets=u.parsePointer(y4)),f}var A4={parse:w4},Bo=new Array(10);Bo[1]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(fe.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(fe.coverage),values:this.parseValueRecordList()};xe.assert(!1,"0x"+i.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Bo[2]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();xe.assert(o===1||o===2,"0x"+i.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let u=this.parsePointer(fe.coverage),d=this.parseUShort(),f=this.parseUShort();if(o===1)return{posFormat:o,coverage:u,valueFormat1:d,valueFormat2:f,pairSets:this.parseList(fe.pointer(fe.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}})))};if(o===2){let g=this.parsePointer(fe.classDef),A=this.parsePointer(fe.classDef),_=this.parseUShort(),E=this.parseUShort();return{posFormat:o,coverage:u,valueFormat1:d,valueFormat2:f,classDef1:g,classDef2:A,class1Count:_,class2Count:E,classRecords:this.parseList(_,fe.list(E,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}}))}}},Bo[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Bo[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Bo[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Bo[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Bo[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Bo[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Bo[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function T4(i,o){o=o||0;let u=new fe(i,o),d=u.parseVersion(1);return xe.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(Bo)}:{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(Bo),variations:u.parseFeatureVariationsList()}}var C4=new Array(10);function S4(i){return new Ce.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Ce.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new Ce.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new Ce.LookupList(i.lookups,C4)}])}var L4={parse:T4,make:S4};function _4(i){let o={};i.skip("uShort");let u=i.parseUShort();xe.argument(u===0,"Unsupported kern sub-table version."),i.skip("uShort",2);let d=i.parseUShort();i.skip("uShort",3);for(let f=0;f<d;f+=1){let g=i.parseUShort(),A=i.parseUShort(),_=i.parseShort();o[g+","+A]=_}return o}function k4(i){let o={};i.skip("uShort"),i.parseULong()>1&&console.warn("Only the first kern subtable is supported."),i.skip("uLong");let u=i.parseUShort()&255;if(i.skip("uShort"),u===0){let d=i.parseUShort();i.skip("uShort",3);for(let f=0;f<d;f+=1){let g=i.parseUShort(),A=i.parseUShort(),_=i.parseShort();o[g+","+A]=_}}return o}function I4(i,o){let u=new ct.Parser(i,o),d=u.parseUShort();if(d===0)return _4(u);if(d===1)return k4(u);throw new Error("Unsupported kern table version ("+d+").")}var E4={parse:I4};function N4(i,o,u,d){let f=new ct.Parser(i,o),g=d?f.parseUShort:f.parseULong,A=[];for(let _=0;_<u+1;_+=1){let E=g.call(f);d&&(E*=2),A.push(E)}return A}var R4={parse:N4};function mg(i,o){let u=[],d=12;for(let f=0;f<o;f+=1){let g=ct.getTag(i,d),A=ct.getULong(i,d+4),_=ct.getULong(i,d+8),E=ct.getULong(i,d+12);u.push({tag:g,checksum:A,offset:_,length:E,compression:!1}),d+=16}return u}function M4(i,o){let u=[],d=44;for(let f=0;f<o;f+=1){let g=ct.getTag(i,d),A=ct.getULong(i,d+4),_=ct.getULong(i,d+8),E=ct.getULong(i,d+12),M;_<E?M="WOFF":M=!1,u.push({tag:g,offset:A,compression:M,compressedLength:_,length:E}),d+=20}return u}function In(i,o){if(o.compression==="WOFF"){let u=new Uint8Array(i.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(Be(u,d),d.byteLength!==o.length)throw new Error("Decompression error: "+o.tag+" decompressed length doesn't match recorded length");return{data:new DataView(d.buffer,0),offset:0}}else return{data:i,offset:o.offset}}function j4(i,o={}){let u,d,f=new pg({empty:!0});i.constructor!==ArrayBuffer&&(i=new Uint8Array(i).buffer);let g=new DataView(i,0),A,_=[],E=ct.getTag(g,0);if(E==="\0\0\0"||E==="true"||E==="typ1")f.outlinesFormat="truetype",A=ct.getUShort(g,4),_=mg(g,A);else if(E==="OTTO")f.outlinesFormat="cff",A=ct.getUShort(g,4),_=mg(g,A);else if(E==="wOFF"){let dr=ct.getTag(g,4);if(dr==="\0\0\0")f.outlinesFormat="truetype";else if(dr==="OTTO")f.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+E);A=ct.getUShort(g,12),_=M4(g,A)}else if(E==="wOF2"){let dr="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+dr)}else throw new Error("Unsupported OpenType signature "+E);let M,R,Y,Z,me,ue,Ae,Ze,ur,nr,kr,zr,Qn,Xn,Jn,Zs,Po,Hr;for(let dr=0;dr<A;dr+=1){let Kt=_[dr],tr;switch(Kt.tag){case"avar":Ae=Kt;break;case"cmap":tr=In(g,Kt),f.tables.cmap=xs.parse(tr.data,tr.offset),f.encoding=new Yt(f.tables.cmap);break;case"cvt ":tr=In(g,Kt),Hr=new ct.Parser(tr.data,tr.offset),f.tables.cvt=Hr.parseShortList(Kt.length/2);break;case"fvar":Y=Kt;break;case"STAT":Z=Kt;break;case"gvar":me=Kt;break;case"cvar":ue=Kt;break;case"fpgm":tr=In(g,Kt),Hr=new ct.Parser(tr.data,tr.offset),f.tables.fpgm=Hr.parseByteList(Kt.length);break;case"head":tr=In(g,Kt),f.tables.head=ei.parse(tr.data,tr.offset),f.unitsPerEm=f.tables.head.unitsPerEm,u=f.tables.head.indexToLocFormat;break;case"hhea":tr=In(g,Kt),f.tables.hhea=Ei.parse(tr.data,tr.offset),f.ascender=f.tables.hhea.ascender,f.descender=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"HVAR":Qn=Kt;break;case"hmtx":zr=Kt;break;case"ltag":tr=In(g,Kt),d=Ls.parse(tr.data,tr.offset);break;case"COLR":tr=In(g,Kt),f.tables.colr=bl.parse(tr.data,tr.offset);break;case"CPAL":tr=In(g,Kt),f.tables.cpal=qn.parse(tr.data,tr.offset);break;case"maxp":tr=In(g,Kt),f.tables.maxp=qs.parse(tr.data,tr.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":Zs=Kt;break;case"OS/2":tr=In(g,Kt),f.tables.os2=gl.parse(tr.data,tr.offset);break;case"post":tr=In(g,Kt),f.tables.post=Vo.parse(tr.data,tr.offset),f.glyphNames=new ke(f.tables.post);break;case"prep":tr=In(g,Kt),Hr=new ct.Parser(tr.data,tr.offset),f.tables.prep=Hr.parseByteList(Kt.length);break;case"glyf":Ze=Kt;break;case"loca":Jn=Kt;break;case"CFF ":M=Kt;break;case"CFF2":R=Kt;break;case"kern":Xn=Kt;break;case"GDEF":ur=Kt;break;case"GPOS":nr=Kt;break;case"GSUB":kr=Kt;break;case"meta":Po=Kt;break;case"gasp":try{tr=In(g,Kt),f.tables.gasp=so.parse(tr.data,tr.offset)}catch(Vi){console.warn("Failed to parse gasp table, skipping."),console.warn(Vi)}break;case"SVG ":tr=In(g,Kt),f.tables.svg=ni.parse(tr.data,tr.offset);break;default:break}}let Va=In(g,Zs);if(f.tables.name=qt.parse(Va.data,Va.offset,d),f.names=f.tables.name,Ze&&Jn){let dr=u===0,Kt=In(g,Jn),tr=R4.parse(Kt.data,Kt.offset,f.numGlyphs,dr),Vi=In(g,Ze);f.glyphs=Ua.parse(Vi.data,Vi.offset,tr,f,o)}else if(M){let dr=In(g,M);Ii.parse(dr.data,dr.offset,f,o)}else if(R){let dr=In(g,R);Ii.parse(dr.data,dr.offset,f,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let ca=In(g,zr);if(Ws.parse(f,ca.data,ca.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs,o),$t(f,o),Xn){let dr=In(g,Xn);f.kerningPairs=E4.parse(dr.data,dr.offset)}else f.kerningPairs={};if(ur){let dr=In(g,ur);f.tables.gdef=A4.parse(dr.data,dr.offset)}if(nr){let dr=In(g,nr);f.tables.gpos=L4.parse(dr.data,dr.offset),f.position.init()}if(kr){let dr=In(g,kr);f.tables.gsub=jn.parse(dr.data,dr.offset)}if(Y){let dr=In(g,Y);f.tables.fvar=Zo.parse(dr.data,dr.offset,f.names)}if(Z){let dr=In(g,Z);f.tables.stat=Ca.parse(dr.data,dr.offset,f.tables.fvar)}if(me){Y||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),Ze||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let dr=In(g,me);f.tables.gvar=fi.parse(dr.data,dr.offset,f.tables.fvar,f.glyphs)}if(ue){Y||console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."),f.tables.cvt||console.warn("This font provides a cvar table, but no cvt table which could be made variable."),Ze||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let dr=In(g,ue);f.tables.cvar=ss.parse(dr.data,dr.offset,f.tables.fvar,f.tables.cvt||[])}if(Ae){Y||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let dr=In(g,Ae);f.tables.avar=_s.parse(dr.data,dr.offset,f.tables.fvar)}if(Qn){Y||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),zr||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let dr=In(g,Qn);f.tables.hvar=m4.parse(dr.data,dr.offset,f.tables.fvar)}if(Po){let dr=In(g,Po);f.tables.meta=Io.parse(dr.data,dr.offset),f.metas=f.tables.meta}return f.palettes=new Hl(f),f}function D4(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function Q4(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return m(x)})();(function(n,a){typeof define=="function"&&define.amd?define(a):typeof t=="object"&&t.exports?t.exports=a():n.opentype=a()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),AE=yE(wE()),Ui=S0("lru-cache:metrics"),qu=dE("lru-cache"),TE=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Qp=()=>Ui.hasSubscribers||qu.hasSubscribers,C6=new Set,ox=typeof process=="object"&&process?process:{},CE=(e,t,r,n)=>{typeof ox.emitWarning=="function"?ox.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},SE=e=>!C6.has(e),fc=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),S6=e=>fc(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Mh:null:null,Mh=class extends Array{constructor(e){super(e),this.fill(0)}},Qc,Cu,LE=(Qc=class{constructor(e,t){if(oi(this,"heap"),oi(this,"length"),!te(Qc,Cu))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=S6(e);if(!t)return[];Cr(Qc,Cu,!0);let r=new Qc(e,t);return Cr(Qc,Cu,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Cu=new WeakMap,dn(Qc,Cu,!1),Qc),lx,cx,$o,po,rl,g0,nl,Su,Lu,sl,gi,mo,ai,As,Or,Na,go,pa,Oi,il,Fi,al,ol,xo,bo,ll,_u,Ra,x0,Bt,Bp,b0,ic,rh,vo,ux,v0,ku,nh,ac,oc,Pp,y0,sh,dx,hx,ih,ds,Op,fx,px,Iu,Fp,Eu,lc,$p,Up,_E=(Up=class{constructor(e){dn(this,Bt),dn(this,$o),dn(this,po),dn(this,rl),dn(this,g0),dn(this,nl),dn(this,Su),dn(this,Lu),dn(this,sl),oi(this,"ttl"),oi(this,"ttlResolution"),oi(this,"ttlAutopurge"),oi(this,"updateAgeOnGet"),oi(this,"updateAgeOnHas"),oi(this,"allowStale"),oi(this,"noDisposeOnSet"),oi(this,"noUpdateTTL"),oi(this,"maxEntrySize"),oi(this,"sizeCalculation"),oi(this,"noDeleteOnFetchRejection"),oi(this,"noDeleteOnStaleGet"),oi(this,"allowStaleOnFetchAbort"),oi(this,"allowStaleOnFetchRejection"),oi(this,"ignoreFetchAbort"),oi(this,"backgroundFetchSize"),dn(this,gi),dn(this,mo),dn(this,ai),dn(this,As),dn(this,Or),dn(this,Na),dn(this,go),dn(this,pa),dn(this,Oi),dn(this,il),dn(this,Fi),dn(this,al),dn(this,ol),dn(this,xo),dn(this,bo),dn(this,ll),dn(this,_u),dn(this,Ra),dn(this,x0),dn(this,b0,()=>{}),dn(this,ic,()=>{}),dn(this,rh,()=>{}),dn(this,vo,()=>!1),dn(this,v0,ne=>{}),dn(this,ku,(ne,ce,Ne)=>{}),dn(this,nh,(ne,ce,Ne,Me)=>{if(Ne||Me)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),oi(this,lx,"LRUCache");let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:a,updateAgeOnGet:l,updateAgeOnHas:c,allowStale:h,dispose:p,onInsert:m,disposeAfter:x,noDisposeOnSet:b,noUpdateTTL:y,maxSize:w=0,maxEntrySize:C=0,sizeCalculation:S,fetchMethod:I,memoMethod:N,noDeleteOnFetchRejection:Q,noDeleteOnStaleGet:W,allowStaleOnFetchRejection:B,allowStaleOnFetchAbort:U,ignoreFetchAbort:K,backgroundFetchSize:re=1,perf:H}=e;if(this.backgroundFetchSize=re,H!==void 0&&typeof H?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(Cr(this,sl,H??TE),t!==0&&!fc(t))throw new TypeError("max option must be a nonnegative integer");let Oe=t?S6(t):Array;if(!Oe)throw new Error("invalid max value: "+t);if(Cr(this,$o,t),Cr(this,po,w),this.maxEntrySize=C||te(this,po),this.sizeCalculation=S,this.sizeCalculation){if(!te(this,po)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(N!==void 0&&typeof N!="function")throw new TypeError("memoMethod must be a function if defined");if(Cr(this,Lu,N),I!==void 0&&typeof I!="function")throw new TypeError("fetchMethod must be a function if specified");if(Cr(this,Su,I),Cr(this,_u,!!I),Cr(this,ai,new Map),Cr(this,As,Array.from({length:t}).fill(void 0)),Cr(this,Or,Array.from({length:t}).fill(void 0)),Cr(this,Na,new Oe(t)),Cr(this,go,new Oe(t)),Cr(this,pa,0),Cr(this,Oi,0),Cr(this,il,LE.create(t)),Cr(this,gi,0),Cr(this,mo,0),typeof p=="function"&&Cr(this,rl,p),typeof m=="function"&&Cr(this,g0,m),typeof x=="function"?(Cr(this,nl,x),Cr(this,Fi,[])):(Cr(this,nl,void 0),Cr(this,Fi,void 0)),Cr(this,ll,!!te(this,rl)),Cr(this,x0,!!te(this,g0)),Cr(this,Ra,!!te(this,nl)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!y,this.noDeleteOnFetchRejection=!!Q,this.allowStaleOnFetchRejection=!!B,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!K,this.maxEntrySize!==0){if(te(this,po)!==0&&!fc(te(this,po)))throw new TypeError("maxSize must be a positive integer if specified");if(!fc(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ut(this,Bt,ux).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!W,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!c,this.ttlResolution=fc(n)||n===0?n:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!fc(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ut(this,Bt,Bp).call(this)}if(te(this,$o)===0&&this.ttl===0&&te(this,po)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!te(this,$o)&&!te(this,po)){let ne="LRU_CACHE_UNBOUNDED";SE(ne)&&(C6.add(ne),CE("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ne,Up))}}get perf(){return te(this,sl)}static unsafeExposeInternals(e){return{starts:te(e,ol),ttls:te(e,xo),autopurgeTimers:te(e,bo),sizes:te(e,al),keyMap:te(e,ai),keyList:te(e,As),valList:te(e,Or),next:te(e,Na),prev:te(e,go),get head(){return te(e,pa)},get tail(){return te(e,Oi)},free:te(e,il),isBackgroundFetch:t=>{var r;return Ut(r=e,Bt,ds).call(r,t)},backgroundFetch:(t,r,n,a)=>{var l;return Ut(l=e,Bt,ih).call(l,t,r,n,a)},moveToTail:t=>{var r;return Ut(r=e,Bt,Eu).call(r,t)},indexes:t=>{var r;return Ut(r=e,Bt,ac).call(r,t)},rindexes:t=>{var r;return Ut(r=e,Bt,oc).call(r,t)},isStale:t=>{var r;return te(r=e,vo).call(r,t)}}}get max(){return te(this,$o)}get maxSize(){return te(this,po)}get calculatedSize(){return te(this,mo)}get size(){return te(this,gi)}get fetchMethod(){return te(this,Su)}get memoMethod(){return te(this,Lu)}get dispose(){return te(this,rl)}get onInsert(){return te(this,g0)}get disposeAfter(){return te(this,nl)}getRemainingTTL(e){return te(this,ai).has(e)?1/0:0}*entries(){for(let e of Ut(this,Bt,ac).call(this))te(this,Or)[e]!==void 0&&te(this,As)[e]!==void 0&&!Ut(this,Bt,ds).call(this,te(this,Or)[e])&&(yield[te(this,As)[e],te(this,Or)[e]])}*rentries(){for(let e of Ut(this,Bt,oc).call(this))te(this,Or)[e]!==void 0&&te(this,As)[e]!==void 0&&!Ut(this,Bt,ds).call(this,te(this,Or)[e])&&(yield[te(this,As)[e],te(this,Or)[e]])}*keys(){for(let e of Ut(this,Bt,ac).call(this)){let t=te(this,As)[e];t!==void 0&&!Ut(this,Bt,ds).call(this,te(this,Or)[e])&&(yield t)}}*rkeys(){for(let e of Ut(this,Bt,oc).call(this)){let t=te(this,As)[e];t!==void 0&&!Ut(this,Bt,ds).call(this,te(this,Or)[e])&&(yield t)}}*values(){for(let e of Ut(this,Bt,ac).call(this))te(this,Or)[e]!==void 0&&!Ut(this,Bt,ds).call(this,te(this,Or)[e])&&(yield te(this,Or)[e])}*rvalues(){for(let e of Ut(this,Bt,oc).call(this))te(this,Or)[e]!==void 0&&!Ut(this,Bt,ds).call(this,te(this,Or)[e])&&(yield te(this,Or)[e])}[(cx=Symbol.iterator,lx=Symbol.toStringTag,cx)](){return this.entries()}find(e,t={}){for(let r of Ut(this,Bt,ac).call(this)){let n=te(this,Or)[r],a=Ut(this,Bt,ds).call(this,n)?n.__staleWhileFetching:n;if(a!==void 0&&e(a,te(this,As)[r],this))return Ut(this,Bt,Iu).call(this,te(this,As)[r],t)}}forEach(e,t=this){for(let r of Ut(this,Bt,ac).call(this)){let n=te(this,Or)[r],a=Ut(this,Bt,ds).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&e.call(t,a,te(this,As)[r],this)}}rforEach(e,t=this){for(let r of Ut(this,Bt,oc).call(this)){let n=te(this,Or)[r],a=Ut(this,Bt,ds).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&e.call(t,a,te(this,As)[r],this)}}purgeStale(){let e=!1;for(let t of Ut(this,Bt,oc).call(this,{allowStale:!0}))te(this,vo).call(this,t)&&(Ut(this,Bt,lc).call(this,te(this,As)[t],"expire"),e=!0);return e}info(e){let t=te(this,ai).get(e);if(t===void 0)return;let r=te(this,Or)[t],n=Ut(this,Bt,ds).call(this,r)?r.__staleWhileFetching:r;if(n===void 0)return;let a={value:n};if(te(this,xo)&&te(this,ol)){let l=te(this,xo)[t],c=te(this,ol)[t];if(l&&c){let h=l-(te(this,sl).now()-c);a.ttl=h,a.start=Date.now()}}return te(this,al)&&(a.size=te(this,al)[t]),a}dump(){let e=[];for(let t of Ut(this,Bt,ac).call(this,{allowStale:!0})){let r=te(this,As)[t],n=te(this,Or)[t],a=Ut(this,Bt,ds).call(this,n)?n.__staleWhileFetching:n;if(a===void 0||r===void 0)continue;let l={value:a};if(te(this,xo)&&te(this,ol)){l.ttl=te(this,xo)[t];let c=te(this,sl).now()-te(this,ol)[t];l.start=Math.floor(Date.now()-c)}te(this,al)&&(l.size=te(this,al)[t]),e.unshift([r,l])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let n=Date.now()-r.start;r.start=te(this,sl).now()-n}Ut(this,Bt,y0).call(this,t,r.value,r)}}set(e,t,r={}){let{status:n=Ui.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="set",n.key=e,t!==void 0&&(n.value=t),n.cache=this);let a=Ut(this,Bt,y0).call(this,e,t,r);return n&&Ui.hasSubscribers&&Ui.publish(n),a}pop(){var e;try{for(;te(this,gi);){let t=te(this,Or)[te(this,pa)];if(Ut(this,Bt,sh).call(this,!0),Ut(this,Bt,ds).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(te(this,Ra)&&te(this,Fi)){let t=te(this,Fi),r;for(;r=t?.shift();)(e=te(this,nl))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=Ui.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let n=Ut(this,Bt,dx).call(this,e,t);return Ui.hasSubscribers&&Ui.publish(r),n}peek(e,t={}){let{status:r=Qp()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let n=Ut(this,Bt,hx).call(this,e,t);return Ui.hasSubscribers&&Ui.publish(r),n}fetch(e,t={}){let r=qu.hasSubscribers,{status:n=Qp()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let a=Ut(this,Bt,Op).call(this,e,t);return n&&r&&(n.trace=!0,qu.tracePromise(()=>a,n).catch(()=>{})),a}forceFetch(e,t={}){let r=qu.hasSubscribers,{status:n=Qp()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let a=Ut(this,Bt,fx).call(this,e,t);return n&&r&&(n.trace=!0,qu.tracePromise(()=>a,n).catch(()=>{})),a}memo(e,t={}){let{status:r=Ui.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="memo",r.key=e,t.context&&(r.context=t.context),r.cache=this);let n=Ut(this,Bt,px).call(this,e,t);return r&&(r.value=n),Ui.hasSubscribers&&Ui.publish(r),n}get(e,t={}){let{status:r=Ui.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let n=Ut(this,Bt,Iu).call(this,e,t);return r&&(n!==void 0&&(r.value=n),Ui.hasSubscribers&&Ui.publish(r)),n}delete(e){return Ut(this,Bt,lc).call(this,e,"delete")}clear(){return Ut(this,Bt,$p).call(this,"delete")}},$o=new WeakMap,po=new WeakMap,rl=new WeakMap,g0=new WeakMap,nl=new WeakMap,Su=new WeakMap,Lu=new WeakMap,sl=new WeakMap,gi=new WeakMap,mo=new WeakMap,ai=new WeakMap,As=new WeakMap,Or=new WeakMap,Na=new WeakMap,go=new WeakMap,pa=new WeakMap,Oi=new WeakMap,il=new WeakMap,Fi=new WeakMap,al=new WeakMap,ol=new WeakMap,xo=new WeakMap,bo=new WeakMap,ll=new WeakMap,_u=new WeakMap,Ra=new WeakMap,x0=new WeakMap,Bt=new WeakSet,Bp=function(){let e=new Mh(te(this,$o)),t=new Mh(te(this,$o));Cr(this,xo,e),Cr(this,ol,t);let r=this.ttlAutopurge?Array.from({length:te(this,$o)}):void 0;Cr(this,bo,r),Cr(this,rh,(c,h,p=te(this,sl).now())=>{t[c]=h!==0?p:0,e[c]=h,n(c,h)}),Cr(this,b0,c=>{t[c]=e[c]!==0?te(this,sl).now():0,n(c,e[c])});let n=this.ttlAutopurge?(c,h)=>{if(r?.[c]&&(clearTimeout(r[c]),r[c]=void 0),h&&h!==0&&r){let p=setTimeout(()=>{te(this,vo).call(this,c)&&Ut(this,Bt,lc).call(this,te(this,As)[c],"expire")},h+1);p.unref&&p.unref(),r[c]=p}}:()=>{};Cr(this,ic,(c,h)=>{if(e[h]){let p=e[h],m=t[h];if(!p||!m)return;c.ttl=p,c.start=m,c.now=a||l();let x=c.now-m;c.remainingTTL=p-x}});let a=0,l=()=>{let c=te(this,sl).now();if(this.ttlResolution>0){a=c;let h=setTimeout(()=>a=0,this.ttlResolution);h.unref&&h.unref()}return c};this.getRemainingTTL=c=>{let h=te(this,ai).get(c);if(h===void 0)return 0;let p=e[h],m=t[h];if(!p||!m)return 1/0;let x=(a||l())-m;return p-x},Cr(this,vo,c=>{let h=t[c],p=e[c];return!!p&&!!h&&(a||l())-h>p})},b0=new WeakMap,ic=new WeakMap,rh=new WeakMap,vo=new WeakMap,ux=function(){let e=new Mh(te(this,$o));Cr(this,mo,0),Cr(this,al,e),Cr(this,v0,t=>{Cr(this,mo,te(this,mo)-e[t]),e[t]=0}),Cr(this,nh,(t,r,n,a)=>{if(!fc(n)){if(Ut(this,Bt,ds).call(this,r))return this.backgroundFetchSize;if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(n=a(r,t),!fc(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return n}),Cr(this,ku,(t,r,n)=>{if(e[t]=r,te(this,po)){let a=te(this,po)-e[t];for(;te(this,mo)>a;)Ut(this,Bt,sh).call(this,!0)}Cr(this,mo,te(this,mo)+e[t]),n&&(n.entrySize=r,n.totalCalculatedSize=te(this,mo))})},v0=new WeakMap,ku=new WeakMap,nh=new WeakMap,ac=function*({allowStale:e=this.allowStale}={}){if(te(this,gi))for(let t=te(this,Oi);Ut(this,Bt,Pp).call(this,t)&&((e||!te(this,vo).call(this,t))&&(yield t),t!==te(this,pa));)t=te(this,go)[t]},oc=function*({allowStale:e=this.allowStale}={}){if(te(this,gi))for(let t=te(this,pa);Ut(this,Bt,Pp).call(this,t)&&((e||!te(this,vo).call(this,t))&&(yield t),t!==te(this,Oi));)t=te(this,Na)[t]},Pp=function(e){return e!==void 0&&te(this,ai).get(te(this,As)[e])===e},y0=function(e,t,r,n){var a,l,c,h;let{ttl:p=this.ttl,start:m,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:b=this.sizeCalculation,status:y}=r,w=Ut(this,Bt,ds).call(this,t);if(t===void 0)return y&&(y.set="deleted"),this.delete(e),this;let{noUpdateTTL:C=this.noUpdateTTL}=r;y&&!w&&(y.value=t);let S=te(this,nh).call(this,e,t,r.size||0,b,y);if(this.maxEntrySize&&S>this.maxEntrySize)return Ut(this,Bt,lc).call(this,e,"set"),y&&(y.set="miss",y.maxEntrySizeExceeded=!0),this;let I=te(this,gi)===0?void 0:te(this,ai).get(e);if(I===void 0)I=te(this,gi)===0?te(this,Oi):te(this,il).length!==0?te(this,il).pop():te(this,gi)===te(this,$o)?Ut(this,Bt,sh).call(this,!1):te(this,gi),te(this,As)[I]=e,te(this,Or)[I]=t,te(this,ai).set(e,I),te(this,Na)[te(this,Oi)]=I,te(this,go)[I]=te(this,Oi),Cr(this,Oi,I),Dp(this,gi)._++,te(this,ku).call(this,I,S,y),y&&(y.set="add"),C=!1,te(this,x0)&&!w&&((a=te(this,g0))==null||a.call(this,t,e,"add"));else{Ut(this,Bt,Eu).call(this,I);let N=te(this,Or)[I];if(t!==N){if(!x)if(Ut(this,Bt,ds).call(this,N)){N!==n&&N.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Q}=N;Q!==void 0&&Q!==t&&(te(this,ll)&&((l=te(this,rl))==null||l.call(this,Q,e,"set")),te(this,Ra)&&te(this,Fi)?.push([Q,e,"set"]))}else te(this,ll)&&((c=te(this,rl))==null||c.call(this,N,e,"set")),te(this,Ra)&&te(this,Fi)?.push([N,e,"set"]);if(te(this,v0).call(this,I),te(this,ku).call(this,I,S,y),te(this,Or)[I]=t,!w){let Q=N&&Ut(this,Bt,ds).call(this,N)?N.__staleWhileFetching:N,W=Q===void 0?"add":t!==Q?"replace":"update";y&&(y.set=W,Q!==void 0&&(y.oldValue=Q)),te(this,x0)&&this.onInsert?.(t,e,W)}}else w||(y&&(y.set="update"),te(this,x0)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!te(this,xo)&&Ut(this,Bt,Bp).call(this),te(this,xo)&&(C||te(this,rh).call(this,I,p,m),y&&te(this,ic).call(this,y,I)),!x&&te(this,Ra)&&te(this,Fi)){let N=te(this,Fi),Q;for(;Q=N?.shift();)(h=te(this,nl))==null||h.call(this,...Q)}return this},sh=function(e){var t;let r=te(this,pa),n=te(this,As)[r],a=te(this,Or)[r],l=Ut(this,Bt,ds).call(this,a);l&&a.__abortController.abort(new Error("evicted"));let c=l?a.__staleWhileFetching:a;return(te(this,ll)||te(this,Ra))&&c!==void 0&&(te(this,ll)&&((t=te(this,rl))==null||t.call(this,c,n,"evict")),te(this,Ra)&&te(this,Fi)?.push([c,n,"evict"])),te(this,v0).call(this,r),te(this,bo)?.[r]&&(clearTimeout(te(this,bo)[r]),te(this,bo)[r]=void 0),e&&(te(this,As)[r]=void 0,te(this,Or)[r]=void 0,te(this,il).push(r)),te(this,gi)===1?(Cr(this,pa,Cr(this,Oi,0)),te(this,il).length=0):Cr(this,pa,te(this,Na)[r]),te(this,ai).delete(n),Dp(this,gi)._--,r},dx=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,a=te(this,ai).get(e);if(a!==void 0){let l=te(this,Or)[a];if(Ut(this,Bt,ds).call(this,l)&&l.__staleWhileFetching===void 0)return!1;if(te(this,vo).call(this,a))n&&(n.has="stale",te(this,ic).call(this,n,a));else return r&&te(this,b0).call(this,a),n&&(n.has="hit",te(this,ic).call(this,n,a)),!0}else n&&(n.has="miss");return!1},hx=function(e,t){let{status:r,allowStale:n=this.allowStale}=t,a=te(this,ai).get(e);if(a===void 0||!n&&te(this,vo).call(this,a)){r&&(r.peek=a===void 0?"miss":"stale");return}let l=te(this,Or)[a],c=Ut(this,Bt,ds).call(this,l)?l.__staleWhileFetching:l;return r&&(c!==void 0?(r.peek="hit",r.value=c):r.peek="miss"),c},ih=function(e,t,r,n){let a=t===void 0?void 0:te(this,Or)[t];if(Ut(this,Bt,ds).call(this,a))return a;let l=new AbortController,{signal:c}=r;c?.addEventListener("abort",()=>l.abort(c.reason),{signal:l.signal});let h={signal:l.signal,options:r,context:n},p=(C,S=!1)=>{let{aborted:I}=l.signal,N=r.ignoreFetchAbort&&C!==void 0,Q=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&C!==void 0);if(r.status&&(I&&!S?(r.status.fetchAborted=!0,r.status.fetchError=l.signal.reason,N&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),I&&!N&&!S)return x(l.signal.reason,Q);let W=y,B=te(this,Or)[t];return(B===y||B===void 0&&N&&S)&&(C===void 0?W.__staleWhileFetching!==void 0?te(this,Or)[t]=W.__staleWhileFetching:Ut(this,Bt,lc).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),Ut(this,Bt,y0).call(this,e,C,h.options,W))),C},m=C=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=C),x(C,!1)),x=(C,S)=>{let{aborted:I}=l.signal,N=I&&r.allowStaleOnFetchAbort,Q=N||r.allowStaleOnFetchRejection,W=Q||r.noDeleteOnFetchRejection,B=y;if(te(this,Or)[t]===y&&(!W||!S&&B.__staleWhileFetching===void 0?Ut(this,Bt,lc).call(this,e,"fetch"):N||(te(this,Or)[t]=B.__staleWhileFetching)),Q)return r.status&&B.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),B.__staleWhileFetching;if(B.__returned===B)throw C},b=(C,S)=>{var I;let N=(I=te(this,Su))==null?void 0:I.call(this,e,a,h);l.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(C(void 0),r.allowStaleOnFetchAbort&&(C=Q=>p(Q,!0)))}),N&&N instanceof Promise?N.then(Q=>C(Q===void 0?void 0:Q),S):N!==void 0&&C(N)};r.status&&(r.status.fetchDispatched=!0);let y=new Promise(b).then(p,m),w=Object.assign(y,{__abortController:l,__staleWhileFetching:a,__returned:void 0});return t===void 0?(Ut(this,Bt,y0).call(this,e,w,{...h.options,status:void 0}),t=te(this,ai).get(e)):te(this,Or)[t]=w,w},ds=function(e){if(!te(this,_u))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},Op=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:l=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:m=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:C,forceRefresh:S=!1,status:I,signal:N}=t;if(I&&(I.op="fetch",I.key=e,S&&(I.forceRefresh=!0),I.cache=this),!te(this,_u))return I&&(I.fetch="get"),Ut(this,Bt,Iu).call(this,e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:a,status:I});let Q={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:a,ttl:l,noDisposeOnSet:c,size:h,sizeCalculation:p,noUpdateTTL:m,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:w,ignoreFetchAbort:y,status:I,signal:N},W=te(this,ai).get(e);if(W===void 0){I&&(I.fetch="miss");let B=Ut(this,Bt,ih).call(this,e,W,Q,C);return B.__returned=B}else{let B=te(this,Or)[W];if(Ut(this,Bt,ds).call(this,B)){let H=r&&B.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",H&&(I.returnedStale=!0)),H?B.__staleWhileFetching:B.__returned=B}let U=te(this,vo).call(this,W);if(!S&&!U)return I&&(I.fetch="hit"),Ut(this,Bt,Eu).call(this,W),n&&te(this,b0).call(this,W),I&&te(this,ic).call(this,I,W),B;let K=Ut(this,Bt,ih).call(this,e,W,Q,C),re=K.__staleWhileFetching!==void 0&&r;return I&&(I.fetch=U?"stale":"refresh",re&&U&&(I.returnedStale=!0)),re?K.__staleWhileFetching:K.__returned=K}},fx=async function(e,t={}){let r=await Ut(this,Bt,Op).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},px=function(e,t={}){let r=te(this,Lu);if(!r)throw new Error("no memoMethod provided to constructor");let{context:n,status:a,forceRefresh:l,...c}=t;a&&l&&(a.forceRefresh=!0);let h=Ut(this,Bt,Iu).call(this,e,c),p=l||h===void 0;if(a&&(a.memo=p?"miss":"hit",p||(a.value=h)),!p)return h;let m=r(e,h,{options:c,context:n});return a&&(a.value=m),Ut(this,Bt,y0).call(this,e,m,c),m},Iu=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:l}=t,c=te(this,ai).get(e);if(c===void 0){l&&(l.get="miss");return}let h=te(this,Or)[c],p=Ut(this,Bt,ds).call(this,h);return l&&te(this,ic).call(this,l,c),te(this,vo).call(this,c)?p?(l&&(l.get="stale-fetching"),r&&h.__staleWhileFetching!==void 0?(l&&(l.returnedStale=!0),h.__staleWhileFetching):void 0):(a||Ut(this,Bt,lc).call(this,e,"expire"),l&&(l.get="stale"),r?(l&&(l.returnedStale=!0),h):void 0):(l&&(l.get=p?"fetching":"hit"),Ut(this,Bt,Eu).call(this,c),n&&te(this,b0).call(this,c),p?h.__staleWhileFetching:h)},Fp=function(e,t){te(this,go)[t]=e,te(this,Na)[e]=t},Eu=function(e){e!==te(this,Oi)&&(e===te(this,pa)?Cr(this,pa,te(this,Na)[e]):Ut(this,Bt,Fp).call(this,te(this,go)[e],te(this,Na)[e]),Ut(this,Bt,Fp).call(this,te(this,Oi),e),Cr(this,Oi,e))},lc=function(e,t){var r,n;Ui.hasSubscribers&&Ui.publish({op:"delete",delete:t,key:e,cache:this});let a=!1;if(te(this,gi)!==0){let l=te(this,ai).get(e);if(l!==void 0)if(te(this,bo)?.[l]&&(clearTimeout(te(this,bo)?.[l]),te(this,bo)[l]=void 0),a=!0,te(this,gi)===1)Ut(this,Bt,$p).call(this,t);else{te(this,v0).call(this,l);let c=te(this,Or)[l];if(Ut(this,Bt,ds).call(this,c)?c.__abortController.abort(new Error("deleted")):(te(this,ll)||te(this,Ra))&&(te(this,ll)&&((r=te(this,rl))==null||r.call(this,c,e,t)),te(this,Ra)&&te(this,Fi)?.push([c,e,t])),te(this,ai).delete(e),te(this,As)[l]=void 0,te(this,Or)[l]=void 0,l===te(this,Oi))Cr(this,Oi,te(this,go)[l]);else if(l===te(this,pa))Cr(this,pa,te(this,Na)[l]);else{let h=te(this,go)[l];te(this,Na)[h]=te(this,Na)[l];let p=te(this,Na)[l];te(this,go)[p]=te(this,go)[l]}Dp(this,gi)._--,te(this,il).push(l)}}if(te(this,Ra)&&te(this,Fi)?.length){let l=te(this,Fi),c;for(;c=l?.shift();)(n=te(this,nl))==null||n.call(this,...c)}return a},$p=function(e){var t,r;for(let n of Ut(this,Bt,oc).call(this,{allowStale:!0})){let a=te(this,Or)[n];if(Ut(this,Bt,ds).call(this,a))a.__abortController.abort(new Error("deleted"));else{let l=te(this,As)[n];te(this,ll)&&((t=te(this,rl))==null||t.call(this,a,l,e)),te(this,Ra)&&te(this,Fi)?.push([a,l,e])}}if(te(this,ai).clear(),te(this,Or).fill(void 0),te(this,As).fill(void 0),te(this,xo)&&te(this,ol)){te(this,xo).fill(0),te(this,ol).fill(0);for(let n of te(this,bo)??[])n!==void 0&&clearTimeout(n);te(this,bo)?.fill(void 0)}if(te(this,al)&&te(this,al).fill(0),Cr(this,pa,0),Cr(this,Oi,0),te(this,il).length=0,Cr(this,mo,0),Cr(this,gi,0),te(this,Ra)&&te(this,Fi)){let n=te(this,Fi),a;for(;a=n?.shift();)(r=te(this,nl))==null||r.call(this,...a)}},Up);function L6(e){let t={individual:{},range:[]},r=new WeakMap;for(let n of e)Pm(t,n,r);return t}function Pm(e,t,r){for(let[n,a]of Object.entries(t.individual))if(e.individual[n])w0(e.individual[n],a,r);else{let l=!1;for(let[c,{range:h,entry:p}]of e.range.entries()){let m=zp(Number(n),h);if(m.both!==null){l=!0,e.individual[n]=a,w0(e.individual[n],zi(p),r),e.range.splice(c,1);for(let x of m.second)Array.isArray(x)?e.range.push({range:x,entry:zi(p)}):e.individual[x]=zi(p)}}l||(e.individual[n]=a)}for(let{range:n,entry:a}of t.range){let l=[n];for(let c=0;c<e.range.length;c++){let{range:h,entry:p}=e.range[c];for(let[m,x]of l.entries())if(Array.isArray(x)){let b=kE(x,h);if(b.both===null)continue;e.range.splice(c,1),c--;let y=zi(p);Array.isArray(b.both)?e.range.push({range:b.both,entry:y}):e.individual[b.both]=y,w0(y,zi(a),r);for(let w of b.second)Array.isArray(w)?e.range.push({range:w,entry:zi(p)}):e.individual[w]=zi(p);l=b.first}else{let b=zp(x,h);if(b.both===null)continue;e.individual[x]=zi(a),w0(e.individual[x],zi(p),r),e.range.splice(c,1),c--;for(let y of b.second)Array.isArray(y)?e.range.push({range:y,entry:zi(p)}):e.individual[y]=zi(p);l.splice(m,1,...b.first);break}}for(let c of Object.keys(e.individual))for(let[h,p]of l.entries())if(Array.isArray(p)){let m=zp(Number(c),p);if(m.both===null)continue;w0(e.individual[c],zi(a),r),l.splice(h,1,...m.second);break}else if(Number(c)===p){w0(e.individual[c],zi(a),r);break}for(let c of l)Array.isArray(c)?e.range.push({range:c,entry:zi(a)}):e.individual[c]=zi(a)}}function w0(e,t,r){let n=r.get(e);n?.has(t)||(n||(n=new Set,r.set(e,n)),n.add(t),t.lookup&&(!e.lookup||e.lookup.index>t.lookup.index||e.lookup.index===t.lookup.index&&e.lookup.subIndex>t.lookup.subIndex)&&(e.lookup=t.lookup),t.forward&&(e.forward?Pm(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?Pm(e.reverse,t.reverse,r):e.reverse=t.reverse))}function kE(e,t){let r={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]){let n=Math.max(e[0],t[0]),a=Math.min(e[1],t[1]);r.both=$c(n,a)}if(e[0]<t[0]){let n=e[0],a=Math.min(t[0],e[1]);r.first.push($c(n,a))}else if(t[0]<e[0]){let n=t[0],a=Math.min(t[1],e[0]);r.second.push($c(n,a))}if(e[1]>t[1]){let n=Math.max(e[0],t[1]),a=e[1];r.first.push($c(n,a))}else if(t[1]>e[1]){let n=Math.max(e[1],t[0]),a=t[1];r.second.push($c(n,a))}return r}function zp(e,t){if(e<t[0]||e>t[1])return{first:[e],second:[t],both:null};let r={first:[],second:[],both:e};return t[0]<e&&r.second.push($c(t[0],e)),t[1]>e&&r.second.push($c(e+1,t[1])),r}function $c(e,t){return t-e===1?e:[e,t]}function zi(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=mx(e.forward,t)),e.reverse&&(r.reverse=mx(e.reverse,t)),e.lookup&&(r.lookup={contextRange:e.lookup.contextRange.slice(),index:e.lookup.index,length:e.lookup.length,subIndex:e.lookup.subIndex,substitutions:e.lookup.substitutions.slice()}),r}function mx(e,t=new Map){let r={};for(let[n,a]of Object.entries(e.individual))r[n]=zi(a,t);return{individual:r,range:e.range.map(({range:n,entry:a})=>({range:n.slice(),entry:zi(a,t)}))}}function Om(e,t,r,n){let a=t[n],l=e[a];if(!l)return;let c=l.lookup;if(l.reverse){let p=IE(l.reverse,t,r);(!c&&p||p&&c&&(c.index>p.index||c.index===p.index&&c.subIndex>p.subIndex))&&(c=p)}if(++n>=t.length||!l.forward)return c;let h=Om(l.forward,t,r,n);return(!c&&h||h&&c&&(c.index>h.index||c.index===h.index&&c.subIndex>h.subIndex))&&(c=h),c}function IE(e,t,r){let n=e[t[--r]],a=n&&n.lookup;for(;n&&((!a&&n.lookup||n.lookup&&a&&a.index>n.lookup.index)&&(a=n.lookup),!(--r<0||!n.reverse));)n=n.reverse[t[r]];return a}function gx(e,t,r){let n=!1;for(let a=0;a<e.length;a++){let l=e[a];if(n){if(r<=l[0])return e[a-1][1]=r,e;if(r<=l[1])return e[a-1][1]=Math.max(r,l[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(r<=l[0])return e.splice(a,0,[t,r]),e;if(r<=l[1])return l[0]=Math.min(t,l[0]),e;if(t<l[1])l[0]=Math.min(t,l[0]),n=!0;else continue}}return n?e[e.length-1][1]=r:e.push([t,r]),e}function EE(e,t){switch(e.format){case 1:let r=e.glyphs.indexOf(t);return r!==-1?r:null;case 2:let n=e.ranges.find(a=>a.start<=t&&a.end>=t);return n?n.index:null}}function Ql(e){switch(e.format){case 1:return e.glyphs.map((r,n)=>({glyphId:r,index:n}));case 2:let t=[];for(let[r,n]of e.ranges.entries())n.end===n.start?t.push({glyphId:n.start,index:r}):t.push({glyphId:[n.start,n.end+1],index:r});return t}}function NE(e,t){let r=t[0],n=Fm(e,r),a=t[0]+1,l=new Map;for(;a<t[1];)Fm(e,a)!==n&&(a-r<=1?l.set(r,n):l.set([r,a],n)),a++;return a-r<=1?l.set(r,n):l.set([r,a],n),l}function Fm(e,t){let r=EE(e.coverage,t);if(r===null)return null;switch(e.substFormat){case 1:return(t+e.deltaGlyphId)%2**16;case 2:return e.substitute[r]??null}}function F1(e,t,r,n,a){let l=[];for(let c of r){c.entry.forward={individual:{},range:[]};for(let h of e)l.push(...jf(c.entry.forward,n,a,t,h).map(({entry:p,substitution:m})=>({entry:p,substitutions:[...c.substitutions,m]})))}return l}function Rf(e,t){let r=[],n=new Set;for(let a of t){if(n.has(a.entry))continue;n.add(a.entry),a.entry.forward??={individual:{},range:[]};let l={};for(let c of e)Array.isArray(c)?a.entry.forward.range.push({entry:l,range:c}):a.entry.forward.individual[c]=l;r.push({entry:l,substitutions:a.substitutions})}return r}function Mf(e,t){let r=[],n=new Set;for(let a of t){if(n.has(a.entry))continue;n.add(a.entry),a.entry.reverse??={individual:{},range:[]};let l={};for(let c of e)Array.isArray(c)?a.entry.reverse.range.push({entry:l,range:c}):a.entry.reverse.individual[c]=l;r.push({entry:l,substitutions:a.substitutions})}return r}function jf(e,t,r,n,a){let l=[];if(!Array.isArray(a))e.individual[a]={},l.push({entry:e.individual[a],substitution:ME(t,r,n,a)});else{let c=RE(t,r,n,a);for(let[h,p]of c){let m={};Array.isArray(h)?e.range.push({range:h,entry:m}):e.individual[h]={},l.push({entry:m,substitution:p})}}return l}function RE(e,t,r,n){for(let a of e.filter(l=>l.sequenceIndex===r))for(let l of t[a.lookupListIndex].subtables){let c=NE(l,n);if(!Array.from(c.values()).every(h=>h!==null))return c}return new Map([[n,null]])}function ME(e,t,r,n){for(let a of e.filter(l=>l.sequenceIndex===r))for(let l of t[a.lookupListIndex].subtables){let c=Fm(l,n);if(c!==null)return c}return null}function jE(e,t,r){let n={individual:{},range:[]},a=Ql(e.coverage);for(let{glyphId:l,index:c}of a){let h=e.chainRuleSets[c];if(h)for(let[p,m]of h.entries()){let x=jf(n,m.lookupRecords,t,0,l).map(({entry:b,substitution:y})=>({entry:b,substitutions:[y]}));for(let[b,y]of m.input.entries())x=F1([y],b+1,x,m.lookupRecords,t);for(let b of m.lookahead)x=Rf([b],x);for(let b of m.backtrack)x=Mf([b],x);for(let{entry:b,substitutions:y}of x)b.lookup={substitutions:y,length:m.input.length+1,index:r,subIndex:p,contextRange:[-1*m.backtrack.length,1+m.input.length+m.lookahead.length]}}}return n}function DE(e,t){return e.format===2?Array.isArray(t)?QE(e,t):new Map([[t,$m(e,t)]]):new Map([[t,null]])}function QE(e,t){let r=t[0],n=$m(e,r),a=t[0]+1,l=new Map;for(;a<t[1];)$m(e,a)!==n&&(a-r<=1?l.set(r,n):l.set([r,a],n)),a++;return a-r<=1?l.set(r,n):l.set([r,a],n),l}function $m(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function Hp(e,t){switch(e.format){case 2:let r=[];for(let n of e.ranges)n.classId===t&&(n.end===n.start?r.push(n.start):r.push([n.start,n.end+1]));return r;default:return[]}}function BE(e,t,r){let n=[],a=Ql(e.coverage);for(let{glyphId:l}of a){let c=DE(e.inputClassDef,l);for(let[h,p]of c.entries()){if(p===null)continue;let m=e.chainClassSet[p];if(m)for(let[x,b]of m.entries()){let y={individual:{},range:[]},w=jf(y,b.lookupRecords,t,0,h).map(({entry:C,substitution:S})=>({entry:C,substitutions:[S]}));for(let[C,S]of b.input.entries())w=F1(Hp(e.inputClassDef,S),C+1,w,b.lookupRecords,t);for(let C of b.lookahead)w=Rf(Hp(e.lookaheadClassDef,C),w);for(let C of b.backtrack)w=Mf(Hp(e.backtrackClassDef,C),w);for(let{entry:C,substitutions:S}of w)C.lookup={substitutions:S,index:r,subIndex:x,length:b.input.length+1,contextRange:[-1*b.backtrack.length,1+b.input.length+b.lookahead.length]};n.push(y)}}}return L6(n)}function PE(e,t,r){let n={individual:{},range:[]},a=Ql(e.inputCoverage[0]);for(let{glyphId:l}of a){let c=jf(n,e.lookupRecords,t,0,l).map(({entry:h,substitution:p})=>({entry:h,substitutions:[p]}));for(let[h,p]of e.inputCoverage.slice(1).entries())c=F1(Ql(p).map(m=>m.glyphId),h+1,c,e.lookupRecords,t);for(let h of e.lookaheadCoverage)c=Rf(Ql(h).map(p=>p.glyphId),c);for(let h of e.backtrackCoverage)c=Mf(Ql(h).map(p=>p.glyphId),c);for(let{entry:h,substitutions:p}of c)h.lookup={substitutions:p,index:r,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return n}function OE(e,t){let r={individual:{},range:[]},n=Ql(e.coverage);for(let{glyphId:a,index:l}of n){let c={};Array.isArray(a)?r.range.push({entry:c,range:a}):r.individual[a]=c;let h=[{entry:c,substitutions:[e.substitutes[l]]}];for(let p of e.lookaheadCoverage)h=Rf(Ql(p).map(m=>m.glyphId),h);for(let p of e.backtrackCoverage)h=Mf(Ql(p).map(m=>m.glyphId),h);for(let{entry:p,substitutions:m}of h)p.lookup={substitutions:m,index:t,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return r}function Um(e,t=new Map){let r={};for(let[n,a]of Object.entries(e.individual))r[n]=xx(a,t);for(let{range:n,entry:a}of e.range){let l=xx(a,t);for(let c=n[0];c<n[1];c++)r[c]=l}return r}function xx(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Um(e.forward,t)),e.reverse&&(r.reverse=Um(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var FE=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new _E({maxSize:t.cacheSize,sizeCalculation:((l,c)=>c.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(l=>l.tag==="calt")||[]).reduce((l,c)=>[...l,...c.feature.lookupListIndexes],[]),n=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],a=n.filter((l,c)=>r.some(h=>h===c));for(let[l,c]of a.entries()){let h=[];switch(c.lookupType){case 6:for(let[m,x]of c.subtables.entries())switch(x.substFormat){case 1:h.push(jE(x,n,m));break;case 2:h.push(BE(x,n,m));break;case 3:h.push(PE(x,n,m));break}break;case 8:for(let[m,x]of c.subtables.entries())h.push(OE(x,m));break}let p=Um(L6(h));this._lookupTrees.push({tree:p,processForward:c.lookupType!==8});for(let m of Object.keys(p))this._glyphLookups[m]||(this._glyphLookups[m]=[]),this._glyphLookups[m].push(l)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let r=[];for(let l of e)r.push(this._font.charToGlyphIndex(l));if(this._lookupTrees.length===0)return{inputGlyphs:r,outputGlyphs:r,contextRanges:[]};let n=this._findInternal(r.slice()),a={inputGlyphs:r,outputGlyphs:n.sequence,contextRanges:n.ranges};return this._cache&&this._cache.set(e,a),a}findLigatureRanges(e){if(this._lookupTrees.length===0)return[];let t=this._cache&&this._cache.get(e);if(t)return Array.isArray(t)?t:t.contextRanges;let r=[];for(let a of e)r.push(this._font.charToGlyphIndex(a));let n=this._findInternal(r);return this._cache&&this._cache.set(e,n.ranges),n.ranges}_findInternal(e){let t=[],r=this._getNextLookup(e,0);for(;r.index!==null;){let n=this._lookupTrees[r.index];if(n.processForward){let a=r.last;for(let l=r.first;l<a;l++){let c=Om(n.tree,e,l,l);if(c){for(let h=0;h<c.substitutions.length;h++){let p=c.substitutions[h];p!==null&&(e[l+h]=p)}gx(t,c.contextRange[0]+l,c.contextRange[1]+l),l+c.length>=a&&(a=l+c.length+1),l+=c.length-1}}}else for(let a=r.last-1;a>=r.first;a--){let l=Om(n.tree,e,a,a);if(l){for(let c=0;c<l.substitutions.length;c++){let h=l.substitutions[c];h!==null&&(e[a+c]=h)}gx(t,l.contextRange[0]+a,l.contextRange[1]+a),a-=l.length-1}}r=this._getNextLookup(e,r.index+1)}return{sequence:e,ranges:t}}_getNextLookup(e,t){let r={index:null,first:1/0,last:-1};for(let n=0;n<e.length;n++){let a=this._glyphLookups[e[n]];if(a)for(let l=0;l<a.length;l++){let c=a[l];if(c>=t){(r.index===null||c<=r.index)&&(r.index=c,r.first>n&&(r.first=n),r.last=n+1);break}}}return r}};function $E(e,t){let r=AE.parse(e);return new FE(r,{cacheSize:0,...t})}function UE(e){if(typeof e!="string")throw new Error("Font family must be a string");let t={input:e,offset:0},r=[],n="";for(;t.offset<t.input.length;){let a=t.input[t.offset++];switch(a){case"'":case'"':n+=zE(t,a);break;case",":r.push(n),n="";break;default:/\s/.test(a)||(t.offset--,n+=HE(t),r.push(n),n="")}}return r}function zE(e,t){let r="",n=!1;for(;e.offset<e.input.length;){let a=e.input[e.offset++];if(n)/[\dA-Fa-f]/.test(a)?(e.offset--,r+=_6(e)):a!==`
120
+ `&&(r+=a),n=!1;else switch(a){case t:return r;case"\\":n=!0;break;default:r+=a}}throw new Error("Unterminated string")}function HE(e){let t="",r=!1;for(;e.offset<e.input.length;){let n=e.input[e.offset++];if(r)/[\dA-Fa-f]/.test(n)?(e.offset--,t+=_6(e)):t+=n,r=!1;else switch(n){case"\\":r=!0;break;case",":return t;default:/\s/.test(n)?t.endsWith(" ")||(t+=" "):t+=n}}return t}function _6(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return Wp(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,Wp(t);t+=r}return Wp(t)}function Wp(e){return String.fromCodePoint(parseInt(e,16))}var Nu;async function WE(e,t){if(!Nu){if(typeof navigator<"u"&&"fonts"in navigator){try{let a=await navigator.permissions.request?.({name:"local-fonts"});if(a&&a.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(a){if(a instanceof Error&&a.name!=="TypeError")throw a}let n={};try{let a=await navigator.fonts.query();for(let l of a)n.hasOwnProperty(l.family)||(n[l.family]=[]),n[l.family].push(l);Nu=Promise.resolve(n)}catch(a){a instanceof Error&&console.error(a.name,a.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let n={};try{let a=await window.queryLocalFonts();for(let l of a)n.hasOwnProperty(l.family)||(n[l.family]=[]),n[l.family].push(l);Nu=Promise.resolve(n)}catch(a){a instanceof Error&&console.error(a.name,a.message)}}Nu??=Promise.resolve({})}let r=await Nu;for(let n of UE(e)){if(GE.includes(n))return;if(r.hasOwnProperty(n)&&r[n].length>0){let a=r[n][0];if("blob"in a){let l=await(await a.blob()).arrayBuffer();return $E(l,{cacheSize:t})}return}}}var GE=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],qE=1e5;function VE(e,t=[]){let r,n,a=0,l;return e.registerCharacterJoiner(c=>{let h=e.options.fontFamily;if(h&&(a===0||r!==h)){n=void 0,a=1,r=h;let p=r;WE(p,qE).then(m=>{p===e.options.fontFamily&&(a=2,n=m,m&&e.refresh(0,e.rows-1))}).catch(m=>{p===e.options.fontFamily&&(a=3,e.options.logLevel==="debug"&&console.debug(l,new Error("Failure while loading font")),n=void 0,l=m)})}return n&&a===2?n.findLigatureRanges(c).map(p=>[p[0],p[1]]):ZE(c,t)})}function ZE(e,t){let r=[];for(let n=0;n<e.length;n++)for(let a=0;a<t.length;a++)if(e.startsWith(t[a],n)){r.push([n,n+t[a].length]),n+=t[a].length-1;break}return r}var YE=class{constructor(e){this._fallbackLigatures=(e?.fallbackLigatures??["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]).sort((t,r)=>r.length-t.length),this._fontFeatureSettings=e?.fontFeatureSettings}activate(e){if(!e.element)throw new Error("Cannot activate LigaturesAddon before open is called");this._terminal=e,this._characterJoinerId=VE(e,this._fallbackLigatures),e.element.style.fontFeatureSettings=this._fontFeatureSettings??'"calt" on'}dispose(){this._characterJoinerId!==void 0&&(this._terminal?.deregisterCharacterJoiner(this._characterJoinerId),this._characterJoinerId=void 0),this._terminal?.element&&(this._terminal.element.style.fontFeatureSettings="")}};function bx(e){let t=0;for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);if(n<48||57<n)return-1;t=t*10+n-48}return t}var KE=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let n=bx(r[1]),a=bx(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(a<0)return!0;this.progress={state:n,value:a};break;case 2:case 4:if(a<0)return!0;this.progress={state:n,value:a||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function k6(e,t){const r=Math.max(e.left,t.left),n=Math.max(e.top,t.top),a=Math.min(e.right,t.right),l=Math.min(e.bottom,t.bottom);return a>r&&l>n?{left:r,top:n,right:a,bottom:l}:null}function vx(e,t){const r=k6(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function qc(e){const t=e.element;if(!t||!e.cols||!e.rows)return null;const n=(t.querySelector?.(".xterm-screen")??null??t).getBoundingClientRect();if(!n.width||!n.height)return null;const a=e.dimensions?.css?.cell?.height,l=n.width/e.cols,c=a&&a>0?a:n.height/e.rows;return{originLeft:n.left,originTop:n.top,cellW:l,cellH:c}}function jh(e,t){const r=qc(e);if(!r)return null;const n=t.row-e.buffer.active.viewportY;if(n<0||n>=e.rows)return null;const a=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(a+.5)*r.cellW,y:r.originTop+n*r.cellH}}function XE(e,t){const r=Math.max(0,e.buffer.active.baseY+e.rows-1);return{col:Math.max(0,Math.min(e.cols-1,t.col)),row:Math.max(0,Math.min(r,t.row))}}function lf(e,t,r){const n=e.row*r+e.col,a=t.row*r+t.col;return n<=a?{start:e,end:t}:{start:t,end:e}}function JE(e,t,r){const n=qc(e);if(!n)return null;const{start:a,end:l}=lf(t,r,e.cols),c=e.buffer.active.viewportY,h=c+e.rows-1;if(l.row<c||a.row>h)return null;const p=Math.max(a.row,c),m=Math.min(l.row,h),x=n.originTop+(p-c)*n.cellH,b=n.originTop+(m-c+1)*n.cellH;return a.row===l.row?{left:n.originLeft+a.col*n.cellW,top:x,right:n.originLeft+(l.col+1)*n.cellW,bottom:b}:{left:n.originLeft,top:x,right:n.originLeft+e.cols*n.cellW,bottom:b}}function eN(e){const t=Math.max(e.viewport.left,e.terminal.left),r=Math.max(e.viewport.top,e.terminal.top),n=Math.min(e.viewport.right,e.terminal.right),a=Math.min(e.viewport.bottom,e.terminal.bottom),l=t+e.margin,c=r+e.margin,h=Math.max(l,n-e.width-e.margin),p=Math.max(c,a-e.height-e.margin),m=H=>Math.max(l,Math.min(H,h)),x=H=>Math.max(c,Math.min(H,p)),b=e.selection?k6(e.selection,{left:t,top:r,right:n,bottom:a}):null;if(!b){const H=m(e.clientX-e.width/2),Oe=e.clientY-e.height-e.fingerGap,ne=e.clientY+e.fingerGap,ce=x(Oe>=c?Oe:ne);return{left:Math.round(H),top:Math.round(ce)}}const y=(b.left+b.right)/2,w=(b.top+b.bottom)/2,C=e.preference?.alignX??y,S=e.selectionGap??e.fingerGap,I=b.top-e.height-S,N=b.bottom+S,Q=e.preference?.vertical==="below"?N:I,W=e.preference?.vertical==="below"?I:N,B=[{left:l,top:c},{left:h,top:c},{left:l,top:p},{left:h,top:p}];e.preference&&B.sort((H,Oe)=>{const ne=ce=>{const Ne=ce.left+e.width/2,Me=ce.top+e.height/2;return Math.hypot(Ne-e.preference.focusX,Me-e.preference.focusY)};return ne(Oe)-ne(H)});const U=[{left:C-e.width/2,top:Q},{left:y-e.width/2,top:Q},{left:C-e.width/2,top:W},{left:y-e.width/2,top:W},{left:b.left-e.width-e.fingerGap,top:w-e.height/2},{left:b.right+e.fingerGap,top:w-e.height/2},...B].map(H=>({left:m(H.left),top:x(H.top)}));let K=U[0],re=Number.POSITIVE_INFINITY;return U.forEach((H,Oe)=>{const ne={left:H.left,top:H.top,right:H.left+e.width,bottom:H.top+e.height},ce=(e.avoid??[]).reduce((Me,be)=>Me+vx(ne,be),0),Ne=(ce>0?1e6:0)+ce*100+vx(ne,b)*10+Oe*.01;Ne<re&&(K=H,re=Ne)}),{left:Math.round(K.left),top:Math.round(K.top)}}function tN(e){const t=e.willChange.split(",").map(n=>n.trim()),r=(n,a)=>!!(n&&n!==a);return r(e.transform,"none")||r(e.perspective,"none")||r(e.filter,"none")||r(e.backdropFilter,"none")||r(e.containerType,"normal")||e.contain.includes("layout")||e.contain.includes("paint")||e.contain.includes("strict")||e.contain.includes("content")||t.includes("transform")||t.includes("perspective")||t.includes("filter")}function rN(e){let t=e.parentElement;for(;t;){if(tN(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function nN(e,t,r,n){const a=e.getBoundingClientRect();let l=0,c=0;if(t){const h=t.getBoundingClientRect();l=h.left+t.clientLeft,c=h.top+t.clientTop}return{x:a.left-l+r,y:a.top-c+n}}function sN(e,t){return t?.ownedPaste?vg(e,t.ownedPaste.submitAfterPaste===!0):t?.paste&&/[\r\n]/.test(e)?vg(e,t.submitAfterPaste??e.endsWith("\r")):e}const iN=500;function aN(e){let t,r,n=!1,a=0,l;const c=e.parser.registerCsiHandler({prefix:"?",final:"l"},p=>(t&&p.some(m=>m===2026)&&(n=!0),!1)),h=p=>{l!==void 0&&(clearTimeout(l),l=void 0);const m=t;if(!m)return;const x=r;if(t=void 0,r=void 0,n=!1,m(),p){const b=e._core?._renderService?._renderer?.value;x&&b?.handleResize(...x),b?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(a++,n=!1,t)return;const p=e._core?._renderService?._renderer?.value;if(!p||typeof p.handleResize!="function"||typeof p.renderRows!="function"||typeof p.clear!="function")return;const m=p.handleResize,x=p.renderRows,b=p.clear;p.handleResize=(y,w)=>{r=[y,w]},p.renderRows=()=>{},p.clear=()=>{},t=()=>{p.handleResize=m,p.renderRows=x,p.clear=b},l=setTimeout(()=>h(!0),iN)},get generation(){return a},written(p){p===a&&n&&!e.modes.synchronizedOutputMode&&h(!0)},cancel(){h(!0)},dispose(){h(!1),c.dispose()}}}function Gp(){return{confirmed:null,pending:null,nextSeq:1}}function yx(e,t){return e?.cols===t.cols&&e.rows===t.rows}function $1(e,t,r){const n={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:n,nextSeq:e.nextSeq+1},request:n}}function oN(e,t){return yx(e.pending,t)||!e.pending&&yx(e.confirmed,t)?{state:e,request:null}:$1(e,t,0)}function lN(e,t){return $1(e,t,0)}function cN(e,t){const r=e.pending;if(!r||t.seq!==r.seq)return{state:e,accepted:!1};const n=t.ok&&Number.isFinite(t.cols)&&Number.isFinite(t.rows)&&(t.cols??0)>0&&(t.rows??0)>0?{cols:Math.floor(t.cols),rows:Math.floor(t.rows)}:null;return{state:{...e,confirmed:n,pending:null},accepted:!0}}function wx(e,t,r=1){const n=e.pending;return!n||n.seq!==t?{state:e,request:null,exhausted:!1}:n.attempt>=r?{state:{...e,confirmed:null,pending:null},request:null,exhausted:!0}:{...$1(e,n,n.attempt+1),exhausted:!1}}function uN(e,t){return!Number.isFinite(t.cols)||!Number.isFinite(t.rows)||t.cols<=0||t.rows<=0?e:{...e,confirmed:{cols:Math.floor(t.cols),rows:Math.floor(t.rows)}}}function Ax(e){return{...e,pending:null}}const dN=150;function Tx(e=0){return{lastPushAt:e}}function hN(e,t,r=dN){return t-e.lastPushAt>=r?(e.lastPushAt=t,{action:"send"}):{action:"hold",readyAt:e.lastPushAt+r}}function fN(e){return{lastPushAt:e}}const zm="termdock-settings",pN=6,mN=100,gN='"calt" on',xN=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function bN(){if(typeof window>"u")return 14;const e=window.matchMedia("(max-width: 767px)").matches,t=window.matchMedia("(pointer: coarse)").matches;return e||t?12:14}function U1(){return{typographyVersion:1,fontFamily:"var(--font-terminal)",fontSize:bN(),rendererMode:"auto",fontWeight:"normal",fontWeightBold:"bold",letterSpacing:0,lineHeight:1.1,minimumContrastRatio:4.5,drawBoldTextInBrightColors:!0,unicodeVersion:"11",customGlyphs:!0,rescaleOverlappingGlyphs:!1,fontLigatures:!0,enableImages:!0,smoothScrolling:!0}}function ah(e,t,r,n){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):n}function Cx(e,t){return e==="normal"||e==="bold"?e:typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(1e3,Math.round(e))):t}function Q0(e){const t=U1(),r=e&&typeof e=="object"?e:{},n=r.rendererMode??r.renderer,a=typeof r.fontFamily=="string"?r.fontFamily.trim():"",l=!a||a==="var(--font-mono)"||a===t.fontFamily,c=r.typographyVersion!==t.typographyVersion&&l&&(r.fontSize===10||r.fontSize===13)&&(r.letterSpacing===0||r.letterSpacing===1)&&r.lineHeight===1.05&&(r.fontWeight===void 0||r.fontWeight==="normal")&&(r.fontWeightBold===void 0||r.fontWeightBold==="bold");return{typographyVersion:t.typographyVersion,fontFamily:l?t.fontFamily:a,fontSize:c?t.fontSize:ah(r.fontSize,pN,mN,t.fontSize),rendererMode:n==="auto"||n==="webgl"||n==="canvas"?n:t.rendererMode,fontWeight:Cx(r.fontWeight,t.fontWeight),fontWeightBold:Cx(r.fontWeightBold,t.fontWeightBold),letterSpacing:c?t.letterSpacing:Math.round(ah(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:c?t.lineHeight:ah(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:ah(r.minimumContrastRatio,1,21,t.minimumContrastRatio),drawBoldTextInBrightColors:t.drawBoldTextInBrightColors,unicodeVersion:t.unicodeVersion,customGlyphs:t.customGlyphs,rescaleOverlappingGlyphs:t.rescaleOverlappingGlyphs,fontLigatures:t.fontLigatures,enableImages:t.enableImages,smoothScrolling:t.smoothScrolling}}function oh(e){return e.pointerType==="touch"||e.pointerType==="pen"}class vN{handlers=new Map;active=new Map;pointerStates=new Map;sorted=[];sortedDirty=!1;listenersRegistered=!1;changeListeners=new Set;constructor(){this.ensureListeners()}register(t){return this.handlers.has(t.name)&&this.log("replace",t.name),this.handlers.set(t.name,t),this.sortedDirty=!0,this.log("register",t.name,`prio=${t.priority}`),()=>{this.unregister(t.name)}}unregister(t){this.handlers.delete(t),this.sortedDirty=!0;for(const[r,n]of this.active)n===t&&(this.active.delete(r),this.pointerStates.delete(r));this.log("unregister",t)}getHandlers(){return this.sortedHandlers().map(t=>({name:t.name,priority:t.priority,hasContainer:t.container!=null}))}getClaimedHandler(t){return this.active.get(t)??null}isClaimedBy(t,r){return this.active.get(t)===r}isAnyPointerClaimed(){return this.active.size>0}onChange(t){return this.changeListeners.add(t),()=>{this.changeListeners.delete(t)}}emitChange(t,r,n){this.changeListeners.size!==0&&this.changeListeners.forEach(a=>{try{a({type:t,pointerId:r,handler:n})}catch{}})}log(t,r,n=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const a=performance.now().toFixed(0);console.debug(`[GestureManager ${a}] ${t} ${r} ${n}`)}}sortedHandlers(){return this.sortedDirty&&(this.sorted=[...this.handlers.values()].sort((t,r)=>r.priority-t.priority),this.sortedDirty=!1),this.sorted}ensureListeners(){this.listenersRegistered||(this.listenersRegistered=!0,document.addEventListener("pointerdown",this.handlePointerDown,{capture:!0,passive:!1}),document.addEventListener("pointermove",this.handlePointerMove,{capture:!0,passive:!1}),document.addEventListener("pointerup",this.handlePointerUp,{capture:!0,passive:!1}),document.addEventListener("pointercancel",this.handlePointerCancel,{capture:!0,passive:!1}))}handlePointerDown=t=>{if(!oh(t))return;const r={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:performance.now()};this.pointerStates.set(t.pointerId,r);let n=!1;for(const a of this.sortedHandlers()){if(!this.handlerMatchesContainer(a,t)){this.log("skip-container",a.name);continue}a.onPointerDown(t,r)&&!n&&(this.active.set(t.pointerId,a.name),n=!0,this.log("claim",a.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,a.name))}n&&t.preventDefault()};handlePointerMove=t=>{if(!oh(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const n of this.sortedHandlers()){if(!this.handlerMatchesContainer(n,t))continue;const a=this.active.get(t.pointerId)===n.name,l=n.onPointerMove(t,a);if(l==="claim"&&!r){const c=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,n.name),r=!0,t.preventDefault(),c&&c!==n.name&&this.log("handoff",`${c}->${n.name}`,`pid=${t.pointerId}`),this.log("claim",n.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,n.name)}if(l==="release"&&a&&!r){const c=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",n.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,c??null)}}};handlePointerUp=t=>{if(!oh(t))return;for(const n of this.sortedHandlers())this.handlerMatchesContainer(n,t)&&n.onPointerUp(t);const r=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,r)};handlePointerCancel=t=>{if(!oh(t))return;for(const n of this.sortedHandlers())this.handlerMatchesContainer(n,t)&&n.onPointerCancel(t);const r=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,r)};handlerMatchesContainer(t,r){return t.container?t.container.contains(r.target):!0}}const I6=new vN,yN=90,wN=80,AN=70,TN=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:n=.8,boostDenominator:a=50,velocityAlpha:l=.15,maxVelocity:c=15,minVelocity:h=.3,decelerationRate:p=.998,enableKinetic:m=!0,shouldCaptureTouch:x,canStartScrollGesture:b,onScroll:y,onScrollWithCoords:w,onTap:C,onClickWithCoords:S,onClaimChange:I,tapThreshold:N=10,gestureName:Q="normal-scroll"}=t,W=1.06,B=L.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),U=L.useRef(0),K=L.useRef(0),re=L.useRef(0),H=L.useRef(null),Oe=L.useRef(0),ne=L.useRef(!1),ce=L.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Ne=L.useCallback(()=>{H.current=null,U.current!==0&&(w&&K.current>0&&re.current>0?w(U.current,K.current,re.current):y&&y(U.current),U.current=0,K.current=0,re.current=0)},[y,w]),Me=L.useCallback(()=>{H.current===null&&typeof window<"u"&&(H.current=window.requestAnimationFrame(Ne))},[Ne]),be=L.useCallback((ye,de,nt)=>{U.current+=ye,de!==void 0&&nt!==void 0&&(K.current=de,re.current=nt),Me()},[Me]),V=L.useCallback(ye=>{if(!ye||!y)return!1;const de=y(ye);return de?Oe.current=0:Oe.current++,de},[y]),Ke=L.useCallback(ye=>{ne.current!==ye&&(ne.current=ye,I?.(ye))},[I]),he=L.useCallback(()=>{const ye=B.current;ye.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(ye.rafId),ye.rafId=null,H.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(H.current),H.current=null,U.current=0},[]),Be=L.useRef(C);Be.current=C;const ae=L.useRef(S);ae.current=S;const X=L.useRef(x);X.current=x;const He=L.useCallback(()=>{const ye=e.current;if(!ye||!("PointerEvent"in window))return()=>{};const de=B.current,nt={name:Q,priority:AN,get container(){return e.current??void 0},onPointerDown:(xe,mt)=>(xe.pointerType!=="touch"||(de.pointerId=xe.pointerId,de.startX=mt.startX,de.startY=mt.startY,de.didMove=!1,de.gestureAxis=null,de.lastY=xe.clientY,de.lastTime=ce(),de.velocity=0,he()),!1),onPointerMove:(xe,mt)=>{if(xe.pointerType!=="touch"||de.pointerId!==xe.pointerId||!de.lastY||!de.lastTime)return"neutral";const It=xe.clientX,At=xe.clientY,Nt=ce(),oe=Nt-de.lastTime,F=At-de.lastY;if(de.startX!==null&&de.startY!==null){const Qe=It-de.startX,tt=At-de.startY;if(!de.didMove&&Math.hypot(Qe,tt)>=N&&(de.didMove=!0),de.gestureAxis===null&&de.didMove){const it=Math.abs(Qe),Rt=Math.abs(tt);it>Rt*W?de.gestureAxis="x":Rt>it*W&&(de.gestureAxis="y")}if(de.gestureAxis==="x")return de.isCurrentlyScrolling=!1,Ke(!1),de.lastY=At,de.lastTime=Nt,mt?"release":"neutral";if(de.gestureAxis===null)return de.lastY=At,de.lastTime=Nt,"neutral"}if(de.gestureAxis==="y"&&!mt&&!(b?.()??!0))return de.lastY=At,de.lastTime=Nt,Ke(!1),"neutral";const we=F/Math.max(oe,1);if(de.velocity=de.velocity*(1-l)+we*l,de.velocity=Math.max(-c,Math.min(c,de.velocity)),Math.abs(F)>1){if(!mt)return Ke(!0),de.lastY=At,de.lastTime=Nt,"claim";de.isCurrentlyScrolling=!0;const Qe=r+Math.min(n,Math.abs(F)/a),tt=-F*Qe;be(tt,It,At),Ke(!0)}return de.lastY=At,de.lastTime=Nt,mt?"claim":"neutral"},onPointerUp:xe=>{if(xe.pointerType!=="touch"||de.pointerId!==xe.pointerId)return;const mt=de.isCurrentlyScrolling;de.isCurrentlyScrolling=!1,Ke(!1);const It=de.rafId!==null||H.current!==null;!de.didMove&&!It&&de.startX!==null&&de.startY!==null&&Be.current?.(de.startX,de.startY),!de.didMove&&!It&&de.startX!==null&&de.startY!==null&&ae.current?.(de.startX,de.startY),de.pointerId=null,de.startX=null,de.startY=null;const At=de.gestureAxis==="x";if(de.gestureAxis=null,m&&mt&&!At&&Math.abs(de.velocity)>h&&de.didMove){const Nt=()=>{const oe=ce(),F=oe-(de.lastTime||oe);if(de.lastTime=oe,de.velocity*=Math.pow(p,F),Math.abs(de.velocity)<h){de.velocity=0,he();return}if(!V(-de.velocity*F)&&Oe.current>2){de.velocity=0,he();return}de.rafId=requestAnimationFrame(Nt)};de.rafId=requestAnimationFrame(Nt)}},onPointerCancel:xe=>{xe.pointerType!=="touch"||de.pointerId!==xe.pointerId||(de.isCurrentlyScrolling=!1,Ke(!1),de.pointerId=null,de.startX=null,de.startY=null,de.gestureAxis=null,he())}},Xe=I6.register(nt),pt=ye.style.touchAction;return ye.style.touchAction="none",()=>{Ke(!1),Xe(),ye.style.touchAction=pt,he()}},[e,Q,r,n,a,l,c,h,p,ce,he,V,be,N,m,Ke,b]),je=L.useCallback(()=>{const ye=e.current;if(!ye)return()=>{};const de=B.current,nt=mt=>{mt.touches.length===1&&((x?.()??!0)&&mt.cancelable&&mt.preventDefault(),de.isCurrentlyScrolling=!1,de.gestureAxis=null,de.lastY=mt.touches[0].clientY,de.startX=mt.touches[0].clientX,de.startY=mt.touches[0].clientY,de.didMove=!1,de.velocity=0,he())},Xe=mt=>{if(mt.touches.length!==1)return;const It=mt.touches[0].clientX,At=mt.touches[0].clientY;if(de.startX!==null&&de.startY!==null){const oe=It-de.startX,F=At-de.startY;if(!de.didMove&&Math.hypot(oe,F)>=N&&(de.didMove=!0),de.gestureAxis===null&&de.didMove){const we=Math.abs(oe),Qe=Math.abs(F);we>Qe*W?de.gestureAxis="x":Qe>we*W&&(de.gestureAxis="y")}if(de.gestureAxis==="x"){de.isCurrentlyScrolling=!1,de.lastY=At;return}if(de.gestureAxis===null){(x?.()??!1)&&mt.cancelable&&mt.preventDefault(),de.lastY=At;return}}if(mt.preventDefault(),!de.lastY){de.lastY=At;return}const Nt=At-de.lastY;if(Math.abs(Nt)>1){de.isCurrentlyScrolling=!0;const oe=r+Math.min(n,Math.abs(Nt)/a),F=-Nt*oe;be(F,It,At)}de.lastY=At},pt=mt=>{if(!mt.changedTouches?.[0])return;const At=de.isCurrentlyScrolling;de.isCurrentlyScrolling=!1;const Nt=de.rafId!==null||H.current!==null;!de.didMove&&!Nt&&C&&de.startX!==null&&de.startY!==null&&C(de.startX,de.startY),!de.didMove&&!Nt&&S&&de.startX!==null&&de.startY!==null&&S(de.startX,de.startY),de.startX=null,de.startY=null;const oe=de.gestureAxis==="x";if(de.gestureAxis=null,m&&At&&!oe&&de.didMove&&Math.abs(de.velocity)>h){const F=()=>{if(de.velocity*=Math.pow(p,16),Math.abs(de.velocity)<h){de.velocity=0,he();return}if(!V(-de.velocity*16)&&Oe.current>2){de.velocity=0,he();return}de.rafId=requestAnimationFrame(F)};de.rafId=requestAnimationFrame(F)}};ye.addEventListener("touchstart",nt,{passive:!1}),ye.addEventListener("touchmove",Xe,{passive:!1}),ye.addEventListener("touchend",pt,{passive:!1}),ye.addEventListener("touchcancel",pt,{passive:!1});const xe=ye.style.touchAction;return ye.style.touchAction="none",()=>{ye.removeEventListener("touchstart",nt),ye.removeEventListener("touchmove",Xe),ye.removeEventListener("touchend",pt),ye.removeEventListener("touchcancel",pt),ye.style.touchAction=xe,he()}},[e,r,n,a,h,p,he,V,be,C,S,N,x,m]),ve=L.useCallback(()=>{he();const ye=typeof window<"u"&&"PointerEvent"in window,de=ye?He():()=>{},nt=ye?()=>{}:je();return()=>{de(),nt(),he()}},[He,je,he]),Fe=L.useCallback(()=>B.current.isCurrentlyScrolling||B.current.rafId!==null||H.current!==null,[]),lt=L.useCallback(()=>{he();const ye=B.current;ye.isCurrentlyScrolling=!1,ye.velocity=0,ye.lastY=null,ye.lastTime=null,ye.startX=null,ye.startY=null,ye.pointerId=null,ye.didMove=!1,ye.gestureAxis=null},[he]);return{setupTouchScroll:ve,isScrolling:Fe,stopAllScroll:lt}};function Sx(e){const{name:t,priority:r}=e,n=v.useRef(e.onPointerDown),a=v.useRef(e.onPointerMove),l=v.useRef(e.onPointerUp),c=v.useRef(e.onPointerCancel),h=v.useRef(e.container);n.current=e.onPointerDown,a.current=e.onPointerMove,l.current=e.onPointerUp,c.current=e.onPointerCancel,h.current=e.container,v.useEffect(()=>{const p={name:t,priority:r,get container(){const x=h.current;return typeof x=="function"?x():x},onPointerDown(x,b){return n.current?.(x,b)??!1},onPointerMove(x,b){return a.current?.(x,b)??"neutral"},onPointerUp(x){l.current?.(x)},onPointerCancel(x){c.current?.(x)}};return I6.register(p)},[t,r])}var Xs;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(Xs||(Xs={}));Xs.Light,Xs.Medium,Xs.Heavy,Xs.Success,Xs.Warning,Xs.Error;Xs.Light,Xs.Medium,Xs.Heavy,Xs.Success,Xs.Warning,Xs.Error;Xs.Light,Xs.Medium,Xs.Heavy,Xs.Success,Xs.Warning,Xs.Error;const CN=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",SN=()=>typeof document<"u"&&!!document.body,LN=()=>{if(SN())try{const e=document.createElement("label");e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;";const t=document.createElement("input");t.type="checkbox",t.setAttribute("switch",""),e.appendChild(t),document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch{}},Lx=e=>Array.isArray(e)?[...e]:[e],_N=e=>{if(CN()){try{const a=Lx(e),l=a.length===1?a[0]:a;navigator.vibrate(l)}catch{}return}const t=Lx(e),r=Array.from({length:Math.ceil(t.length/2)},(a,l)=>[t[l*2]??0,t[l*2+1]??0]);let n=0;for(const[a,l]of r)a>0&&setTimeout(LN,n),n+=a+l},Ao=e=>_N(e);function E6({message:e}){const{t}=Xr();return s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center px-4",children:s.jsx(i1,{dots:!0,label:e??t("terminal.loading"),className:"max-w-full rounded-full bg-surface-2 px-4 py-2 text-center shadow-sm"})})}function kN(){const{t:e}=Xr();return s.jsx(E6,{message:e("terminal.initializing")})}const IN=({message:e,onRetry:t})=>{const{t:r}=Xr();return s.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:s.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:s.jsxs("svg",{className:"w-6 h-6 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img","aria-label":r("terminal.error"),children:[s.jsx("title",{children:r("terminal.error")}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})]})}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("h3",{className:"font-medium text-foreground",children:r("terminal.failedToLoad")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e||r("terminal.unknownError")})]}),t&&s.jsx("button",{type:"button",onClick:t,className:"mt-2 px-5 py-2.5 bg-primary text-primary-foreground text-sm font-medium rounded-full hover:bg-primary/90 active:scale-[0.97] transition-all shadow-sm",children:r("common.retry")})]})})};function Dh(e){return Array.from(e)}function _x(e,t,r){return Math.max(t,Math.min(r,e))}function EN(e,t,r,n){const a=Dh(e),l=Dh(t);let c=_x(r,0,a.length);const h=_x(n,0,l.length);let p=0;for(;p<a.length&&p<l.length&&a[p]===l[p];)p++;let m=0;for(;m<a.length-p&&m<l.length-p&&a[a.length-1-m]===l[l.length-1-m];)m++;const x=a.length-p-m,b=l.slice(p,l.length-m).join(""),y=[];if(x>0||b){const w=p+x;c>w?y.push({left:c-w}):c<w&&y.push({right:w-c}),c=w,x>0&&(y.push({backspace:x}),c=p),b&&(y.push({insert:b}),c+=Dh(b).length)}return c>h?y.push({left:c-h}):c<h&&y.push({right:h-c}),c=h,{ops:y,cursor:c}}function kx(e){const t=e.value,r=e.selectionStart??t.length;return Dh(t.slice(0,r)).length}const cf=16,NN=10,Ix=1.5,RN=1.8,Ex=240,MN=125,jN=92;function DN(e,t,r){const n=Math.hypot(e,t),a=Math.abs(e),l=Math.abs(t),c=()=>a>=l*Ix?e>0?"right":"left":l>=a*Ix?t>0?"down":"up":"";if(r==="")return n>cf?c():"";if(n<NN)return"";if(n<=cf)return r;const h=c();if(h===""||h===r)return r;if(r==="left"&&h==="right"||r==="right"&&h==="left"||r==="up"&&h==="down"||r==="down"&&h==="up")return h;const m=r==="left"||r==="right";return(m?l:a)>=(m?a:l)*RN?h:r}function QN(e){const t=jN-cf,r=Math.min(Math.max((e-cf)/t,0),1);return Ex-r*(Ex-MN)}const Hm=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,Nx=new RegExp(`^( *)(${Hm.source})`,"u"),BN=/[,;:!?]+$/u,PN=/^[a-z][a-z\d+.-]*:\/\//iu;function ON(e){return!e||e==="/"||PN.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function N6(e){const t=[];Hm.lastIndex=0;let r;for(;(r=Hm.exec(e))!==null;){const a=r[0].replace(BN,"");if(!ON(a))continue;const l=e.slice(r.index+a.length).match(/^:(\d+)(?::\d+)?(?=$|[\s:,,;;。!!??)\]}`])/u),c=l?Number(l[1]):void 0,h=c!==void 0&&Number.isSafeInteger(c)&&c>0;t.push({text:a,...h?{line:c}:{},startIndex:r.index,endIndex:r.index+a.length+(h?l[0].length:0)})}return t}function qp(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function FN(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function $N(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return qp(r);if(r==="~"||r.startsWith("~/")){const n=t?FN(t):null;return n?qp(`${n}/${r.slice(2)}`):null}return t?.startsWith("/")?qp(`${t}/${r}`):null}function Vu(e,t,r=8){const n=e.buffer.active.getLine(t-1),a=e.buffer.active.getLine(t);if(!n||!a||a.isWrapped)return null;const l=n.translateToString(!0).trimEnd(),c=a.translateToString(!0);let h=N6(l).at(-1);const p=c.match(Nx);if(!p)return null;if(!h){const I=r>0?Vu(e,t-1,r-1):null;if(I===null)return null;const N=l.slice(I).match(Nx);if(!N||N[1]||N[2].length!==l.length-I)return null;h={text:N[2],startIndex:I,endIndex:l.length}}if(h.endIndex!==l.length||h.line!==void 0||/^[~/]/u.test(p[2])||/^\.\.?\//u.test(p[2])||h.text.endsWith("/")&&p[2].startsWith("."))return null;const m=p[2];let x=n.length-1;for(;x>=0&&!(n.getCell(x)?.getChars()||"").trim();)x-=1;const b=p[1].length;let y=0;for(let I=b;I<a.length;I+=1){const N=a.getCell(I);if(N?.getWidth()!==0){if(!N||/[\s/:]/u.test(N.getChars()||" "))break;y+=N.getWidth()}}if(n.length-x-1>=Math.max(8,b+2,y))return null;const C=n.getCell(x),S=a.getCell(b);return!C||!S||C.isFgDefault()||S.isFgDefault()||C.getFgColorMode()!==S.getFgColorMode()||C.getFgColor()!==S.getFgColor()||!m.includes("/")&&!/^[^/:]+\.[\p{L}\p{N}_-]+$/u.test(m)&&(h.text.endsWith("/")||!C.isUnderline()||!S.isUnderline())?null:b}function UN(e,t){const r=e.buffer.active;let n=t-1;if(!r.getLine(n))return null;for(;n>0&&(r.getLine(n)?.isWrapped||Vu(e,n)!==null);)n-=1;let a=t-1;for(;a+1<r.length&&(r.getLine(a+1)?.isWrapped||Vu(e,a+1)!==null);)a+=1;let l="";const c=[],h=[];for(let m=n;m<=a&&l.length<=2048;m+=1){const x=r.getLine(m);if(!x)break;const b=m>n?Vu(e,m)??0:0;let y=x.length;if(m<a&&Vu(e,m+1)!==null)for(;y>0&&!(x.getCell(y-1)?.getChars()||"").trim();)y-=1;for(let w=b;w<y;w+=1){const C=x.getCell(w);if(!C||C.getWidth()===0)continue;const S=C.getChars()||" ";l+=S;for(let I=0;I<S.length;I+=1)c.push({x:w+1,y:m+1}),h.push({x:w+Math.max(1,C.getWidth()),y:m+1})}}const p=l.trimEnd().length;return{text:l.slice(0,p),startPositions:c.slice(0,p),endPositions:h.slice(0,p)}}function zN(e,t){return{provideLinks(r,n){const a=UN(e,r);if(!a){n(void 0);return}const l=N6(a.text).map(c=>({text:c.text,range:{start:a.startPositions[c.startIndex]??{x:c.startIndex+1,y:r},end:a.endPositions[c.endIndex-1]??{x:c.endIndex,y:r}},activate:()=>c.line===void 0?t(c.text):t(c.text,c.line)}));n(l.length>0?l:void 0)}}}function HN(){let e=0,t=-1/0,r=-1/0;const n=()=>{e=0,t=r=-1/0};return{reset:n,consume(a,l){if(!a.ctrlKey&&!a.metaKey)return n(),0;const{deltaY:c,deltaX:h,deltaMode:p}=a;if(!Number.isFinite(c)||!Number.isFinite(h)||c===0||Math.abs(c)<=Math.abs(h))return 0;const m=c*(p===1?16:p===2?40:1);if((l-t>250||Math.sign(m)!==Math.sign(e))&&(e=0),t=l,l-r<120)return e=0,0;if(e+=m,Math.abs(e)<40)return 0;const x=e>0?-1:1;return e=0,r=l,x}}}function lh(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function WN(e,t,r){const n=lh(e.fontBoundingBoxAscent)+lh(e.fontBoundingBoxDescent),a=lh(e.actualBoundingBoxAscent)+lh(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(n||a||t)*r))}const Bc=8,ch=36,Rx=10,GN=1.08,qN=1.16,uh=6,VN=.94,ZN=.08,YN=.12,KN=88,XN=36,JN=10,eR=14,tR=52,rR=80,nR=8;function dh(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function sR(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function iR(e){if(typeof window>"u")return null;const t=[e,...Array.from(e.querySelectorAll("*"))];let r=null;for(const n of t){const l=window.getComputedStyle(n).overflowY;if(!(l!=="auto"&&l!=="scroll")){if(n.scrollHeight-n.clientHeight>2)return n;r||(r=n)}}return r}const aR=new Set(["visibility","bfcache","online"]),oR=5e5,lR=1e5,Ru=260,Mu=140,Mx=80;function cR(e){return!e}const jx=e=>{if((!e||e.includes("var("))&&typeof window<"u"){const t=getComputedStyle(document.documentElement).getPropertyValue(!e||e.trim()==="var(--font-terminal)"?"--font-terminal":"--font-mono").trim();if(t)return t}return e};function Dx(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function Pc(e,t,r){const n=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(n||t*r))}function uR(e){return{background:e.background,foreground:e.foreground,cursor:e.cursor||e.foreground,cursorAccent:e.cursorAccent||e.background,selectionBackground:e.selectionBackground||"rgba(0, 0, 0, 0.3)",selectionForeground:e.selectionForeground||e.foreground,black:e.black||"#6F6E69",red:e.red||"#AF3029",green:e.green||"#66800B",yellow:e.yellow||"#AD8301",blue:e.blue||"#205EA6",magenta:e.magenta||"#A02F6F",cyan:e.cyan||"#24837B",white:e.white||"#CECDC3",brightBlack:e.brightBlack||"#6F6E69",brightRed:e.brightRed||"#D14D41",brightGreen:e.brightGreen||"#879A39",brightYellow:e.brightYellow||"#D0A215",brightBlue:e.brightBlue||"#4385BE",brightMagenta:e.brightMagenta||"#CE5D97",brightCyan:e.brightCyan||"#3AA99F",brightWhite:e.brightWhite||"#FFFCF0"}}const Qx=new Map;function dR(e,t,r,n,a){if(typeof window>"u"||typeof document>"u")return null;const l=e.getBoundingClientRect();if(l.width<24||l.height<24)return null;const c=window.devicePixelRatio||1,h=`${r}::${n}::${a}::${c}::${t}`;let p=Qx.get(h);if(!p)try{const y=document.createElement("canvas").getContext("2d");if(!y)return null;y.font=`${r}px ${t}`;const w=y.measureText("M"),S=(Math.floor(w.width*c)+Math.round(n))/c,I=WN(w,r,a);S>=1&&I>=1&&(p={cellWidth:S,cellHeight:I},Qx.set(h,p))}catch{return null}if(!p)return null;const m=Math.max(2,Math.floor(l.width/p.cellWidth)),x=Math.max(2,Math.floor(l.height/p.cellHeight));return!Number.isFinite(m)||!Number.isFinite(x)?null:{cols:m,rows:x}}function hR(e){const t=e.buffer.active,r=t.viewportY,n=Math.min(t.length,r+e.rows),a=[];for(let l=r;l<n;l+=1){const c=t.getLine(l);c&&a.push(c.translateToString(!0))}return a.join(`
121
+ `).replace(/\s+$/g,"")}function ju(e,t,r){const n=qc(e);if(!n)return null;const a=Math.max(0,Math.min(e.cols-1,Math.floor((t-n.originLeft)/n.cellW))),l=Math.max(0,Math.min(e.rows-1,Math.floor((r-n.originTop)/n.cellH)));return{col:a,row:e.buffer.active.viewportY+l}}function Vp(e,t,r){const n=t.row*e.cols+t.col,a=r.row*e.cols+r.col;if(n===a)return e.clearSelection(),!1;const l=Math.min(n,a),c=Math.max(n,a)+1,h=l%e.cols,p=Math.floor(l/e.cols);return e.select(h,p,c-l),!0}function Bx(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function fR(e,t,r,n,a=!0){if(typeof window>"u")return{left:0,top:0};const l=window.visualViewport,c=l?.offsetLeft??0,h=l?.offsetTop??0,p=l?.width??window.innerWidth,m=l?.height??window.innerHeight,x=Bx("--safe-top-inset"),b=Bx("--safe-bottom-inset"),y=n?JE(n.terminal,n.anchor,n.focus):null,w=[];let C;if(a&&w.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),n){const I=qc(n.terminal),{start:N,end:Q}=lf(n.anchor,n.focus,n.terminal.cols),W=jh(n.terminal,N),B=jh(n.terminal,Q);if(W&&w.push({left:W.x-24,top:W.y-48,right:W.x+24,bottom:W.y+4}),B&&I){const U=B.y+I.cellH;w.push({left:B.x-24,top:U-4,right:B.x+24,bottom:U+48})}if(y){const U=n.anchor.row*n.terminal.cols+n.anchor.col,K=n.focus.row*n.terminal.cols+n.focus.col,re=U<=K,H=y.right-y.left,ne=n.anchor.row===n.focus.row?re?y.left+H*.25:y.right-H*.25:(y.left+y.right)/2,ce=jh(n.terminal,n.focus),Ne=ce&&I?ce.y+I.cellH/2:t;C={vertical:n.focus.row<n.anchor.row?"below":"above",alignX:ne,focusX:ce?.x??e,focusY:Ne}}}const S=eN({clientX:e,clientY:t,viewport:{left:c,top:h+x,right:c+p,bottom:h+m-b},terminal:r,width:KN,height:XN,margin:JN,fingerGap:eR,selection:y,avoid:w,preference:C,selectionGap:tR});return{left:S.left-r.left,top:S.top-r.top}}const R6=L.forwardRef(({sessionKey:e,sessionId:t,backendSessionId:r,getPasteOwnerKey:n,isLayoutVisible:a=!0,chunks:l,onInput:c,onResize:h,onFlowControl:p,onTmuxScroll:m,tmuxScrollSensitivity:x=.55,onDoubleTap:b,onInputFocusChange:y,onMobileLongPressCopyResult:w,onMobilePasteResult:C,onReadyChange:S,onSizeSynchronizedChange:I,onWritesSettled:N,onWriteProgress:Q,onCursorPositionChange:W,onDirectoryLinkActivate:B,terminalSettings:U,theme:K,className:re,enableTouchScroll:H,mobileLongPressMode:Oe="arrows",autoFocus:ne=!0,cursorVisible:ce=!0,suppressSmoothScroll:Ne=!1},Me)=>{const{t:be}=Xr(),V=L.useRef(null),Ke=L.useRef(null),he=L.useRef(null),Be=L.useRef(null),ae=L.useRef(null),X=L.useRef(null),He=L.useRef(Ne);He.current=Ne;const je=L.useRef(null),ve=L.useRef(c),Fe=L.useRef(h),lt=L.useRef(y),ye=L.useRef(p),de=L.useRef(S);de.current=S;const nt=L.useRef(I);nt.current=I;const Xe=L.useRef(N);Xe.current=N;const pt=L.useRef(Q);pt.current=Q;const xe=L.useRef(W);xe.current=W;const mt=L.useRef(B);mt.current=B;const It=L.useRef(U.rendererMode),At=L.useRef(""),Nt=L.useRef(0),oe=L.useRef(!1),F=L.useRef(null),we=L.useRef(0),Qe=L.useRef(0),tt=L.useRef(!1),it=L.useRef(null),Rt=L.useRef(null),Xt=L.useRef(null),Zt=L.useRef(!1),Lt=L.useRef(null),Lr=L.useRef(()=>{}),Qr=L.useRef(null),Pt=L.useRef(null),Dt=L.useRef(void 0),pr=L.useRef(null),pe=L.useRef(!1),Ge=L.useRef(0),at=L.useRef(null),Mt=L.useRef(null),er=L.useRef(!1),J=L.useRef(typeof window<"u"?window.devicePixelRatio:1),bt=L.useRef(!1),Ce=L.useRef(!1),lr=L.useRef(null),Ve=L.useRef(""),zt=L.useRef(0),Jt=L.useRef(null),Wr=L.useRef(null),yn=L.useRef(null),Ar=L.useMemo(()=>HN(),[t]);L.useEffect(()=>(window.addEventListener("blur",Ar.reset),document.addEventListener("visibilitychange",Ar.reset),()=>{window.removeEventListener("blur",Ar.reset),document.removeEventListener("visibilitychange",Ar.reset)}),[Ar]);const Jr=L.useRef(0),Fr=L.useRef(0),$r=L.useRef(0),an=L.useRef(null),An=L.useRef(0),gt=L.useRef(0),fe=L.useRef(!1),Vr=L.useRef(0),[,ct]=L.useReducer(k=>k+1,0),[Ue,Tr]=L.useReducer(k=>k+1,0),[wt,Tn]=L.useState("loading"),[Nr,cn]=L.useState(null),[Ie,ht]=L.useState(null);L.useEffect(()=>{const k=j=>{(j.target instanceof Element?j.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&ht(String(j.detail))};return window.addEventListener("termdock:file-drop-error",k),()=>window.removeEventListener("termdock:file-drop-error",k)},[e]);const Je=L.useMemo(()=>ad("terminal"),[]),[_r,Zr]=L.useState(!0),[Gr,Ir]=L.useState(!1);L.useEffect(()=>{if(!_r&&wt!=="loading"){Ir(!1);return}const k=window.setTimeout(()=>Ir(!0),160);return()=>window.clearTimeout(k)},[_r,wt]);const[es,Ft]=L.useState(!1),[hn,ee]=L.useState({visible:!1,activeDir:""}),[Ye,qt]=L.useState(null),Gt=L.useRef(null),Yr=L.useRef(!1),Br=L.useRef({active:!1,anchor:null,focus:null,dragging:null}),[Er,ar]=L.useState(null),[br,Hn]=L.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),Qs=L.useRef(br);Qs.current=br;const hs=L.useRef(null),[xs,On]=L.useState({active:!1,text:""}),En=L.useRef(null),Bs=L.useRef(null);ve.current=c,Fe.current=h,lt.current=y,ye.current=p,It.current=U.rendererMode;const bs=L.useRef(ne);bs.current=ne;const Ur=L.useRef(ce);Ur.current=ce;const Pr=L.useRef(H);Pr.current=H;const kt=L.useRef(a);kt.current=a;const Yt=cR(!!m),{rendererMode:q,fontFamily:ke,fontSize:rt,fontWeight:or,fontWeightBold:$t,letterSpacing:cr,lineHeight:Et,minimumContrastRatio:fn,drawBoldTextInBrightColors:Ts,unicodeVersion:_i,customGlyphs:Ps,rescaleOverlappingGlyphs:Wn,fontLigatures:wa,enableImages:di,smoothScrolling:Gn}=U,ls=q==="webgl",qr=L.useCallback(()=>{Gt.current!==null&&(clearTimeout(Gt.current),Gt.current=null),qt(null)},[]),qn=L.useCallback((k,j)=>{Gt.current!==null&&(clearTimeout(Gt.current),Gt.current=null),Yr.current=!1,qt(k),!j?.persistent&&(Gt.current=setTimeout(()=>{Gt.current=null,qt(null)},3e3))},[]);L.useEffect(()=>{if(!Ye)return;const k=()=>{Br.current.active||qr()},j=()=>qr();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",j),document.addEventListener("visibilitychange",j),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",j),document.removeEventListener("visibilitychange",j)}},[qr,Ye]),L.useEffect(()=>()=>{Gt.current!==null&&(clearTimeout(Gt.current),Gt.current=null)},[]);const en=L.useCallback(()=>{const k=he.current,j=V.current,O=Br.current;if(!k||!j||!O.active||!O.anchor||!O.focus){ar(null);return}const z=j.getBoundingClientRect(),Te=qc(k)?.cellH??16,{start:Se,end:Le}=lf(O.anchor,O.focus,k.cols),ut=O.dragging==="start"?O.focus:O.dragging==="end"?O.anchor:Se,Wt=O.dragging==="end"?O.focus:O.dragging==="start"?O.anchor:Le,fr=(yr,us)=>{const ps=jh(k,yr);return ps?{left:ps.x-z.left,top:us?ps.y-z.top:ps.y+Te-z.top}:null};ar({start:fr(ut,!0),end:fr(Wt,!1)})},[]),Ht=L.useCallback(k=>{const j=he.current,O=V.current,z=Br.current;if(!j||!O||!z.active||!z.anchor||!z.focus)return;if(z.dragging){qr();return}const Te=O.getBoundingClientRect(),Se={x:(Te.left+Te.right)/2,y:(Te.top+Te.bottom)/2};qn(fR(k?.x??Se.x,k?.y??Se.y,Te,{terminal:j,anchor:z.anchor,focus:z.focus},k!==void 0),{persistent:!0})},[qr,qn]),Fn=L.useCallback(()=>{const k=Br.current;k.active=!1,k.anchor=null,k.focus=null,k.dragging=null,ar(null),qr()},[qr]);L.useEffect(()=>{if(!Er)return;const k=he.current;if(!k)return;const j=k.onScroll(()=>{en(),Ht()}),O=k.onResize(()=>Fn());return()=>{j.dispose(),O.dispose()}},[Er,en,Ht,Fn]),L.useEffect(()=>{H||lt.current?.(!1)},[H]);const jr=L.useCallback((k,j,O)=>{const z=(O.element?.offsetWidth||0)/O.cols||8,Te=(O.element?.offsetHeight||0)/O.rows||16,Se=Math.max(1,Math.min(O.cols,Math.floor(k/z)+1)),Le=Math.max(1,Math.min(O.rows,Math.floor(j/Te)+1));return{x:Se,y:Le}},[]),mr=L.useCallback((k,j,O)=>{const z=he.current;if(!z)return!1;const Te=k>0?-1:1;if(z.modes?.mouseTrackingMode!=="none"){let Se,Le;if(j!==void 0&&O!==void 0){const fr=jr(j,O,z);Se=fr.x,Le=fr.y}else Se=z.buffer.active.cursorX+1,Le=z.buffer.active.cursorY+1;const Wt=`\x1B[<${Te>0?64:65};${Se};${Le}M`;return ve.current(Wt),!0}if(z.buffer.active.type==="alternate"){const Se=Te>0?"\x1B[A":"\x1B[B";return ve.current(Se),!0}return null},[jr]),Dr=L.useCallback(k=>{const j=he.current;if(!j)return!1;const O=Pc(he.current,rt,Et),z=Ge.current+k,Te=Math.trunc(z/O);return Ge.current=z-Te*O,Te!==0?(j.scrollLines(Te),!0):!1},[rt,Et]),wn=L.useCallback(k=>{if(!he.current)return!1;const z=Pc(he.current,rt,Et)/Math.max(.1,x),Te=Ge.current+k;let Se=Math.trunc(Te/z);if(Ge.current=Te-Se*z,Se===0&&Math.abs(Te)>=z/3&&(Se=Te>0?1:-1,Ge.current=0),Se===0)return!1;const Le=Se>0?"down":"up",ut=Math.max(1,Math.min(Math.abs(Se),10));return m(Le,ut),!0},[rt,Et,m,x]),Ln=L.useRef(mr);Ln.current=mr;const Vn=L.useRef(Dr);Vn.current=Dr;const Zn=L.useRef(wn);Zn.current=wn;const cs=L.useRef(m);cs.current=m;const ts=L.useRef({pointerId:null,tmuxActiveAtDown:!1});L.useEffect(()=>{if(!H)return;const k=V.current;if(!k)return;const j=z=>{z.pointerType==="touch"&&(ts.current.pointerId=z.pointerId,ts.current.tmuxActiveAtDown=!!cs.current)},O=z=>{z.pointerType==="touch"&&ts.current.pointerId===z.pointerId&&(ts.current.pointerId=null,ts.current.tmuxActiveAtDown=!1)};return k.addEventListener("pointerdown",j,{capture:!0,passive:!0}),k.addEventListener("pointerup",O,{capture:!0,passive:!0}),k.addEventListener("pointercancel",O,{capture:!0,passive:!0}),()=>{k.removeEventListener("pointerdown",j,!0),k.removeEventListener("pointerup",O,!0),k.removeEventListener("pointercancel",O,!0)}},[H]);const Cn=L.useCallback(()=>{if(fe.current)return!1;const k=ts.current;return k.pointerId!==null?!k.tmuxActiveAtDown:!cs.current},[]),ki=L.useCallback((k,j,O)=>{const z=Ln.current(k,j,O);return z!==null?z:cs.current?Zn.current(k):Vn.current(k)},[]),Cs=L.useCallback((k,j)=>{if(performance.now()<=gt.current){gt.current=0;return}const O=he.current;if(O&&O.modes?.mouseTrackingMode!=="none"){const z=jr(k,j,O),Te=z.x,Se=z.y,Le=`\x1B[<0;${Te};${Se}M`,ut=`\x1B[<0;${Te};${Se}m`;ve.current(Le,{skipModifierTransform:!0}),ve.current(ut,{skipModifierTransform:!0})}},[jr]),_n=L.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Nn=L.useCallback((k=700)=>{an.current=null,An.current=_n()+k},[_n]),Kr=L.useCallback(()=>Pr.current&&_n()<=An.current,[_n]),Ss=L.useCallback(()=>{const k=Pt.current;return!k||typeof document>"u"?!1:document.activeElement===k},[]),pn=L.useCallback(()=>{if(typeof window>"u")return!1;const k=ut=>{if(typeof document>"u")return 0;const Wt=Number.parseFloat(document.documentElement.style.getPropertyValue(ut)||"0");return Number.isFinite(Wt)?Wt:0},j=k("--kb-height");if(j>0)return j>=Mx;const O=window.visualViewport;if(!O)return!1;const z=k("--app-base-vh")||window.innerHeight,Te=k("--safe-bottom-inset"),Se=O.height+O.offsetTop;return Math.max(0,Math.round(z-Se-Te))>=Mx},[]),$=L.useCallback(()=>{Jt.current!==null&&(clearTimeout(Jt.current),Jt.current=null),Wr.current=null},[]),_e=L.useCallback(k=>{const j=he.current;let O="";for(const z of k)z.left&&(O+=(j?dh(j,"D"):"\x1B[D").repeat(z.left)),z.right&&(O+=(j?dh(j,"C"):"\x1B[C").repeat(z.right)),z.backspace&&(O+="".repeat(z.backspace)),z.insert&&(O+=z.insert);return O},[]),Pe=L.useCallback(k=>{const j=k.value,O=bu(j),z=Ve.current;if(!(Pr.current&&!O.includes("\r")&&!z.includes("\r"))){if(O===z)return;let fr=0;for(;fr<z.length&&fr<O.length&&z[fr]===O[fr];)fr++;const yr=z.length-fr;yr>0&&ve.current("".repeat(yr));const us=O.slice(fr);if(us){try{he.current?.clearSelection()}catch{}ve.current(us)}Ve.current=O,zt.current=Array.from(O).length;return}const Se=kx(k),{ops:Le,cursor:ut}=EN(z,O,zt.current,Se),Wt=_e(Le);if(Wt){if(Le.some(fr=>fr.insert))try{he.current?.clearSelection()}catch{}ve.current(Wt)}Ve.current=O,zt.current=ut},[_e]),We=L.useCallback((k,j)=>{const O=k.value,z=bu(O),Te=Ve.current;if(z===Te){$();return}let Se=0;for(;Se<Te.length&&Se<z.length&&Te[Se]===z[Se];)Se++;const Le=Te.length-Se;if(H&&!j?.immediate&&Le>=nR){Wr.current=k,Jt.current!==null&&clearTimeout(Jt.current),Jt.current=setTimeout(()=>{Jt.current=null;const Wt=Wr.current;Wr.current=null,Wt&&Pe(Wt)},rR);return}$(),Pe(k)},[$,H,Pe]),qe=L.useCallback(k=>{We(k,{immediate:!0}),ve.current("\r"),k.value="",Ve.current="",zt.current=0},[We]),ft=L.useCallback((k,j,O)=>{if(!k)return;$();const z=j??Pt.current;z&&(z.value=""),Ve.current="",zt.current=0;try{he.current?.clearSelection()}catch{}Fn();const Te=sN(k,O);return ve.current(Te,{skipModifierTransform:!0,consumeModifier:O?.consumeModifier,targeted:O?.targeted,ownedPaste:O?.ownedPaste})},[$]),Ct=L.useCallback((k,j)=>{const O=bu(k);return O?(vt.current?.controller.abort(),ht(null),sp(O)||(ft(O,j,{paste:!0,submitAfterPaste:!1}),qr()),!0):!1},[qr,ft]);L.useEffect(()=>H4(k=>{if(k.sessionKey!==e||k.paths.length===0)return;const j=k.paths.map(L0).join(" ");ft(`${j} `);try{Pt.current?.focus({preventScroll:!0})}catch{}}),[ft,e]);const Qt=L.useRef(r);Qt.current=r;const st=L.useRef({sessionKey:e,sessionId:t,getPasteOwnerKey:n});st.current={sessionKey:e,sessionId:t,getPasteOwnerKey:n};const vt=L.useRef(null),sr=L.useRef(!0),yt=L.useCallback(()=>{vt.current?.controller.abort();const k=st.current,j=fm(),O=Ki(),z=ve.current,Te=k.getPasteOwnerKey?.()??null,Se=new AbortController,Le={controller:Se,current:()=>sr.current&&!Se.signal.aborted&&vt.current===Le&&fm()===j&&Ki()===O&&!O?.closed&&st.current.sessionKey===k.sessionKey&&st.current.sessionId===k.sessionId&&ve.current===z&&(st.current.getPasteOwnerKey?.()??null)===Te};return vt.current=Le,Le},[]),P=L.useCallback(async k=>{const j=yt(),O=Qt.current,z=()=>j.current()&&Qt.current===O,Te=he.current,Se=Te?.hasSelection()?Te.getSelection():"";try{if(Se&&k)return k.setData("text/plain",Se),!0;if(Se){const Le=await Lh(Se,z);return!Le&&z()&&ht("复制失败,请重试"),Le}return O&&cs.current?await Ew(O,z):!1}catch(Le){return z()&&ht(Le instanceof Error?Le.message:"复制失败,请重试"),!1}},[yt]),G=L.useCallback(k=>k.current(),[]);L.useEffect(()=>{const k=()=>{const O=vt.current;O&&!O.current()&&O.controller.abort()};k(),window.addEventListener("termdock:secure-state",k);const j=()=>vt.current?.controller.abort();return window.addEventListener("auth:unauthorized",j),()=>{window.removeEventListener("termdock:secure-state",k),window.removeEventListener("auth:unauthorized",j)}}),L.useEffect(()=>(sr.current=!0,()=>{sr.current=!1,vt.current?.controller.abort()}),[]);const le=L.useCallback(async(k,j,O)=>{const z=O??yt();if(!z.current())return!1;ht(null);try{const Te=await pb(k,z.controller.signal);return G(z)?sp(`${L0(Te)} `)?!0:await ft(`${L0(Te)} `,j)===!1?(G(z)&&ht("终端未接受粘贴,请重试"),!1):G(z)?(qr(),!0):!1:!1}catch(Te){return G(z)&&ht(Te instanceof Error?Te.message:"Image upload failed"),!1}},[qr,yt,G,ft]),ge=L.useCallback(async(k,j,O=[],z)=>{const Te=z??yt();if(!Te.current())return!1;ht(null);try{const Se=await mb(k,Te.controller.signal);if(!G(Te))return!1;const Le=[...O,...Se];if(!Le.length)return!1;const ut=`${Le.map(L0).join(" ")} `;return sp(ut)?!0:await ft(ut,j)===!1?(G(Te)&&ht("终端未接受粘贴,请重试"),!1):G(Te)?(qr(),!0):!1}catch(Se){return G(Te)&&ht(Se instanceof Error?Se.message:"File upload failed"),!1}},[qr,yt,G,ft]),$e=L.useCallback(async(k,j)=>{const O=yt();ht(null);try{const z=await gb(j,O.current);return z.kind==="text"?Ct(z.text,k):z.kind==="files"?!z.paths.length&&z.files.length===1&&z.files[0].type.startsWith("image/")?le(z.files[0],k,O):ge(z.files,k,z.paths,O):(O.current()&&ht("剪贴板未提供可读取的文字、图片或视频;视频可通过文件按钮选择上传。"),!1)}catch(z){return O.current()&&ht(z instanceof Error?z.message:"Clipboard read failed"),!1}},[yt,ge,le,Ct]),ot=L.useCallback(k=>{if(hs.current&&!k?.repositionFrozen)return null;const j=he.current;if(!j||!j.element)return null;const O=qc(j),Te=j.element.querySelector(".xterm-screen")??j.element,Se=Te.getBoundingClientRect(),Le=O?.cellW??(Se.width>0&&j.cols>0?Se.width/j.cols:8),ut=O?.cellH??(Se.height>0&&j.rows>0?Se.height/j.rows:17),Wt=Pt.current;let fr=Dt.current;Wt&&(fr===void 0||fr!==null&&(!fr.isConnected||!fr.contains(Wt)))&&(fr=rN(Wt),Dt.current=fr);const yr=j.buffer.active,us=yr.cursorX*Le,ps=yr.cursorY*ut,Kn=nN(Te,fr??null,us,ps),rr=Math.round(Kn.x),un=Math.round(Kn.y),ms={x:rr,y:un,cellW:Le,cellH:ut,cursorX:yr.cursorX};return Qs.current=ms,hs.current&&k?.repositionFrozen&&(hs.current={...ms}),Hn(xn=>Math.abs(xn.x-rr)<.5&&Math.abs(xn.y-un)<.5&&Math.abs(xn.cellW-Le)<.5&&Math.abs(xn.cellH-ut)<.5&&xn.cursorX===yr.cursorX?xn:ms),ms},[]),xt=L.useRef(ot);xt.current=ot,L.useEffect(()=>{if(!H)return;let k=null,j=null;const O=()=>{k!==null&&window.cancelAnimationFrame(k),j!==null&&window.cancelAnimationFrame(j),k=window.requestAnimationFrame(()=>{k=null,j=window.requestAnimationFrame(()=>{j=null,xt.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",O),window.visualViewport?.addEventListener("scroll",O),document.addEventListener("termdock:viewport-keyboard-change",O),()=>{k!==null&&window.cancelAnimationFrame(k),j!==null&&window.cancelAnimationFrame(j),window.visualViewport?.removeEventListener("resize",O),window.visualViewport?.removeEventListener("scroll",O),document.removeEventListener("termdock:viewport-keyboard-change",O)}},[H]);const Tt=L.useCallback(k=>{let j=0;for(const O of k){const z=O.codePointAt(0)??0,Te=z>=4352&&z<=4447||z>=11904&&z<=12350||z>=12353&&z<=13311||z>=13312&&z<=19903||z>=19968&&z<=40959||z>=40960&&z<=42191||z>=44032&&z<=55203||z>=63744&&z<=64255||z>=65072&&z<=65103||z>=65280&&z<=65376||z>=65504&&z<=65510||z>=127744&&z<=129791;j+=Te?2:1}return j},[]),Rr=L.useCallback(k=>{const j=he.current,{cellW:O,cellH:z}=br;if(!j||!k)return{width:Math.max(1,Math.round(O)),height:Math.max(1,Math.round(z)),whiteSpace:"pre"};const Se=hs.current?.cursorX??j.buffer.active.cursorX,Le=Math.max(1,j.cols),ut=Math.max(1,Tt(k)),Wt=Math.max(1,Le-Se);if(ut<=Wt)return{width:Math.max(1,Math.round(ut*O)),height:Math.max(1,Math.round(z)),whiteSpace:"pre"};const fr=ut-Wt,us=1+Math.ceil(fr/Le);return{width:Math.max(1,Math.round(Wt*O)),height:Math.max(1,Math.round(us*z)),whiteSpace:"pre-wrap"}},[br,Tt]),mn=L.useCallback(()=>{Dt.current=void 0;const k=xt.current();hs.current={...k??Qs.current}},[]),St=L.useCallback(()=>{hs.current=null},[]),tn=L.useCallback(k=>{if(!bt.current&&hs.current===null)return!1;if(bt.current=!1,hs.current=null,$(),lr.current!==null&&(clearTimeout(lr.current),lr.current=null),Ce.current=!1,k){k.value=Ve.current;try{k.setSelectionRange(k.value.length,k.value.length)}catch{}}return On(j=>j.active||j.text?{active:!1,text:""}:j),!0},[$]),rn=L.useCallback((k,j)=>{const O=Pt.current;if(O)try{O.removeAttribute("readonly");const Te=typeof document<"u"&&document.activeElement===O&&!pn(),Se=_n(),Le=Se-Vr.current;Vr.current=Se,Te&&Le>600?(O.blur(),O.removeAttribute("readonly"),O.focus(),Vr.current=_n()):O.focus()}catch{}},[pn,_n]),Os=L.useCallback(k=>{Fr.current=_n()+k},[_n]),kn=L.useCallback(()=>H?_n()<=Fr.current:!1,[H,_n]),on=L.useCallback(k=>{Os(k),$r.current=_n()},[Os,_n]),gr=L.useCallback(()=>{H&&Pt.current?.removeAttribute("readonly")},[H]),Vt=L.useCallback(k=>k instanceof HTMLElement&&(k.closest('[data-terminal-copy-popover="true"]')!==null||k.closest('[data-mobile-copy-button="true"]')!==null||k.closest("[data-selection-handle]")!==null),[]),Yn=L.useCallback(k=>{if(gr(),on(Ru),!H||k.pointerType!=="touch"){an.current=null;return}const j=k.target;if(Vt(j)){Nn();return}Ye&&!(j instanceof HTMLElement&&j.closest('[data-terminal-copy-popover="true"]'))&&qr(),an.current={pointerId:k.pointerId,startX:k.clientX,startY:k.clientY,moved:!1}},[qr,H,on,Vt,Ye,gr,Nn]),vs=L.useCallback(k=>{on(Ru);const j=an.current;!j||j.pointerId!==k.pointerId||Math.hypot(k.clientX-j.startX,k.clientY-j.startY)>12&&(j.moved=!0)},[on]),Ii=L.useCallback(k=>{on(Mu);const j=an.current;an.current=null,!(!H||k.pointerType!=="touch")&&(!j||j.pointerId!==k.pointerId||j.moved||Kr()||rn(k.clientX,k.clientY))},[H,on,rn,Kr]),hi=L.useCallback(()=>{an.current=null,on(Mu)},[on]),qo=L.useMemo(()=>({enableKinetic:!0}),[]),ei=L.useRef(()=>!1),Pa=L.useRef(rn);Pa.current=rn;const Rn=L.useCallback((k,j)=>{Kr()||Pa.current(k,j)},[Kr]),Ei=L.useRef(b);Ei.current=b;const ea=L.useRef(w);ea.current=w;const _o=L.useRef(C);_o.current=C;const rs=L.useCallback(()=>{if(Yr.current)return;Yr.current=!0,Nn();const k=he.current,j=k?.hasSelection()?k.getSelection():"";try{k?.clearSelection()}catch{}Wi.flushSync(()=>{Fn()}),(async()=>{const O=await Lh(j);ea.current?.(O)})()},[Fn,Nn]),ns=L.useCallback(k=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:k}}))},[]),{setupTouchScroll:Ws,stopAllScroll:Gs}=TN(V,{...qo,shouldCaptureTouch:ei.current,canStartScrollGesture:Cn,onScroll:ki,onScrollWithCoords:ki,onClickWithCoords:Cs,onTap:Rn,onClaimChange:ns,tapThreshold:12,gestureName:`normal-scroll:${e}`});L.useEffect(()=>{if(!H)return;Pt.current?.setAttribute("readonly","");const k=Ws();return()=>{k()}},[H,Ws]),L.useEffect(()=>{if(!H)return;let k=pn();const j=()=>{const O=pn();if(k&&!O){const z=Pt.current;z&&typeof document<"u"&&document.activeElement===z&&(z.setAttribute("readonly",""),z.blur())}k=O};return window.visualViewport?.addEventListener("resize",j),window.visualViewport?.addEventListener("scroll",j),document.addEventListener("termdock:viewport-keyboard-change",j),()=>{window.visualViewport?.removeEventListener("resize",j),window.visualViewport?.removeEventListener("scroll",j),document.removeEventListener("termdock:viewport-keyboard-change",j)}},[H,pn]),L.useEffect(()=>{if(!H)return;const k=V.current;if(!k)return;const j=z=>{const Se=z.sourceCapabilities?.firesTouchEvents===!0,Le=_n()-$r.current<=1200;return!Se&&!Le?!1:k.contains(z.target)},O=z=>{j(z)&&(z.cancelable&&z.preventDefault(),z.stopImmediatePropagation(),z.stopPropagation())};return k.addEventListener("mousedown",O,{capture:!0,passive:!1}),k.addEventListener("mouseup",O,{capture:!0,passive:!1}),k.addEventListener("click",O,{capture:!0,passive:!1}),document.addEventListener("mouseup",O,{capture:!0,passive:!1}),()=>{k.removeEventListener("mousedown",O,!0),k.removeEventListener("mouseup",O,!0),k.removeEventListener("click",O,!0),document.removeEventListener("mouseup",O,!0)}},[H,_n]);const ys=L.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),Ls=L.useCallback(()=>{const k=ys.current;k.rafId!==null&&(cancelAnimationFrame(k.rafId),k.rafId=null)},[]),fs=L.useCallback((k,j,O)=>{const z=he.current;if(!z||!z.element||!z.cols||!z.rows)return null;const Te=ys.current,Se=z.element.getBoundingClientRect(),Le=j??Te.lastX??Se.left+Se.width/2,ut=O??Te.lastY??Se.top+Se.height/2,Wt=Le-Se.left,fr=ut-Se.top,yr=z.element.offsetWidth/z.cols||8,us=z.element.offsetHeight/z.rows||16,ps=Math.max(1,Math.min(z.cols,Math.floor(Wt/yr)+1)),Kn=Math.max(1,Math.min(z.rows,Math.floor(fr/us)+1));return`\x1B[<${k==="up"?64:65};${ps};${Kn}M`},[]),nn=L.useCallback((k,j,O,z)=>{if(j<=0)return;const Te=fs(k,O,z);Te&&ve.current(j===1?Te:Te.repeat(j),{skipModifierTransform:!0})},[fs]),qs=L.useRef(nn);qs.current=nn;const Ni=L.useRef(()=>{}),Ri=L.useCallback(()=>{const j=Pc(he.current,rt,Et)/Math.max(.1,x),O=1+ys.current.instantSpeed*.1;return j/Math.min(6,O)},[rt,Et,x]),Mi=L.useCallback(()=>{const k=ys.current;k.rafId=null;const j=Ri();let O=0,z=0;for(;O+z<uh&&k.remainder>=j;)k.remainder-=j,z++;for(;O+z<uh&&k.remainder<=-j;)k.remainder+=j,O++;if(z>0&&nn("down",z),O>0&&nn("up",O),O+z>0)k.rafId=requestAnimationFrame(Mi);else if(k.pointerId!==null&&Math.abs(k.remainder)>=j/3){const Se=k.remainder>0?"down":"up";k.remainder=0,nn(Se,1),k.rafId=requestAnimationFrame(Mi)}},[Ri,nn]),ro=L.useCallback(()=>{const k=ys.current;k.rafId===null&&typeof requestAnimationFrame<"u"&&(k.rafId=requestAnimationFrame(Mi))},[Mi]),gl=L.useCallback(k=>{if(k.pointerType!=="touch")return!1;Ls();const j=ys.current;return j.pointerId=k.pointerId,j.lastX=k.clientX,j.lastY=k.clientY,j.startX=k.clientX,j.startY=k.clientY,j.gestureAxis=null,j.remainder=0,j.velocity=0,j.instantSpeed=0,j.didScroll=!1,!1},[Ls]),ko=L.useCallback((k,j)=>{if(fe.current)return j?"release":"neutral";if(performance.now()<=gt.current)return"neutral";const O=ys.current;if(k.pointerType!=="touch"||k.pointerId!==O.pointerId||O.lastY==null)return"neutral";if(O.gestureAxis===null&&O.startX!==null&&O.startY!==null){const Se=Math.abs(k.clientX-O.startX),Le=Math.abs(k.clientY-O.startY);if(Se>Rx||Le>Rx){if(Se>Le*GN)return O.gestureAxis="x","release";Le>Se*qN&&(O.gestureAxis="y")}}if(O.gestureAxis==="x")return O.lastX=k.clientX,O.lastY=k.clientY,"release";if(O.gestureAxis===null)return O.lastX=k.clientX,O.lastY=k.clientY,"neutral";const z=k.clientY-O.lastY;O.lastX=k.clientX,O.lastY=k.clientY;const Te=-z;if(O.remainder+=Te,O.instantSpeed=Math.abs(Te),O.velocity=O.velocity*.45+Te*.55,j){const Le=Pc(he.current,rt,Et)/Math.max(.1,x);Math.abs(O.remainder)>=Le/3&&(O.didScroll=!0,ro())}return"claim"},[rt,Et,x,ro]),Tc=L.useCallback(k=>{const j=ys.current;if(k.pointerType!=="touch"||k.pointerId!==j.pointerId)return;if(Ls(),j.pointerId=null,j.lastX=null,j.lastY=null,j.startX=null,j.startY=null,j.instantSpeed=0,j.gestureAxis==="x"){j.gestureAxis=null;return}j.gestureAxis=null;const z=Pc(he.current,rt,Et)/Math.max(.1,x);if(j.didScroll&&Math.abs(j.velocity)>z*ZN){const Te=()=>{j.velocity*=VN,j.remainder+=j.velocity;const Se=1+Math.abs(j.velocity)*.1,Le=z/Math.min(6,Se);if(Math.abs(j.velocity)<z*YN){if(Math.abs(j.remainder)>=Le/3){const fr=j.remainder>0?"down":"up";nn(fr,1),j.remainder=0}j.velocity=0,j.rafId=null;return}let ut=0,Wt=0;for(;ut+Wt<uh&&j.remainder>=Le;)j.remainder-=Le,Wt++;for(;ut+Wt<uh&&j.remainder<=-Le;)j.remainder+=Le,ut++;Wt>0&&nn("down",Wt),ut>0&&nn("up",ut),j.rafId=requestAnimationFrame(Te)};j.rafId=requestAnimationFrame(Te)}else Math.abs(j.remainder)>=z/3&&ro();j.didScroll&&k.stopImmediatePropagation()},[Ls,nn,ro,x,rt,Et]),Vo=L.useCallback(k=>{const j=ys.current;k.pointerType!=="touch"||k.pointerId!==j.pointerId||(Ls(),j.pointerId=null,j.lastX=null,j.lastY=null,j.startX=null,j.startY=null,j.gestureAxis=null,j.remainder=0,j.velocity=0,j.didScroll=!1)},[Ls]);Sx({name:`tmux-scroll:${e}`,priority:wN,container:()=>V.current,onPointerDown:H&&m?gl:void 0,onPointerMove:H&&m?ko:void 0,onPointerUp:H&&m?Tc:void 0,onPointerCancel:H&&m?Vo:void 0});const Mn=L.useRef({pointerId:null,originX:0,originY:0,holdTimer:null,mode:"idle",longPressMode:"arrows",copyStart:null,copyDidSelect:!1,edgeScrollTimer:null,edgeScrollDir:0,edgeScrollLines:0,edgeClientX:0,edgeClientY:0,gestureLocked:!1,joystickDir:"",joystickRepeatTimer:null,repeatIntervalMs:260,lastHapticTime:0,lastTapTime:0,lastTapX:0,lastTapY:0,tapStartX:0,tapStartY:0,tapDidMove:!1}),Aa=L.useRef(null);Aa.current=V.current;const xl=Aa,ta=ve,Oa=L.useRef(Oe);Oa.current=Oe;const jn=L.useCallback(k=>{const j=Mn.current;j.gestureLocked!==k&&(j.gestureLocked=k,ns(k))},[ns]),ra=L.useCallback(()=>{const k=Mn.current;k.edgeScrollTimer!==null&&(clearInterval(k.edgeScrollTimer),k.edgeScrollTimer=null),k.edgeScrollDir=0},[]),ji=L.useCallback(k=>{const j=he.current,O=Mn.current;if(j){if(O.mode==="copy"&&O.copyStart){O.copyDidSelect=Vp(j,O.copyStart,k)||O.copyDidSelect;return}if(O.mode==="adjust"){const z=Br.current;if(!z.active||!z.anchor)return;z.focus=XE(j,k),Vp(j,z.anchor,z.focus),en()}}},[en]),Io=L.useCallback((k,j)=>{const O=he.current,z=Mn.current;if(!O)return;const Te=qc(O);if(!Te)return;const Se=Te.originTop,Le=Te.originTop+O.rows*Te.cellH,ut=Math.max(28,Te.cellH*1.5),Wt=j-Se,fr=Le-j;let yr=0,us=0;if(Wt<ut?(yr=-1,us=Math.min(1,(ut-Wt)/ut)):fr<ut&&(yr=1,us=Math.min(1,(ut-fr)/ut)),z.edgeClientX=k,z.edgeClientY=j,yr===0){ra();return}z.edgeScrollDir=yr,z.edgeScrollLines=1+Math.round(us*5),z.edgeScrollTimer===null&&(z.edgeScrollTimer=setInterval(()=>{const ps=he.current,Kn=Mn.current;if(!ps||Kn.edgeScrollDir===0)return;if(Kn.mode!=="copy"&&Kn.mode!=="adjust"){ra();return}ps.scrollLines(Kn.edgeScrollDir*Kn.edgeScrollLines);const rr=ju(ps,Kn.edgeClientX,Kn.edgeClientY-ch);rr&&ji(rr)},60))},[ji,ra]),Ul=L.useCallback(k=>{if(k.pointerType!=="touch")return!1;const j=xl.current;if(!j)return!1;const O=k.target;if(!(O instanceof HTMLElement)||!j.contains(O)||O.closest('[data-mobile-keyboard="true"]'))return!1;const z=Mn.current;z.longPressMode=Oa.current;const Te=Br.current;if(Te.active&&z.pointerId===null){const Se=O.closest("[data-selection-handle]");if(Se instanceof HTMLElement){const Le=he.current,ut=Se.dataset.selectionHandle==="start"?"start":"end";if(Le&&Te.anchor&&Te.focus){const Wt=lf(Te.anchor,Te.focus,Le.cols);return Te.anchor=ut==="start"?Wt.end:Wt.start,Te.focus=ut==="start"?Wt.start:Wt.end,Te.dragging=ut,qr(),z.pointerId=k.pointerId,z.tapStartX=k.clientX,z.tapStartY=k.clientY,z.tapDidMove=!1,z.mode="adjust",fe.current=!0,Nn(1800),Pt.current?.setAttribute("readonly",""),Gs(),Ls(),Ao(Bc),jn(!0),!0}}if(!O.closest("[data-terminal-copy-popover]")){Fn();try{he.current?.clearSelection()}catch{}}}if(z.pointerId!==null)return!0;if(fe.current=!1,Ei.current){const Se=performance.now(),Le=k.clientX,ut=k.clientY;if(z.lastTapTime!==0&&Se-z.lastTapTime<=300&&Math.hypot(Le-z.lastTapX,ut-z.lastTapY)<=25)return Ao(Bc),gt.current=performance.now()+500,Ei.current?.(),Ft(!0),Bs.current&&clearTimeout(Bs.current),Bs.current=setTimeout(()=>Ft(!1),400),z.lastTapTime=0,!0}return z.holdTimer!==null&&(clearTimeout(z.holdTimer),z.holdTimer=null),z.joystickRepeatTimer!==null&&(clearTimeout(z.joystickRepeatTimer),z.joystickRepeatTimer=null),z.joystickDir="",z.copyStart=null,z.copyDidSelect=!1,z.pointerId=k.pointerId,z.originX=k.clientX,z.originY=k.clientY,z.tapStartX=k.clientX,z.tapStartY=k.clientY,z.tapDidMove=!1,z.mode="holding",z.longPressMode==="copy"&&jn(!0),z.holdTimer=setTimeout(()=>{if(z.holdTimer=null,z.mode==="holding"){if(z.longPressMode==="copy"){const Se=he.current,Le=Se?ju(Se,z.tapStartX,z.tapStartY):null;if(!Se||!Le){z.mode="idle";return}z.mode="copy",fe.current=!0,Nn(1800),Pt.current?.setAttribute("readonly",""),z.copyStart=Le,z.copyDidSelect=!1,Gs(),Ls(),Se.clearSelection(),Ao(Bc),jn(!0);return}z.mode="arrow",fe.current=!0,Nn(1e3),Gs(),Ls(),Ao(Bc),jn(!0),requestAnimationFrame(()=>{ee({visible:!0,activeDir:""})})}},350),!0},[jn,qr,Fn]),zl=L.useCallback((k,j)=>{if(k.pointerType!=="touch")return"neutral";const O=Mn.current;if(O.mode==="arrow"&&k.pointerId!==O.pointerId||O.mode==="copy"&&k.pointerId!==O.pointerId||O.mode!=="arrow"&&O.mode!=="copy"&&k.pointerId!==O.pointerId)return"neutral";const z=k.clientX-O.tapStartX,Te=k.clientY-O.tapStartY;if(Math.hypot(z,Te)>10&&(O.tapDidMove=!0),O.mode==="holding"){if(!j)return O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),jn(!1),fe.current=!1,O.mode="idle","neutral";const Se=k.clientX-O.originX,Le=k.clientY-O.originY;return O.longPressMode==="copy"&&Math.hypot(Se,Le)>20?(O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),jn(!1),fe.current=!1,O.mode="idle","release"):Math.hypot(Se,Le)>20?(O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),jn(!1),O.mode="idle","release"):"claim"}if(O.mode==="adjust"){if(!j)return"claim";Gs();const Se=he.current,Le=Br.current;if(!Se||!Le.active||!Le.anchor||!Le.focus)return"claim";const ut=ju(Se,k.clientX,k.clientY-ch);return ut&&(ji(ut),Io(k.clientX,k.clientY)),"claim"}if(O.mode==="copy"){if(!j)return"claim";Gs();const Se=he.current;if(!Se||!O.copyStart)return"claim";const Le=ju(Se,k.clientX,k.clientY-ch);return Le&&(ji(Le),Io(k.clientX,k.clientY)),"claim"}if(O.mode==="arrow"){if(!j)return"claim";const Se={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},Le=k.clientX-O.tapStartX,ut=k.clientY-O.tapStartY,Wt=DN(Le,ut,O.joystickDir);if(Wt&&Wt!==O.joystickDir&&(O.originX=k.clientX,O.originY=k.clientY),Wt){const fr=k.clientX-O.originX,yr=k.clientY-O.originY,us=Math.hypot(fr,yr);if(O.repeatIntervalMs=QN(us),Wt!==O.joystickDir){O.joystickRepeatTimer!==null&&clearTimeout(O.joystickRepeatTimer);const ps=O.joystickDir==="";O.joystickDir=Wt,ta.current(Se[Wt]);const Kn=performance.now();Kn-O.lastHapticTime>120&&(Ao(Bc),O.lastHapticTime=Kn);const rr=ps?400:300;O.joystickRepeatTimer=setTimeout(function un(){if(O.joystickDir!==Wt)return;ta.current(Se[Wt]);const ms=performance.now();ms-O.lastHapticTime>120&&(Ao(Bc),O.lastHapticTime=ms),O.joystickRepeatTimer=setTimeout(un,O.repeatIntervalMs)},rr)}ee({visible:!0,activeDir:Wt})}else O.joystickRepeatTimer!==null&&(clearTimeout(O.joystickRepeatTimer),O.joystickRepeatTimer=null),O.joystickDir="",ee({visible:!0,activeDir:""});return"claim"}return"neutral"},[jn,ji,Io]),bl=L.useCallback(k=>{if(k.pointerType!=="touch"||k.pointerId!==Mn.current.pointerId)return;const j=Mn.current;if(j.mode==="copy"){Gs(),Ls(),ra(),jn(!1);const z=he.current;let Te=null;if(z&&j.copyStart&&(Te=ju(z,k.clientX,k.clientY-ch),Te&&(j.copyDidSelect=Vp(z,j.copyStart,Te)||j.copyDidSelect)),z&&j.copyDidSelect&&z.hasSelection()&&j.copyStart){const Se=Br.current;Se.active=!0,Se.anchor=j.copyStart,Se.focus=Te??j.copyStart,Se.dragging=null,en(),Ht({x:k.clientX,y:k.clientY}),Nn(1800),Ao(Bc)}else ea.current?.(!1);j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),j.copyStart=null,j.copyDidSelect=!1,j.pointerId=null,j.mode="idle",fe.current=!1;return}if(j.mode==="adjust"){Gs(),Ls(),ra(),jn(!1),Br.current.dragging=null,en(),Ht({x:k.clientX,y:k.clientY}),Nn(1800),j.pointerId=null,j.mode="idle",fe.current=!1;return}if(j.mode==="arrow"){Gs(),Ls(),jn(!1),ee({visible:!1,activeDir:""}),j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",j.pointerId=null,j.mode="idle",fe.current=!1;return}const O=xl.current;if(O&&!j.tapDidMove){const z=k.target;z instanceof HTMLElement&&O.contains(z)&&!z.closest('[data-mobile-keyboard="true"]')&&(j.lastTapTime=performance.now(),j.lastTapX=k.clientX,j.lastTapY=k.clientY)}else j.tapDidMove&&(j.lastTapTime=0);j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",jn(!1),fe.current=!1,j.copyStart=null,j.copyDidSelect=!1,j.pointerId=null,j.mode="idle"},[jn,Gs,Nn,ra,en,Ht]),Di=L.useCallback(()=>{const k=Mn.current;jn(!1),ra(),k.mode==="arrow"&&ee({visible:!1,activeDir:""}),k.mode==="adjust"&&(Br.current.dragging=null,en(),Ht()),k.holdTimer!==null&&(clearTimeout(k.holdTimer),k.holdTimer=null),k.joystickRepeatTimer!==null&&(clearTimeout(k.joystickRepeatTimer),k.joystickRepeatTimer=null),k.joystickDir="",fe.current=!1,k.copyStart=null,k.copyDidSelect=!1,k.pointerId=null,k.tapDidMove=!1,k.mode="idle"},[jn,ra,en,Ht]);Sx({name:`long-press:${e}`,priority:yN,container:()=>V.current,onPointerDown:H?Ul:void 0,onPointerMove:H?zl:void 0,onPointerUp:H?bl:void 0,onPointerCancel:H?Di:void 0});const ti=L.useCallback((k={})=>{Qe.current+=1,At.current="",Rt.current=null,Nt.current=0,Zt.current=!1,Lt.current=null,oe.current&&(oe.current=!1,k.notifyFlowResume===!0&&ye.current?.(!1)),F.current=null,tt.current=!1,it.current=null},[]),na=L.useCallback((k="unknown",j="update")=>{try{const O=Be.current?.fit(j,kt.current,k);if(!O)return;O.changed&&(Ge.current=0),Je("fit",O)}catch{X.current?.cancel()}},[Je]),sa=L.useCallback(k=>{const j=he.current;if(j)try{j.refresh(0,Math.max(0,j.rows-1)),Je("terminal refreshed (sync)",{reason:k,cols:j.cols,rows:j.rows,hasWebgl:!!at.current})}catch(O){Je("terminal refresh (sync) failed",{reason:k,error:O})}},[Je]),ia=L.useCallback(k=>{const j=Mt.current;if(j){try{j.dispose()}catch{}Mt.current=null}const O=at.current;if(!O)return!1;X.current?.cancel();try{O.dispose()}catch{}return at.current=null,Je("renderer disposed",{type:"webgl",reason:k}),!0},[Je]),ri=L.useCallback((k,j)=>{if(at.current)return!0;try{const O=new tI({customGlyphs:Ps});return Mt.current=O.onContextLoss(()=>{Je("webgl context loss",{reason:"onContextLoss"}),er.current=!0,typeof window<"u"&&window.setTimeout(()=>{ws("webgl-context-loss",{forceRendererRecreate:!0})},0)}),X.current?.cancel(),k.loadAddon(O),at.current=O,er.current=!1,Je("renderer",{type:"webgl",reason:j,mobile:H,mode:It.current}),sa(`webgl-enabled:${j}`),na(`webgl-enabled:${j}`),$s.current=!0,!0}catch(O){return Je("webgl load failed, fallback to dom renderer",{reason:j,error:O,mobile:H,mode:It.current}),!1}},[Je,Ps,H,na,sa]),Zo=200,vl=L.useRef(0),Qi=L.useRef(new Map),Fa=L.useRef(new Map),gn=L.useRef(Gp()),Is=L.useRef(!0),Fs=L.useRef(null),Ta=L.useRef(null),aa=L.useRef(-1),Ca=L.useRef(new Map),$s=L.useRef(!1),$a=L.useRef(!1),Eo=L.useRef(Tx()),oa=L.useRef(null),_s=L.useRef(null),Gi=L.useCallback(()=>{oa.current!==null&&(clearTimeout(oa.current),oa.current=null),_s.current=null},[]),No=L.useCallback(()=>{const k=Qi.current;k.forEach(j=>cancelAnimationFrame(j)),k.clear(),Fa.current.clear()},[]),ss=L.useCallback(()=>{Fs.current!==null&&(window.clearTimeout(Fs.current),Fs.current=null)},[]),qi=L.useRef(()=>{}),Ro=L.useCallback(k=>{Is.current&&(ss(),nt.current?.(!1),Fe.current(k.cols,k.rows,k.seq),Fs.current=window.setTimeout(()=>{Fs.current=null;const j=wx(gn.current,k.seq);gn.current=j.state,j.request&&$a.current?(Je("resize ack timeout; retrying",{seq:k.seq,retrySeq:j.request.seq,cols:j.request.cols,rows:j.request.rows}),qi.current(j.request)):j.exhausted&&(X.current?.cancel(),Je("resize ack timeout; leaving size unconfirmed",{seq:k.seq,cols:k.cols,rows:k.rows}))},1200))},[ss,Je]);qi.current=Ro;const fi=L.useCallback((k,j)=>{if(!Is.current||!$a.current)return;const O=oN(gn.current,{cols:k,rows:j});gn.current=O.state,O.request&&Ro(O.request)},[Ro]),no=L.useCallback((k,j)=>{const O=hN(Eo.current,Date.now());if(O.action==="send"){_s.current=null,fi(k,j);return}_s.current={cols:k,rows:j},oa.current===null&&(oa.current=setTimeout(()=>{oa.current=null;const z=_s.current;_s.current=null,z&&(Eo.current=fN(Date.now()),fi(z.cols,z.rows))},Math.max(0,O.readyAt-Date.now())))},[fi]),Yo=400,so=L.useRef(0),Mo=L.useCallback((k,j,O)=>{if(!Number.isFinite(k)||!Number.isFinite(j)||k<=0||j<=0)return;const z=Math.floor(k),Te=Math.floor(j);gn.current=uN(gn.current,{cols:z,rows:Te}),O!=="tmux-screen-sync"&&(Is.current=!1,ss(),Gi(),gn.current=Ax(gn.current),X.current?.cancel()),Je("pty-size broadcast received",{cols:z,rows:Te,source:O??"unknown"})},[Je,ss,Gi]),Sa=L.useCallback(k=>{const j=he.current;if(!j||!j.cols||!j.rows||!$a.current||typeof document<"u"&&(document.visibilityState!=="visible"||!El()))return;const O=Date.now(),z=Is.current;if(Is.current=!0,z&&O-so.current<Yo)return;const Te=j.cols,Se=j.rows,Le=gn.current.confirmed;Le&&Le.cols===Te&&Le.rows===Se||(so.current=O,Je("ensureSizeMatches push",{reason:k,cols:Te,rows:Se,lastServerSize:Le}),fi(Te,Se))},[Je,fi]),ni=L.useCallback((k,j)=>{const O=he.current,z=je.current;if(!O||!z||!kt.current)return;if(!$s.current){Je("refresh skipped: renderer not ready",{reason:k});return}if(j.dedupeKey!==void 0){if(Ca.current.get(k)===j.dedupeKey){Je("refresh deduped",{reason:k,dedupeKey:j.dedupeKey});return}Ca.current.set(k,j.dedupeKey)}Je("refresh",{reason:k,options:j});const Te=j.forceRendererRecreate===!0||er.current||ls&&!!at.current&&aR.has(k)&&/Android/i.test(navigator.userAgent);let Se=!1;Te&&(er.current=!1,ls?(ia(`refresh:${k}`),ri(O,`refresh:${k}`)||sa(`refresh:${k}:webgl-fallback`),Se=!0):(sa(`refresh:${k}`),Se=!0));const Le=W4(j.forceRedraw===!0,k==="dpr-change",Se);!Le&&!Se&&Je("terminal redraw skipped: fit/write already repaints",{reason:k});const ut={cols:O.cols,rows:O.rows};na(`refresh:${k}`,j.geometryPhase);const Wt={cols:O.cols,rows:O.rows};if(Le&&sa(`refresh:${k}`),j.skipResizePush||G4({before:ut,after:Wt,lastServerSize:gn.current.confirmed,reconcileServerSize:j.reconcileServerSize})&&no(Wt.cols,Wt.rows),!j.skipScrollToBottom&&k!=="resize"&&k!=="dpr-change"){const yr=requestAnimationFrame(()=>{const Kn=he.current;if(Kn&&Kn.buffer.active.type!=="alternate")try{Kn.scrollToBottom()}catch{}}),us=Qi.current,ps=us.get(k);ps!==void 0&&cancelAnimationFrame(ps),us.set(k,yr)}},[Je,ls,ia,ri,sa,na,no]),ws=L.useCallback((k,j={})=>{if(he.current,k==="session-key-change"&&(Is.current=!0,gn.current=Gp(),ss(),Gi(),Eo.current=Tx(),Ca.current.clear(),No()),!j.force&&(k==="visibility"||k==="bfcache"||k==="online")){const z=Date.now();if(z-vl.current<Zo){Je("refresh throttled",{reason:k});return}vl.current=z}if(Fa.current.set(k,j),Qi.current.has(k))return;const O=requestAnimationFrame(()=>{const z=Fa.current.get(k)??{};Qi.current.delete(k),Fa.current.delete(k),ni(k,z)});Qi.current.set(k,O)},[Je,No,ss,Gi,ni]),se=L.useRef(a);L.useLayoutEffect(()=>{const k=a&&!se.current;se.current=a,a?k&&ni("layout-visible",{geometryPhase:"reveal",forceRedraw:!0,reconcileServerSize:!0,skipScrollToBottom:!0}):(Gi(),X.current?.cancel())},[a,ni,Gi]);const Re=L.useCallback(k=>{const j=Qi.current.get(k);if(j===void 0)return;const O=Fa.current.get(k)??{};cancelAnimationFrame(j),Qi.current.delete(k),Fa.current.delete(k),ni(k,O)},[ni]);Ni.current=()=>Re("resize"),L.useEffect(()=>()=>{No(),pr.current!==null&&(window.clearTimeout(pr.current),pr.current=null)},[e,No]),L.useEffect(()=>{gn.current=Gp(),ss(),Ca.current.clear()},[e,ss]);const et=L.useCallback(()=>{if(tt.current)return;const k=he.current;if(!k){ti();return}if(!At.current)return;const j=At.current,O=j.length,z=Rt.current,Te=Zt.current;At.current="",Rt.current=null,Zt.current=!1,tt.current=!0;let Se=null;Te&&(Se=Lt.current??{depth:0},Lt.current=Se,Se.depth+=1);const Le=X.current,ut=Le?.generation;k.write(j,()=>{if(Se&&(Se.depth-=1),ut!==void 0&&Le?.written(ut),tt.current=!1,Nt.current-=O,Nt.current<0&&(Nt.current=0),z!==null&&pt.current?.(z),oe.current&&Nt.current<lR&&(oe.current=!1,ye.current?.(!1)),At.current){et();return}const Wt=++Qe.current,fr=()=>{if(Wt!==Qe.current||tt.current||At.current)return;const yr=k.buffer.active;Xe.current?.({x:yr.cursorX,y:yr.cursorY,rows:k.rows,lastProcessedChunkId:it.current})};typeof window>"u"?fr():window.requestAnimationFrame(()=>{window.requestAnimationFrame(fr)})})},[ti]);Lr.current=et;const _t=L.useCallback(()=>{if(F.current!==null)return;const k=++we.current;F.current=k,queueMicrotask(()=>{F.current===k&&(F.current=null,et())})},[et]),ze=L.useCallback((k,j,O=!1)=>{if(!k)return;Qe.current+=1,At.current+=k,Rt.current=j,Zt.current=Zt.current||O,Nt.current+=k.length;const z=Xt.current;(z===null||j>z)&&(Xt.current=j),!oe.current&&Nt.current>=oR&&(oe.current=!0,ye.current?.(!0)),_t()},[_t]);return L.useEffect(()=>{let k=!1,j=null,O=null,z=[];const Te=V.current;return Te?(Te.tabIndex=H?-1:0,(async()=>{de.current?.(!1),Tn("loading"),cn(null),Zr(!0);try{const Le=await Z4(()=>{const rr=dR(Te,jx(ke),rt,cr,Et);return{...rr?{cols:rr.cols,rows:rr.rows}:{},allowProposedApi:!0,fontFamily:jx(ke),fontSize:rt,fontWeight:Dx(or),fontWeightBold:Dx($t),theme:uR(K),logLevel:"off",cursorBlink:!ls,cursorStyle:"block",cursorInactiveStyle:Ur.current?"bar":"none",scrollback:m?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:Z9(q,di),convertEol:Yt,drawBoldTextInBrightColors:Ts,rescaleOverlappingGlyphs:Wn,minimumContrastRatio:fn,letterSpacing:cr,lineHeight:Et,smoothScrollDuration:Gn&&!He.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}},()=>!k);if(!Le)return;const ut=new Pw;Le.loadAddon(ut);const Wt=lI(window.termdockDesktop,rr=>{window.open(rr)});z.push(Le.registerLinkProvider(hI(Le,Wt))),Le.loadAddon(new oI(Wt)),Le.registerLinkProvider(zN(Le,(rr,un)=>{mt.current?.(rr,un)}));const fr=new vI;Le.loadAddon(fr),Le.unicode.activeVersion=_i,Le.loadAddon(new _I({highlightLimit:1e3}));const yr=new RI;Le.loadAddon(yr),ae.current=yr,Le.loadAddon(new KE),z.push(Le.parser.registerOscHandler(52,jI(()=>!k&&El()&&kt.current&&!Lt.current?.depth,()=>ht("程序复制失败,请重试或选中文字复制")))),j=Le,he.current=Le,je.current=ut,J.current=typeof window<"u"?window.devicePixelRatio:1,Le.open(Te),Be.current=new Y4(Le,ut,Te,{authority:"viewport",beforeLiveResize:()=>{$a.current&&Is.current&&cs.current&&X.current?.begin()}}),X.current=aN(Le),wa&&Le.loadAddon(new YE({fontFeatureSettings:gN,fallbackLigatures:xN}));try{const rr=Le._core;rr?.coreService&&(rr.coreService.isCursorInitialized=!0),Le.refresh(0,Le.rows-1)}catch{}ls?(ri(Le,"init"),$s.current=!0):(Je("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:H,mode:q}),$s.current=!0),Zr(!1),Tr();const us=rr=>{if(!document.hasFocus()||document.visibilityState==="hidden"){Ar.reset();return}const un=Ar.consume(rr,performance.now());if((rr.ctrlKey||rr.metaKey)&&(rr.preventDefault(),un)){const ms=zh(t)??rt,xn=K4(ms+un);xn!==ms&&Th(t,xn)}};if(yn.current=us,Te.addEventListener("wheel",us,{passive:!1}),!H){let rr=0,un=null,ms=null,xn=null;const io=()=>{xn=null,Ni.current();const Es=Pc(he.current,rt,Et),Hl=Jr.current+rr;rr=0;const La=Math.trunc(Hl/Es);if(Jr.current=Hl-La*Es,La!==0){const yl=La>0?"down":"up",ru=he.current,e0=Math.max(3,Math.floor((ru?.rows??24)/2)),t0=Math.abs(La);t0>e0&&(Jr.current=0),qs.current(yl,Math.min(t0,e0),un??void 0,ms??void 0)}};Le.attachCustomWheelEventHandler(Es=>{if(Es.ctrlKey||Es.metaKey||Es.shiftKey)return!0;if(Es.deltaY===0)return!1;if(!he.current||!cs.current)return!0;const La=Pc(he.current,rt,Et);let yl=Es.deltaY;return Es.deltaMode===1?yl=Es.deltaY*La:Es.deltaMode===2&&(yl=Es.deltaY*(Te.clientHeight||La*20)),rr+=yl,un=Es.clientX,ms=Es.clientY,xn===null&&(xn=requestAnimationFrame(io)),Es.preventDefault(),!1})}const ps=iR(Te);if(ps?(ps.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),Ke.current=ps,ct()):Ke.current=null,ws("mount",{skipResizePush:!0,skipScrollToBottom:!0}),bs.current&&(H?Le.focus():Pt.current?.focus({preventScroll:!0})),H||xt.current(),z.push(Le.onRender(()=>{const rr=Le.buffer.active;xe.current?.({x:rr.cursorX,y:rr.cursorY,rows:Le.rows}),H||xt.current()})),!H){try{const rr=Le.textarea;if(rr){rr.tabIndex=-1,rr.setAttribute("aria-hidden","true"),rr.setAttribute("readonly",""),rr.value="";const un=()=>{Pt.current?.focus({preventScroll:!0})};rr.addEventListener("focus",un),z.push({dispose:()=>rr.removeEventListener("focus",un)})}}catch{}try{z.push(Le.onCursorMove(()=>xt.current())),z.push(Le.onResize(()=>xt.current()))}catch{}}z.push(Le.onData(rr=>{const un=Lt.current;un!==null&&un.depth>0||ve.current(rr,{skipModifierTransform:!0})}));const Kn=rr=>{const un=typeof window<"u"?window.devicePixelRatio:1,ms=Math.abs(un-J.current)>.001;return ms&&(J.current=un,Je("device pixel ratio changed",{value:un,source:rr})),ms};if(O=new ResizeObserver(rr=>{if(!X4(!!Pr.current,kt.current)){Je("resize observer skipped: hidden mobile session");return}Dt.current=void 0;const un=rr[0];un&&Je("resize observer",{width:Math.round(un.contentRect.width),height:Math.round(un.contentRect.height)});const ms=Kn("resize-observer");ws(ms?"dpr-change":"resize")}),O.observe(Te),typeof window<"u"){const rr=()=>{Kn("window-resize")&&ws("dpr-change")};window.addEventListener("resize",rr),z.push({dispose:()=>window.removeEventListener("resize",rr)});const un=window.visualViewport;if(un){const ms=()=>{Kn("visual-viewport-resize")&&ws("dpr-change")};un.addEventListener("resize",ms),z.push({dispose:()=>un.removeEventListener("resize",ms)})}}na("init-fit","initialize"),Tn("ready"),de.current?.(!0)}catch(Le){console.error("Failed to initialize terminal:",Le),Zr(!1),Tn("error"),cn(Le instanceof Error?Le.message:"Failed to load terminal")}})(),()=>{de.current?.(!1),k=!0,lt.current?.(!1),Qr.current?.(),Qr.current=null,bt.current=!1,lr.current!==null&&(clearTimeout(lr.current),lr.current=null),Ce.current=!1,hs.current=null,$(),On({active:!1,text:""});for(const Le of z)Le.dispose();O?.disconnect(),yn.current&&(Te.removeEventListener("wheel",yn.current),yn.current=null),X.current?.dispose(),X.current=null,ia("component-unmount"),j?.dispose(),he.current=null,Be.current=null,je.current=null,Ke.current=null,ti({notifyFlowResume:!0}),ss(),Gi()}):void 0},[na,ke,rt,Ar,or,$t,cr,Et,fn,Ts,_i,Ps,Wn,wa,di,Gn,K,ti,$,H,ri,ia,Je,ss,Gi]),L.useEffect(()=>{const k=he.current;k&&(k.options.smoothScrollDuration=Gn&&!Ne?125:0)},[Gn,Ne,Ue]),L.useEffect(()=>{const k=he.current;k&&(k.options.cursorInactiveStyle=ce?"bar":"none",ce||k.blur())},[ce,Ue]),L.useEffect(()=>{const k=he.current;if(k){if(ls){if(k.options.cursorBlink=!1,ri(k,"renderer-mode-change")&&di&&!pe.current)try{k.loadAddon(new uE({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),pe.current=!0}catch(O){Je("image addon skipped",{error:O})}return}k.options.cursorBlink=!0,ia("renderer-mode-change")&&(sa("renderer-mode-change:webgl-disabled"),na("renderer-mode-change:webgl-disabled"))}},[ls,di,ri,ia,sa,na,Je]),L.useEffect(()=>{const k=he.current;k&&(it.current!==null&&k.reset(),ti(),Ve.current="",zt.current=0,Pt.current&&(Pt.current.value=""),ws("session-reset",{skipScrollToBottom:!0}),bs.current&&(Pr.current?k.focus():Pt.current?.focus({preventScroll:!0})))},[e,Ue,ws,ti]),L.useEffect(()=>{if(!H||typeof document>"u")return;let k=null;const j=()=>{k=null;const z=Pt.current;if(!z||document.activeElement!==z||bt.current)return;const Te=Ve.current,Se=bu(z.value);if(Se!==Te||Se.includes("\r")||!pn())return;const Le=Math.min(kx(z),Array.from(Se).length),ut=Le-zt.current;if(ut===0)return;const Wt=he.current,fr=ut<0?(Wt?dh(Wt,"D"):"\x1B[D").repeat(-ut):(Wt?dh(Wt,"C"):"\x1B[C").repeat(ut);ve.current(fr),zt.current=Le},O=()=>{k===null&&(k=requestAnimationFrame(j))};return document.addEventListener("selectionchange",O),()=>{document.removeEventListener("selectionchange",O),k!==null&&cancelAnimationFrame(k)}},[H,pn]),L.useEffect(()=>{if(!H)return;const k=Ws();return Qr.current=k,()=>{k(),Qr.current=null}},[H,Ws]),L.useEffect(()=>{const k=he.current;if(k)try{k.options.scrollback=m?0:1e3}catch{}},[m,Ue]),L.useEffect(()=>{const k=he.current;if(!k)return;if(l.length===0){it.current!==null&&(k.reset(),ti(),ws("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const j=it.current;let O,z=!1;if(j===null)O=l;else{const Te=l.findIndex(Se=>Se.id===j);Te>=0?O=l.slice(Te+1):(O=l,z=!0)}if(O.length>0){const Te=O.map(ut=>ut.data).join(""),Se=Xt.current,Le=Se!==null&&(O[0].id<=Se||z);ze(Te,O[O.length-1].id,Le)}it.current=l[l.length-1].id},[l,Ue,ze,ws,ti]),L.useImperativeHandle(Me,()=>({serializeSnapshot:()=>he.current?ae.current?.serialize({scrollback:100})??null:null,focus:()=>{if(Pr.current){rn();return}Pt.current?.focus({preventScroll:!0})},blur:()=>{const k=Pt.current;tn(k),k&&typeof document<"u"&&document.activeElement===k&&k.blur(),Pr.current&&k?.setAttribute("readonly",""),lt.current?.(!1)},clear:()=>{const k=he.current;k&&(k.reset(),ti(),ws("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{ti({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const k=he.current;if(!k)return!1;const j=k.hasSelection()?k.getSelection():hR(k),O=await Lh(j);return O&&k.hasSelection()&&qr(),O},pasteClipboardText:async()=>{Sa("paste"),Nn();const k=await $e(Pt.current);return _o.current?.(k),k},sendSequence:(k,j)=>(k&&Sa("send-sequence"),ft(k,null,j)),getDimensions:()=>Be.current?.dimensions??null,requestRefresh:ws,setSessionReady:k=>{$a.current=k,k||(X.current?.cancel(),ss(),gn.current=Ax(gn.current),Ta.current=null,aa.current=-1,nt.current?.(!1))},acknowledgeResize:k=>{if(!k.ok&&typeof k.seq=="number"){const Se=wx(gn.current,k.seq);if(!Se.request&&!Se.exhausted)return;ss(),gn.current=Se.state,Se.request&&$a.current?qi.current(Se.request):Se.exhausted&&X.current?.cancel();return}const j=cN(gn.current,k);if(!j.accepted)return;ss(),gn.current=j.state,Je("resize acknowledged",{seq:k.seq,ok:k.ok,cols:k.cols,rows:k.rows,screenSyncPending:k.screenSyncPending===!0,screenSyncGeneration:k.screenSyncGeneration});const O=he.current,z=j.state.confirmed;if(!!!(O&&z&&O.cols===z.cols&&O.rows===z.rows)){nt.current?.(!1);return}if(k.screenSyncPending&&typeof k.screenSyncGeneration=="number"){Ta.current=k.screenSyncGeneration;const Se=aa.current>=k.screenSyncGeneration;nt.current?.(Se),Se&&(Ta.current=null);return}Ta.current=null,nt.current?.(!0)},notifyScreenSynchronized:k=>{if(!Number.isFinite(k))return;aa.current=Math.max(aa.current,k);const j=Ta.current;if(j===null||k<j)return;Ta.current=null;const O=he.current,z=gn.current.confirmed;nt.current?.(!!(O&&z&&O.cols===z.cols&&O.rows===z.rows))},notifyServerSize:Mo,ensureSizeMatches:Sa,requestPtyRedraw:()=>{const k=he.current;if(!k||!$a.current||!Is.current||gn.current.pending||Ta.current!==null)return;const j=lN(gn.current,{cols:k.cols,rows:k.rows});gn.current=j.state,qi.current(j.request)}}),[H,tn,rn,ti,$e,ft,ws,ss,Je,fi,Mo,Sa]),s.jsxs("div",{ref:V,"data-termdock-terminal-dropzone":e,"data-termdock-terminal-owner":n?.()??e,className:`relative h-full w-full terminal-viewport-container ${re||""}`,style:{backgroundColor:K.background,touchAction:hn.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:Yn,onPointerMoveCapture:vs,onPointerUpCapture:Ii,onPointerCancelCapture:hi,onTouchStartCapture:k=>{if(Vt(k.target)){Nn(),on(Ru);return}gr(),on(Ru)},onTouchMoveCapture:()=>on(Ru),onTouchEndCapture:()=>on(Mu),onTouchCancelCapture:()=>on(Mu),onMouseDown:k=>{H||k.button===0&&(pr.current!==null&&(window.clearTimeout(pr.current),pr.current=null),requestAnimationFrame(()=>{try{Pt.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:k=>{H||k.button===0&&(pr.current!==null&&window.clearTimeout(pr.current),pr.current=window.setTimeout(()=>{pr.current=null;try{Pt.current?.focus({preventScroll:!0})}catch{}},0))},children:[s.jsx(H_,{target:V}),Ie&&s.jsx("button",{type:"button",role:"alert",onClick:()=>ht(null),className:"absolute bottom-2 left-2 right-2 z-20 rounded-md border border-border bg-surface-2 px-3 py-2 text-left text-sm text-foreground",children:Ie}),Ye&&s.jsxs("button",{type:"button","data-terminal-copy-popover":"true",className:"absolute z-30 inline-flex h-9 w-[88px] select-none items-center justify-center gap-1.5 rounded-full border border-white/15 bg-[rgb(28_28_30_/_0.92)] px-3 text-[13px] font-semibold text-white shadow-[0_10px_28px_rgb(0_0_0_/_0.32),0_2px_8px_rgb(0_0_0_/_0.18)] backdrop-blur-xl transition-transform duration-100 ease-out active:scale-[0.96]",style:{left:Ye.left,top:Ye.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:k=>{Nn(),k.stopPropagation()},onPointerUp:k=>{k.preventDefault(),k.stopPropagation(),rs()},onTouchStart:k=>{Nn(),k.stopPropagation()},onTouchEnd:k=>{k.preventDefault(),k.stopPropagation(),rs()},onClick:k=>{k.preventDefault(),k.stopPropagation(),rs()},children:[s.jsx(q4,{size:14,strokeWidth:2.4}),s.jsx("span",{children:be("common.copy")})]}),Er?.start&&s.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:Er.start.left,top:Er.start.top,transform:"translate(-50%, -100%)",touchAction:"none"},onPointerDown:k=>k.stopPropagation(),children:s.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-1/2 flex -translate-x-1/2 flex-col items-center",children:[s.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"}),s.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"})]})}),Er?.end&&s.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:Er.end.left,top:Er.end.top,transform:"translate(-50%, 0)",touchAction:"none"},onPointerDown:k=>k.stopPropagation(),children:s.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 flex -translate-x-1/2 flex-col items-center",children:[s.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"}),s.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"})]})}),Gr&&_r&&s.jsx(kN,{}),Gr&&wt==="loading"&&!_r&&s.jsx(E6,{}),wt==="error"&&s.jsx(IN,{message:Nr||void 0,onRetry:()=>{window.location.reload()}}),wt==="ready"&&s.jsxs(s.Fragment,{children:[s.jsx("textarea",{ref:Pt,onCopy:k=>{k.preventDefault(),P(k.clipboardData)},"aria-label":be("terminal.input"),"data-terminal-input-anchor":"true",inputMode:"text",enterKeyHint:"enter",autoCapitalize:"off",autoComplete:"nope",autoCorrect:"off",spellCheck:!1,tabIndex:-1,style:{position:"absolute",opacity:0,zIndex:20,background:"transparent",color:"transparent",caretColor:"transparent",resize:"none",overflow:"hidden",border:"none",padding:0,margin:0,outline:"none",...H?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const k=br.x,j=br.y,O={position:"fixed",left:k,top:j,pointerEvents:"none",touchAction:"auto",fontSize:`${rt}px`,fontFamily:ke,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(br.cellW)),height:Math.max(1,Math.round(br.cellH))};if(!xs.active)return O;const z=Rr(xs.text);return{...O,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:z.width,height:z.height,whiteSpace:z.whiteSpace}})()},onContextMenu:k=>{k.preventDefault()},onFocus:()=>{Je("input anchor focus"),Dt.current=void 0,xt.current(),ws("focus",{skipResizePush:!0,skipScrollToBottom:!0}),lt.current?.(!0)},onBlur:k=>{H||tn(k.currentTarget);const j=kn(),O=typeof document<"u"?document.activeElement:null;if(Je("input anchor blur",{guarded:j,activeTag:O?.tagName??null,activeClass:O?.className??null}),!j){H&&Pt.current?.setAttribute("readonly",""),lt.current?.(!1);return}if(typeof window>"u"){lt.current?.(!1);return}window.setTimeout(()=>{Ss()||pn()||(H&&Pt.current?.setAttribute("readonly",""),lt.current?.(!1))},Mu)},onBeforeInput:k=>{if(bt.current)return;const j=k.nativeEvent;if(j instanceof InputEvent){if(j.inputType==="insertFromPaste"||j.inputType==="insertFromPasteAsQuotation"){const O=j.dataTransfer?.getData("text/plain")||j.data;if(O){k.preventDefault();const z=Ct(O,k.currentTarget);H&&_o.current?.(z)}return}if(j.inputType==="insertLineBreak"){if(Ce.current){Ce.current=!1,lr.current!==null&&(clearTimeout(lr.current),lr.current=null),k.preventDefault();return}k.preventDefault(),qe(k.currentTarget);return}if(j.inputType==="deleteContentBackward"||j.inputType==="deleteContentForward"||j.inputType==="deleteByCut"){if(!k.currentTarget.value){k.preventDefault(),ve.current("");return}if(j.inputType==="deleteContentBackward"&&k.currentTarget.selectionStart===0&&k.currentTarget.selectionEnd===0){k.preventDefault(),ve.current("");return}return}}},onInput:k=>{if(bt.current)return;const j=k.nativeEvent,O=V4(Ve.current,bu(k.currentTarget.value),j.inputType);if(O){const z=Ct(O,k.currentTarget);H&&_o.current?.(z);return}We(k.currentTarget)},onPaste:k=>{const{files:j,text:O}=xb(k.clipboardData);if(window.termdockDesktop?.readClipboardFiles||j.length){k.preventDefault(),$e(k.currentTarget,{files:j,text:O});return}if(!O){(window.termdockDesktop||typeof navigator.clipboard?.read=="function")&&(k.preventDefault(),$e(k.currentTarget));return}k.preventDefault();const z=Ct(O,k.currentTarget);H&&_o.current?.(z)},onKeyDown:k=>{const j=sR(k);if(!j&&!bt.current){if(k.getModifierState("AltGraph"))return;const O=he.current,z=k.metaKey,Te=k.ctrlKey,Se=k.altKey,Le=k.shiftKey,ut=k.key;if(z&&!Te&&!Se&&!Le&&ut==="Enter"){k.preventDefault(),qe(k.currentTarget);return}if((z||Te)&&!Se&&!Le&&(ut==="v"||ut==="V"))return;if(z&&!Te&&!Se&&!Le&&(ut==="c"||ut==="C")){k.preventDefault(),P();return}if((z||Te)&&!Se&&!Le&&(ut==="k"||ut==="K")){k.preventDefault(),O&&(O.reset(),ti(),ws("clear",{skipResizePush:!0,skipScrollToBottom:!0})),k.currentTarget.value="",Ve.current="",zt.current=0;return}if(z&&!Te&&!Se&&!Le&&ut==="Backspace"){k.preventDefault(),ft("",k.currentTarget);return}if(z&&!Te&&!Se&&!Le&&ut==="Delete"){k.preventDefault(),ft("\v",k.currentTarget);return}if(z&&!Te&&!Se&&!Le&&ut==="ArrowLeft"){k.preventDefault(),ft("",k.currentTarget);return}if(z&&!Te&&!Se&&!Le&&ut==="ArrowRight"){k.preventDefault(),ft("",k.currentTarget);return}if(z)return;if(Se&&!Te&&!z&&!Le&&ut==="Backspace"){k.preventDefault(),ft("\x1B",k.currentTarget);return}if(Se&&!Te&&!z&&!Le&&ut==="Delete"){k.preventDefault(),ft("\x1Bd",k.currentTarget);return}if(Se&&!Te&&!z&&!Le&&ut==="ArrowLeft"){k.preventDefault(),ft("\x1Bb",k.currentTarget);return}if(Se&&!Te&&!z&&!Le&&ut==="ArrowRight"){k.preventDefault(),ft("\x1Bf",k.currentTarget);return}const Wt=V_(k,O?.modes?.applicationCursorKeysMode===!0);if(Wt!==null){k.preventDefault(),ft(Wt,k.currentTarget);return}}if(k.key==="Enter"||k.key==="Go"||k.key==="done"||k.key==="send"){if(j||bt.current){k.preventDefault();return}if(Ce.current){Ce.current=!1,lr.current!==null&&(clearTimeout(lr.current),lr.current=null),k.preventDefault();return}k.preventDefault(),qe(k.currentTarget);return}if(k.key==="Backspace"){if(j||bt.current)return;if(!k.currentTarget.value){k.preventDefault(),ve.current("");return}if(k.currentTarget.selectionStart===0&&k.currentTarget.selectionEnd===0){k.preventDefault(),ve.current("");return}}},onCompositionStart:()=>{bt.current=!0,mn(),On({active:!0,text:""})},onCompositionUpdate:k=>{bt.current=!0;const j=k.data??k.currentTarget.value;On(O=>O.active&&O.text===j?O:{active:!0,text:j})},onCompositionEnd:k=>{bt.current=!1,Ce.current=!0,lr.current!==null&&clearTimeout(lr.current),lr.current=setTimeout(()=>{Ce.current=!1,lr.current=null},50),On({active:!1,text:""}),We(k.currentTarget),St()}}),xs.active&&(()=>{const k=Rr(xs.text);return s.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:br.x,top:br.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:k.width,height:k.height,margin:0,padding:0,color:K.foreground,background:K.background,boxShadow:`-1px 0 0 1px ${K.background}`,fontSize:`${rt}px`,fontFamily:ke,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:K.foreground,wordBreak:"break-all",whiteSpace:k.whiteSpace,transition:"none"},children:xs.text})})(),s.jsx("div",{"aria-hidden":!0,className:`absolute left-1/2 -translate-x-1/2 top-6 z-30 pointer-events-none
122
+ rounded-full bg-[var(--surface-elevated)] px-4 py-1.5 text-sm font-semibold text-foreground
123
+ shadow-lg transition-all duration-150 ease-out`,style:{opacity:es?1:0,transform:es?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),s.jsx("div",{ref:En,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:hn.visible?1:0,transform:hn.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:hn.visible&&(()=>{const{activeDir:k}=hn,j=O=>k===O;return s.jsxs("div",{className:"flex flex-col items-center gap-0.5 rounded-xl bg-[var(--overlay-background)] backdrop-blur-sm shadow-lg px-1.5 py-1.5",children:[s.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${j("up")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M12 19V5M7 11l5-5 5 5"})})}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${j("left")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),s.jsx("div",{className:"w-7 h-7 flex items-center justify-center rounded-lg text-[rgb(var(--overlay-foreground-rgb)_/_0.18)]",children:s.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("circle",{cx:"12",cy:"12",r:"4"})})}),s.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${j("right")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),s.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${j("down")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]})})()})]})]})});R6.displayName="TerminalViewport";const pR=R6,mR=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},gR=()=>({async createSession(e){return a7(e)},connect(e,t,r){const n=i7(e,t.onEvent,t.onError,{...mR(r),getDimensions:r?.getDimensions});return{close:()=>n()}},sendInputExitingCopyMode:J4,async sendInput(e,t){await Y5(e,t)},async resize(e){await s7(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await Z5(e)},async restartSession(e,t){return n7(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await r7(e)},async tmuxAction(e,t){return t7(e,t)},async listTmuxSessions(){return mm()},async getTmuxStatus(){return pm()},async checkHealth(e){return e7(e)}}),xR="\x1B",bR=/\x1b\[[IO]/g,vR=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,yR=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function Px(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function wR(e){const t=e.replace(bR,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let n=Px(vR,t,r);if(n<0&&(n=Px(yR,t,r)),n<0&&t.startsWith("\x1B[M",r)&&t.length>=r+6&&(n=r+6),n<0)return!1;r=n}return!0}function AR(e){return e===xR}function Wm(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const Zu=18;function TR(){return M6.map(e=>e.id)}const M6=[{id:"default",label:"Base",programs:[],includeAlt:!0,rowLayout:[3,3,3],actions:[],showOnDesktop:!1},{id:"opencode",label:"Code",programs:["opencode"],includeAlt:!1,rowLayout:[6],actions:[{id:"opencode-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo||\r"},{id:"opencode-new",label:"/new",sequence:"/new",doubleTapSequence:"/new||\r"},{id:"opencode-models",label:"/models",sequence:"/models",doubleTapSequence:"/models||\r"},{id:"opencode-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact||\r"}],showOnDesktop:!0},{id:"claude",label:"Claude",programs:["claude","claude-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"claude-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"claude-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"claude-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"}],showOnDesktop:!0},{id:"kimi",label:"Kimi",programs:["kimi","kimi-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"kimi-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"kimi-new",label:"/new",sequence:"/new",doubleTapSequence:"/new\r"},{id:"kimi-sessions",label:"/sessions",sequence:"/sessions",doubleTapSequence:"/sessions\r"},{id:"kimi-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"kimi-goal",label:"/goal",sequence:"/goal",doubleTapSequence:"/goal\r"}],showOnDesktop:!0},{id:"codex",label:"Codex",programs:["codex"],includeAlt:!1,rowLayout:[6],actions:[{id:"codex-shift-left",label:"⇧←",sequence:"\x1B[1;2D"},{id:"codex-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"codex-model",label:"/model",sequence:"/model",doubleTapSequence:"/model\r"},{id:"codex-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"codex-resume",label:"/resume",sequence:"/resume",doubleTapSequence:"/resume\r"}],showOnDesktop:!0},{id:"coco",label:"Coco",programs:["coco"],includeAlt:!1,rowLayout:[6],actions:[{id:"coco-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"coco-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"coco-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"coco-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0},{id:"traex",label:"TraeX",programs:["traex","traecli"],includeAlt:!1,rowLayout:[6],actions:[{id:"traex-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"traex-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"traex-compact",label:"/compact",sequence:"/||compact ",doubleTapSequence:"/||compact ||\r"},{id:"traex-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"traex-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0}];function bd(){return M6.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function z1(e){const t=Array.isArray(e)?e.map(r=>Math.min(20,Math.max(2,Math.floor(r)))).filter(r=>Number.isFinite(r)):[];return t.length>0?t:[3,3]}function j6(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const H1=/^\/(.+)\/([gimsuy]*)$/;function Ox(e){return H1.test(e.trim())}function uf(e){const t=e.trim().match(H1);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function D6(e){if(typeof e!="string")return null;const t=e.trim();return t?H1.test(t)?uf(t)?t:null:t.toLowerCase():null}function Fx(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16))).replace(/\\r/g,"\r").replace(/\\n/g,`
124
+ `).replace(/\\t/g," ")}const $x="||",CR=120;function SR(e){return e.includes($x)?e.split($x).filter(t=>t.length>0):[e]}function N0(e){const t=new Set,r=e.map((a,l)=>{const c=typeof a.id=="string"&&a.id.trim().length>0?a.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${l+1}`,h=t.has(c)?`${c}-${l+1}`:c;return t.add(h),{id:h,label:typeof a.label=="string"&&a.label.trim().length>0?a.label.trim():"Preset",programs:Array.isArray(a.programs)?a.programs.map(p=>D6(p)).filter(p=>!!p):[],includeAlt:typeof a.includeAlt=="boolean"?!!a.includeAlt:!1,rowLayout:z1(a.rowLayout),showOnDesktop:typeof a.showOnDesktop=="boolean"?!!a.showOnDesktop:!1,actions:Array.isArray(a.actions)?a.actions.map((p,m)=>{const x={id:typeof p.id=="string"&&p.id.trim().length>0?p.id:`${h}-action-${m+1}`,label:typeof p.label=="string"?p.label:`Key ${m+1}`,sequence:typeof p.sequence=="string"?p.sequence:""};return typeof p.doubleTapSequence=="string"&&(x.doubleTapSequence=p.doubleTapSequence),x}):[]}}).filter(a=>a.id!=="auto"),n=bd()[0];return n&&!r.some(a=>a.id==="default")&&r.unshift(n),r}function LR(e,t){const r=j6(e);if(!r)return"default";for(const n of t)if(n.id!=="default")for(const a of n.programs){const l=uf(a);if(l){if(l.test(r))return n.id}else if(r.includes(a))return n.id}return"default"}function Ux(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??bd()[0]}function _R(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function kR(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.id==="default"||t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function Q6(e,t){const r=z1(t),n=[];let a=0,l=0;for(;a<e.length;){const c=r[Math.min(l,r.length-1)]??3;n.push({columns:c,items:e.slice(a,a+c)}),a+=c,l+=1}return n}const B6=28,P6=({mode:e,presetLabel:t,title:r,ariaLabel:n,disabled:a,onPointerDown:l,buttonRef:c})=>s.jsx("button",{ref:c,type:"button",onPointerDown:l,tabIndex:-1,disabled:a,className:"h-7 w-7 rounded-full bg-surface-2 shadow-sm text-[11px] font-medium active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",title:r,"aria-label":n??r,children:e==="auto"?s.jsx(G9,{size:14}):(t.charAt(0)||"?").toUpperCase()}),IR={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},Du=8;function ER(e,t){return IR[e]??null}const NR=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:n,lockedModifier:a,disabled:l,defaultShowExtended:c=!1,presetLabel:h,presetModeLabel:p,presetMode:m,presetOptions:x,includeAlt:b,presetRowLayout:y,extraActions:w,onKeyPress:C,onTextPress:S,onPastePress:I,onFilePress:N,onFileLongPress:Q,fileUploadState:W="idle",fileUploadProgress:B=0,longPressMode:U="arrows",copyFeedback:K="idle",onLongPressModeToggle:re,onModifierToggle:H,onPresetSelect:Oe,onExpandedChange:ne})=>{const{t:ce}=Xr(),[Ne,Me]=L.useState(c),[be,V]=L.useState(!1),Ke=L.useRef(null),he=r==="desktop-actions",Be=he||Ne,[ae,X]=L.useState(!1),[He,je]=L.useState(null),ve=l||!e||!t,Fe=l||!e,lt=L.useRef(null),ye=L.useRef(null),de=L.useRef(null),nt=L.useRef(null),Xe=L.useRef(null),pt=L.useRef(K),xe=L.useRef(null),mt=L.useRef(0),It=L.useRef(null),At=L.useRef(!1),Nt=L.useCallback(Ve=>{if(ve)return;const zt=Ve.target;if(!(zt instanceof Element))return;const Jt=zt.closest("button"),Wr=Jt?.hasAttribute("data-mobile-native-action")===!0;Jt&&!Wr?(Ve.preventDefault(),Ao(Du)):Jt&&Ao(Du)},[ve]),oe=L.useCallback(Ve=>{Ve.preventDefault()},[]),F=L.useCallback(Ve=>{const zt=Ve.target;ve||zt instanceof HTMLElement&&zt.closest("button")&&zt.blur()},[ve]);L.useEffect(()=>{Me(c)},[c]),L.useEffect(()=>{he||ne?.(Ne)},[he,ne,Ne]),L.useEffect(()=>{ve&&(xe.current!==null&&(window.clearTimeout(xe.current.timer),xe.current=null),X(!1),je(null))},[ve]),L.useEffect(()=>{e||(X(!1),je(null))},[e]),L.useEffect(()=>{if(!ae)return;const Ve=()=>{const zt=lt.current?.getBoundingClientRect();zt&&je({left:Math.max(8,zt.left),top:Math.max(8,zt.top-8)})};return Ve(),window.addEventListener("resize",Ve),window.addEventListener("scroll",Ve,!0),()=>{window.removeEventListener("resize",Ve),window.removeEventListener("scroll",Ve,!0)}},[ae]),L.useEffect(()=>{const Ve=pt.current;if(pt.current=K,K==="idle"||K===Ve)return;if(Xe.current!==null&&window.clearTimeout(Xe.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(K==="copied"){ye.current?.animate?.([{transform:"scale(1)"},{transform:"scale(1.16)",offset:.28},{transform:"scale(0.96)",offset:.62},{transform:"scale(1)"}],{duration:720,easing:"cubic-bezier(0.16, 1, 0.3, 1)"});const Jt=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];de.current?.animate?.(Jt,{duration:760,easing:"ease-out"}),nt.current?.animate?.(Jt,{duration:760,delay:130,easing:"ease-out"})}else ye.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});Ao(Du),K==="copied"&&(Xe.current=window.setTimeout(()=>{Ao(Du),Xe.current=null},90),U==="copy"&&re?.())},[K,U,re]),L.useEffect(()=>()=>{Xe.current!==null&&window.clearTimeout(Xe.current)},[]);const we=L.useCallback((Ve,zt)=>{ve||(Ve.preventDefault(),C(zt))},[C,ve]),Qe=L.useCallback((Ve,zt)=>{ve||(Ve.preventDefault(),H(zt))},[H,ve]),tt=L.useCallback(Ve=>{ve||(Ve.preventDefault(),Me(zt=>{const Jt=!zt;return Jt&&(V(!0),Ke.current!==null&&window.clearTimeout(Ke.current),Ke.current=window.setTimeout(()=>{V(!1),Ke.current=null},350)),Jt}))},[ve]),it=L.useCallback(()=>{const Ve=typeof performance<"u"?performance.now():Date.now();Ve-mt.current<350||(mt.current=Ve,I?.())},[I]),Rt=L.useCallback(Ve=>{ve||(Ve.stopPropagation(),Ve.pointerType!=="touch"&&(Ve.preventDefault(),it()))},[ve,it]),Xt=L.useCallback(Ve=>{ve||(Ve.preventDefault(),Ve.stopPropagation(),it())},[ve,it]),Zt=L.useCallback(Ve=>{ve||W==="uploading"||!N||(Ve.preventDefault(),Ve.stopPropagation(),At.current||N(),At.current=!1)},[W,N,ve]),Lt=L.useCallback(()=>{It.current!==null&&window.clearTimeout(It.current),It.current=null},[]),Lr=L.useCallback(Ve=>{Ve.stopPropagation(),!(ve||W==="uploading"||!Q)&&(At.current=!1,It.current=window.setTimeout(()=>{It.current=null,At.current=!0,Ao(Du),Q()},500))},[W,Q,ve]);L.useEffect(()=>()=>Lt(),[Lt]);const Qr=L.useCallback(Ve=>{ve||Ve.stopPropagation()},[ve]),Pt=250,Dt=L.useCallback(()=>{xe.current!==null&&(window.clearTimeout(xe.current.timer),xe.current=null)},[]);L.useEffect(()=>()=>{Dt(),Ke.current!==null&&(window.clearTimeout(Ke.current),Ke.current=null)},[Dt]);const pr=L.useCallback((Ve,zt)=>{if(ve)return;if(Ve.preventDefault(),!zt.doubleTapSequence){S(zt.sequence);return}const Jt=xe.current;if(Jt!==null&&Jt.actionId===zt.id){window.clearTimeout(Jt.timer),xe.current=null,S(zt.doubleTapSequence);return}Dt();const Wr=window.setTimeout(()=>{xe.current=null,S(zt.sequence)},Pt);xe.current={actionId:zt.id,timer:Wr}},[Dt,S,ve]),pe=L.useCallback(Ve=>{ve||(Ve.preventDefault(),Ve.stopPropagation(),re?.())},[re,ve]),Ge=L.useCallback(Ve=>{ve||Ve.stopPropagation()},[ve]),at=L.useCallback(Ve=>{if(ve)return;Ve.preventDefault();const zt=Ve.currentTarget.getBoundingClientRect();je({left:Math.max(8,zt.left),top:Math.max(8,zt.top-8)}),X(Jt=>!Jt)},[ve]),Mt=L.useCallback((Ve,zt)=>{ve||(Ve.preventDefault(),X(!1),je(null),Oe(zt))},[Oe,ve]),er=w.length>0,J=L.useMemo(()=>{const Ve=[{id:"preset",kind:"preset"}];if(!he&&b&&Ve.push({id:"alt",kind:"alt"}),er){const zt=w.map(Jt=>({id:Jt.id,kind:"text",action:Jt}));return Ve.concat(zt)}return he?Ve.concat([{id:"esc",kind:"key",keyName:"esc"},{id:"ctrl-c",kind:"key",keyName:"ctrl-c"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"},{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"}]):Ve.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[w,er,b,he]),bt=L.useMemo(()=>Q6(J,he&&!er?[6]:y),[J,er,he,y]),Ce=`${he?"space-y-1":"mt-1 space-y-1"}${be?" pointer-events-none":""}`,lr=ae&&He?Wi.createPortal(s.jsx("div",{className:"fixed z-popover min-w-28 -translate-y-full rounded-2xl bg-surface-elevated p-1.5 shadow-xl border border-border/15",style:{left:He.left,top:He.top},children:s.jsx("div",{className:"grid gap-1",children:x.map(Ve=>s.jsx("button",{type:"button",onPointerDown:zt=>Mt(zt,Ve.id),tabIndex:-1,disabled:Fe,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${Ve.id===m?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:Ve.label},Ve.id))})}),document.body):null;return s.jsxs(s.Fragment,{children:[lr,s.jsx("div",{"data-mobile-keyboard":"true",className:`z-chrome select-none overflow-hidden app-chrome-bg transition-all duration-150 ease-out px-1 py-0 ${e?he?"max-h-24":"max-h-40":"max-h-0"} ${e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"} ${t?"":"[&_button]:pointer-events-none"}`,onMouseDownCapture:Nt,onPointerDownCapture:Nt,onContextMenuCapture:oe,onFocusCapture:F,children:s.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!he&&s.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[s.jsx("button",{type:"button",onPointerDown:Ve=>we(Ve,"esc"),tabIndex:-1,disabled:Fe,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"Esc"}),s.jsx("button",{type:"button",onPointerDown:Ve=>Qe(Ve,"ctrl"),tabIndex:-1,disabled:Fe,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${n==="ctrl"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${a==="ctrl"?"ring-2 ring-accent":""}`,children:s.jsx("span",{className:"font-medium",children:a==="ctrl"?"Ctrl*":"Ctrl"})}),s.jsx("button",{type:"button",onPointerDown:Ve=>we(Ve,"ctrl-c"),tabIndex:-1,disabled:Fe,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"C-C"}),s.jsx("button",{type:"button",onPointerDown:Ve=>we(Ve,"ctrl-u"),tabIndex:-1,disabled:Fe,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"C-U"}),s.jsxs("button",{type:"button",onPointerDown:Lr,onPointerUp:Lt,onPointerCancel:Lt,onClick:Zt,tabIndex:-1,disabled:Fe||!N||W==="uploading",title:W==="uploading"?`${ce("rightSidebar.uploading")} ${Math.round(B)}%`:ce(W==="inserted"?"rightSidebar.inserted":W==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":ce("rightSidebar.insertLocalFile"),className:`relative h-7 w-full overflow-hidden rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center ${W==="inserted"?"bg-primary/15 text-primary":W==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[W==="uploading"&&s.jsx("span",{"aria-hidden":"true","data-file-upload-progress":"true",className:"absolute inset-y-0 left-0 bg-primary/25 transition-[width] duration-150 ease-out",style:{width:`${Math.max(0,Math.min(100,B))}%`}}),s.jsx("span",{className:"relative z-10 flex items-center justify-center",children:W==="uploading"?s.jsx(Ti,{size:15,className:"animate-spin"}):W==="inserted"?s.jsx(Ba,{size:15}):W==="failed"?s.jsx(zn,{size:15}):s.jsx(b9,{size:15})}),W!=="idle"&&s.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:W==="uploading"?`${ce("rightSidebar.uploading")} ${Math.round(B)}%`:ce(W==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),s.jsx("button",{type:"button",onPointerDown:()=>S("/"),tabIndex:-1,disabled:Fe,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"/"}),s.jsx("button",{type:"button",onPointerDown:Ve=>we(Ve,"enter"),tabIndex:-1,disabled:Fe,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:s.jsx(Ow,{size:16})}),s.jsxs("button",{ref:ye,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Ge,onTouchStart:Ge,onClick:pe,tabIndex:-1,disabled:Fe,title:ce(K==="copied"?"terminal.copied":K==="failed"?"terminal.copyFailed":U==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":ce(U==="copy"?"terminal.switchLongPressToArrows":"terminal.switchLongPressToCopy"),className:`relative isolate h-7 w-full overflow-visible rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-colors keyboard-button-active disabled:opacity-50 flex items-center justify-center ${K==="copied"?"bg-primary/15 text-primary":K==="failed"?"bg-destructive/15 text-destructive":U==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[s.jsx("span",{ref:de,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),s.jsx("span",{ref:nt,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/40 opacity-0"}),s.jsxs("span",{className:"relative z-10 h-4 w-4","aria-hidden":"true",children:[s.jsx(Ba,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${K==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),s.jsx(zn,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${K==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),s.jsx(Tb,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${K==="idle"&&U==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),s.jsx(I9,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${K==="idle"&&U==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),K!=="idle"&&s.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:K==="copied"?`${ce("terminal.copied")} · ${ce("terminal.longPressSendsArrows")}`:`${ce("terminal.copyFailed")} · ${ce("terminal.longPressSelectsText")}`})]}),s.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Rt,onPointerUp:Qr,onTouchStart:Qr,onTouchEnd:Qr,onClick:Xt,tabIndex:-1,disabled:Fe,title:ce("terminal.paste"),"aria-label":ce("terminal.paste"),className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:s.jsx(h9,{size:15})}),s.jsx("button",{type:"button",onPointerDown:tt,tabIndex:-1,disabled:Fe,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:Ne?s.jsx(o7,{size:16}):s.jsx(O0,{size:16})})]}),Be&&s.jsx("div",{className:Ce,children:bt.map((Ve,zt)=>{const Jt=Ve.items[0]?.kind==="preset",Wr=Math.max(2,Ve.columns),yn=Jt?`${B6}px repeat(${Math.max(1,Wr-1)}, minmax(0, 1fr))`:`repeat(${Wr}, minmax(0, 1fr))`;return s.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:yn},children:Ve.items.map(Ar=>Ar.kind==="preset"?s.jsx(P6,{buttonRef:Ar.id==="preset"?lt:void 0,mode:m,presetLabel:h,title:p,disabled:Fe,onPointerDown:at},Ar.id):Ar.kind==="alt"?s.jsx("button",{type:"button",onPointerDown:Jr=>Qe(Jr,"alt"),tabIndex:-1,disabled:Fe,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${n==="alt"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${a==="alt"?"ring-2 ring-accent":""}`,children:s.jsx("span",{className:"font-medium",children:a==="alt"?"Alt*":"Alt"})},Ar.id):Ar.kind==="text"?s.jsxs("button",{type:"button",onPointerDown:Jr=>pr(Jr,Ar.action),tabIndex:-1,disabled:Fe,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm px-1 text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 relative",children:[Ar.action.label,Ar.action.doubleTapSequence&&s.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},Ar.id):s.jsx("button",{type:"button",onPointerDown:Jr=>we(Jr,Ar.keyName),tabIndex:-1,disabled:Fe,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:Ar.keyName==="esc"?"Esc":Ar.keyName==="ctrl-c"?"Ctrl-C":Ar.keyName==="ctrl-d"?"Ctrl-D":Ar.keyName==="home"?"Home":"End"},Ar.id))},`row-${zt}`)})})]})})]})},RR=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:n,connectionError:a,terminalSessionId:l})=>{if(typeof window>"u")return null;const c=window.visualViewport?Math.max(0,Math.round(window.innerHeight-window.visualViewport.height-window.visualViewport.offsetTop)):0;return s.jsxs("div",{className:"px-3 py-2 bg-surface text-foreground text-xs border-b border-border/15",children:[s.jsx("div",{className:"font-bold mb-2",children:"Debug Info"}),s.jsxs("div",{className:"grid grid-cols-2 gap-1 font-mono",children:[s.jsxs("div",{children:["isMobile: ",s.jsx("span",{className:e?"text-accent":"text-destructive",children:String(e)})]}),s.jsxs("div",{children:["touchPoints: ",navigator.maxTouchPoints]}),s.jsxs("div",{children:["innerWidth: ",window.innerWidth]}),s.jsxs("div",{children:["innerHeight: ",window.innerHeight]}),s.jsxs("div",{children:["viewportH:"," ",window.visualViewport?Math.round(window.visualViewport.height):"N/A"]}),s.jsxs("div",{children:["inputFocused: ",String(t)]}),s.jsxs("div",{children:["keyboard~: ",c,"px"]}),s.jsxs("div",{children:["connecting:"," ",s.jsx("span",{className:n?"text-muted-foreground":"text-accent",children:String(n)})]}),s.jsxs("div",{children:["sessionId:"," ",s.jsx("span",{className:l?"text-accent":"text-destructive",children:l?"✓":"✗"})]}),s.jsxs("div",{children:["error:"," ",s.jsx("span",{className:a?"text-destructive":"text-accent",children:a?"Yes":"No"})]}),s.jsxs("div",{children:["isIOS:"," ",s.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]})]}),s.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:s.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},MR=/^Reconnecting/i,jR=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:n,onHardRestart:a})=>{const{t:l}=Xr(),c=!!e&&MR.test(e),h=!!(n&&!e||c),[p,m]=L.useState(!1);return L.useEffect(()=>{if(!h){m(!1);return}const x=setTimeout(()=>m(!0),1500);return()=>clearTimeout(x)},[h]),h?p?s.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:s.jsx(i1,{dots:!0,label:l("connection.reconnecting"),className:"rounded-full bg-surface-2 px-3 py-1 text-[11px]"})}):null:e?s.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2",children:s.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-destructive/70",children:[s.jsx("span",{children:e}),t&&s.jsx("button",{type:"button",onClick:a,disabled:r,className:"text-[11px] text-destructive/90 hover:text-destructive underline underline-offset-2 transition-colors disabled:opacity-40",children:l("common.retry")})]})}):null},Qh=300,DR=120,QR=2e3,BR=250,PR=6e4;function OR(e){const t=new Set(e.slides.flat()),r=new Set([...e.visibleSessionIds].filter(c=>t.has(c)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&r.add(e.foregroundSessionId);const n=e.slides.findIndex(c=>c.some(h=>r.has(h)));if(n<0)return r;const a=e.slides[n-1]??[],l=e.slides[n+1]??[];for(let c=0;c<Math.max(a.length,l.length)&&r.size<3;c+=1)for(const h of[a[c],l[c]])h&&r.size<3&&r.add(h);return r}function Zp(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function hh(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function FR(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function $R(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function UR(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function zR(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function HR(e){return!e.initialConnectionPending}function WR(e){return!e}function GR(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function qR(e,t){return[...e].every(r=>t.has(r))}function VR(e,t){return e===null||t-e>=BR}function ZR(e){return!1}function YR(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,PR-(e.now-e.reconnectStartedAt))}function KR(e,t){const r=new Map;let n=0;for(const a of e)if(!r.has(a)){if(t.has(a)){r.set(a,0);continue}r.set(a,Qh+n*DR),n+=1}return r}const XR="Session not found on server",Bh="Terminal session not found",JR="STALE_SESSION_RESTORE_REJECTED";function zx(e){return Gm(e)?!1:e?.message===XR||e?.status===404&&e.message===Bh}function Gm(e){return e?.code===JR}const eM="/tmp";async function tM(e,t,r){const a=(await t(eM,[e])).files[0];if(!a?.path)throw new Error("Upload did not return a file path");let l;try{l=await r(a.path)}catch{throw new df(a)}if(!l)throw new df(a);return a}class df extends Error{constructor(t){super("File uploaded, but its reference was not accepted"),this.uploaded=t,this.name="UploadedReferenceRejectedError"}uploaded}const O6=[640,960,1280,1600,2048,2560,3072,4096],F6=[240,360,480,540,720,1080,1440,2160],nd={min:.1,max:1,step:.01},sd={min:25e4,max:2e7,step:25e4},W1="termdock:mobile-media-compression-v1",A0={showResultToast:!0,imageEnabled:!1,imageMaxDimension:2048,imageQuality:.8,videoEnabled:!1,videoMaxHeight:720,videoBitrate:25e5};function $6(){try{const e=JSON.parse(localStorage.getItem(W1)||"null");return!e||typeof e!="object"?A0:{showResultToast:e.showResultToast!==!1,imageEnabled:e.imageEnabled===!0,imageMaxDimension:O6.includes(e.imageMaxDimension)?e.imageMaxDimension:A0.imageMaxDimension,imageQuality:typeof e.imageQuality=="number"&&e.imageQuality>=nd.min&&e.imageQuality<=nd.max?e.imageQuality:A0.imageQuality,videoEnabled:e.videoEnabled===!0,videoMaxHeight:F6.includes(e.videoMaxHeight)?e.videoMaxHeight:A0.videoMaxHeight,videoBitrate:typeof e.videoBitrate=="number"&&e.videoBitrate>=sd.min&&e.videoBitrate<=sd.max?e.videoBitrate:A0.videoBitrate}}catch{return A0}}const G1=wd((e,t)=>({preferences:$6(),saveFailed:!1,update:r=>{const n={...t().preferences,...r};let a=!1;try{localStorage.setItem(W1,JSON.stringify(n))}catch{a=!0}e({preferences:n,saveFailed:a})}}));typeof window<"u"&&window.addEventListener("storage",e=>{(e.key===W1||e.key===null)&&G1.setState({preferences:$6(),saveFailed:!1})});function fh(e){if(e<1024)return`${e} B`;const t=["B","KB","MB","GB","TB"],r=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024)));return`${Number((e/1024**r).toFixed(1))} ${t[r]}`}function rM({result:e,message:t,onClose:r}){const{locale:n}=Xr(),a=n==="zh",l=v.useRef(null),[c,h]=v.useState(null),[p,m]=v.useState(!1);return v.useEffect(()=>{const x=URL.createObjectURL(e.file);return h(x),m(!1),()=>URL.revokeObjectURL(x)},[e.file]),v.useEffect(()=>{const x=l.current;return x?.showModal(),()=>x?.close()},[]),s.jsx("dialog",{ref:l,"aria-label":a?"上传结果预览":"Uploaded media preview",onCancel:x=>{x.preventDefault(),r()},onClick:x=>{x.target===x.currentTarget&&r()},onKeyDown:x=>x.stopPropagation(),onKeyUp:x=>x.stopPropagation(),className:"fixed inset-0 z-modal-panel m-0 h-[100dvh] max-h-none w-screen max-w-none bg-transparent p-3 text-foreground backdrop:bg-[var(--app-backdrop)] open:flex open:items-center open:justify-center",children:s.jsxs("section",{className:"flex max-h-[calc(100dvh-env(safe-area-inset-top,0px)-env(safe-area-inset-bottom,0px)-1.5rem)] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-xl",children:[s.jsxs("header",{className:"flex shrink-0 items-start gap-3 border-b border-border/15 p-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"text-sm font-semibold",children:a?"上传结果预览":"Uploaded media preview"}),s.jsx("p",{className:"mt-1 break-words text-xs text-muted-foreground",children:t}),s.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",children:e.file.name})]}),s.jsx("button",{type:"button",autoFocus:!0,onClick:r,"aria-label":a?"关闭预览":"Close preview",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:s.jsx(zn,{size:18})})]}),s.jsx("div",{className:"min-h-0 overflow-auto p-2",children:p?s.jsx("p",{role:"alert",className:"p-4 text-sm text-muted-foreground",children:a?"文件已上传,但当前浏览器无法预览此格式。":"File uploaded, but this browser cannot preview this format."}):c&&(e.kind==="image"?s.jsx("img",{src:c,alt:e.file.name,onError:()=>m(!0),className:"mx-auto block max-h-[65dvh] max-w-full object-contain"}):s.jsx("video",{src:c,controls:!0,playsInline:!0,preload:"metadata",onError:()=>m(!0),className:"mx-auto block max-h-[65dvh] w-full"}))})]})})}function nM({result:e,onDismiss:t}){const{locale:r}=Xr(),n=r==="zh",a=G1(I=>I.preferences.showResultToast),l=a?e:null,[c,h]=v.useState(null);v.useEffect(()=>{if(!e)return;if(!a){t();return}const I=window.setTimeout(t,2e3);return()=>window.clearTimeout(I)},[e,a,t]);const p=l??c?.result;if(!p)return null;const m=p.originalSize-p.uploadedSize,x=p.originalSize>0?Math.abs(m)/p.originalSize*100:0,b=x<1?"<1%":`${Math.floor(x)}%`,y=p.kind==="image"?n?"图片":"Image":n?"视频":"Video",w=m>0?n?"已压缩上传":"Compressed upload":n?"已处理上传":"Processed upload",C=m>0?n?`省 ${b}`:`${b} saved`:m<0?`+${b}`:n?"体积未变":"Size unchanged",S=p.originalRetained?n?`已尝试压缩 · 保留原图 ${fh(p.uploadedSize)},已上传`:`Compression tried · original ${fh(p.uploadedSize)} uploaded`:`${w} · ${fh(p.originalSize)} → ${fh(p.uploadedSize)} · ${C}`;return s.jsxs(s.Fragment,{children:[l&&s.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"pointer-events-none absolute left-1/2 top-1/2 z-30 w-max max-w-[calc(100%-1.5rem)] -translate-x-1/2 -translate-y-1/2 motion-safe:animate-[fade-in_0.15s_ease-out]",children:s.jsxs("button",{type:"button","aria-label":`${y}:${S} · ${n?"点击预览":"Preview"}`,onClick:()=>{h({result:l,message:S}),t()},className:"pointer-events-auto flex max-w-full select-none items-center gap-1.5 rounded-full border border-border/15 bg-surface-elevated px-3 py-2 text-[11px] leading-4 text-foreground shadow-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[s.jsx(Ba,{size:13,strokeWidth:2.5,className:"shrink-0 text-primary","aria-hidden":"true"}),s.jsx("span",{className:"truncate tabular-nums",children:S}),s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n?"预览 ›":"Preview ›"})]})}),c&&Wi.createPortal(s.jsx(rM,{result:c.result,message:c.message,onClose:()=>h(null)}),document.body)]})}const sM=320,Hx="termdock:mobile-keyboard-expanded",Wx="termdock:mobile-keyboard-preset-mode",Gx="termdock:mobile-long-press-mode",iM=80;function aM(e){return/\.(?:jpe?g|png|heic|heif)$/i.test(e.name)||/^(?:image\/jpeg|image\/png|image\/heic|image\/heif)$/i.test(e.type)}function qx(e){const t=(e instanceof Error?e.message:String(e)).slice(0,3e3);return/importing a module script failed|dynamically imported module|loading chunk/i.test(t)?`压缩模块加载失败,可能是页面版本过旧或网络中断。请更新页面后重试,无需清除转码器缓存。
125
+ ${t}`:t}function oM(e){switch(e?.phase){case"loading":return`正在加载转码器… ${e.progress??0}%(优先使用浏览器缓存)`;case"saving":return"加载完成,正在保存到本机…";case"initializing":return e.source==="local"?"已找到本机缓存,正在初始化转码器…":"正在初始化本地转码器…";case"ready":return e.source==="local"?"已从本机缓存加载,转码器已就绪。":e.saved?"转码器已就绪,已保存到本机供下次使用。":"转码器已就绪。";default:return"正在检查本机转码器缓存…"}}function Yp(){return K5()}const lM={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},cM=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:n=U1(),colorTheme:a="dark",toolbarPresets:l=[],isActive:c=!0,focusSuspended:h=!1,allowOwnedPasteWhileFocusSuspended:p=!1,deferCursorUntilPositioned:m=!1,isLayoutVisible:x=!0,focusRequestToken:b=0,resumeRequestToken:y=0,resumeRequestReason:w="visibility",resumeRequestDelayMs:C=0,forceResumeReconnect:S=!1,initialConnectDelayMs:I=0,initialConnectEnabled:N=!0,resumeRequestEnabled:Q=!0,onStreamReadyChange:W,onStreamConnected:B,onViewportReadyChange:U,onContentReadyChange:K,onKeyboardVisibilityChange:re,suppressKeyboard:H=!1,keyboardPortalTarget:Oe=null,sharedMobileKeyboardLayout:ne=!1,suppressPageFlipRefresh:ce=!1,showDebug:Ne,onStatusChange:Me})=>{const{t:be}=Xr(),[V]=L.useState(e||Gw()),[Ke,he]=L.useState(()=>(e?zh(e):null)??n.fontSize),Be=L.useMemo(()=>gR(),[]),ae=L.useMemo(()=>ad("session"),[]),X=L.useMemo(()=>ad("keyboard"),[]),He=L.useRef(null),je=L.useRef(null);L.useEffect(()=>{zh(V)===null&&he(n.fontSize)},[n.fontSize,V]);const ve=L.useMemo(()=>({...n,fontSize:Ke}),[n,Ke]),Fe=l7(),lt=h||Fe,[ye,de]=L.useState(Yp),[nt,Xe]=L.useState(!1),[pt,xe]=L.useState(!1),[mt,It]=L.useState(!1),[At,Nt]=L.useState(()=>typeof document>"u"?!0:!document.hidden&&El()),[oe,F]=L.useState(()=>typeof document>"u"?!0:document.hasFocus()),[we,Qe]=L.useState(!1),tt=L.useRef(we);tt.current=we;const[it,Rt]=L.useState(!1),[Xt,Zt]=L.useState(!1),[Lt,Lr]=L.useState(!1),[Qr,Pt]=L.useState(!0),{isOpen:Dt,keyboardHeight:pr}=bb({enabled:ye&&c}),[pe,Ge]=L.useState(null),[at,Mt]=L.useState(null),[er,J]=L.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(Hx)==="true"),[bt,Ce]=L.useState(()=>{if(typeof window>"u")return"auto";const se=window.localStorage.getItem(Wx);return se&&se.length>0?se:"auto"}),[lr,Ve]=L.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(Gx)==="copy"?"copy":"arrows"),[zt,Jt]=L.useState("idle"),[Wr,yn]=L.useState("idle"),[Ar,Jr]=L.useState(0),[Fr,$r]=L.useState(null),[an,An]=L.useState(null),[gt,fe]=L.useState(null),Vr=L.useCallback(()=>fe(null),[]),{preferences:ct,update:Ue,saveFailed:Tr}=G1(),{videoEnabled:wt,videoMaxHeight:Tn,videoBitrate:Nr,imageEnabled:cn,imageMaxDimension:Ie,imageQuality:ht}=ct,[Je,_r]=L.useState(!1),[Zr,Gr]=L.useState(null),[Ir,es]=L.useState(null),Ft=Mr(se=>se.sessions.get(V)),{setTerminalSession:hn,setConnecting:ee,appendToBuffer:Ye,replaceBuffer:qt,clearTerminalSession:Gt,removeTerminalSession:Yr,clearBuffer:Br,setSessionActiveProgram:Er,setSessionCwd:ar,setSessionCopyMode:br,setSessionAgentStatus:Hn,setSessionShellTitle:Qs,setSessionPromptState:hs,clearAgentNeedsReview:xs}=Mr.getState(),On=L.useMemo(()=>`wt-${V.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[V]),En=Ft?.terminalSessionId??null,Bs=Ft?.mode??"shell",bs=Ft?.activeProgram??null,Ur=L.useMemo(()=>N0(l),[l]),Pr=Bs==="tmux",kt=Ft?.bufferChunks??[],ks=Ft?.isConnecting??!1,Yt=En,q=L.useCallback(async(se,Re)=>{const et=$N(se,Ft?.cwd||Ft?.directory);if(!et)return;let _t=et,ze="directory";try{_t=(await c7(et)).path}catch(k){if(!(k instanceof Error)||k.message!=="Path is not a directory")return;ze="file"}try{Sr.getState().openTerminalPath({path:_t,kind:ze,line:Re})}catch{}},[Ft?.cwd,Ft?.directory]),ke=t??Ft?.mode??"shell",rt=ke==="tmux"?r??Ft?.tmuxSessionName??null:null,[or,$t]=L.useState(null),cr=L.useRef(!1),[Et,fn]=L.useState(!1),[Ts,_i]=L.useState(!1),[Ps,Wn]=L.useState(null),[wa,di]=L.useState(0),[Gn,ls]=L.useState(null),qr=Ne!==void 0?Ne:!1,qn=L.useRef(null),en=L.useRef(null),Ht=L.useRef(null),Fn=L.useRef(new B_),jr=L.useRef(null),mr=L.useRef(null),Dr=L.useRef(!1),wn=L.useRef(null),Ln=L.useRef([]),Vn=L.useRef(0),Zn=L.useRef(!1),cs=L.useRef(Promise.resolve()),ts=L.useRef(null),Cn=L.useRef(null),ki=L.useRef(-1),Cs=L.useRef(null),_n=L.useRef(0),Nn=L.useRef(null),Kr=L.useRef(null),Ss=L.useRef(0),pn=L.useRef(0),$=L.useRef(!1),_e=L.useRef(null),Pe=L.useRef(null),We=L.useRef(!1),qe=L.useRef(0),ft=L.useRef(!1),Ct=L.useRef(!1),Qt=L.useRef(!1),st=L.useRef(null),vt=L.useRef(null),sr=L.useRef(null),yt=L.useRef(c),P=L.useRef(x);P.current=x,yt.current=c;const G=L.useRef(lt);G.current=lt;const le=L.useRef(h);le.current=h;const ge=L.useRef(p);ge.current=p;const $e=L.useRef(ye),ot=L.useRef(null),xt=L.useRef(null),Tt=L.useRef(null),Rr=L.useRef(null),mn=L.useRef(null),St=L.useRef(null),tn=L.useRef(null),rn=L.useCallback(()=>{const se=++qe.current,Re=()=>{se===qe.current&&Rt(!0)};if(typeof window>"u"){Re();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(Re))},[]),Os=L.useCallback(se=>{if(ft.current){if(vt.current!==null&&(window.clearTimeout(vt.current),vt.current=null),se.x===0&&se.y>=se.rows-1){Pt(!1);return}vt.current=window.setTimeout(()=>{vt.current=null,Pt(!0)},iM)}},[]),kn=L.useRef(null);L.useEffect(()=>()=>{kn.current?.()},[]);const on=L.useCallback(()=>{kn.current||(kn.current=M1(()=>{kn.current=null;const se=Mr.getState(),Re=Ht.current,et=se.getTerminalSession(V);if(!Re||et?.mode!=="shell"||se.hasPendingBufferWrites(V))return;const _t=u7(Re),ze=mr.current?.getDimensions();if(!_t||!ze)return;const j=mr.current?.serializeSnapshot();j&&d7({id:Re,version:1,..._t,...ze,data:j,savedAt:Date.now()})},2e3))},[V]),gr=L.useCallback(se=>{const Re=Mr.getState(),et=Re.getTerminalSession(V)?.bufferChunks.at(-1)?.id;if(Ht.current&&et!==void 0&&et<=se&&!Re.hasPendingBufferWrites(V)&&(h7(Ht.current),on()),!$.current||!zR({writtenChunkId:se,initialTargetChunkId:_e.current}))return;const _t=Pe.current;Pe.current=null,_t!==null&&mr.current?.notifyScreenSynchronized(_t),$.current=!1,_e.current=null,rn()},[rn,on,V]),Vt=L.useCallback(se=>{if(!ft.current)return;const Re=st.current;Re&&Re.x===se.x&&Re.y===se.y&&Re.rows===se.rows||(st.current=se,vt.current!==null&&(window.clearTimeout(vt.current),vt.current=null),se.x===0&&se.y>=se.rows-1&&Pt(!1))},[]);L.useEffect(()=>{if(!m){Ct.current=!1;return}Ct.current||(Ct.current=!0,Qt.current=!1,ft.current=!0,st.current=null,Pt(!1),vt.current!==null&&(window.clearTimeout(vt.current),vt.current=null),sr.current!==null&&window.clearTimeout(sr.current),sr.current=window.setTimeout(()=>{sr.current=null,vt.current!==null&&typeof window<"u"&&window.clearTimeout(vt.current),vt.current=null,ft.current=!1,Pt(!0)},15e3))},[m]);const Yn=L.useCallback(()=>{Rr.current=null;const se=Tt.current;Tt.current=null,se&&Qs(se.sessionId,se.title)},[Qs]),vs=L.useCallback((se,Re)=>{if(Tt.current={sessionId:se,title:Re},Rr.current===null){if(typeof window>"u"){Yn();return}Rr.current=window.requestAnimationFrame(Yn)}},[Yn]),Ii=L.useCallback(()=>{Rr.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(Rr.current),Rr.current=null,Tt.current=null},[]),hi=L.useCallback(async()=>{const se=ke;return(await f7({preferredFrontendSessionId:V,mode:se,tmuxSessionName:se==="tmux"?rt||On:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[ke,rt,On,V]),qo=L.useRef(c);L.useEffect(()=>{if(!c){mr.current?.blur(),qo.current=!1;return}if(qo.current)return;qo.current=!0;const se=A7(ye,ce);if(se==="single"){mr.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}se!=="none"&&mr.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[c,ye,ce,Yt]),L.useEffect(()=>{$e.current=ye},[ye]);const ei=L.useCallback(()=>{!yt.current||G.current||mr.current?.focus()},[]);L.useLayoutEffect(()=>{lt&&mr.current?.blur()},[lt]),L.useEffect(()=>{if(!c||lt||Qr||Qt.current)return;Qt.current=!0;const se=window.requestAnimationFrame(()=>{mr.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(se)},[lt,c,Qr]);const Pa=L.useCallback(se=>{typeof window>"u"||typeof document>"u"||!yt.current||G.current||$e.current||document.hidden||!El()||(ot.current!==null&&window.clearTimeout(ot.current),ot.current=window.setTimeout(()=>{if(ot.current=null,!yt.current||G.current||$e.current||document.hidden||!El())return;const Re=document.activeElement,et=Re?.getAttribute("data-terminal-input-anchor")==="true";if((Re instanceof HTMLInputElement||Re instanceof HTMLTextAreaElement||Re instanceof HTMLSelectElement||Re?.isContentEditable===!0)&&!et||Re?.closest("[data-file-browser-keyboard]")){X("desktop resume focus skipped: editable active",{reason:se});return}X("desktop resume focus",{reason:se}),mr.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),mr.current?.focus()},50))},[X]);L.useEffect(()=>()=>{ot.current!==null&&typeof window<"u"&&window.clearTimeout(ot.current),ot.current=null,xt.current!==null&&typeof window<"u"&&window.clearTimeout(xt.current),xt.current=null,mn.current!==null&&typeof window<"u"&&window.clearTimeout(mn.current),mn.current=null,St.current!==null&&typeof window<"u"&&window.clearTimeout(St.current),St.current=null,sr.current!==null&&typeof window<"u"&&window.clearTimeout(sr.current),sr.current=null,vt.current!==null&&typeof window<"u"&&window.clearTimeout(vt.current),vt.current=null},[]),L.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const se=()=>{xt.current!==null&&window.clearTimeout(xt.current),xt.current=window.setTimeout(()=>{xt.current=null;const Re=document.activeElement;if(Re?.closest("[data-file-browser-keyboard]"))return;const _t=!(Re?.getAttribute("data-terminal-input-anchor")==="true")&&!!(Re&&(Re instanceof HTMLInputElement||Re instanceof HTMLTextAreaElement||Re instanceof HTMLSelectElement||Re.isContentEditable));X9({isActive:yt.current&&!G.current,isMobile:$e.current,documentVisible:!document.hidden,activeElementIsEditable:_t})&&ei()},0)};return document.addEventListener("pointerup",se),()=>{document.removeEventListener("pointerup",se),xt.current!==null&&(window.clearTimeout(xt.current),xt.current=null)}},[ei]);const Rn=L.useCallback(()=>{qs.current=!1,di(se=>se+1)},[]),Ei=L.useCallback((se,Re,et)=>{const _t=Ht.current,ze=Date.now();if(_t&&Re&&p7(_t)){je.current={startedAt:ze,strategy:"reconnect",reason:se},Da("info","PWA_RESUME terminal-start",{frontendSessionId:V,backendSessionId:_t,strategy:"reconnect",reason:se,active:yt.current});return}if(_t&&m7(_t,()=>{const k=je.current;Da("info","PWA_RESUME terminal-responsive",{frontendSessionId:V,backendSessionId:_t,durationMs:k?Date.now()-k.startedAt:null,strategy:k?.strategy??"probe",reason:k?.reason??se}),je.current=null,B?.(V)},{visible:et})){je.current={startedAt:ze,strategy:"probe",reason:se},Da("info","PWA_RESUME terminal-start",{frontendSessionId:V,backendSessionId:_t,strategy:"probe",reason:se,active:yt.current}),ae("[Terminal] resume probe sent",{reason:se,backendSessionId:_t,active:yt.current});return}if(ae("[Terminal] resume probe missing connection, restarting ensureSession",{reason:se,backendSessionId:_t,active:yt.current}),!HR({initialConnectionPending:We.current})){ae("[Terminal] resume probe deferred during initial websocket handshake",{reason:se,backendSessionId:_t});return}Rn()},[ae,B,Rn,V]),ea=L.useCallback((se,Re)=>{const et=Ht.current;et&&wn.current!==se&&(wn.current=se,yg(et,se,Re),ae("[Terminal] flow-control state sent",{backendSessionId:et,paused:se,reason:Re}))},[ae]),_o=L.useCallback((se,Re)=>{const et=Ht.current;et&&Nn.current!==se&&(Nn.current=se,wg(et,se,Re),ae("[Terminal] focus state sent",{backendSessionId:et,focused:se,reason:Re}))},[ae]),rs=L.useCallback((se,Re)=>{const et=Ht.current;et&&Kr.current!==se&&(Kr.current=se,Ag(et,se,Re),ae("[Terminal] viewing state sent",{backendSessionId:et,viewing:se,reason:Re}))},[ae]),ns=Y9({isActive:c&&!lt,viewportFocused:mt,documentVisible:At,windowFocused:oe,streamReady:we}),Ws=K9({isActive:c,documentVisible:At,windowFocused:oe,streamReady:we,isDesktop:Nl()!==null}),Gs=L.useRef(ns),ys=L.useRef(Ws);L.useEffect(()=>{Gs.current=ns,_o(ns,"logical-focus-change")},[ns,_o,Yt]),L.useEffect(()=>{ys.current=Ws,rs(Ws,"logical-viewing-change")},[Ws,rs,Yt]),P_(Yt,At,we),L.useEffect(()=>{const se=Re=>{const et=Re.detail;!et||et.sessionId!==V||he(et.fontSize??n.fontSize)};return window.addEventListener("termfontchange",se),()=>window.removeEventListener("termfontchange",se)},[V,n.fontSize]),L.useEffect(()=>{const se=()=>{const ze=!document.hidden&&El();Nt(ze),ze&&c&&Pa("visibility")},Re=ze=>{c&&Pa(ze.persisted?"bfcache":"pageshow")},et=()=>{F(!0),Pa("window-focus")},_t=()=>F(!1);return document.addEventListener("visibilitychange",se),window.addEventListener(Tg,se),window.addEventListener("pageshow",Re),window.addEventListener("focus",et),window.addEventListener("blur",_t),()=>{document.removeEventListener("visibilitychange",se),window.removeEventListener(Tg,se),window.removeEventListener("pageshow",Re),window.removeEventListener("focus",et),window.removeEventListener("blur",_t)}},[c,Pa]),L.useEffect(()=>{if(!y||!Q||!Ni.current)return;const se=C,Re=se<=0,et=He.current;if(et?.token===y&&(et.visible||!Re))return;const _t=()=>{He.current={token:y,visible:Re},mr.current?.requestRefresh(w,{skipScrollToBottom:!0}),Ei(se>0?"global-resume-background":"global-resume-visible",se<=0&&S,Re)};if(se<=0){_t();return}const ze=window.setTimeout(_t,se);return()=>window.clearTimeout(ze)},[y,w,Q,C,S,Ei]);const Ls=L.useRef(0);L.useEffect(()=>{if(we){Ls.current=0;return}if(!Et||or==="Authentication required"||or===Bh)return;const se=Ls.current,Re=Math.min(2e3*Math.pow(2,Math.min(se,4)),3e4),et=setTimeout(()=>{Ls.current+=1,ae("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:Ls.current,backendSessionId:Ht.current}),$t("Reconnecting..."),fn(!1),Rn()},Re);return()=>clearTimeout(et)},[or,Et,we,wa,ae,Rn]),L.useEffect(()=>{if(typeof window>"u"){Xe(!1);return}const se=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;Xe(se)},[]),L.useEffect(()=>{(!c||!ye)&&xe(!1),c||It(!1)},[c,ye]),L.useEffect(()=>{Ht.current=Yt,ki.current=-1,Pe.current=null,Nn.current=null,Kr.current=null,wn.current=null},[Yt]),L.useEffect(()=>{W?.(V,we)},[we,W,V]),L.useEffect(()=>{K?.(V,we&&it&&Xt)},[it,Xt,we,K,V]),L.useEffect(()=>{Pr||(Zn.current=!1,ts.current=null,Cn.current&&(clearTimeout(Cn.current),Cn.current=null))},[Pr]),L.useEffect(()=>{Yt&&mr.current?.requestRefresh("session-key-change",{force:!0})},[Yt]),L.useEffect(()=>{const se=!H&&x&&c&&ye&&Dt;X("visibility signal",{sessionId:V,isActive:c,isMobile:ye,isInputFocused:pt,isViewportKeyboardOpen:Dt,viewportKeyboardHeight:pr,visible:se}),re?.(V,se)},[re,H,x,V,c,ye,Dt,pr,X]),L.useEffect(()=>{c&&b&&b!==_n.current&&(_n.current=b,ei())},[b,ei,c]),L.useEffect(()=>{jr.current=V},[V]),L.useEffect(()=>{!ye&&(pe!==null||at!==null)&&(Ge(null),Mt(null),Cs.current=null)},[ye,pe,at]),L.useEffect(()=>{!Yt&&(pe!==null||at!==null)&&(Ge(null),Mt(null),Cs.current=null)},[Yt,pe,at]),L.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Hx,er?"true":"false")},[er]),L.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Wx,bt)},[bt]),L.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Gx,lr)},[lr]),L.useEffect(()=>{de(Yp());const se=()=>{de(Yp())};return window.addEventListener("resize",se),()=>window.removeEventListener("resize",se)},[]);const fs=L.useCallback(()=>{Ss.current+=1,pn.current+=1,cs.current=Promise.resolve(),Yn(),Ii();const se=qn.current;qn.current=null,en.current=null,We.current=!1,tt.current=!1,Qe(!1),mr.current?.setSessionReady(!1);const Re=Ht.current;Re&&yg(Re,!1,"stream-disconnect"),Dr.current=!1,wn.current=null,Ln.current=[],se?.()},[Ii,Yn]),nn=L.useCallback(async se=>{if(en.current===se){ae(`[startStream] Skipping - already connected to ${se}`);return}ae(`[startStream] Starting stream for frontendSessionId=${V} backendSessionId=${se}`),Wn(null),qe.current+=1,$.current=!1,_e.current=null,Rt(!1),Zt(!1),fs();const Re=Ss.current+1;Ss.current=Re,We.current=!0;const et=Mr.getState().getTerminalSession(V);if(et?.mode==="shell"&&!et.bufferChunks.length){const ze=await Promise.race([g7(se),new Promise(k=>window.setTimeout(()=>k(null),75))]);if(Ss.current!==Re||jr.current!==V)return;if(ze&&!Mr.getState().getTerminalSession(V)?.bufferChunks.length){Mr.getState().replaceBuffer(V,[ze.data]);const k=mr.current?.getDimensions();k?.cols===ze.cols&&k.rows===ze.rows&&x7(se,ze.seq,ze.epoch)}}const _t=Be.connect(se,{onEvent:ze=>{if(Ss.current!==Re)return;const k=V;if(k)switch(ze.type){case"connected":{pn.current+=1,cs.current=Promise.resolve(),We.current=!1;const j=je.current;j&&(Da("info","PWA_RESUME terminal-connected",{frontendSessionId:k,backendSessionId:Ht.current,durationMs:Date.now()-j.startedAt,strategy:j.strategy,reason:j.reason}),je.current=null),B?.(k),(ze.runtime||ze.ptyBackend)&&ae(`[Terminal] connected frontendSessionId=${k} backendSessionId=${Ht.current} runtime=${ze.runtime??"unknown"} pty=${ze.ptyBackend??"unknown"} cwd=${ze.cwd??"unknown"}`),ee(k,!1),$t(null),fn(!1),Wn(null),tt.current=!0,Qe(!0),Ht.current&&(wg(Ht.current,Gs.current,"stream-connected"),Ag(Ht.current,ys.current,"stream-connected")),mr.current?.setSessionReady(!0),wn.current=null,ea(Dr.current,"stream-connected"),ze.tuiProgress!==void 0&&Mr.getState().setSessionTuiProgress(k,ze.tuiProgress??null),ze.shellTitle!==void 0&&Mr.getState().setSessionShellTitle(k,ze.shellTitle??null),ze.promptState!==void 0&&ze.promptState!==null&&Mr.getState().setSessionPromptState(k,ze.promptState);const O=Mr.getState().getTerminalSession(k);if(O?.terminalSessionId&&ze.mode&&Mr.getState().setTerminalSession(k,{sessionId:O.terminalSessionId,cols:80,rows:24,mode:ze.mode,tmuxSessionName:ze.tmuxSessionName??null,cwd:ze.cwd??null}),ze.activeProgram!==void 0&&Er(k,ze.activeProgram??null,ze.activeProgramSource??null,ze.activeProgramRaw??null),mr.current?.requestRefresh("connected",{force:!0,reconcileServerSize:yt.current}),ze.mode!=="tmux"&&(ls(null),br(k,!1)),ae("[Terminal] Connected event received:",{frontendSessionId:k,backendSessionId:Ht.current,storeHasState:!!O,storeTerminalId:O?.terminalSessionId,hasHistoryInStore:!!O?.history?.length,historyLength:O?.history?.length??0}),O?.history&&O.history.length>0){ae(`[Terminal] Restoring ${O.history.length} history chunks to frontend session ${k}`);const Se=O.history.reduce((ut,Wt)=>ut+Wt.length,0),Le=Math.max(300,Math.min(2e3,Math.ceil(Se/200)));Vn.current=Date.now()+Le,O.history.forEach(ut=>{Ye(k,ut,{markActivity:!1})}),Mr.getState().setSessionHistory(k,[]),ae(`[Terminal] History restoration complete for ${k}`)}else ae(`[Terminal] No history to restore for ${k}`);const z=ze.replayChunks,Te=!!O?.history?.length||!!z?.length;if(Te?$.current=!0:rn(),z&&z.length>0){let Se=null;if(ze.replayOutOfWindow)mr.current?.prepareScreenReplacement(),ae(`[Terminal] Replay out-of-window, atomically replacing buffer (${z.length} chunks)`),Se=qt(k,$_(z));else{ae(`[Terminal] Replay incremental: ${z.length} chunks`);for(const Wt of z)Ye(k,Wt)}const Le=z.reduce((Wt,fr)=>Wt+fr.length,0),ut=Math.max(200,Math.min(1500,Math.ceil(Le/200)));Vn.current=Math.max(Vn.current,Date.now()+ut),_e.current=Se}Te&&_e.current===null&&(_e.current=Mr.getState().flushPendingBufferWrites(k),_e.current===null&&($.current=!1,rn()));break}case"reconnecting":{tt.current=!1,Qe(!1),Wn(j=>j??Date.now()),$t("Reconnecting..."),fn(!1);break}case"data":{ze.data&&(Dr.current?Ln.current.push(ze.data):(Ye(k,ze.data),Fn.current.consume(ze.data.length,performance.now(),yt.current&&!document.hidden&&El())&&Mr.getState().flushPendingBufferWrites(k)));break}case"tmux-layout":{ls(ze.layout??null),ze.layout&&br(k,ze.layout.inCopyMode);break}case"tmux-screen-sync":{const j=ze.generation??0;if(j<ki.current)break;ki.current=j,qe.current+=1,$.current=!0,Rt(!1),Ln.current=[],mr.current?.prepareScreenReplacement(),Pe.current=j,_e.current=qt(k,U_(ze.chunks??[])),_e.current===null&&(Pe.current=null,mr.current?.notifyScreenSynchronized(j),$.current=!1,rn()),typeof ze.cols=="number"&&typeof ze.rows=="number"&&mr.current?.notifyServerSize(ze.cols,ze.rows,"tmux-screen-sync");break}case"active-program":{Er(k,ze.activeProgram??null,ze.activeProgramSource??null,ze.activeProgramRaw??null);break}case"cwd":{ar(k,ze.cwd??null);break}case"agent-status":{Hn(k,{agentStatus:ze.agentStatus??null,agentIndicator:ze.agentIndicator??null,agentStatusDetail:ze.agentStatusDetail??null,agent:ze.agent??null,agentMessage:ze.agentMessage??null,agentNativeSessionId:ze.agentNativeSessionId??null,agentResumeRecovered:ze.agentResumeRecovered===!0,agentRich:ze.agentRich===!0,agentActivity:ze.agentActivity??0,agentCwd:ze.agentCwd??null,reviewed:ze.reviewed??null});break}case"git-status":{Mr.getState().setSessionGitStatus(k,ze.gitStatus??null);break}case"focus-mode":{ae("[Terminal] focus tracking mode",{backendSessionId:Ht.current,requested:ze.focusTrackingRequested===!0});break}case"resize-ack":{mr.current?.acknowledgeResize({seq:ze.seq,ok:ze.ok!==!1,cols:ze.cols,rows:ze.rows,screenSyncPending:ze.screenSyncPending,screenSyncGeneration:ze.screenSyncGeneration});break}case"pty-size":{typeof ze.cols=="number"&&typeof ze.rows=="number"&&mr.current?.notifyServerSize(ze.cols,ze.rows,ze.source);break}case"shell-title":{vs(k,ze.title??null);break}case"prompt-state":{hs(k,ze.state??"idle",ze.exitCode??null);break}case"tui-progress":{Mr.getState().setSessionTuiProgress(k,ze.tuiProgress??null);break}case"exit":{const j=typeof ze.exitCode=="number"?ze.exitCode:null,O=typeof ze.signal=="number"?ze.signal:null;Ye(k,`\r
126
+ [Process exited${j!==null?` with code ${j}`:""}${O!==null?` (signal ${O})`:""}]\r
127
+ `),Gt(k),ee(k,!1),$t("Terminal session ended"),Qe(!1),fn(!1),Wn(null),ls(null),br(k,!1),fs();break}}},onError:(ze,k)=>{if(Ss.current!==Re)return;const j=V;if(!j)return;We.current=!1,tt.current=!1,Qe(!1);const O=ze.name==="TerminalInputError"&&"code"in ze&&ze.code==="TERMINAL_INPUT_REJECTED",z=k&&ze.message==="Authentication required",Te=!O&&zx(ze),Se=O||z?ze.message:Te||k?"Reconnecting...":ze.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${k}):`,Se),Te&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:Ht.current,frontendSessionId:j,isActive:c,isMobile:ye,fatal:k,stack:new Error().stack}),$t(Se),fn(!!k),k&&(Wn(null),ee(j,!1),fs(),Te&&(ae("[onError] Session lost, auto-recreating"),$t("Reconnecting..."),fn(!1),Gt(j),Br(j),Ht.current=null,qs.current=!1,Rn()))}},{...lM,getDimensions:()=>P.current&&!document.hidden&&El()?mr.current?.getDimensions()??null:null});qn.current=()=>{_t.close(),Ss.current===Re&&(en.current=null)},en.current=se},[Ye,Br,Gt,ae,fs,rn,B,ea,Rn,vs,ee,Er,Hn,br,ar,hs,Be,V]);L.useEffect(()=>{const se=YR({isActive:c,isStreamReady:we,reconnectStartedAt:Ps,now:Date.now()});if(se===null)return;const Re=window.setTimeout(()=>{ae("[Terminal] visible reconnect watchdog expired",{backendSessionId:Ht.current,reconnectStartedAt:Ps}),fs(),ee(V,!1),$t("Reconnecting..."),fn(!1),Wn(Date.now()),Rn()},se);return()=>window.clearTimeout(Re)},[ae,fs,c,we,Ps,Rn,V,ee]);const qs=L.useRef(!1),Ni=L.useRef(!1),Ri=L.useRef(0);L.useEffect(()=>()=>{Ri.current+=1,qs.current=!1,fs()},[fs]);const Mi=L.useRef(ke),ro=L.useRef(rt);L.useEffect(()=>{const se=Mi.current,Re=ro.current;Mi.current=ke,ro.current=rt,jr.current===V&&(se===ke&&Re===rt||(qs.current=!1,fs(),di(et=>et+1)))},[ke,rt,fs,V]),L.useEffect(()=>{if(jr.current!==V&&(ae(`[useEffect] sessionId changed from ${jr.current} to ${V}, allowing reinitialization`),qs.current=!1,Ni.current=!1),qs.current&&jr.current===V){ae(`[useEffect] Already initialized for sessionId=${V}, skipping`);return}if(!Lt)return;const se=async k=>{if(ae(`[ensureSession] Starting for sessionId=${V}, runId=${k}`),!jr.current||jr.current!==V){ae(`[ensureSession] SessionId mismatch or stale run (current=${jr.current}, target=${V}), skipping`);return}if(k!==Ri.current){ae(`[ensureSession] Stale run detected (runId=${k}, currentRunId=${Ri.current}), skipping`);return}const j=Mr.getState(),O=j.getTerminalSession(V),z=O?.mode??ke;ae("[ensureSession] Current state from store:",{terminalSessionId:O?.terminalSessionId,mode:O?.mode,tmuxSessionName:O?.tmuxSessionName,isConnecting:O?.isConnecting});let Te=O?.terminalSessionId??null,Se=!Te;if(Te&&z!==ke?(ae(`[ensureSession] Store mode mismatch for ${Te}: current=${z} desired=${ke}, will create new session`),Se=!0,j.clearTerminalSession(V),Te=null):Te&&ke==="tmux"&&rt&&O?.tmuxSessionName!==rt&&(ae(`[ensureSession] Store tmux name mismatch for ${Te}: current=${O?.tmuxSessionName} desired=${rt}, will create new session`),Se=!0,j.clearTerminalSession(V),Te=null),Te&&Be.checkHealth&&!yt.current){ae(`[ensureSession] Checking health of existing session ${Te}`);try{const Le=await Be.checkHealth(Te);if(ae("[ensureSession] Health check result:",Le),!Le.healthy)ae(`[ensureSession] Session ${Te} is NOT healthy (healthy=${Le.healthy}), will create new session`),ae("[ensureSession] Health check details:",Le),Se=!0,Le.mode&&O?.terminalSessionId&&j.setTerminalSession(V,{sessionId:O.terminalSessionId,cols:80,rows:24,mode:Le.mode,tmuxSessionName:Le.tmuxSessionName??null}),j.clearTerminalSession(V),ae("[ensureSession] Cleared unhealthy session from store");else{ae(`[ensureSession] Session ${Te} is healthy, reusing it, cwd=${Le.cwd}, clients=${Le.clients}, lastActivity=${Date.now()-(Le.lastActivity||0)}ms ago`),Le.mode&&O?.terminalSessionId&&j.setTerminalSession(V,{sessionId:O.terminalSessionId,cols:80,rows:24,mode:Le.mode,tmuxSessionName:Le.tmuxSessionName??null}),ae(`[ensureSession] Setting terminalIdRef to ${Te} and starting stream`),Ht.current=Te,nn(Te),ae(`[ensureSession] Successfully reused healthy session ${Te}, returning early`);return}}catch(Le){ae(`[ensureSession] Failed to check health of session ${Te}:`,Le),ae("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(ae(`[ensureSession] Decision: shouldCreateNewSession=${Se}, terminalId=${Te}`),Se){ae(`[ensureSession] Creating new session, shouldCreateNewSession=${Se}, runId=${k}`),$t(null),fn(!1),j.setConnecting(V,!0);const ut=Mr.getState().getTerminalSession(V),fr=(ut?.mode??ke)===ke&&(ke!=="tmux"||!rt||ut?.tmuxSessionName===rt);if(ut?.terminalSessionId&&fr)ae(`[ensureSession] Race condition avoided: another instance already created session ${ut.terminalSessionId}`),j.setConnecting(V,!1),Te=ut.terminalSessionId,Se=!1;else try{const yr=await hi();if(ae(`[ensureSession] Opened managed backend session ${yr.sessionId}`),k!==Ri.current){ae(`[ensureSession] Stale run after session creation (runId=${k}, currentRunId=${Ri.current}), leaving ${yr.sessionId} for sibling`);return}j.setTerminalSession(V,yr),ae(`[ensureSession] Updated store with new session ${yr.sessionId}`),Te=yr.sessionId}catch(yr){if(k!==Ri.current){ae("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(yr instanceof Xu&&Gm(yr)){ae("[ensureSession] Confirmed missing persisted session:",{sessionId:V,error:yr.message}),j.clearTerminalSession(V),$t(Bh),fn(!0),j.setConnecting(V,!1);return}$t("Reconnecting..."),fn(!0),j.setConnecting(V,!1);return}}if(k!==Ri.current){ae(`[ensureSession] Stale run before starting stream (runId=${k}, currentRunId=${Ri.current}), skipping`);return}if(!Te){ae(`[ensureSession] No terminalId, terminalId=${Te}`);return}ae(`[ensureSession] Starting stream for session ${Te}`),Ht.current=Te,nn(Te),ae(`[ensureSession] ensureSession completed for sessionId=${V}, terminalId=${Te}`)};let Re=null,et=null;const _t=()=>{et=null,!(qs.current&&jr.current===V)&&(ae(`[useEffect] Running ensureSession for sessionId=${V}, hasInitialized=${qs.current}`),qs.current=!0,Ni.current=!0,Re=++Ri.current,se(Re))};if(!N&&!Ni.current){ae(`[useEffect] Holding background connection until the selected session is ready: ${V}`);return}const ze=Ni.current?0:Math.max(0,I);return ze>0?(ae(`[useEffect] Delaying initial connection for sessionId=${V} by ${ze}ms`),et=window.setTimeout(_t,ze)):_t(),()=>{et!==null&&window.clearTimeout(et),ae(`[useEffect] Cleanup for sessionId=${V}, runId=${Re??"pending"}`)}},[V,wa,nn,fs,Be,ae,ke,rt,On,I,N,Lt]);const gl=L.useCallback(async()=>{if(V&&!Ts){_i(!0),$t(null),fn(!1),Wn(null),fs();try{Be.forceKill&&await Be.forceKill({sessionId:V})}catch{}Yr(V),Br(V),mr.current?.clear(),await new Promise(se=>setTimeout(se,100));try{ee(V,!0);const se=await hi();hn(V,se),Ht.current=se.sessionId,nn(se.sessionId)}catch(se){$t(se instanceof Xu&&Gm(se)?Bh:"Reconnecting..."),fn(!0),ee(V,!1)}finally{_i(!1)}}},[V,Ts,fs,Be,Yr,Br,ee,hn,nn,hi]),ko=L.useCallback((se,Re,et,_t)=>{if(!(Ht.current!==Re||pn.current!==et)){if(se instanceof Xu&&zx(se)){ae("[Terminal] operation backend missing, recovering",{terminalId:Re,sessionId:V}),$t("Reconnecting..."),fn(!1),fs(),Gt(V),Ht.current=null,ee(V,!0),Rn();return}$t(se instanceof Error?se.message:_t)}},[Gt,ae,fs,Rn,V,ee]),Tc=L.useCallback((se,Re)=>{const et=Re?.ownedPaste?b7(Re.ownedPaste,V,se):!1;if(Re?.ownedPaste&&!et||le.current&&!(et&&ge.current)||(G.current||a1())&&!et)return Promise.resolve(!1);const _t=()=>!!Re?.ownedPaste&&T7(Re.ownedPaste,V)&&(yt.current||Re?.targeted===!0)&&(!le.current||ge.current)&&tt.current&&!cr.current&&!document.hidden&&navigator.onLine!==!1&&El();if(et&&!_t())return Promise.resolve(!1);if(!yt.current&&!Re?.targeted||!se)return;const ze=wR(se),k=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(se);if(Date.now()<Vn.current)return Promise.resolve(!1);let j=se,O=Re?.consumeModifier??!1;if(!Re?.skipModifierTransform&&!ze&&pe&&se.length>0){const ut=se[0];if(ut.length===1&&/[a-zA-Z]/.test(ut)){const Wt=ut.toUpperCase();pe==="ctrl"?(j=String.fromCharCode(Wt.charCodeAt(0)&31),O=!0):pe==="alt"&&(j=`\x1B${se}`,O=!0)}O||(pe==="alt"&&(j=`\x1B${se}`),O=!0)}const z=Ht.current;if(!z)return;const Te=pn.current,Se=async()=>{if(Ht.current!==z||pn.current!==Te)return!1;try{if((!ze||k)&&Fn.current.input(performance.now()),Pr&&k&&(Zn.current=!0),Pr&&!ze&&Zn.current&&Be.tmuxAction){if(Zn.current=!1,et&&!_t())return!1;if(Be.sendInputExitingCopyMode?.(z,j))return xs(V),!0;try{await Be.tmuxAction(z,{action:"copy-mode",enabled:!1})}catch{}if(Ht.current!==z||pn.current!==Te)return!1;if(AR(j))return!0}return et&&(!_t()||Ht.current!==z||pn.current!==Te)||(await Be.sendInput(z,j),et&&(!_t()||Ht.current!==z||pn.current!==Te))?!1:(xs(V),!0)}catch(ut){return ko(ut,z,Te,"Failed to send input"),!1}},Le=cs.current.then(Se);return cs.current=Le.then(()=>{},()=>{}),O&&(at||Ge(null),ei()),Le},[pe,xs,ei,ko,Pr,at,V,Be]);L.useEffect(()=>{const se=Re=>{const et=Re,_t=et.detail?.sessionId;if(_t?_t!==V:!yt.current)return;const ze=et.detail?.text;if(!ze)return;const k=et.detail?.nonce;if(cr.current||!mr.current){k&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:k,ok:!1}}));return}const j=C7(et.detail,V),O=et.detail?.ownedPaste&&!j?Promise.resolve(!1):mr.current.sendSequence(ze,{paste:et.detail?.paste,submitAfterPaste:et.detail?.submitAfterPaste,targeted:!!_t,ownedPaste:j??void 0});k&&Promise.resolve(O).then(z=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:k,ok:z===!0}}))},()=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:k,ok:!1}}))}),J9($e.current,et.detail?.focus!==!1)&&ei()};return window.addEventListener("termdock-insert-reference",se),()=>window.removeEventListener("termdock-insert-reference",se)},[ei,V]);const Vo=L.useCallback((se,Re,et)=>{const _t=Ht.current;if(!_t){X("xterm resize push skipped: no terminalId",{cols:se,rows:Re});return}X("xterm resize push",{cols:se,rows:Re}),Be.resize({sessionId:_t,cols:se,rows:Re,seq:et}).catch(ze=>{mr.current?.acknowledgeResize({seq:et,ok:!1}),ze&&/session not found/i.test(String(ze.message||ze))&&console.warn("[Terminal] resize 404 session not found",{sessionId:_t,cols:se,rows:Re,stack:new Error().stack})})},[Be,X]),Mn=L.useCallback(async se=>{const Re=Ht.current;if(!Re||!Be.tmuxAction)return;const et=pn.current;try{const _t=await Be.tmuxAction(Re,se);if(Ht.current!==Re||pn.current!==et)return;_t.layout&&(ls(_t.layout),se.action==="switch-session"&&(hn(V,{sessionId:Re,cols:80,rows:24,mode:"tmux",tmuxSessionName:_t.layout.sessionName}),v7(V,{tmuxSessionName:_t.layout.sessionName}).catch(ze=>{console.warn("[Terminal] failed to update inventory after tmux switch",ze)})))}catch(_t){ko(_t,Re,et,"Failed to execute tmux action")}},[ko,V,hn,Be]);L.useEffect(()=>{if(!Gn||!Yt)return;const Re=Gn.windows.find(et=>et.id===Gn.activeWindowId)?.panes.find(et=>et.id===Gn.activePaneId);Re&&mr.current?.requestRefresh("tmux-layout",{skipResizePush:!0,skipScrollToBottom:!0,dedupeKey:`${Yt}:${Gn.sessionId}:${Re.id}:${Re.width}x${Re.height}`})},[Gn,Yt]);const Aa=L.useCallback((se,Re=5)=>{const et=Math.max(1,Math.min(Math.floor(Re)||1,40));Zn.current=!0;const _t=ts.current;if(_t&&_t.direction===se){_t.lines+=et;return}_t&&Mn({action:"scroll",direction:_t.direction,lines:_t.lines}).finally(()=>{ei()}),ts.current={direction:se,lines:et},Cn.current&&clearTimeout(Cn.current),Cn.current=setTimeout(()=>{const ze=ts.current;ze&&(ts.current=null,Mn({action:"scroll",direction:ze.direction,lines:ze.lines}).finally(()=>{ei()}))},0)},[ei,Mn]),xl=L.useCallback(se=>{const Re=Date.now(),et=Cs.current,_t=et!==null&&et.modifier===se&&Re-et.timestamp<=sM;if(Cs.current={modifier:se,timestamp:Re},at===se){Mt(null),Ge(null);return}if(_t){Mt(se),Ge(se);return}at!==null&&at!==se&&Mt(null),Ge(ze=>ze===se?null:se)},[at]),ta=L.useCallback(se=>{if(It(se&&yt.current),X("input focus changed",{focused:se,isActive:yt.current,isMobile:$e.current}),!$e.current||!yt.current){xe(!1);return}xe(Re=>Re===se?Re:se)},[X]),Oa=L.useCallback(se=>{if(Dr.current=se,ea(se,"viewport-watermark"),!se&&Ln.current.length>0){const Re=V;if(Re){const et=Ln.current;Ln.current=[];for(const _t of et)Ye(Re,_t)}}},[Ye,ea,V]),jn=L.useCallback(se=>{yt.current&&mr.current?.ensureSizeMatches(se)},[]),ra=L.useRef(null);L.useEffect(()=>{if(!c)return;const se=ra.current;if(!se)return;const Re=()=>jn("pointerdown"),et=()=>jn("keydown"),_t=()=>jn("touchstart"),ze=()=>jn("wheel");return se.addEventListener("pointerdown",Re),se.addEventListener("keydown",et),se.addEventListener("touchstart",_t,{passive:!0}),se.addEventListener("wheel",ze,{passive:!0}),()=>{se.removeEventListener("pointerdown",Re),se.removeEventListener("keydown",et),se.removeEventListener("touchstart",_t),se.removeEventListener("wheel",ze)}},[c,jn]);const ji=L.useCallback(se=>{mr.current=se},[]),Io=L.useCallback(se=>{Lr(se),U?.(V,se)},[U,V]),Ul=L.useCallback(se=>{const Re=ER(se);if(!Re)return;const et=pe!==null;mr.current?.sendSequence(Re,{consumeModifier:et})},[pe]),zl=L.useCallback(se=>{const Re=SR(se);if(Re.length===0)return;const et=pe!==null;mr.current?.sendSequence(Fx(Re[0]),{consumeModifier:et});for(let _t=1;_t<Re.length;_t+=1){const ze=Re[_t];window.setTimeout(()=>{mr.current?.sendSequence(Fx(ze))},CR*_t)}},[pe]),bl=L.useCallback(()=>{mr.current?.pasteClipboardText()},[]),Di=L.useCallback(se=>{St.current!==null&&(window.clearTimeout(St.current),St.current=null),yn(se),(se==="inserted"||se==="failed")&&(St.current=window.setTimeout(()=>{St.current=null,yn("idle")},1400))},[]),ti=L.useCallback(()=>{Di("idle"),Jr(0),tn.current?.click()},[Di]),na=L.useCallback(()=>{_r(!0)},[]),sa=L.useCallback(se=>{const Re=se.currentTarget.files?.[0];if(se.currentTarget.value="",!Re)return;const et=V;An(null),$r(null),fe(null),Jr(0),Di("uploading");const _t=wt&&Re.type.startsWith("video/")?{maxHeight:Tn,videoBitrate:Nr,onProgress:Jr}:null,ze=cn&&aM(Re)?{maxDimension:Ie,quality:ht}:null;let k=_t?"视频压缩":ze?"图片压缩":"文件上传";(async()=>{const j=_t?await(await Pl(async()=>{const{compressVideoLocally:O}=await import("./videoCompression-BFhMaMl7.js");return{compressVideoLocally:O}},__vite__mapDeps([17,1,2,3,4,5]))).compressVideoLocally(Re,_t):ze?await(await Pl(async()=>{const{compressImageLocally:O}=await import("./imageCompression-DaUBNTq-.js");return{compressImageLocally:O}},[])).compressImageLocally(Re,ze):Re;k="文件上传",await tM(j,(O,z)=>X5(O,z,void 0,Jr),O=>(k="插入终端",gm(Cg(O,null),et,()=>yt.current&&!cr.current&&jr.current===et&&Mr.getState().activeSessionId===et))),(_t||ze)&&fe({file:j,kind:_t?"video":"image",originalSize:Re.size,uploadedSize:j.size,originalRetained:j===Re})})().then(()=>Di("inserted"),j=>{j instanceof df&&An({path:j.uploaded.path,sessionId:et});const O=j instanceof df?j.uploaded.path:qx(j);$r({stage:k,detail:O}),_r(!0),Di("failed"),Da("warn","MOBILE_MEDIA_UPLOAD failed",{stage:k,detail:O})})},[Nr,wt,Tn,cn,Ie,ht,V,Di]),ia=L.useCallback(async()=>{const se=an;if(!se||se.sessionId!==V)return;_r(!1),await new Promise(et=>window.requestAnimationFrame(()=>et())),Di("uploading"),await gm(Cg(se.path,null),se.sessionId,()=>yt.current&&!cr.current&&jr.current===se.sessionId&&Mr.getState().activeSessionId===se.sessionId)?(An(null),$r(null),Di("inserted")):(_r(!0),Di("failed"))},[an,V,Di]);L.useEffect(()=>{if(!Je||!wt)return;let se=!0;return es(null),Gr({phase:"checking-cache"}),Pl(async()=>{const{prepareLocalVideoCompression:Re}=await import("./videoCompression-BFhMaMl7.js");return{prepareLocalVideoCompression:Re}},__vite__mapDeps([17,1,2,3,4,5])).then(({prepareLocalVideoCompression:Re})=>{if(se)return Re(et=>{se&&Gr(et)})}).catch(Re=>{se&&es(qx(Re))}),()=>{se=!1}},[Je,wt]);const ri=ks||or!==null;cr.current=ri;const Zo=L.useRef(bs);ri||(Zo.current=bs);const vl=ri?Zo.current:bs,Qi=L.useMemo(()=>LR(vl,Ur),[vl,Ur]),Fa=L.useMemo(()=>Ux(Ur,bt),[bt,Ur]),gn=!ye&&bt!=="auto"&&Fa.id!=="default"&&Fa.showOnDesktop!==!0?"auto":bt,Is=gn==="auto"?Qi:gn,Fs=L.useMemo(()=>Ux(Ur,Is),[Is,Ur]),Ta=L.useMemo(()=>Fs.actions.filter(se=>se.sequence.trim().length>0).map((se,Re)=>({...se,label:Wm(se,Re)})),[Fs.actions]),aa=L.useMemo(()=>j6(bs),[bs]),Ca=Fs.label,$s=L.useMemo(()=>gn!=="auto"?`Manual preset: ${Fs.label}`:aa?`Auto preset · ${Fs.label} (${aa})`:"Auto preset",[aa,gn,Fs.label]),$a=L.useCallback(se=>{Ce(se)},[]),Eo=L.useCallback(()=>{Ve(se=>se==="copy"?"arrows":"copy"),Jt("idle")},[]),oa=L.useCallback(()=>{typeof window>"u"||(mn.current!==null&&window.clearTimeout(mn.current),mn.current=window.setTimeout(()=>{mn.current=null,Jt("idle")},1200))},[]),_s=L.useCallback(se=>{mn.current!==null&&typeof window<"u"&&(window.clearTimeout(mn.current),mn.current=null),Jt(se?"copied":"failed"),oa()},[oa]),Gi=L.useCallback(se=>{J(se)},[]),No=L.useMemo(()=>ye?_R(Ur):kR(Ur),[ye,Ur]),ss=L.useMemo(()=>y7(a),[a]);L.useEffect(()=>{if(!Pr||!we||!Lt||!Yt)return;const se=z_(ss);se&&Be.sendInput(Yt,se).catch(Re=>{console.warn("[Terminal] Failed to synchronize tmux default colors:",Re)})},[Pr,we,Lt,Yt,Be,ss]);const qi=L.useMemo(()=>`terminal::${V}`,[V]),Ro=L.useCallback(()=>`${Ht.current??"pending"}:${pn.current}`,[]);L.useEffect(()=>{Me?.({isConnecting:ks,isRestarting:Ts,hasError:!!or,sessionId:Yt})},[ks,Ts,or,Yt,Me]);const fi=!Yt||ks||Ts,no=L.useCallback((se,Re)=>{if(fi)return;const et=Math.max(1,Math.min(Math.floor(Re)||1,40));Aa(se,et)},[Aa,fi]);L.useEffect(()=>{if(!c||!ye)return;mr.current?.requestRefresh("resize",{skipScrollToBottom:!Dt,force:!0})},[c,ye,Dt,pr,V]),L.useEffect(()=>{if(!c||!ye)return;const se=Re=>{const et=Re.detail;mr.current?.requestRefresh("resize",{skipScrollToBottom:et?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",se),()=>{document.removeEventListener("termdock:viewport-keyboard-change",se)}},[c,ye,V]);const Yo=!H&&(ye||Fs.id==="default"||Fs.showOnDesktop===!0),so=c,{rootStyle:Mo,contentStyle:Sa}=vb(ye&&!ne),ni=s.jsx(NR,{visible:Yo,interactive:so,presentation:ye?"mobile":"desktop-actions",activeModifier:pe,lockedModifier:at,disabled:fi,defaultShowExtended:er,presetLabel:Ca,presetModeLabel:$s,presetMode:gn,presetOptions:No,includeAlt:Fs.includeAlt,presetRowLayout:Fs.rowLayout,extraActions:Ta,onKeyPress:Ul,onTextPress:zl,onPastePress:ye?bl:void 0,onFilePress:ye?ti:void 0,onFileLongPress:ye?na:void 0,fileUploadState:Wr,fileUploadProgress:Ar,longPressMode:lr,copyFeedback:zt,onLongPressModeToggle:Eo,onModifierToggle:xl,onPresetSelect:$a,onExpandedChange:Gi}),ws=typeof window<"u"&&(navigator.maxTouchPoints>0||"ontouchstart"in window);return s.jsxs("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",style:Mo,"data-owned-terminal-startup":window.__TD_NATIVE_GATE_STATE?JSON.stringify({active:c,viewportReady:Lt,streamReady:we,contentReady:it,sizeReady:Xt}):void 0,children:[s.jsx("input",{ref:tn,type:"file",className:"hidden",onChange:sa}),Je&&Wi.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>_r(!1),"aria-label":be("common.close")}),s.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"mobile-video-compression-title",className:"fixed bottom-[max(0.75rem,env(safe-area-inset-bottom,0px))] left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] z-modal-panel max-h-[calc(100dvh-1.5rem)] overflow-y-auto rounded-2xl border border-border/15 bg-surface p-4 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:left-1/2 sm:right-auto sm:w-[min(28rem,calc(100vw-2rem))] sm:-translate-x-1/2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"mobile-video-compression-title",className:"text-sm font-semibold text-foreground",children:"本地媒体压缩"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"按文件类型选择压缩方式,处理完成后才上传。"})]}),s.jsx("button",{type:"button",className:"min-h-10 rounded-lg bg-surface-2 px-3 text-xs",onClick:()=>_r(!1),children:be("common.close")})]}),Fr&&s.jsxs("div",{role:"alert",className:"mt-3 rounded-lg bg-destructive/10 p-3 text-xs text-destructive",children:[s.jsxs("p",{children:[Fr.stage,"失败。",Fr.stage.endsWith("压缩")?"原文件未上传。":Fr.stage==="插入终端"?"文件已上传,路径见详情。":""]}),s.jsxs("details",{className:"mt-2",children:[s.jsx("summary",{className:"cursor-pointer",children:"错误详情"}),s.jsx("p",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:Fr.detail})]}),an&&s.jsx("button",{type:"button",onClick:()=>{ia()},disabled:Wr==="uploading"||an.sessionId!==V,className:"mt-2 rounded-lg bg-surface-2 px-3 py-2 text-foreground disabled:opacity-50",children:be("common.retry")})]}),Tr&&s.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:"本机未能保存设置,重新打开后可能恢复默认值。"}),s.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[s.jsx("span",{children:"显示压缩结果提示"}),s.jsx("input",{type:"checkbox",checked:ct.showResultToast,onChange:se=>Ue({showResultToast:se.target.checked}),className:"h-4 w-4 accent-primary"})]}),s.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[s.jsx("span",{children:"压缩图片后上传"}),s.jsx("input",{type:"checkbox",checked:cn,onChange:se=>Ue({imageEnabled:se.target.checked}),className:"h-4 w-4 accent-primary"})]}),cn&&s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["图片最长边",s.jsx("select",{value:Ie,onChange:se=>Ue({imageMaxDimension:Number(se.target.value)}),className:"mt-1 block min-h-10 w-full rounded-lg bg-surface-2 px-3 text-sm text-foreground",children:O6.map(se=>s.jsxs("option",{value:se,children:[se," px",se===640?" · 最省流量":se===2048?" · 推荐":se===4096?" · 保留更多细节":""]},se))})]}),s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["图片画质:",Math.round(ht*100),"%",s.jsx("input",{type:"range",min:nd.min,max:nd.max,step:nd.step,value:ht,onChange:se=>Ue({imageQuality:Number(se.target.value)}),className:"mt-2 h-1 w-full accent-primary"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"支持 JPEG、PNG、HEIC 照片;GIF、SVG 等保持原文件。压缩后未变小也会保留原图。"})]}),s.jsx("div",{className:"mt-4 border-t border-border/15 pt-1"}),s.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[s.jsx("span",{children:"压缩视频后上传"}),s.jsx("input",{type:"checkbox",checked:wt,onChange:se=>Ue({videoEnabled:se.target.checked}),className:"h-4 w-4 accent-primary"})]}),wt&&s.jsxs("div",{className:"mt-4 space-y-4",children:[s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["视频最长边(像素)",s.jsx("select",{value:Tn,onChange:se=>Ue({videoMaxHeight:Number(se.target.value)}),className:"mt-1 block min-h-10 w-full rounded-lg bg-surface-2 px-3 text-sm text-foreground",children:F6.map(se=>s.jsxs("option",{value:se,children:[se," px",se===240?" · 最省流量":se===720?" · 推荐":se>=1440?" · 手机处理较慢":""]},se))})]}),s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["目标视频码率:",Nr/1e6," Mbps",s.jsx("input",{type:"range",min:sd.min,max:sd.max,step:sd.step,value:Nr,onChange:se=>Ue({videoBitrate:Number(se.target.value)}),className:"mt-2 h-1 w-full accent-primary"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"保持比例,不放大原视频。尺寸越小通常处理越快;码率越低体积通常越小,过高可能比原片更大。"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",role:"status","aria-live":"polite",children:Ir?"本地转码器准备失败,请关闭开关后重试。":oM(Zr)}),Zr?.saved===!1&&s.jsx("p",{className:"text-[11px] text-destructive",children:"本机未能保存转码器,重新打开后可能需要重新下载。"}),Ir&&s.jsx("p",{className:"text-[11px] text-destructive",children:Ir})]})]})]}),document.body),qr&&s.jsx(RR,{isMobile:ye,isInputFocused:pt,isIOS:nt,isConnecting:ks,connectionError:or,terminalSessionId:Yt}),s.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:ss.background,...Sa},children:[s.jsx("div",{ref:ra,className:"h-full w-full box-border",children:s.jsx(w7,{fallback:s.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:s.jsxs("div",{className:"flex flex-col items-center gap-3 text-center rounded-2xl bg-surface-2 px-6 py-5 shadow-sm",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/15 flex items-center justify-center",children:s.jsx("svg",{className:"w-5 h-5 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),s.jsx("span",{className:"text-sm text-muted-foreground",children:be("terminal.componentFailed")})]})}),children:s.jsx(pR,{ref:ji,sessionKey:qi,sessionId:V,getPasteOwnerKey:Ro,backendSessionId:Yt,isLayoutVisible:x,chunks:kt,onInput:Tc,onResize:Vo,onFlowControl:Oa,onTmuxScroll:Pr?no:void 0,tmuxScrollSensitivity:.38,onDoubleTap:ye?()=>{mr.current?.sendSequence(" ")}:void 0,onInputFocusChange:ta,onMobileLongPressCopyResult:_s,onReadyChange:Io,onSizeSynchronizedChange:Zt,onWritesSettled:Os,onWriteProgress:gr,onCursorPositionChange:Vt,onDirectoryLinkActivate:q,terminalSettings:ve,theme:ss,enableTouchScroll:ye,mobileLongPressMode:lr,autoFocus:c&&!lt&&!ye&&!ws,inputActive:c&&!lt,cursorVisible:!lt&&Qr,suppressSmoothScroll:!it||!Xt,className:lt||!Qr?"terminal-focus-suspended":void 0},qi)})}),s.jsx(nM,{result:gt,onDismiss:Vr}),s.jsx(jR,{connectionError:or,isFatalError:Et,isRestarting:Ts,isConnecting:ks,onHardRestart:gl})]}),Oe?H?null:Wi.createPortal(ni,Oe):ni]})};function uM({session:e,active:t,onActivate:r,onToggleRightSidebar:n}){const{t:a}=Xr(),l=Mr(c=>{const h=c.sessions.get(e.id);return cl(e,h?.activeProgram??null,h?.cwd??null,void 0,h?.shellTitle??null,h?.promptState??null).primary});return s.jsxs("div",{"data-pane-titlebar":"true",className:"swiper-no-swiping flex h-6 min-h-6 shrink-0 items-center border-b border-border app-chrome-bg text-foreground",children:[s.jsxs("button",{type:"button","data-split-pane-title":e.id,draggable:!1,onDragStart:c=>c.preventDefault(),"aria-pressed":t,title:`${l} · 拖动标题移动,边缘拆分,中央交换`,onClick:r,className:"split-pane-drag-handle flex h-full min-w-0 cursor-grab active:cursor-grabbing flex-1 items-center gap-1.5 overflow-hidden px-2 text-left text-[12px] font-medium leading-none hover:opacity-80 focus-visible:outline focus-visible:outline-1 focus-visible:outline-current focus-visible:-outline-offset-1",children:[s.jsx(Go,{size:11,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:l}),s.jsx(yb,{size:12,"aria-hidden":"true",className:"shrink-0 opacity-60"})]}),n&&s.jsx("button",{type:"button",onClick:n,"aria-label":a("tab.explorerTitle"),title:a("tab.explorerTitle"),className:"inline-flex h-full w-7 shrink-0 items-center justify-center hover:opacity-80 focus-visible:outline focus-visible:outline-1 focus-visible:outline-current focus-visible:-outline-offset-1",children:s.jsx(J5,{size:14})})]})}const dM="termdock:startup:";function R0(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${dM}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function Vx(e,t){e||Wi.flushSync(t)}const qm="horizontal";function B0(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function Ph(e,t){if(!Array.isArray(e)||e.length!==t)return B0(t);const r=e.map(Number);if(r.some(a=>!Number.isFinite(a)||a<=0))return B0(t);const n=r.reduce((a,l)=>a+l,0);return n<=0?B0(t):r.map(a=>a/n)}function hM(e){const t=Math.max(1,Math.ceil(Math.sqrt(Math.max(1,e))));return{columns:t,rows:Math.max(1,Math.ceil(Math.max(1,e)/t))}}function fM(e){return e==="horizontal"||e==="vertical"||e==="grid"}function pM(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,n=[];for(const a of e){if(!a||typeof a!="object")continue;const l=a;if(typeof l.id!="string"||!l.id||r.has(l.id))continue;const c=Array.isArray(l.sessionIds)?l.sessionIds.filter(m=>typeof m=="string"&&!!m&&!t.has(m)):[],h=[...new Set(c)];if(h.length<2)continue;const p=hM(h.length);h.forEach(m=>t.add(m)),r.add(l.id),n.push({id:l.id,...typeof l.name=="string"&&l.name.trim()?{name:l.name.trim().slice(0,80)}:{},sessionIds:h,layout:fM(l.layout)?l.layout:qm,ratios:Ph(l.ratios,h.length),...l.gridColumnRatios!==void 0?{gridColumnRatios:Ph(l.gridColumnRatios,p.columns)}:{},...l.gridRowRatios!==void 0?{gridRowRatios:Ph(l.gridRowRatios,p.rows)}:{}})}return n}function mM(e,t){const r=new Set(t);return e.flatMap(n=>{const a=n.sessionIds.filter(l=>r.has(l));return a.length<2?[]:[{...n,sessionIds:a,ratios:a.length===n.sessionIds.length?Ph(n.ratios,a.length):B0(a.length)}]})}function vd(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function Kp(e,t,r){if(!t||!r||t===r)return e;const n=vd(e,t),a=vd(e,r);if(n&&n.id===a?.id)return e;const l=[...n?.sessionIds??[t],...a?.sessionIds??[r]],c=[...new Set(l)],h={id:n?.id??`split:${t}`,...n?.name?{name:n.name}:{},sessionIds:c,layout:c.length>2&&(!n||n.layout===qm)?"grid":n?.layout??qm,ratios:B0(c.length)},p=new Set([n?.id,a?.id].filter(Boolean)),m=e.filter(b=>!p.has(b.id)),x=n?Math.max(0,e.findIndex(b=>b.id===n.id)):m.length;return m.splice(Math.min(x,m.length),0,h),m}function gM(e,t){const r=vd(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(a=>a.id!==r.id);const n=r.sessionIds.filter(a=>a!==t);return e.map(a=>a.id===r.id?{...a,sessionIds:n,ratios:B0(n.length)}:a)}function xM(e,t){const r=vd(e,t);return r?e.filter(n=>n.id!==r.id):e}function bM(e,t,r){return e.map(n=>{if(n.id!==t)return n;const a=[...new Set(r)],l=new Set(n.sessionIds);return a.length===n.sessionIds.length&&a.every(h=>l.has(h))?{...n,sessionIds:a}:n})}function vM(e,t,r){const n=r.trim().slice(0,80);return e.map(a=>a.id===t?{...a,...n?{name:n}:{name:void 0}}:a)}const Vm=320,U6=1,yM=Vm+120,Zm="termdock:split-workspaces:v2",z6="termdock:split-workspace:v1",wM=.1,AM=.9;function Xp(){if(typeof window>"u")return{mobile:!1,landscape:!1};const e=K5();return{mobile:e,landscape:e&&window.innerWidth>window.innerHeight}}function TM(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Zm);if(e)return pM(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(z6)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(AM,Math.max(wM,typeof t.ratio=="number"?t.ratio:.5));return[{id:`split:${t.primaryId}`,sessionIds:[t.primaryId,t.secondaryId],layout:t.direction==="vertical"?"vertical":"horizontal",ratios:[r,1-r]}]}}catch{}return[]}function CM(e,t){const r=new Map(e.map(c=>[c.id,c])),n=new Map;t.forEach(c=>c.sessionIds.forEach(h=>n.set(h,c)));const a=new Set,l=[];for(const c of e){const h=n.get(c.id);if(!h){l.push({key:c.id,sessions:[c]});continue}if(a.has(h.id))continue;a.add(h.id);const p=h.sessionIds.flatMap(m=>{const x=r.get(m);return x?[x]:[]});p.length>=2&&l.push({key:h.id,sessions:p,workspace:h})}return l}function Zx(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function ph(e,t){const r=hf(e,t);if(r===null)return;const n=e.wrapperEl;Zx(e),n&&(n.style.transitionDuration="0ms");try{const a=e;a.setTransition?.(0),a.setTranslate?.(r),Zx(e),n&&(n.style.transitionDuration="0ms",n.style.transform=`translate3d(${r}px, 0px, 0px)`)}catch{n&&(n.style.transitionDuration="0ms",n.style.transform=`translate3d(${r}px, 0px, 0px)`)}}function Ym(e){try{const t=typeof e.getTranslate=="function"?e.getTranslate():e.translate;return typeof t=="number"&&Number.isFinite(t)?t:null}catch{return typeof e.translate=="number"&&Number.isFinite(e.translate)?e.translate:null}}function hf(e,t){const r=e.snapGrid,n=Array.isArray(r)?r[t]:void 0;return typeof n!="number"||!Number.isFinite(n)?null:-n}function SM(e,t){const r=Ym(e),n=hf(e,t);return r!==null&&n!==null&&Math.abs(r-n)<=U6}function LM(e){const t=[],r=new Map,n=new Map,a=new Map;for(const l of e){const c=r.get(l.id)??[];if(c.push(l.id),r.set(l.id,c),l.sessionId){const h=n.get(l.sessionId)??[];h.push(l.id),n.set(l.sessionId,h)}if(l.mode==="tmux"&&l.tmuxSessionName){const h=a.get(l.tmuxSessionName)??[];h.push(l.id),a.set(l.tmuxSessionName,h)}}for(const[l,c]of r)c.length>1&&t.push({kind:"frontend",key:l,sessionIds:c});for(const[l,c]of n)c.length>1&&t.push({kind:"backend",key:l,sessionIds:c});for(const[l,c]of a)c.length>1&&t.push({kind:"tmux",key:l,sessionIds:c});return t}function H6(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function W6(e){return{id:e.sessionId,name:e.name,customName:e.customName===!0,sessionId:e.backendSessionId,mode:e.mode==="tmux"||e.mode==="shell"?e.mode:"shell",tmuxSessionName:e.tmuxSessionName??null}}function _M(e,t){const r=H6(e),n=r.findIndex(a=>a.id===t.id);if(n>=0){const a=[...r];return a[n]=t,a}return[...r,t]}function Yx(e,t){const r=new Map(e.map(n=>[n.id,n]));return t.map(n=>{const a=r.get(n.sessionId);return{...W6(n),history:a?.history}})}function Kx(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function Xx(e){if(!e||typeof e!="object")return"unknown";const t=e;if(typeof t.pointerType=="string"&&t.pointerType)return t.pointerType;if(typeof t.type=="string"){if(t.type.startsWith("touch"))return"touch";if(t.type.startsWith("mouse"))return"mouse";if(t.type.startsWith("pointer"))return"pointer"}return"unknown"}function Jx(e){const t=new Map;for(const[r,n]of e)t.set(r,n.cwd??null);return t}function kM(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t)if(e.get(r)!==n)return!1;return!0}function IM(e){const t="".toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,12);if(t)return`wt-${t}`;const r=Date.now().toString(36),n=Math.random().toString(36).slice(2,8);return`wt-${r}${n}`}const EM=({terminalSettings:e=U1(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:n,terminalFocusAvailable:a=!0,terminalReferenceAvailable:l=a,defaultSessionMode:c="shell",defaultTmuxSessionName:h="",connectionPrioritySessionId:p=null,connectionPriorityReady:m=!0,desktopRightSidebarEnabled:x=!1,onToggleRightSidebar:b,desktopFloatingTitle:y=!1,desktopLeftSidebarPinned:w=!1,desktopPinnedLeftSidebarWidth:C=0,desktopViewportWidth:S=0,onStatusChange:I,onSessionDataUpdate:N,onInitialViewportReady:Q,onInitialRecoveryRequired:W})=>{const{t:B}=Xr(),U=y&&!w&&Nl()?.platform==="darwin"&&document.documentElement.dataset.termdockPreview==="true",K=v.useMemo(()=>ad("session"),[]),re=v.useMemo(()=>ad("terminal"),[]),[H,Oe]=v.useState([]),[ne,ce]=v.useState(null),Ne=v.useRef(0),Me=v.useRef(0),[be,V]=v.useState(!1);jl(be?{tone:"recovering",message:"正在恢复会话连接…"}:null),v.useEffect(()=>()=>{Me.current++},[]);const Ke=Hs(P=>P.activePaneId);v.useEffect(()=>{Hs.getState().setActivePane(ne)},[ne]);const[he,Be]=v.useState(null),[ae,X]=v.useState(!0),[He,je]=v.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[ve,Fe]=v.useState(()=>new Set),[lt,ye]=v.useState(()=>({token:0,completed:new Set})),[de,nt]=v.useState(0),[Xe,pt]=v.useState(()=>new Set),[xe,mt]=v.useState(()=>new Set),[It,At]=v.useState(()=>new Map),Nt=v.useCallback((P,G)=>{At(le=>{if(G===null?!le.has(P):le.get(P)===G)return le;const ge=new Map(le);return G===null?ge.delete(P):ge.set(P,G),ge})},[]),oe=v.useRef(new Map),[F,we]=v.useState(()=>new Set),Qe=v.useRef(!1),tt=v.useRef(null),it=v.useRef({}),[Rt,Xt]=v.useState(null),[Zt,Lt]=v.useState(()=>TM()),[Lr,Qr]=v.useState(!1),Pt=v.useCallback(P=>{Ne.current+=1,Qr(P)},[]),Dt=v.useRef(null),pr=v.useRef(Lr);pr.current=Lr,xc(Dt,Lr&&!!ne,()=>Pt(!1));const[pe,Ge]=v.useState(null),[at,Mt]=v.useState(null),er=v.useRef(new Set),[J,bt]=v.useState(null),[Ce,lr]=v.useState(null),[Ve,zt]=v.useState(!1),[Jt,Wr]=v.useState(()=>Xp().mobile),[yn,Ar]=v.useState(()=>Xp().landscape),[Jr,Fr]=v.useState(null),[$r,an]=v.useState(null),An=v.useRef(a),gt=v.useRef(!1),fe=v.useRef(!1),Vr=v.useRef(null),ct=v.useRef(null),Ue=v.useRef(Jt),Tr=v.useRef(null),wt=v.useCallback(P=>{P!==Tr.current&&(Ne.current+=1),Tr.current=P,ce(P)},[]);v.useEffect(()=>Sr.subscribe((P,G)=>{(P.rightOpen!==G.rightOpen||P.rightTab!==G.rightTab)&&(Ne.current+=1)}),[]);const Tn=v.useRef(0),Nr=v.useRef([]),cn=v.useRef(0),Ie=v.useRef(null),ht=v.useRef(!1),Je=v.useRef(!0),_r=v.useRef(null),Zr=v.useRef(""),Gr=v.useRef(0);v.useEffect(()=>{if(typeof window>"u")return;const P=()=>{const G=Xp();Ue.current=G.mobile,Wr(G.mobile),Ar(G.landscape)};return P(),window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const{sessions:Ir,inventory:es,activeSessionId:Ft,isLoading:hn,openSession:ee,setActiveSession:Ye,removeSession:qt,renameSession:Gt,resetSessionCustomName:Yr,reorderSessions:Br,restoreSessions:Er}=S7(),ar=es?.tmuxRecovery??null;v.useEffect(()=>{ar&&W?.()},[ar,W]),v.useEffect(()=>{lr(null),bt(null)},[ar?.id]);const br=v.useCallback(async()=>{bt("restore"),lr(null);try{const P=await L7(ar?.id);await Er(),P.accepted||lr(B("tab.tmuxRecoveryFailed"))}catch{lr(B("tab.tmuxRecoveryFailed"))}finally{bt(null)}},[Er,B,ar?.id]),Hn=v.useCallback(async()=>{const P=ar?.operation;if(P)try{await _7(P.id,!P.paused),await Er()}catch{lr(B("tab.tmuxRecoveryFailed"))}},[Er,B,ar?.operation]),Qs=v.useCallback(async()=>{bt("dismiss"),lr(null);try{await k7(),await Er()}catch{lr(B("tab.tmuxRecoveryDismissFailed"))}finally{bt(null)}},[Er,B]),hs=Sr(P=>P.groupByFolder),xs=G0(P=>P.collaborationGroups),On=Sr(P=>P.leftOpen||P.rightOpen),En=Sr(P=>P.rightSidebarWidthContextKey),Bs=Sr(P=>P.rightSidebarWidth),bs=Sr(P=>P.rightPinned),[Ur,Pr]=v.useState(()=>Jx(Mr.getState().sessions));v.useEffect(()=>Mr.subscribe(P=>{const G=Jx(P.sessions);Pr(le=>kM(le,G)?le:G)}),[]);const{arranged:kt}=v.useMemo(()=>qh(H,P=>Ur.get(P.id)??null,hs,"",Zt,xs),[H,Ur,hs,Zt,xs]),ks=v.useRef(kt);ks.current=kt;const Yt=v.useMemo(()=>CM(kt,Zt),[kt,Zt]),q=v.useRef(Yt);q.current=Yt;const ke=v.useMemo(()=>vd(Zt,ne),[ne,Zt]),rt=v.useMemo(()=>{const P=Yt.find(G=>G.sessions.some(le=>le.id===ne));return new Set(P?.sessions.map(G=>G.id)??[])},[ne,Yt]),or=v.useMemo(()=>{const P=new Map;if(!x||S<=0)return P;for(const G of Yt){const le=G.sessions[0];if(!le)continue;const ge=I7(le.id,Ur.get(le.id)??null,G.workspace?.id??null);if(!(ge===En?bs:E7(le.id,Ur.get(le.id)??null,G.workspace?.id??null)))continue;const ot=ge===En?Bs:N7(le.id,Ur.get(le.id)??null,G.workspace?.id??null),xt=Ch(ot,S,C);P.set(G.key,xt+eb)}return P},[Ur,C,x,bs,En,Bs,S,Yt]),$t=v.useMemo(()=>Zp(H.map(P=>({id:P.id,backendSessionId:P.sessionId})),p),[p,H]),cr=v.useMemo(()=>Kx(Ir,Ft),[Ft,Ir]),Et=hh({prioritySessionId:$t,activeSessionId:he??ne,persistedActiveSessionId:cr,firstSessionId:H[0]?.id??null}),fn=v.useMemo(()=>KR(Yt.flatMap(P=>P.sessions.map(G=>G.id)),rt),[rt,Yt]),Ts=Et!==null&&ve.has(Et),_i=v.useMemo(()=>{const P=new Set(rt);return he&&P.add(he),!P.size&&Et&&P.add(Et),P},[rt,he,Et]),Ps=lt.token===He.token&&qR(_i,lt.completed),Wn=Ps||de===He.token?He.token:-1;v.useEffect(()=>{if(!He.token||Ps)return;const P=window.setTimeout(()=>nt(He.token),QR);return()=>window.clearTimeout(P)},[He.token,Ps]);const wa=v.useCallback((P,G)=>{Fe(le=>{if(le.has(P)===G)return le;const $e=new Set(le);return G?$e.add(P):$e.delete(P),$e})},[]),di=v.useCallback(P=>{const G=Tn.current;ye(ge=>{if(ge.token===G&&ge.completed.has(P))return ge;const $e=new Set(ge.token===G?ge.completed:[]);return $e.add(P),{token:G,completed:$e}});const le=$t??he??Tr.current;P===le&&R0("foreground-stream-connected")},[he,$t]),Gn=v.useCallback((P,G)=>{pt(le=>{if(le.has(P)===G)return le;const ge=new Set(le);return G?ge.add(P):ge.delete(P),ge})},[]),ls=v.useCallback((P,G)=>{mt(le=>{if(le.has(P)===G)return le;const ge=new Set(le);return G?ge.add(P):ge.delete(P),ge})},[]);v.useEffect(()=>{for(const[P,G]of oe.current){const le=H.find(ge=>ge.id===P);if(!le||le.sessionId!==G.backendSessionId){oe.current.delete(P);continue}!ve.has(P)||!Xe.has(P)||!xe.has(P)||(oe.current.delete(P),Y5(G.backendSessionId,`${G.command}\r`).catch(ge=>{console.error("[Session] Failed to send startup command:",ge)}))}},[H,ve,Xe,xe]);const qr=Et!==null&&Xe.has(Et),qn=Et!==null&&xe.has(Et);v.useEffect(()=>{qr&&R0("foreground-viewport-ready")},[qr]),v.useEffect(()=>{qn&&R0("foreground-content-ready")},[qn]);const en=v.useCallback(P=>It.has(P)?It.get(P)===!0:Xe.has(P)&&ve.has(P)&&xe.has(P),[It,Xe,ve,xe]),Ht=Et!==null&&en(Et);v.useEffect(()=>{if(!Q)return;if(!ae&&H.length===0){Q();return}if(!Ht)return;const P=[...rt].every(en);let G=0,le=0;const ge=()=>{G=requestAnimationFrame(()=>{le=requestAnimationFrame(()=>{R0("initial-viewport-presented"),Q()})})};P&&ge();const $e=P?void 0:window.setTimeout(ge,8e3);return()=>{cancelAnimationFrame(G),cancelAnimationFrame(le),clearTimeout($e)}},[Ht,en,Ts,qn,qr,ae,Q,H.length,rt,Xe,ve,xe]);const Fn=v.useMemo(()=>Jt?OR({slides:Yt.map(P=>P.sessions.map(G=>G.id)),visibleSessionIds:rt,foregroundSessionId:Et}):F,[Jt,Yt,rt,Et,F]);v.useEffect(()=>{if(Jt||rt.size===0)return;const P=new Set(rt),G=Yt.findIndex(le=>le.sessions.some(ge=>rt.has(ge.id)));for(let le=-2;le<=2;le+=1)le!==0&&Yt[G+le]?.sessions.forEach(ge=>P.add(ge.id));we(le=>{let ge=!1;const $e=new Set(le);for(const ot of P)$e.has(ot)||($e.add(ot),ge=!0);return ge?$e:le})},[Jt,rt,Yt]);const jr=D_(Fn);v.useEffect(()=>{if(!he)return;if(!H.some(G=>G.id===he)){Be(null);return}if(!en(he))return;const P=window.setTimeout(()=>{Be(G=>G===he?null:G),An.current&&!Ue.current&&Xt({sessionId:he,token:Date.now()})},80);return()=>window.clearTimeout(P)},[en,he,H]),v.useEffect(()=>{typeof window>"u"||(Zt.length>0?(window.localStorage.setItem(Zm,JSON.stringify(Zt)),window.localStorage.removeItem(z6)):window.localStorage.removeItem(Zm))},[Zt]),v.useEffect(()=>{hn||ae||Zt.length===0||Lt(P=>mM(P,H.map(G=>G.id)))},[hn,ae,H,Zt.length]),v.useEffect(()=>{if(!pe)return;const P=window.setTimeout(()=>Ge(null),3200);return()=>window.clearTimeout(P)},[pe]),Tr.current=ne,Tn.current=He.token,Nr.current=H,Ie.current=Ft,ht.current=hn,Je.current=ae,An.current=a;const mr=v.useCallback((P=tt.current)=>{const G=cn.current,le=typeof window<"u"?window.visualViewport:null,ge=P?Ym(P):null,$e=P?hf(P,G):null;return{sessionsLength:Nr.current.length,workspaceSlidesLength:q.current.length,sessionIds:Nr.current.map(ot=>ot.id),activeSessionId:Tr.current,activeSessionIndex:G,persistedActiveId:Ie.current,isLoading:ht.current,isRestoring:Je.current,activeIndex:P?.activeIndex??null,previousIndex:P?.previousIndex??null,animating:P?.animating??null,allowTouchMove:P?.allowTouchMove??null,width:P?.width??null,translate:ge,targetTranslate:$e,translateDelta:ge!==null&&$e!==null?ge-$e:null,snapGridLength:P?.snapGrid?.length??null,targetSnap:P?.snapGrid?.[G]??null,visualViewport:le?{width:Math.round(le.width),height:Math.round(le.height),offsetTop:Math.round(le.offsetTop)}:null}},[]),Dr=v.useCallback((P,G)=>{K(P,{...mr(),...G})},[K,mr]);v.useEffect(()=>{hn||ae||ne!==Ft&&Ye(ne)},[ne,hn,ae,Ft,Ye]);const wn=v.useMemo(()=>{if(kt.length===0||!ne)return 0;const P=Yt.findIndex(G=>G.sessions.some(le=>le.id===ne));return P>=0?P:0},[Yt,ne]);cn.current=wn;const Ln=v.useCallback(()=>{Vr.current&&(clearTimeout(Vr.current),Vr.current=null)},[]),Vn=v.useCallback(P=>{Ln(),Vr.current=setTimeout(()=>{Vr.current=null,gt.current=!1,Dr("[swiper:touch-guard-clear]",{reason:P})},yM)},[Ln,Dr]),Zn=v.useCallback((P,G={})=>{const le=tt.current,ge=cn.current,$e=q.current;if(!le||$e.length===0||ge<0||ge>=$e.length)return;if(gt.current){Dr("[swiper:sync-skip-touch]",{reason:P});return}if(le.animating){Dr("[swiper:sync-skip-animating]",{reason:P});return}const ot=Ym(le),xt=hf(le,ge),Tt=ot!==null&&xt!==null&&Math.abs(ot-xt)<=U6,Rr=le.activeIndex===ge;if(Dr("[swiper:sync-check]",{reason:P,activeIndexAligned:Rr,translateAligned:Tt,immediate:G.immediate===!0}),!(Rr&&Tt)){if(Rr){ph(le,ge),Dr("[swiper:sync-forced-active]",{reason:P,translateAligned:Tt,immediate:G.immediate===!0});return}G.immediate?(ph(le,ge),le.slideTo(ge,0,!1),ph(le,ge)):le.slideTo(ge,Vm,!1),Dr("[swiper:sync-applied]",{reason:P,activeIndexAligned:Rr,translateAligned:Tt,immediate:G.immediate===!0})}},[Dr]);v.useEffect(()=>{const P=G=>{const le=G;tt.current&&(tt.current.allowTouchMove=!le.detail.locked),Dr("[swiper:gesture-lock]",{locked:le.detail.locked})};return document.addEventListener("termdock:gesture-lock",P),()=>document.removeEventListener("termdock:gesture-lock",P)},[Dr]),v.useEffect(()=>{if(H.length===0){ne!==null&&wt(null);return}if(!ne){if(!m)return;wt(hh({prioritySessionId:$t,activeSessionId:null,persistedActiveSessionId:cr,firstSessionId:H[0]?.id??null}));return}H.some(G=>G.id===ne)||wt(H[0].id)},[H,ne,m,$t,cr]);const cs=v.useCallback((P,G)=>{if(G&&Date.now()<Gr.current){it.current[P]=!1;return}it.current[P]=G,an(le=>G?P:le===P?null:le)},[]),ts=v.useCallback(P=>{if(!gt.current&&P.activeIndex!==cn.current){Dr("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:P.activeIndex,expectedActiveIndex:cn.current}),requestAnimationFrame(()=>Zn("ignored-layout-slide-change",{immediate:!0}));return}const G=q.current[P.activeIndex],le=G?.sessions.some(ot=>ot.id===ne)?ne:G?.sessions[0]?.id;if(Dr("[swiper:slide-change]",{nextSessionId:le??null,instanceActiveIndex:P.activeIndex}),!le||le===ne)return;const ge=!!ne&&it.current[ne]===!0,$e=An.current&&(!Ue.current||ge);if(ct.current=le,wt(le),$e){Xt({sessionId:le,token:Date.now()});return}Xt(null)},[H,ne,Dr,Zn]);v.useLayoutEffect(()=>{if(ct.current===ne){Dr("[swiper:sync-skip-swiper-driven]",{activeSessionId:ne}),ct.current=null;return}Zn("active-session-index",{immediate:!0})},[ne,wn,H.length,Zn,Dr]),v.useEffect(()=>{const P=tt.current;if(!P)return;const G=Yt.length>1&&!On&&!Lr;P.allowTouchMove!==G&&(P.allowTouchMove=G,Dr("[swiper:allow-touch-sync]",{nextAllow:G,sidebarOverlayOpen:On}))},[Yt.length,Dr,On,Lr]);const Cn=v.useCallback(P=>{const G=tt.current;if(!G)return;const le=G.el;if(Dr("[swiper:layout-before]",{reason:P,scrollLeft:le?.scrollLeft??null}),le&&(le.scrollLeft=0),G.updateSize(),G.updateSlides(),G.updateProgress(),G.updateSlidesClasses(),le&&(le.scrollLeft=0),Dr("[swiper:layout-after]",{reason:P,scrollLeft:le?.scrollLeft??null}),gt.current||G.animating){Dr("[swiper:layout-skip-sync-motion]",{reason:P});return}Zn(`layout:${P}`,{immediate:!0}),requestAnimationFrame(()=>{const ge=tt.current;ge&&(gt.current||ge.animating||ph(ge,cn.current))})},[Dr,Zn]);v.useEffect(()=>()=>Ln(),[Ln]);const ki=Yt.map(P=>P.key).join("\0");v.useEffect(()=>{requestAnimationFrame(()=>Cn("group-change"))},[hs,ki,Cn]),v.useEffect(()=>{let P=null,G="mount";const le=Tt=>{G=Tt,P===null&&(P=requestAnimationFrame(()=>{P=null,Cn(`viewport-change:${G}`)}))},ge=()=>le("window-resize"),$e=()=>le("visual-viewport-resize"),ot=()=>le("visual-viewport-scroll"),xt=Tt=>{le(`measured:${Tt.detail?.source??"unknown"}`)};return window.addEventListener("resize",ge),window.visualViewport?.addEventListener("resize",$e),window.visualViewport?.addEventListener("scroll",ot),document.addEventListener(Sg,xt),le("mount"),()=>{window.removeEventListener("resize",ge),window.visualViewport?.removeEventListener("resize",$e),window.visualViewport?.removeEventListener("scroll",ot),document.removeEventListener(Sg,xt),P!==null&&cancelAnimationFrame(P)}},[Cn]),v.useEffect(()=>{if(typeof document>"u")return;let P=null,G=null;const le=Rr=>{if(Rr!=="online"&&document.hidden)return;const mn=performance.now();if(!VR(G,mn))return;G=mn;const St=Rr==="bfcache"||Rr==="online"?Rr:"visibility",tn=ZR();ip(),Da("info","PWA_RESUME scheduled",{source:Rr,forceForegroundReconnect:tn,activeSessionId:Tr.current}),je(rn=>({token:rn.token+1,reason:St,forceForegroundReconnect:tn})),requestAnimationFrame(()=>Cn(`resume:${Rr}:raf`)),P&&clearTimeout(P),P=setTimeout(()=>{P=null,Cn(`resume:${Rr}:settled`)},320)},ge=()=>{if(document.hidden){ip();return}le("visibility")},$e=()=>{ip()},ot=Rr=>{le(Rr.persisted?"bfcache":"pageshow")},xt=()=>le("online"),Tt=()=>le("focus");return document.addEventListener("visibilitychange",ge),window.addEventListener("pagehide",$e),window.addEventListener("pageshow",ot),window.addEventListener("online",xt),window.addEventListener("focus",Tt),()=>{document.removeEventListener("visibilitychange",ge),window.removeEventListener("pagehide",$e),window.removeEventListener("pageshow",ot),window.removeEventListener("online",xt),window.removeEventListener("focus",Tt),P&&clearTimeout(P)}},[Cn]),v.useLayoutEffect(()=>{if(!WR(ae))return;const P=LM(H),G=JSON.stringify(P);P.length>0&&G!==Zr.current?(Zr.current=G,console.warn("[session-invariant] duplicate mapping detected",P)):P.length===0&&Zr.current&&(Zr.current=""),N?.({sessions:H.map(le=>({id:le.id,name:le.name,customName:le.customName,mode:le.mode,tmuxSessionName:le.tmuxSessionName})),activeSessionId:ne,splitWorkspaces:Zt.map(({id:le,name:ge,sessionIds:$e,layout:ot})=>({id:le,...ge?{name:ge}:{},sessionIds:$e,layout:ot}))})},[H,ne,Zt,N,ae]),v.useEffect(()=>{if(hn||Qe.current)return;Qe.current=!0;const P=Zp(Ir.map(ot=>({id:ot.sessionId,backendSessionId:ot.backendSessionId??null})),p),G=Kx(Ir,Ft),le=hh({prioritySessionId:m?P:null,activeSessionId:null,persistedActiveSessionId:G,firstSessionId:Ir[0]?.sessionId??null}),ge=H6(Ir.map(W6));if(K("[Session] Restoring",ge.length,"persisted sessions (one-shot)"),Dr("[swiper:restore-start]",{persistedSessionIds:Ir.map(ot=>ot.sessionId),nextActiveSessionId:le}),ge.length>0){const ot=Mr.getState();ge.forEach(Tt=>{Tt.sessionId&&ot.setTerminalSession(Tt.id,{sessionId:Tt.sessionId,cols:80,rows:24,mode:Tt.mode,tmuxSessionName:Tt.tmuxSessionName,history:Tt.history})}),Ir.forEach(Tt=>{Tt.agent!==void 0&&ot.setSessionAgentIdentity(Tt.sessionId,Tt.agent),Tt.activeProgram!=null&&ot.setSessionActiveProgram(Tt.sessionId,Tt.activeProgram),Tt.cwd!=null&&ot.setSessionCwd(Tt.sessionId,Tt.cwd),Tt.shellTitle!=null&&ot.setSessionShellTitle(Tt.sessionId,Tt.shellTitle)}),Oe(ge);const xt=le||ge[0]?.id||null;wt(xt),Dr("[swiper:restore-complete]",{restoredSessionIds:ge.map(Tt=>Tt.id),nextActiveSessionId:xt})}(async()=>(ge.length===0&&await _r.current?.({createIfEmpty:!0}),X(!1),requestAnimationFrame(()=>Zn("restore-finished",{immediate:!0}))))()},[hn,Ir,Ft,K,Dr,Zn,m,p]),v.useEffect(()=>{if(!m||ae||H.length===0)return;const P=Zp(H.map(le=>({id:le.id,backendSessionId:le.sessionId})),p),G=hh({prioritySessionId:P,activeSessionId:Tr.current,persistedActiveSessionId:cr,firstSessionId:H[0]?.id??null});G&&G!==Tr.current&&wt(G)},[m,p,ae,cr,H]);const Cs=v.useRef([]),_n=v.useRef(!1);Tr.current=ne,v.useEffect(()=>{if(ae)return;const P=Cs.current,G=Ir,le=new Map(P.map(St=>[St.sessionId,St])),ge=Mr.getState();for(const St of G){const tn=le.get(St.sessionId),rn=Mr.getState().sessions.get(St.sessionId);St.agent!==void 0&&JSON.stringify(St.agent)!==JSON.stringify(rn?.agent)&&(rn?.agent==null||JSON.stringify(St.agent)!==JSON.stringify(tn?.agent))&&ge.setSessionAgentIdentity(St.sessionId,St.agent),St.activeProgram!=null&&St.activeProgram!==rn?.activeProgram&&(rn?.activeProgram==null||St.activeProgram!==tn?.activeProgram)&&ge.setSessionActiveProgram(St.sessionId,St.activeProgram),St.cwd!=null&&St.cwd!==rn?.cwd&&(rn?.cwd==null||St.cwd!==tn?.cwd)&&ge.setSessionCwd(St.sessionId,St.cwd),St.shellTitle!=null&&St.shellTitle!==rn?.shellTitle&&(rn?.shellTitle==null||St.shellTitle!==tn?.shellTitle)&&ge.setSessionShellTitle(St.sessionId,St.shellTitle)}if(!_n.current){Oe(St=>Yx(St,G)),Cs.current=G,_n.current=!0;return}const $e=new Set(P.map(St=>St.sessionId)),ot=new Set(G.map(St=>St.sessionId)),xt=new Map(P.map(St=>[St.sessionId,St.name]));Cs.current=G,Oe(St=>{const tn=Yx(St,G);return(!Tr.current||!tn.some(rn=>rn.id===Tr.current))&&wt(tn[0]?.id??null),tn});const Tt=G.filter(St=>!$e.has(St.sessionId)),Rr=[...$e].filter(St=>!ot.has(St)),mn=G.filter(St=>$e.has(St.sessionId)&&xt.get(St.sessionId)!==St.name);(Tt.length>0||Rr.length>0||mn.length>0)&&K("[Session] Synced persisted sessions:",{newSessionIds:Tt.map(St=>St.sessionId),removedSessionIds:Rr,renamedSessionIds:mn.map(St=>St.sessionId),currentSessionIds:G.map(St=>St.sessionId)});for(const St of G){if(!St.backendSessionId)continue;Mr.getState().setTerminalSession(St.sessionId,{sessionId:St.backendSessionId,cols:80,rows:24,mode:St.mode,tmuxSessionName:St.tmuxSessionName})}},[Ir,ae,K]);const Nn=v.useCallback(async P=>{const G=++Me.current;V(!1);const le=Ne.current,ge=()=>G===Me.current&&le===Ne.current&&(P?.shouldActivate?.()??!0);try{const $e=Sr.getState(),ot=ne?{rightOpen:$e.rightOpen,rightPinned:$e.rightPinned,rightSidebarWidth:$e.rightSidebarWidth,rightTab:$e.rightTab}:null,xt=P?.mode==="tmux"||P?.mode==="shell"?P.mode:c,Tt=(P?.tmuxSessionName||"").trim(),Rr=h.trim(),mn=xt==="tmux"?Tt||Rr||IM():null,St=typeof P?.cwd=="string"?P.cwd:null,tn=ne?Mr.getState().sessions.get(ne)?.cwd??null:null,rn=typeof St=="string"&&St.trim().length>0?St:typeof tn=="string"&&tn.trim().length>0?tn:void 0,Os=await b_({preferredFrontendSessionId:P?.preferredFrontendSessionId,requireExisting:P?.requireExisting===!0,mode:xt,tmuxSessionName:mn,cwd:rn,termType:"xterm-256color",createIfEmpty:P?.createIfEmpty===!0},vs=>ee(vs,{shouldActivate:ge}),{current:ge,pending:vs=>{G===Me.current&&V(vs)}});if(Os.discarded)return P?.onResult?.({ok:!1,error:"unknown"}),null;const kn=Os.session,on=Os.terminalSession;!Os.reused&&ot&&Sr.getState().initializeRightSidebarForSession(kn.sessionId,on.cwd??rn??null,ot);const gr={id:kn.sessionId,name:kn.name,customName:kn.customName===!0,sessionId:on.sessionId,mode:on.mode??kn.mode,tmuxSessionName:on.tmuxSessionName??kn.tmuxSessionName},Vt=P?.command?.trim();return Vt&&oe.current.set(gr.id,{backendSessionId:on.sessionId,command:Vt}),Oe(vs=>_M(vs,gr)),ge()&&wt(gr.id),Mr.getState().setTerminalSession(gr.id,{sessionId:on.sessionId,cols:80,rows:24,mode:gr.mode,tmuxSessionName:gr.tmuxSessionName,activeProgram:on.activeProgram,activeProgramRaw:on.activeProgramRaw,activeProgramSource:on.activeProgramSource,cwd:on.cwd}),K("[Session] Inventory opened session:",{frontendSessionId:gr.id,backendSessionId:on.sessionId,reused:Os.reused,mode:gr.mode,tmuxSessionName:gr.tmuxSessionName}),P?.onResult?.({ok:!0,sessionId:gr.id}),gr.id}catch($e){return console.error("[Session] Failed to create new session:",$e),P?.onResult?.({ok:!1,error:O3($e)}),null}},[c,h,ne,ee,K]);_r.current=Nn;const Kr=v.useCallback((P,G={})=>{Ne.current+=1,Hs.getState().setActivePane(P);const le=Tr.current,ge=!!le&&it.current[le]===!0;if(wt(P),Ue.current&&G.preserveMobileKeyboard===!1){Gr.current=Date.now()+600,le&&(it.current[le]=!1),an(null),Xt(null);const $e=document.activeElement;$e instanceof HTMLTextAreaElement&&$e.closest(".terminal-viewport-container")&&$e.blur();return}ge&&Ue.current&&an(P),An.current&&(!Ue.current||ge)&&Xt({sessionId:P,token:Date.now()})},[]),Ss=v.useCallback(P=>{wt(P),Pt(!0),Ge(null)},[]),pn=v.useCallback(P=>{const G=Tr.current;!G||G===P||(Lt(le=>Kp(le,G,P)),Pt(!1),Kr(G,{preserveMobileKeyboard:!1}))},[Kr]),$=v.useCallback(async()=>{const P=Tr.current;if(!P||Ve)return;const G=Ne.current;zt(!0);const le=Mr.getState().sessions.get(P)?.cwd??void 0,ge=await Nn({cwd:le||void 0,mode:c,shouldActivate:()=>!1});if(zt(!1),!ge){Ge(B("common.error"));return}!pr.current||G!==Ne.current||!Nr.current.some($e=>$e.id===P)||(Lt($e=>Kp($e,P,ge)),Pt(!1),Kr(P,{preserveMobileKeyboard:!1}))},[Kr,c,Nn,Ve,B]),_e=v.useCallback(P=>{Lt(G=>xM(G,P)),P&&Kr(P,{preserveMobileKeyboard:!1})},[Kr]),Pe=v.useCallback(P=>{Lt(G=>gM(G,P)),Kr(P,{preserveMobileKeyboard:!1})},[Kr]),We=v.useCallback(P=>{if(H.find(le=>le.id===P)){if(Ne.current+=1,Hs.getState().setActivePane(P),P===Tr.current)return;if(wt(P),!UR({isMobile:Ue.current,viewportReady:Xe.has(P),streamReady:ve.has(P),contentReady:xe.has(P)})){Be(null),An.current&&Xt({sessionId:P,token:Date.now()}),K("[Session] Switched to session:",P);return}we(ge=>{if(ge.has(P))return ge;const $e=new Set(ge);return $e.add(P),$e}),Be(P),K("[Session] Switched to session:",P)}},[xe,K,ve,H,Xe]),qe=v.useCallback((P,G)=>{G.trim()&&(Oe(le=>le.map(ge=>ge.id===P?{...ge,name:G.trim(),customName:!0}:ge)),Gt(P,G.trim()))},[Gt]),ft=v.useCallback(P=>{Oe(G=>G.map(le=>le.id===P?{...le,customName:!1}:le)),Yr(P)},[Yr]),Ct=v.useCallback(P=>{Oe(G=>{const le=new Map(G.map(xt=>[xt.id,xt])),ge=P.map(xt=>le.get(xt)).filter(xt=>xt!==void 0),$e=new Set(P),ot=G.filter(xt=>!$e.has(xt.id));return[...ge,...ot]}),Br(P),K("[Session] Reordered sessions:",P),requestAnimationFrame(()=>{tt.current?.update()})},[Br,K]),Qt=v.useCallback(async P=>{const G=typeof P=="string"?P:P.sessionId,le=typeof P=="string"?"auto":P.closeMode??"auto",ge=H.find(Tt=>Tt.id===G);if(!ge||er.current.has(G))return;er.current.add(G),Ne.current+=1;const $e=Lg(kt,G,Tt=>Tt.id);try{le==="destroy"&&ge.mode==="tmux"&&ge.tmuxSessionName?(await tb(ge.tmuxSessionName),K("[Session] Destroyed tmux session:",{frontendSessionId:ge.id,tmuxSessionName:ge.tmuxSessionName})):ge.sessionId&&(await Z5(ge.sessionId),K("[Session] Closed backend terminal:",ge.sessionId))}catch(Tt){console.error("[Session] Failed to close backend terminal:",Tt),Mt({sessionId:G,closeMode:le});return}finally{er.current.delete(G)}Mt(Tt=>Tt?.sessionId===G?null:Tt);const xt=Nr.current.filter(Tt=>Tt.id!==G).some(Tt=>Tt.id===$e)?$e:Lg(Nr.current,G,Tt=>Tt.id);Tr.current===G&&wt(xt),Oe(Tt=>Tt.filter(Rr=>Rr.id!==G)),qt(G,xt),delete it.current[G],K("[Session] Closed session:",{sessionId:G,closeMode:le})},[H,kt,qt,K]),st=v.useCallback(P=>{if(!P)return;const G=H.filter(le=>le.sessionId===P);if(G.length!==0){G.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:P,frontendSessionIds:G.map(le=>le.id)}),Oe(le=>{const ge=le.filter($e=>$e.sessionId!==P);return ge.length!==le.length&&!ge.some(ot=>ot.id===ne)&&wt(ge.length>0?ge[0].id:null),ge});for(const le of G)qt(le.id),delete it.current[le.id];K("[Session] Backend gone, dropped local session(s):",G.map(le=>le.id))}},[H,ne,qt,K]);v.useEffect(()=>{const P=gr=>{Nn(gr.detail)},G=gr=>{We(gr.detail)},le=()=>{const gr=Tr.current;!gr||Ue.current||Xt({sessionId:gr,token:Date.now()})},ge=gr=>{const Vt=gr;Vt.detail&&Ss(Vt.detail)},$e=gr=>{const Vt=gr.detail;_e(Vt??Tr.current??void 0)},ot=gr=>{const Vt=gr.detail;Vt&&Pe(Vt)},xt=gr=>{const Vt=gr.detail,Yn=typeof Vt=="string"?Vt:Vt?.layout,vs=typeof Vt=="string"?Tr.current:Vt?.sessionId;Yn!=="horizontal"&&Yn!=="vertical"&&Yn!=="grid"||Lt(Ii=>Ii.map(hi=>hi.sessionIds.includes(vs??"")?{...hi,layout:Yn}:hi))},Tt=gr=>{const Yn=gr.detail?.direction;if(Yn!=="prev"&&Yn!=="next")return;const vs=ks.current;if(vs.length<=1)return;const Ii=Tr.current,hi=Ii?vs.findIndex(Ei=>Ei.id===Ii):-1,Pa=((hi>=0?hi:0)+(Yn==="next"?1:-1)+vs.length)%vs.length,Rn=vs[Pa]?.id;Rn&&Rn!==Ii&&We(Rn)},Rr=gr=>{Qt(gr.detail)},mn=gr=>{st(gr.detail)},St=gr=>{const Vt=gr;!Vt.detail?.sessionId||!Vt.detail?.name||qe(Vt.detail.sessionId,Vt.detail.name)},tn=gr=>{const Vt=gr;Vt.detail?.sessionId&&ft(Vt.detail.sessionId)},rn=gr=>{const Vt=gr;Vt.detail?.sessionIds&&Ct(Vt.detail.sessionIds)},Os=gr=>{const Vt=gr.detail;!Vt?.workspaceId||!Array.isArray(Vt.sessionIds)||Lt(Yn=>bM(Yn,Vt.workspaceId,Vt.sessionIds))},kn=gr=>{const Vt=gr.detail;!Vt?.workspaceId||typeof Vt.name!="string"||Lt(Yn=>vM(Yn,Vt.workspaceId,Vt.name))},on=gr=>{const Vt=gr.detail;!Vt?.primaryId||!Vt.secondaryId||Vt.primaryId===Vt.secondaryId||(Lt(Yn=>Kp(Yn,Vt.primaryId,Vt.secondaryId)),Kr(Vt.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",P),window.addEventListener("switch-terminal-session",G),window.addEventListener("focus-active-terminal-session",le),window.addEventListener("open-terminal-split-chooser",ge),window.addEventListener("close-terminal-split",$e),window.addEventListener("remove-terminal-split-pane",ot),window.addEventListener("set-terminal-split-direction",xt),window.addEventListener("cycle-terminal-session",Tt),window.addEventListener("close-terminal-session",Rr),window.addEventListener("close-terminal-session-by-backend",mn),window.addEventListener("rename-terminal-session",St),window.addEventListener("reset-terminal-session-name",tn),window.addEventListener("reorder-terminal-session",rn),window.addEventListener("reorder-terminal-split-workspace",Os),window.addEventListener("rename-terminal-split-workspace",kn),window.addEventListener("combine-terminal-split-sessions",on),()=>{window.removeEventListener("new-terminal-session",P),window.removeEventListener("switch-terminal-session",G),window.removeEventListener("focus-active-terminal-session",le),window.removeEventListener("open-terminal-split-chooser",ge),window.removeEventListener("close-terminal-split",$e),window.removeEventListener("remove-terminal-split-pane",ot),window.removeEventListener("set-terminal-split-direction",xt),window.removeEventListener("cycle-terminal-session",Tt),window.removeEventListener("close-terminal-session",Rr),window.removeEventListener("close-terminal-session-by-backend",mn),window.removeEventListener("rename-terminal-session",St),window.removeEventListener("reset-terminal-session-name",tn),window.removeEventListener("reorder-terminal-session",rn),window.removeEventListener("reorder-terminal-split-workspace",Os),window.removeEventListener("rename-terminal-split-workspace",kn),window.removeEventListener("combine-terminal-split-sessions",on)}},[Kr,Nn,We,Ss,_e,Pe,Qt,st,qe,ft,Ct]),v.useEffect(()=>{if(!ke||Jt)return;const P=G=>{if(!Q_(G,a1())||!(G.ctrlKey||G.metaKey)||!G.shiftKey)return;if(ke.layout==="horizontal"?G.key==="ArrowLeft"||G.key==="ArrowRight":ke.layout==="vertical"?G.key==="ArrowUp"||G.key==="ArrowDown":G.key.startsWith("Arrow")){G.preventDefault(),G.stopPropagation();const ge=ke.sessionIds.indexOf(Tr.current??""),$e=G.key==="ArrowLeft"||G.key==="ArrowUp"?-1:1,ot=(Math.max(0,ge)+$e+ke.sessionIds.length)%ke.sessionIds.length,xt=ke.sessionIds[ot];if(!xt)return;Kr(xt);return}G.key==="Backspace"&&(G.preventDefault(),G.stopPropagation(),_e(Tr.current??void 0))};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[Kr,ke,_e,Jt]);const vt=P=>{const G=Mr.getState().sessions.get(P.id);return cl(P,G?.activeProgram??null,G?.cwd??null,void 0,G?.shellTitle??null,G?.promptState??null)},[sr]=Af(ne||""),yt=(P,G={})=>{const le=P.id===ne&&!Ke?.startsWith("@collaboration:"),ge=rt.has(P.id)&&!G.hidden,$e=m&&$R({sessionId:P.id,foregroundSessionId:Et,visibleSessionIds:rt,deferredViewportSessionIds:Jt?jr:Fn}),ot=FR({sessionId:P.id,foregroundSessionId:Et,foregroundReady:Ts,isVisible:ge})&&m,xt=GR({sessionId:P.id,foregroundSessionId:Et,requestToken:He.token,foregroundCompletedToken:Wn,isVisible:_i.has(P.id)})&&m,Tt=ge||P.id===Et||Fn.has(P.id)?0:fn.get(P.id)??Qh;return s.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${G.hidden?"invisible pointer-events-none":""}`,style:G.containerStyle,"aria-hidden":G.hidden||void 0,onPointerDownCapture:()=>{ge&&Vx(le,()=>Kr(P.id))},onWheelCapture:()=>{Vx(le,()=>Kr(P.id))},children:[G.showPaneTitle&&s.jsx(uM,{session:P,active:le,onActivate:()=>Kr(P.id),onToggleRightSidebar:le?b:void 0}),s.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:s.jsx(C_,{sessionId:P.id,terminalReady:ve.has(P.id)&&Xe.has(P.id),name:vt(P).primary,active:le&&ge,onChatReadyChange:Nt,onKeyboardChange:Rr=>cs(P.id,Rr),children:Rr=>$e&&s.jsx(cM,{sessionId:P.id,mode:P.mode,tmuxSessionName:P.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:le,focusSuspended:!Rr||!a||he!==null,allowOwnedPasteWhileFocusSuspended:l&&he===null,deferCursorUntilPositioned:he===P.id||P.mode==="tmux"&&!xe.has(P.id),isLayoutVisible:ge&&Rr,initialConnectEnabled:ot&&xt,resumeRequestEnabled:xt,suppressKeyboard:G.suppressKeyboard||!Rr,keyboardPortalTarget:G.keyboardPortalTarget,sharedMobileKeyboardLayout:G.sharedMobileKeyboardLayout,suppressPageFlipRefresh:G.suppressPageFlipRefresh,focusRequestToken:Rt?.sessionId===P.id?Rt.token:0,resumeRequestToken:He.token,resumeRequestReason:He.reason,forceResumeReconnect:He.forceForegroundReconnect&&_i.has(P.id),resumeRequestDelayMs:_i.has(P.id)?0:G.hidden?Qh:fn.get(P.id)??Qh,initialConnectDelayMs:Tt,onStreamReadyChange:wa,onStreamConnected:di,onViewportReadyChange:Gn,onContentReadyChange:ls,onKeyboardVisibilityChange:Rr?cs:void 0,showDebug:n,onStatusChange:le?I:void 0})})})]},P.id)};return s.jsxs("div",{className:"relative h-full flex flex-col",children:[at&&H.some(P=>P.id===at.sessionId)&&s.jsxs("div",{role:"alert",className:"fixed inset-x-3 top-[calc(var(--safe-top-inset)+0.75rem)] z-toast mx-auto flex max-w-lg items-center gap-3 rounded-xl border border-destructive/30 bg-surface-elevated px-4 py-3 text-[12px] text-foreground shadow-lg",children:[s.jsx("span",{className:"min-w-0 flex-1",children:B("tab.closeFailed",{name:H.find(P=>P.id===at.sessionId).name})}),s.jsx("button",{type:"button",className:"shrink-0 rounded-lg px-2 py-1 text-primary hover:bg-surface-2",onClick:()=>{Qt(at)},children:B("common.retry")}),s.jsx("button",{type:"button",className:"shrink-0 rounded-lg p-1 hover:bg-surface-2","aria-label":B("common.close"),onClick:()=>Mt(null),children:s.jsx(zn,{size:16})})]}),ar&&s.jsx("section",{className:"fixed inset-x-3 top-[calc(var(--safe-top-inset)+0.75rem)] z-toast mx-auto max-w-lg rounded-2xl border border-warning/30 bg-surface-elevated px-4 py-3.5 shadow-[0_20px_60px_var(--app-shadow-strong)]",role:"alert","aria-live":"assertive",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-warning/15 text-warning",children:s.jsx(c1,{size:18})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:B("tab.tmuxRecoveryTitle",{count:ar.sessions.length})}),s.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:B("tab.tmuxRecoveryHint")}),s.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:ar.sessions.map(P=>P.name).join(" · ")}),ar.operation&&s.jsxs("div",{className:"mt-2 rounded-lg bg-surface-2 px-2.5 py-2 text-[10px] text-muted-foreground","aria-live":"polite",children:[s.jsx("p",{children:B("tab.tmuxRecoveryProgress",{total:ar.operation.total,queued:ar.operation.queued,paused:ar.operation.paused_count,resourceWait:ar.operation.resource_wait,running:ar.operation.running,succeeded:ar.operation.succeeded,failed:ar.operation.failed})}),ar.operation.pauseReason==="resources"&&s.jsx("p",{className:"mt-1",children:B("tab.tmuxRecoveryPausedForResources")}),s.jsx("div",{className:"mt-1 max-h-24 overflow-y-auto",children:ar.operation.items.map(P=>s.jsxs("p",{className:`mt-1 ${P.errorCode?"text-destructive":""}`,children:[P.sessionId,": ",P.errorCode??P.resourceWaitReason??P.phase,P.memAvailableBytes!==void 0?` · 可用内存 ${(P.memAvailableBytes/1024**3).toFixed(1)} GiB`:"",P.actualRssBytes!==void 0?` · 实际 RSS ${(P.actualRssBytes/1024**2).toFixed(0)} MiB`:"",P.estimatedRssBytes!==void 0&&P.actualRssBytes===void 0?` · 预估 RSS ${(P.estimatedRssBytes/1024**2).toFixed(0)} MiB`:""]},P.sessionId))})]}),Ce&&s.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:Ce}),s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[s.jsxs("button",{type:"button",disabled:J!==null||!!(ar.operation&&!["succeeded","partial_failure"].includes(ar.operation.state)),onClick:()=>{br()},className:"inline-flex min-h-9 items-center gap-1.5 rounded-lg bg-primary px-3 text-[11px] font-medium text-primary-foreground transition active:opacity-80 disabled:opacity-50",children:[s.jsx(rb,{size:13,className:J==="restore"?"animate-spin":""}),J==="restore"?B("tab.tmuxRecoveryRestoring"):ar.operation&&!["succeeded","partial_failure"].includes(ar.operation.state)?B("tab.tmuxRecoveryInProgress"):B("tab.tmuxRecoveryRestoreAll")]}),ar.operation&&["queued","resource_wait","running","paused"].includes(ar.operation.state)&&s.jsx("button",{type:"button",disabled:J!==null,onClick:()=>{Hn()},className:"inline-flex min-h-9 items-center rounded-lg px-3 text-[11px] text-muted-foreground transition hover:bg-surface-2 disabled:opacity-50",children:ar.operation.paused?B("tab.tmuxRecoveryResume"):B("tab.tmuxRecoveryPause")}),s.jsx("button",{type:"button",disabled:J!==null||!!(ar.operation&&!S_(ar.operation)),onClick:()=>{Qs()},className:"inline-flex min-h-9 items-center rounded-lg px-3 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-50",children:B("tab.tmuxRecoveryDismiss")})]})]})]})}),s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(Rw,{onSwiper:P=>{tt.current=P,P.allowTouchMove=Yt.length>1&&!On&&!Lr,Dr("[swiper:on-swiper]",{allowTouchMove:P.allowTouchMove}),requestAnimationFrame(()=>Cn("on-swiper"))},onSlideChange:ts,onTouchStart:(P,G)=>{const le=Xx(G),ge=le==="touch"||le==="pen"||le==="unknown";re("[swipe:touch-start]",{pointerType:le,allowed:ge}),Dr("[swiper:touch-start]",{pointerType:le,allowed:ge}),ge&&(Ln(),fe.current=!0,gt.current=!0)},onTouchEnd:(P,G)=>{const le=Xx(G),ge=le==="touch"||le==="pen"||le==="unknown";re("[swipe:touch-end]",{pointerType:le,allowed:ge}),Dr("[swiper:touch-end]",{pointerType:le,allowed:ge}),ge&&(fe.current=!1,Vn("touch-end"))},onTransitionEnd:()=>{const P=tt.current;if(fe.current){Dr("[swiper:transition-end-during-touch]");return}if(gt.current&&P&&!SM(P,cn.current)){Dr("[swiper:transition-end-deferred]");return}Ln(),gt.current=!1,Dr("[swiper:transition-end]")},initialSlide:Math.max(0,wn),speed:Vm,slidesPerView:1,resistanceRatio:.82,threshold:8,longSwipesRatio:.2,touchAngle:45,touchStartPreventDefault:!1,simulateTouch:!1,noSwiping:!0,noSwipingSelector:"[data-mobile-keyboard='true'], [data-session-chat]",className:`terminal-session-swiper h-full ${sr==="chat"?"session-chat-swiper":""}`,children:Yt.map(P=>{const G=P.workspace,le=!!G&&P.sessions.length>=2,ge=Jt?yn?"horizontal":"vertical":G?.layout??"horizontal",$e=Jt&&$r?P.sessions.some(xt=>xt.id===$r):!1,ot=P.sessions.some(xt=>xt.id===ne)?ne:P.sessions[0]?.id;return s.jsx(Mw,{className:"h-full",children:s.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":or.get(P.key)??0,style:{paddingRight:or.get(P.key)??0,paddingTop:y&&!le?"2.5rem":void 0},children:le?s.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:vb(Jt&&sr!=="chat").rootStyle,children:[U&&!Jt&&s.jsx("header",{"data-termdock-window-header":"true","data-split-window-header":"true",className:"flex h-[46px] min-h-[46px] shrink-0 items-center app-chrome-bg pl-[88px] pr-3 text-[12px] text-muted-foreground",children:s.jsx("span",{className:"min-w-0 truncate",children:G?.name||B("tab.splitWorkspace")})}),s.jsx(L2,{layoutId:P.key,preset:G?.layout??"horizontal",initialTree:k_(P.sessions.map(xt=>xt.id),ge,G?.ratios,G?.gridColumnRatios,G?.gridRowRatios),mobile:Jt,focusId:$e?$r:null,panes:P.sessions.map(xt=>({id:xt.id,content:yt(xt,{showPaneTitle:!Jt,suppressKeyboard:Jt&&xt.id!==ot,keyboardPortalTarget:Jt?Jr:null,sharedMobileKeyboardLayout:Jt,suppressPageFlipRefresh:!0})}))}),Jt&&s.jsx("div",{ref:Fr,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):s.jsx(L2,{layoutId:P.key,preset:G?.layout??"horizontal",mobile:Jt,panes:[{id:P.sessions[0].id,content:yt(P.sessions[0])}]})})},P.key)})})}),Lr&&ne&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>Pt(!1),"aria-label":B("common.close")}),s.jsxs("section",{ref:Dt,tabIndex:-1,className:"fixed inset-x-3 bottom-3 z-modal-panel mx-auto max-h-[min(78svh,620px)] max-w-md overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-[0_24px_70px_var(--app-shadow-strong)] sm:bottom-auto sm:top-1/2 sm:-translate-y-1/2",style:{paddingBottom:"var(--safe-bottom-inset)"},role:"dialog","aria-modal":"true","aria-label":B("tab.splitTitle"),children:[s.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[s.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:s.jsx(Uc,{size:17})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:B("tab.splitTitle")}),s.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:B("tab.splitExistingHint")})]}),s.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",onClick:()=>Pt(!1),"aria-label":B("common.close"),children:s.jsx(zn,{size:16})})]}),s.jsxs("div",{className:"max-h-[calc(min(78svh,620px)-72px)] overflow-y-auto overscroll-contain p-2",children:[s.jsxs("button",{type:"button",disabled:Ve,onClick:()=>{$()},className:"flex w-full items-center gap-3 rounded-xl px-3 py-3 text-left transition hover:bg-surface-2 active:bg-surface-elevated disabled:opacity-60",children:[s.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:s.jsx(ui,{size:17})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:B("tab.splitNew")}),s.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:B("tab.splitNewHint")})]})]}),Zt.filter(P=>P.id!==ke?.id).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:B("tab.splitExistingGroups")}),Zt.filter(P=>P.id!==ke?.id).map((P,G)=>{const le=P.sessionIds.flatMap(ot=>{const xt=H.find(Tt=>Tt.id===ot);return xt?[xt]:[]});if(le.length<2)return null;const ge=P.name||`${B("tab.splitWorkspace")} ${G+1}`,$e=le.map(ot=>vt(ot).primary).join(" · ");return s.jsxs("button",{type:"button",onClick:()=>pn(le[0].id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[s.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:s.jsx(Uc,{size:15})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground",children:ge}),s.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:B("tab.splitOccupied")})]}),s.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[B("tab.sessionCount",{count:le.length})," · ",$e]})]}),s.jsx(Ba,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},P.id)})]}),s.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:B("tab.splitAvailableSessions")}),H.filter(P=>!Zt.some(G=>G.sessionIds.includes(P.id))&&P.id!==ne).length===0&&Zt.filter(P=>P.id!==ke?.id).length===0?s.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:B("tab.splitNoOtherSessions")}):H.filter(P=>!Zt.some(G=>G.sessionIds.includes(P.id))&&P.id!==ne).map(P=>{const G=Ur.get(P.id)??null,le=vt(P);return s.jsxs("button",{type:"button",onClick:()=>pn(P.id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[s.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground",children:G?s.jsx(od,{size:15}):s.jsx(Uc,{size:15})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[12px] font-medium text-foreground",children:le.primary}),s.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:G?yd(G)??G:P.name})]}),s.jsx(Ba,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},P.id)})]})]})]}),pe&&s.jsx("div",{className:"fixed inset-x-3 bottom-4 z-toast mx-auto max-w-md rounded-xl border border-border/20 bg-surface-elevated px-4 py-3 text-center text-[12px] text-foreground shadow-lg",children:pe})]})};function NM({sessionId:e,compact:t=!1,onDone:r,onInsertTodoPrompt:n}){const a=V5(),[l,c]=Af(e,a.has("session.owner-menu"));if(!a.has("session.owner-menu"))return null;const h=`inline-flex items-center gap-2 text-xs hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-ring ${t?"min-h-7 rounded px-2":"min-h-11 rounded-xl px-3"}`;return s.jsxs("div",{className:`border-b border-border/15 ${t?"space-y-1 px-2 py-1":"space-y-2 px-3 py-3"}`,children:[s.jsx("div",{role:"group","aria-label":"会话显示方式",className:`flex gap-1 bg-surface-2 ${t?"rounded-md p-0.5":"rounded-xl p-1"}`,children:[["terminal","终端",nb],["chat","普通对话",wc]].map(([p,m,x])=>s.jsxs("button",{type:"button","aria-pressed":l===p,className:`${h} flex-1 justify-center ${l===p?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,onClick:()=>{c(p),r()},children:[s.jsx(x,{size:t?14:15}),m]},p))}),a.has("todo.guidance")&&n&&s.jsxs("button",{type:"button",className:`${h} w-full justify-start text-foreground`,onClick:n,children:[s.jsx(Cb,{size:t?14:15}),"插入待办提示"]}),a.has("session.share")&&s.jsxs("button",{type:"button",className:`${h} w-full justify-start text-foreground`,onClick:()=>{r(),R7({inviteSessionId:e,viewMode:l})},children:[s.jsx(Lb,{size:t?14:15}),"分享这个会话"]})]})}const RM="【待办指引:需要添加待办时,先执行 `td todo --help` 查看用法。】";function MM(e,t){const r=Ki(),n=as(),a=()=>Ki()===r&&!r?.closed&&as()?.url===n?.url&&as()?.targetPeerId===n?.targetPeerId;return new Promise(l=>{let c=!1,h=!1;const p=()=>{y.disconnect(),window.clearTimeout(w),document.removeEventListener("pointerdown",x,!0),document.removeEventListener("keydown",x,!0),window.removeEventListener(pl,b)},m=C=>{c||(c=!0,p(),l(C))},x=()=>{h||m("cancelled")},b=()=>{if(c||h)return;if(!a()){m("cancelled");return}const C=Array.from(document.querySelectorAll("[data-session-workspace]")).find(S=>S.dataset.sessionWorkspace===e&&S.dataset.sessionActive==="true"&&S.dataset.sessionInputReady==="true");!C||M7()||(h=!0,p(),gm(t,e,()=>a()&&C.isConnected&&C.dataset.sessionActive==="true",C,{paste:!0,submitAfterPaste:!1,focus:!0}).then(S=>m(S?"inserted":a()?"failed":"cancelled"),()=>m(a()?"failed":"cancelled")))},y=new MutationObserver(b);y.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["data-session-active","data-session-input-ready","aria-hidden","inert"]});const w=window.setTimeout(()=>m(a()?"failed":"cancelled"),8e3);document.addEventListener("pointerdown",x,!0),document.addEventListener("keydown",x,!0),window.addEventListener(pl,b),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e})),requestAnimationFrame(b)})}function jM({sessionId:e}){const[t,r,n,a]=Af(e),l=t==="chat"?"切换到终端":"切换到对话",c=t==="chat"?nb:wc;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":l,title:l,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md ring-1 ring-border/10 transition hover:bg-surface-elevated sm:h-8 sm:w-8 ${t==="chat"?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,onPointerDown:h=>h.preventDefault(),onClick:()=>{const h=document.activeElement;h instanceof HTMLElement&&h.matches('textarea,input,[contenteditable="true"]')&&h.blur(),r(t==="chat"?"terminal":"chat")},children:s.jsx(c,{size:15})}),n&&Wi.createPortal(s.jsxs("div",{role:"alert",className:"fixed inset-x-3 bottom-4 z-toast mx-auto flex max-w-md items-center gap-3 rounded-xl border border-border bg-surface px-4 py-3 text-xs text-foreground shadow-lg",children:[s.jsx("span",{className:"flex-1",children:n}),s.jsx("button",{type:"button",className:"min-h-9 shrink-0 px-2 text-primary",onClick:a,children:"关闭"})]}),document.body)]})}const DM={sm:"h-4 w-7",md:"h-6 w-10"},QM={sm:"h-3 w-3",md:"h-5 w-5"},BM={sm:"translate-x-3",md:"translate-x-4"};function hl({checked:e,disabled:t=!1,size:r="md",className:n=""}){return s.jsx("span",{"aria-hidden":"true",className:`inline-flex shrink-0 items-center rounded-full transition ${DM[r]} ${e?"bg-primary":"bg-surface-elevated"} ${t?"opacity-50":""} ${n}`,children:s.jsx("span",{className:`mx-0.5 inline-block rounded-full bg-[var(--background)] shadow transition ${QM[r]} ${e?BM[r]:""}`})})}function PM(){if(typeof window>"u")return Q0(void 0);try{const e=window.localStorage.getItem(zm);return Q0(e?JSON.parse(e):void 0)}catch{return Q0(void 0)}}function Jp(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(zm),r=t?JSON.parse(t):{},n=Q0({...r,...e});window.localStorage.setItem(zm,JSON.stringify(n))}catch{}}function OM(){const[e,t]=L.useState(PM);L.useEffect(()=>{Jp(e)},[e]);const r=L.useCallback(a=>{t(l=>{const c=Q0({...l,...a});return Jp(c),c})},[]),n=L.useCallback(()=>{const a=Q0(void 0);t(a),Jp(a)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:n}}const Km="termdock-settings";function FM(e){return e==="shell"||e==="tmux"}function $M(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(Km);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&FM(t.newSessionMode)?t.newSessionMode:null,n=r??"shell",a=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:n,tmuxName:a,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function e5(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Km),n={...t?JSON.parse(t):{},...e};window.localStorage.setItem(Km,JSON.stringify(n))}catch{}}function UM(){const[e,t]=L.useState($M),r=L.useCallback((a,l)=>{const c=l?.userInitiated!==!1;t(h=>({...h,mode:a,userSelectedMode:c?a:h.userSelectedMode})),c&&e5({newSessionMode:a,newSessionModeUserSelected:!0})},[]),n=L.useCallback(a=>{t(l=>({...l,tmuxName:a})),e5({newSessionTmuxName:a})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:n}}const zM=550,HM=10;function Df(){const e=v.useRef(null),t=v.useRef(null),r=v.useRef(!1),n=v.useRef(!1),a=v.useRef(null),l=v.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),c=v.useCallback(()=>{l(),t.current=null},[l]);return v.useEffect(()=>{const p=()=>{c(),r.current=!1},m=()=>{document.hidden&&p()};return window.addEventListener("blur",p),document.addEventListener("visibilitychange",m),()=>{c(),a.current!=null&&window.clearTimeout(a.current),window.removeEventListener("blur",p),document.removeEventListener("visibilitychange",m)}},[c]),v.useCallback(p=>({onPointerDown:m=>{n.current=!1,a.current!=null&&(window.clearTimeout(a.current),a.current=null),!(m.pointerType!=="touch"&&m.pointerType!=="pen")&&(c(),r.current=!1,t.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY},e.current=window.setTimeout(()=>{e.current=null,t.current&&(r.current=!0,W0(),p())},zM))},onPointerMove:m=>{const x=t.current;if(!x||x.pointerId!==m.pointerId||r.current)return;const b=m.clientX-x.startX,y=m.clientY-x.startY;Math.hypot(b,y)>HM&&c()},onPointerUp:m=>{r.current&&(m.preventDefault(),r.current=!1,n.current=!0,a.current!=null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{n.current=!1,a.current=null},600)),c()},onPointerCancel:c,onPointerLeave:m=>{t.current?.pointerId===m.pointerId&&!r.current&&c()},onClickCapture:m=>{n.current&&(n.current=!1,a.current!=null&&(window.clearTimeout(a.current),a.current=null),m.preventDefault(),m.stopPropagation())}}),[c])}function t5({mode:e,activeProgram:t,promptState:r,shellNames:n}){return e!=="tmux"?!1:r==="running"?!0:r==="idle"?!1:t===null||!n.has(t.toLowerCase())}function WM(e,t){return!!e&&!!t&&e.id===t.id&&e.target===t.target&&e.client===t.client&&e.backend===t.backend&&e.mode===t.mode&&e.tmux===t.tmux}function GM({sessionId:e,confirmButton:t,onConfirm:r,onCancel:n,isCurrent:a}){const l=v.useRef({sessionId:e,onConfirm:r,onCancel:n,isCurrent:a});return l.current={sessionId:e,onConfirm:r,onCancel:n,isCurrent:a},v.useEffect(()=>{t.current?.focus({preventScroll:!0})},[e,t]),v.useLayoutEffect(()=>{let c=!1;const h=p=>{if(l.current.sessionId===e&&!(p.key!=="Escape"&&p.key!=="Enter")){if(p.isComposing||p.keyCode===229||p.key==="Enter"&&(p.altKey||p.ctrlKey||p.metaKey||p.shiftKey)){p.key==="Enter"&&p.target instanceof Node&&t.current?.contains(p.target)&&p.preventDefault();return}p.preventDefault(),p.stopImmediatePropagation(),!(c||p.repeat)&&(c=!0,p.key==="Escape"||l.current.isCurrent?.()===!1?l.current.onCancel():l.current.onConfirm())}};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[e,t]),null}function qM(){const[e,t]=v.useState(null),r=v.useRef(0),n=v.useRef(!1),a=v.useCallback(c=>{r.current++,n.current&&t(c)},[]),l=v.useCallback(async()=>{const c=++r.current,h=as();try{const p=await j7();n.current&&c===r.current&&h===as()&&a(p)}catch{}},[a]);return v.useEffect(()=>{n.current=!0;const c=xm(m=>{m.type==="update-state"&&a(m.state)}),h=()=>{a(null),l()},p=()=>{document.visibilityState!=="hidden"&&l()};return window.addEventListener(pl,h),window.addEventListener("pageshow",p),window.addEventListener("focus",p),document.addEventListener("visibilitychange",p),l(),()=>{n.current=!1,r.current++,c(),window.removeEventListener(pl,h),window.removeEventListener("pageshow",p),window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",p)}},[a,l]),{state:e,apply:a,refresh:l}}function VM(e,t,r){return!!(e&&t===e&&!r)}function ZM(e){const[t,r]=v.useState({}),n=v.useCallback(async()=>{const a=Ki();if(!(!a||a.closed||document.visibilityState==="hidden"))try{const l=await a.request({type:"session-sharing-status"});if(Ki()!==a||!Array.isArray(l.items))return;const c=Object.fromEntries(l.items.filter(h=>typeof h.sessionId=="string").map(h=>[h.sessionId,{...h,serviceId:a.targetPeerId}]));r(h=>JSON.stringify(h)===JSON.stringify(c)?h:c)}catch{}},[]);return v.useEffect(()=>{if(!e)return;n();const a=setInterval(()=>{n()},5e3);return window.addEventListener("termdock:sharing-changed",n),window.addEventListener("focus",n),()=>{clearInterval(a),window.removeEventListener("termdock:sharing-changed",n),window.removeEventListener("focus",n)}},[e,n]),{items:t,refresh:n}}function YM({status:e,onChanged:t}){const[r,n]=v.useState(),[a,l]=v.useState(!1),[c,h]=v.useState(""),p=v.useRef(null);return v.useEffect(()=>{(!e||!e.devices&&!e.invitations)&&n(void 0)},[e?.sessionId,e?.devices,e?.invitations]),xc(p,!!r&&!!e&&(!!e.devices||!!e.invitations),()=>n(void 0)),!e||!e.devices&&!e.invitations?null:s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button","aria-label":`已共享,${e.connectedDevices} 台设备连接,管理共享`,title:`已共享 · ${e.connectedDevices} 台设备连接`,"aria-expanded":!!r,className:"sidebar-session-action inline-flex h-7 shrink-0 items-center gap-1 rounded-md px-1.5 text-[10px] text-primary hover:bg-primary/15",onClick:m=>{m.stopPropagation();const x=m.currentTarget.getBoundingClientRect();h(""),n({left:Math.max(8,Math.min(x.left,window.innerWidth-280)),top:Math.max(8,Math.min(x.bottom+6,window.innerHeight-210))})},children:[s.jsx(Lb,{size:11}),s.jsxs("span",{children:["共享 · ",e.connectedDevices]})]}),r&&Wi.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-menu-backdrop",onClick:()=>n(void 0)}),s.jsxs("div",{ref:p,role:"dialog","aria-label":"会话共享状态",className:"fixed z-menu-panel w-[264px] rounded-xl border border-border bg-surface p-3 text-sm text-foreground shadow-xl",style:r,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("strong",{className:"text-xs font-medium",children:"已共享"}),s.jsx("button",{type:"button","aria-label":"关闭共享状态",className:"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-surface-2",onClick:()=>n(void 0),children:s.jsx(zn,{size:14})})]}),s.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["当前 ",e.connectedDevices," 台设备连接 · ",e.devices," 台已授权"]}),e.invitations>0&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[e.invitations," 个邀请待使用"]}),s.jsx("p",{className:"mt-3 text-[11px] leading-5 text-muted-foreground",children:"停止共享会断开此会话的访客连接,并取消对应邀请。"}),c&&s.jsx("p",{role:"alert",className:"mt-2 text-xs text-destructive",children:c}),s.jsx("button",{type:"button",disabled:a,className:"mt-2 min-h-10 w-full rounded-lg bg-destructive/10 px-3 text-xs text-destructive hover:bg-destructive/15 disabled:opacity-40",onClick:async()=>{const m=Ki();if(!m||e.serviceId&&e.serviceId!==m.targetPeerId){h("服务已切换,请重新打开共享状态");return}l(!0),h("");try{await m.request({type:"session-sharing-stop",sessionId:e.sessionId}),Ki()===m&&(t(),n(void 0))}catch{h("暂时无法停止共享,请重试")}finally{l(!1)}},children:a?"正在停止共享…":"停止共享此会话"})]})]}),document.body)]})}const q1="termdock:agent-command-presets:v1",Qf="termdock:new-session-commands:v1",Xm="termdock:launch-commands-changed";function ff(e){try{return localStorage.getItem(e)||""}catch{return""}}function Bf(){try{const e=JSON.parse(ff(Qf)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function V1(){try{const e=JSON.parse(ff(q1)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([t,r])=>{if(!r||typeof r!="object"||!Array.isArray(r.presets))return[];const n=r.presets.filter(a=>!!a&&typeof a=="object"&&"id"in a&&typeof a.id=="string"&&"name"in a&&typeof a.name=="string"&&"command"in a&&typeof a.command=="string"&&!!a.command.trim());return[[t,{presets:n,selectedId:n.some(a=>a.id===r.selectedId)?r.selectedId:null}]]}))}catch{return{}}}function tu(e,t){const r=V1()[e];if(r)return r;const n=Bf()[e]?.trim();return n&&n!==t.trim()?{presets:[{id:"legacy",name:n,command:n}],selectedId:"legacy"}:{presets:[],selectedId:null}}function G6(e,t){const r=tu(e,t);return r.presets.find(n=>n.id===r.selectedId)?.command??t}function TB(e){return Object.prototype.hasOwnProperty.call(V1(),e)||Object.prototype.hasOwnProperty.call(Bf(),e)}function Z1(e,t,r){const n={...Bf(),[e]:t.presets.find(a=>a.id===t.selectedId)?.command??r};localStorage.setItem(Qf,JSON.stringify(n)),localStorage.setItem(q1,JSON.stringify({...V1(),[e]:t})),window.dispatchEvent(new Event(Xm))}function Jm(e,t,r){const n=tu(e,t);if(r!==null&&!n.presets.some(a=>a.id===r))throw new Error("Command preset unavailable");Z1(e,{...n,selectedId:r},t)}function q6(e,t,r){const n=r.command.trim();if(!n)throw new Error("Command required");const a=tu(e,t),l={id:r.id&&a.presets.some(h=>h.id===r.id)?r.id:crypto.randomUUID(),name:r.name.trim()||n,command:n},c=a.presets.filter(h=>h.id!==l.id);return Z1(e,{presets:[...c,l],selectedId:l.id},t),l}function KM(e,t,r){const n=tu(e,t);Z1(e,{presets:n.presets.filter(a=>a.id!==r),selectedId:n.selectedId===r?null:n.selectedId},t)}function XM(e,t,r){const n=tu(e,t),a=n.presets.find(l=>l.id===n.selectedId&&l.command===r.trim())??n.presets.find(l=>l.command===r.trim());a?Jm(e,t,a.id):!r.trim()||r.trim()===t.trim()?Jm(e,t,null):q6(e,t,{name:r.trim(),command:r})}function JM(e){return window.addEventListener(Xm,e),window.addEventListener("storage",e),()=>{window.removeEventListener(Xm,e),window.removeEventListener("storage",e)}}function ej(e,t){return v.useSyncExternalStore(JM,()=>`${ff(q1)}
128
+ ${ff(Qf)}`,()=>""),tu(e,t)}function tj({groupId:e,version:t,onRestore:r}){const[n,a]=v.useState([]),[l,c]=v.useState(null),[h,p]=v.useState(""),m=v.useRef(!1);v.useEffect(()=>{let b=!0;const y=async()=>{try{const C=await D7();b&&a(C.entries.filter(S=>S.groups.some(I=>I.id===e)))}catch{}},w=yc(()=>{y()},1e4);return()=>{b=!1,w()}},[e,t]);const x=async b=>{if(!m.current){m.current=!0,c(b.sessionId),p("");try{const y=await Q7(b.sessionId);await r(y.session),a(w=>w.filter(C=>C.sessionId!==b.sessionId))}catch(y){p(y instanceof Error?y.message:"恢复失败,归档已保留")}finally{m.current=!1,c(null)}}};return!n.length&&!h?null:s.jsxs("details",{className:"border-t border-border/15 text-muted-foreground",children:[s.jsxs("summary",{className:"flex min-h-11 cursor-pointer items-center gap-2 px-2 text-[11px]",children:[s.jsx(Hh,{size:13}),"已归档的执行会话 · ",n.length]}),h&&s.jsx("p",{role:"alert",className:"px-2 pb-2 text-xs text-destructive",children:h}),n.map(b=>s.jsxs("div",{className:"border-t border-border/10 px-2 py-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:b.title}),s.jsxs("button",{type:"button",disabled:l!==null,onClick:()=>{x(b)},className:"inline-flex min-h-11 shrink-0 items-center gap-1 rounded-md px-2 text-xs text-primary hover:bg-primary/10 disabled:opacity-40",children:[l===b.sessionId&&s.jsx(sn,{size:12,className:"animate-spin"}),l===b.sessionId?"恢复中…":"恢复"]})]}),s.jsx("p",{className:"text-[10px] leading-4",children:b.cleanup.state==="removed"?"执行目录已回收,恢复时重建;分支和结果保留。":b.cleanup.reason||"目录保留,可继续恢复原会话。"}),s.jsxs("details",{children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-[10px]",children:[b.agent.slug," 会话 ID 与目录"]}),s.jsx("code",{className:"block select-text break-all text-[10px]",children:b.agent.sessionId}),s.jsx("span",{className:"mt-1 block select-text break-all text-[10px]",children:b.cwd})]})]},b.sessionId))]})}function r5(e,t){const r=new Set,n=new Set;for(const a of e.filter(l=>l.groupId===t)){const l=a.attempts.find(h=>h.id===a.activeAttemptId)?.assignee,c=l&&a.memberSessions[`${l.serviceId}:${l.sessionId}`];if(a.status==="open"){c&&n.add(c);const h=a.scheduledAssignee;h&&n.add(a.memberSessions[`${h.serviceId}:${h.sessionId}`])}else c&&a.workspace&&a.workflow?.kind==="step"&&a.workflow.isolated&&r.add(c);a.coordinator&&n.add(a.memberSessions[`${a.coordinator.serviceId}:${a.coordinator.sessionId}`]),a.workflow?.reviewers.forEach(h=>n.add(a.memberSessions[`${h.serviceId}:${h.sessionId}`]))}return n.forEach(a=>r.delete(a)),r}const pf={ack:"成员确认接手",working:"成员报告进行中",blocked:"成员报告受阻",complete:"成员提交结果",failed:"成员报告失败"};function mf(e){const t=e.attempts.find(h=>h.id===e.activeAttemptId)?.report;if(!t)return null;const r=typeof t.content=="string"?t.content:"",n=t.summary,a=r.split(/\n\s*\n/).map(h=>h.split(`
129
+ `).filter(p=>!/^#{1,6}\s/.test(p)).join(`
130
+ `).trim()).find(Boolean),l=typeof n=="string"&&n.trim()?n.trim():a,c=Number.isFinite(t.createdAt)&&t.createdAt>0&&Number.isFinite(new Date(t.createdAt).getTime());return{status:t.status,label:pf[t.status]??"成员明确报告",createdAt:c?t.createdAt:null,content:r,summary:l?l.slice(0,512):"报告摘要未提供,请查看详情中的原始报告"}}function Pf(e){if(e.status!=="open")return[];const t=mf(e),r=t&&["blocked","failed"].includes(t.status)?{source:"member",label:t.label,content:t.content,summary:t.summary,createdAt:t.createdAt}:null,n=r&&(e.automationIssueSource==="member-report"||!e.summaryOnly&&!!t?.content&&e.automationIssue===t.content.slice(0,1e3)),a=r&&!t?.content&&!e.automationIssueSource,l=e.automationIssue&&!n?{source:a?"unknown":"system",label:a?"服务记录(来源待核对)":e.automationIssue.startsWith("消息投递")?"投递需要处理":e.activeAttemptId?"自动安排受阻":"执行准备受阻",content:e.automationIssue,summary:e.automationIssue}:null;return[r,l].filter(c=>!!c)}function rj(e){return Pf(e)[0]??null}function Jc(e){if(e.status==="accepted")return e.completionMode==="reviewed"?"独立评审通过":"已验收";if(e.status==="closed")return"已关闭";if(e.purpose==="automation"){const c={unassigned:"后台记录待分派",awaiting_report:"后台执行等待明确报告",ack:"执行成员已确认接手",working:"成员报告进行中",blocked:"成员报告受阻",failed:"成员报告失败",complete:"执行已交付"};return e.execution?c[e.execution.status]:"后台执行记录"}if(e.decisions.some(c=>c.status==="pending"))return"需要你回答";const t=rj(e);if(t)return t.label;if(e.workflow?.paused)return"自动安排已暂停";const r=e.attempts.find(c=>c.id===e.activeAttemptId),n=e.artifacts.filter(c=>c.kind==="plan"&&c.attemptId===e.activeAttemptId).at(-1);if(n&&n.id!==e.approvedPlanArtifactId)return"需要你确认方案";const a=e.artifacts.filter(c=>c.kind==="result"&&c.attemptId===e.activeAttemptId).at(-1),l=a&&e.events.some(c=>c.kind==="revise"&&c.attemptId===e.activeAttemptId&&c.createdAt>=a.createdAt);if(a&&!l){const c=e.artifacts.filter(h=>h.kind==="review"&&h.reviewsArtifactId===a.id).at(-1);return e.workflow&&c?.verdict!=="pass"?c?.verdict==="changes"?"评审要求修改":"等待独立评审":e.workflow?.kind==="step"?"评审通过 · 等待接续":"等待你验收"}return l?e.events.some(c=>c.kind==="revise"&&c.source==="user"&&c.attemptId===e.activeAttemptId&&c.createdAt>=a.createdAt)?"已要求跟进 · 等待新结果":"已要求修改 · 等待新结果":r?r.report?pf[r.report.status]:["failed","expired"].includes(r.deliveryStatus??"")?"投递未成功":e.deliveries.some(c=>c.attemptId===e.activeAttemptId&&c.error)?"投递需要关注":r.deliveryStatus==="delivered"?"已写入终端 · 等待回复":"等待投递":e.scheduledAssignee?e.dependsOn.length?"依赖完成后自动分派":e.workflow?.isolated===!1?"等待分派":"准备独立执行目录":e.dependsOn.length?"等待依赖与分派":"待分派"}function Ji(e){return e.purpose!=="automation"&&e.status==="open"&&["需要你回答","需要你确认方案","等待你验收","执行准备受阻","自动安排受阻","成员报告受阻","成员报告失败","投递未成功","投递需要关注","投递需要处理"].includes(Jc(e))}function n5(){return JSON.stringify(as())}function nj(e){const t=e instanceof Error?e.message:String(e);return(e&&typeof e=="object"&&"name"in e?String(e.name):"")==="UnexpectedEOFError"&&/^Unexpected EOF - stream closed while reading \d+\/\d+ bytes$/.test(t)||t==="Secure response ended unexpectedly"?"连接中断,待处理事项暂时无法加载;恢复后会自动重试。":t||"协作待处理事项加载失败"}const Yu=wd(e=>{let t=0,r,n=null,a;return{tasks:[],allTasks:[],error:null,refresh:async()=>{const l=n5();if(a?.target===l)return a.promise;a?.controller.abort(),r!==l&&(r=l,n=null,e({tasks:[],allTasks:[],error:null}));const c=++t,h=new AbortController,p={owner:c,target:l,controller:h,promise:Promise.resolve()};a=p;const m=()=>a?.owner===c&&n5()===l;return p.promise=(async()=>{try{const{tasks:x}=await sb(void 0,h.signal);m()&&(n=null,e({tasks:x.filter(Ji),allTasks:x,error:null}))}catch(x){if(!m()||h.signal.aborted||x instanceof Error&&x.name==="AbortError")return;const b=x instanceof Error?x.message:String(x);n!==b&&(console.error("[CollaborationTaskInbox] refresh failed",x),n=b),e({error:nj(x)})}finally{a?.owner===c&&(a=void 0)}})(),p.promise}}});function s5(e,t){try{localStorage.setItem(`termdock:tasks:${location.origin}:${e}:open-task`,JSON.stringify(t))}catch{}window.dispatchEvent(new CustomEvent("open-collaboration-task",{detail:{groupId:e,taskId:t}}))}function i5(e){const t=e.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/);return t?{numbers:[Number(t[1]),Number(t[2]),Number(t[3])],prerelease:t[4]??null}:null}function sj(e,t){const r=i5(e),n=i5(t);if(!r||!n)throw new Error(`Invalid version comparison: ${e} / ${t}`);for(let a=0;a<3;a+=1)if(r.numbers[a]!==n.numbers[a])return r.numbers[a]-n.numbers[a];return r.prerelease===n.prerelease?0:r.prerelease===null?1:n.prerelease===null?-1:r.prerelease.localeCompare(n.prerelease,"en",{numeric:!0})}function a5({sessionIds:e}){const t=B7(a=>e.reduce((l,c)=>l+(a.unread[c]?.length??0),0)),{locale:r}=Xr();if(!t)return null;const n=r==="zh"?`${t} 条未读进展`:`${t} unread progress updates`;return s.jsx("span",{title:n,"aria-label":n,className:"inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1 text-[10px] font-medium text-primary",children:t>99?"99+":t})}function ij(e){if(!e.startsWith("remote:"))return null;const t=e.slice(7).split(":");if(t.length!==2)return null;try{const r=decodeURIComponent(t[0]),n=decodeURIComponent(t[1]),a=new URL(r);return!["https:","http:"].includes(a.protocol)||a.origin!==r||!n?null:{origin:r,sessionId:n}}catch{return null}}async function V6(e){const t=ij(e);if(!t)throw new Error("远端会话标识无效");if(window.termdockDesktop?.collaborationFocus)try{if(await window.termdockDesktop.collaborationFocus(e))return}catch{}window.dispatchEvent(new CustomEvent("termdock:open-remote-session",{detail:t}))}function Y1(e){const t=e?.tuiProgress?.state;return(t==="set"||t==="indeterminate")&&e?.agentStatus!=="working"&&e?.agentStatus!=="waiting"&&!e?.agentNeedsReview}function aj(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function oj(e,t,r,n="next"){if(e.length===0)return null;const a=t?e.findIndex(l=>l.sessionId===t):-1;for(let l=1;l<=e.length;l+=1){const c=n==="next"?l:-l,h=(a+c+e.length)%e.length,p=e[h];if(p&&r(p))return p.sessionId}return null}function lj(e,t,r="next"){return oj(e,t,aj,r)}const cj={activeKey:"root",items:[]},uj=()=>()=>{},dj=()=>cj;function hj(e){const t=zo(),r=v.useSyncExternalStore(t?.subscribe??uj,t?.snapshot??dj),n=P7(),a=r.items.map(l=>l.key===n?{...l,reviewCount:e}:l).filter(l=>l.reviewCount>0);return{host:t,groups:a,currentKey:n,active:!t||r.activeKey===n,total:t?e+a.reduce((l,c)=>l+(c.key===n?0:c.reviewCount),0):e,hasOtherAttention:a.some(l=>l.key!==n)}}function fj({groups:e,currentKey:t,onClose:r}){const{t:n}=Xr(),a=v.useId(),l=v.useRef(null),c=v.useRef(null),h=v.useRef(r);h.current=r;const p=v.useRef(!0),[m,x]=v.useState(""),b=e.reduce((C,S)=>C+S.reviewCount,0);v.useEffect(()=>{const C=document.activeElement;c.current?.focus({preventScroll:!0});const S=I=>{if(I.key==="Escape"&&(I.preventDefault(),I.stopImmediatePropagation(),h.current()),I.key!=="Tab")return;const N=Array.from(l.current?.querySelectorAll("button:not(:disabled)")??[]),Q=N[0],W=N[N.length-1],B=!l.current?.contains(document.activeElement);I.shiftKey&&(document.activeElement===Q||B)?(I.preventDefault(),W?.focus()):!I.shiftKey&&(document.activeElement===W||B)&&(I.preventDefault(),Q?.focus())};return document.addEventListener("keydown",S,!0),()=>{document.removeEventListener("keydown",S,!0),p.current&&C?.isConnected&&!C.closest("[inert]")&&C.focus({preventScroll:!0})}},[]);const y=(C,S)=>{const I=zo(),N=I?.snapshot().items.find(W=>W.key===C.key);if(!N?.reviewCount||S&&!N.attentionSessions?.some(W=>W.id===S)){x(n("serviceAttention.changed"));return}p.current=!1;let Q=!1;S&&C.key===t?(window.dispatchEvent(new CustomEvent("termdock:focus-session",{detail:S})),Q=!0):S&&N.service?.targetPeerId?Q=I?.focusSession(N.service.targetPeerId,S)??!1:N.service&&(Q=I?.activate(N.service,!0)??!1),Q?r():(p.current=!0,x(n("serviceAttention.unavailable")))},w=C=>C.phase==="offline"?n("serviceAttention.offline"):C.phase==="login"?n("serviceAttention.login"):C.phase==="connecting"||C.phase==="reconnecting"?n("connection.reconnecting"):null;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":n("common.close"),tabIndex:-1,className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)]",onClick:r}),s.jsx("div",{className:"pointer-events-none fixed inset-0 z-modal-panel flex items-end justify-center p-3 sm:items-center sm:p-6",style:{paddingTop:"max(12px, var(--safe-top-inset, env(safe-area-inset-top, 0px)))",paddingBottom:"max(12px, var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px)))"},children:s.jsxs("section",{ref:l,role:"dialog","aria-modal":"true","aria-labelledby":a,"data-sidebar-gesture-ignore":!0,onKeyDown:C=>C.stopPropagation(),className:"pointer-events-auto flex max-h-full w-full max-w-md flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-xl",children:[s.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[s.jsx(Ol,{size:20,className:"shrink-0 text-[color:var(--warning)]","aria-hidden":"true"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{id:a,className:"text-sm font-semibold",children:n("serviceAttention.title")}),s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:n("serviceAttention.summary",{services:e.length,count:b})})]}),s.jsx("button",{ref:c,type:"button","aria-label":n("common.close"),onClick:r,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl text-muted-foreground hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:s.jsx(zn,{size:18})})]}),s.jsxs("div",{className:"min-h-0 overflow-y-auto overscroll-contain p-2",children:[e.length===0&&s.jsx("p",{role:"status",className:"px-4 py-8 text-center text-sm text-muted-foreground",children:n("serviceAttention.empty")}),e.map(C=>s.jsxs("section",{className:"mb-2 last:mb-0",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3 pb-1 pt-2 text-xs",children:[s.jsx("h3",{className:"min-w-0 flex-1 truncate font-medium",title:C.service?.label,children:C.service?.label||n("serviceAttention.currentService")}),C.key===t&&s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n("agent.currentSession")}),s.jsx("span",{className:"shrink-0 tabular-nums text-[color:var(--warning)]",children:C.reviewCount})]}),w(C)&&s.jsx("p",{className:"px-3 pb-1 text-xs text-[color:var(--warning)]",children:w(C)}),C.attentionSessions?.length?C.attentionSessions.map(S=>s.jsxs("button",{type:"button",onClick:()=>y(C,S.id),className:"flex min-h-14 w-full items-center gap-3 rounded-xl px-3 py-2 text-left hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"line-clamp-2 break-words text-sm",title:S.label,children:S.label}),s.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:S.waiting?n("serviceAttention.waiting"):n("agent.needsReview")})]}),s.jsx(Ci,{size:16,className:"shrink-0 text-muted-foreground","aria-hidden":"true"})]},S.id)):s.jsx("button",{type:"button",onClick:()=>y(C),className:"min-h-11 w-full rounded-xl px-3 py-2 text-left text-sm hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:n("serviceAttention.viewService")})]},C.key))]}),s.jsxs("footer",{className:"shrink-0 border-t border-border px-4 py-3 text-xs text-muted-foreground",children:[m&&s.jsx("p",{role:"alert",className:"mb-1 text-[color:var(--warning)]",children:m}),n("serviceAttention.scope")]})]})})]})}function pj(e){const t=e.icon&&e.isPlugin?`/api/terminal/agent-plugin-icon/${encodeURIComponent(e.slug)}${e.iconVersion?`?v=${Math.floor(e.iconVersion)}`:""}`:void 0,[r,n]=v.useState();if(v.useEffect(()=>{if(n(void 0),!t)return;const a=new AbortController;let l;return fetch(t,{signal:a.signal}).then(async c=>{if(!c.ok)throw new Error(`Icon request failed: ${c.status}`);const h=await c.blob();a.signal.aborted||(l=URL.createObjectURL(h),n({endpoint:t,src:l}))}).catch(()=>{}),()=>{a.abort(),l&&URL.revokeObjectURL(l)}},[t]),!!e.icon)return e.isPlugin?r?.endpoint===t?r?.src:void 0:`/icons/agents/${e.icon}.svg`}const Ja=42,gf=20,mj=10;function e1(e,t,r){return Math.min(r,Math.max(t,e))}function Of(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),n=Math.max(0,e.safeBottom??0),a=Math.max(0,e.safeLeft??0),l=Math.max(0,e.bottomClearance??72),c=a+gf,h=Math.max(c,e.width-r-gf-Ja),p=Math.max(t+12,52),m=Math.max(p,e.height-n-l-Ja);return{minX:c,maxX:h,minY:p,maxY:m}}function o5(e,t){const r=Of(e),n=e1(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*n}}function Vc(e,t){const r=Of(e);return{x:e1(t.x,r.minX,r.maxX),y:e1(t.y,r.minY,r.maxY)}}function l5(e,t){const r=Of(e),n=Vc(e,t),a=(r.minX+r.maxX+Ja)/2,l=n.x+Ja/2<a?"left":"right",c=r.maxY-r.minY;return{position:{x:l==="left"?r.minX:r.maxX,y:n.y},preference:{side:l,yRatio:c>0?(n.y-r.minY)/c:0}}}function c5(e,t,r){const n=Vc(e,t),a=Ja+mj,l=m=>Math.abs(m.x-r.x)<a&&Math.abs(m.y-r.y)<a;if(!l(n))return n;const c=[{...n,y:r.y-a},{...n,y:r.y+a}].map(m=>Vc(e,m)).filter(m=>!l(m)).sort((m,x)=>Math.abs(m.y-n.y)-Math.abs(x.y-n.y));if(c[0])return c[0];const h=Of(e);return[{...n,x:h.minX},{...n,x:h.maxX}].map(m=>Vc(e,m)).filter(m=>!l(m)).sort((m,x)=>Math.abs(m.x-n.x)-Math.abs(x.x-n.x))[0]??n}const Qu="var(--warning)",u5="var(--success)",d5="var(--tmux)",h5="termdock:mobile-attention-position:v1",f5="termdock:running-session-position:v1",gj={side:"right",yRatio:.68},xj={side:"right",yRatio:.54};function p5(e,t){if(typeof window>"u")return t;try{const r=JSON.parse(window.localStorage.getItem(e)??"null");if(r&&(r.side==="left"||r.side==="right")&&typeof r.yRatio=="number"&&Number.isFinite(r.yRatio))return{side:r.side,yRatio:Math.min(1,Math.max(0,r.yRatio))}}catch{}return t}function bj(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function mh(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e));return Number.isFinite(t)?Math.max(0,t):0}function vj(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const n=window.visualViewport,a=n?.width??window.innerWidth,l=n?.height??window.innerHeight,c=t?.getBoundingClientRect(),h=!!(c&&c.width>0&&c.height>0);return{width:a,height:l,safeTop:Math.max(mh("--safe-top-inset"),(h?Math.max(0,c.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(mh("--safe-right-inset"),(h?Math.max(0,a-c.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(mh("--safe-bottom-inset"),(h?Math.max(0,l-c.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(mh("--safe-left-inset"),(h?Math.max(0,c.left):0)+Math.max(0,r.left??0)),bottomClearance:e?gf:72}}function Z6(){const e=Mr.getState(),t=Array.from(e.sessions.values()),r=lj(t,e.activeSessionId);if(!r)return;const n=e.activeSessionId?e.sessions.get(e.activeSessionId):void 0;n?.agentNeedsReview&&e.clearAgentNeedsReview(n.sessionId),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:r}))}function m5(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function Y6(e){switch(e){case"success":return"var(--success)";case"warning":return"var(--warning)";case"danger":return"var(--destructive)";case"info":case"accent":return"var(--accent)";default:return"var(--muted-foreground)"}}function yj({indicator:e,tone:t,size:r}){const n=Y6(t);switch(e){case"spinner":return s.jsx(Ti,{size:r,className:"shrink-0 animate-spin",style:{color:n}});case"question":return s.jsx(Gh,{size:r,className:"shrink-0 animate-bounce-y",style:{color:n}});case"badge":return s.jsx(Ol,{size:r+1,className:"shrink-0 animate-pulse",style:{color:n}});case"terminal":return s.jsx(Go,{size:r,className:"shrink-0",style:{color:n}});case"pulse":return s.jsx(c9,{size:r,className:"shrink-0 animate-pulse",style:{color:n}});case"ring":return s.jsx("span",{className:"block shrink-0 rounded-full border-2",style:{width:r,height:r,borderColor:n}});case"dot":return s.jsx("span",{className:"block shrink-0 rounded-full",style:{width:Math.max(5,r-4),height:Math.max(5,r-4),backgroundColor:n}})}}function Zc({agent:e,size:t=12}){const r=t-4,n=pj(e);return n?e.iconMode==="native"?s.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t},title:e.displayName,children:s.jsx("img",{src:n,alt:e.displayName,style:{width:r,height:r}})}):s.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:s.jsx("span",{className:"block bg-white",style:{width:r,height:r,WebkitMask:`url(${n}) center / contain no-repeat`,mask:`url(${n}) center / contain no-repeat`}})}):s.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:s.jsx(Ad,{size:r,className:"text-white"})})}function wj({sessionMode:e,state:t,size:r=11}){const n=t?.agent?s.jsx(Zc,{agent:t.agent,size:r+1}):e==="tmux"?s.jsx(bc,{size:r,className:"shrink-0"}):s.jsx(Go,{size:r,className:"shrink-0"});if(t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview))return s.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:s.jsx(yj,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})});if(t?.agentStatus==="working")return s.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:s.jsx(Ti,{size:r,className:"shrink-0 animate-spin",style:{color:u5}})});if(t?.agentStatus==="waiting")return s.jsx("span",{title:t.agentMessage??void 0,children:s.jsx(Gh,{size:r,className:"shrink-0 animate-bounce-y",style:{color:Qu}})});if(t?.agentStatus==="done"&&t.agentNeedsReview)return s.jsx("span",{title:t.agentMessage??void 0,children:s.jsx(Ol,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Qu}})});if(t?.agentNeedsReview)return s.jsx("span",{title:t.agentMessage??void 0,children:s.jsx(Ol,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Qu}})});if(Y1(t))return s.jsx("span",{title:t?.tuiProgress?.message??t?.tuiProgress?.app,children:s.jsx(Ti,{size:r,className:"shrink-0 animate-spin",style:{color:u5}})});if(t?.tuiProgress?.source==="osc7501"){const a=t.tuiProgress,l=a.message??a.app;if(a.state==="blocked")return s.jsx("span",{title:l,children:s.jsx(Gh,{size:r,style:{color:Qu}})});if(a.state==="done")return s.jsx("span",{title:l,children:s.jsx(Ol,{size:r,style:{color:Qu}})});if(a.state==="error")return s.jsx("span",{title:l,children:s.jsx(F7,{size:r,style:{color:"var(--destructive)"}})})}return t?.inCopyMode?e==="tmux"?s.jsx(bc,{size:r,className:"shrink-0 animate-pulse",style:{color:d5}}):s.jsx(Go,{size:r,className:"shrink-0 animate-pulse",style:{color:d5}}):n}function Aj({status:e,detail:t,needsReview:r,inCopyMode:n,progress:a}){const{t:l}=Xr();return t&&!r?s.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface animate-pulse",style:{backgroundColor:Y6(t.tone)},title:t.label}):e==="working"?s.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--success)] ring-2 ring-surface shadow-[0_0_6px_rgb(var(--success-rgb)_/_0.50)] animate-pulse",title:l("agent.aiRunning")}):e==="waiting"||r?s.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:l(r?"agent.finishedReview":"agent.aiWaiting")}):a?.source==="osc7501"&&["blocked","done","error"].includes(a.state)?s.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface",style:{backgroundColor:a.state==="error"?"var(--destructive)":"var(--warning)"},title:a.message??a.app}):n?s.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-[2px] bg-[var(--tmux)] ring-2 ring-surface",title:l("agent.copyMode")}):null}function K6({count:e,tone:t,title:r}){const{t:n}=Xr();if(e<=0)return null;const a=t==="running"?"inline-flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.12)] px-1.5 py-0.5 text-[10px] font-medium text-[color:var(--success)]":"inline-flex min-h-6 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-0.5 text-[10px] font-semibold text-[color:var(--warning)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.24)] transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)] active:scale-[0.97]",l=t==="running"?"h-1.5 w-1.5 rounded-full bg-[var(--success)] animate-pulse":"h-1.5 w-1.5 rounded-full bg-[var(--warning)] animate-pulse";if(t==="review"){const c=r??n("agent.jumpToNext");return s.jsxs("button",{type:"button",className:a,title:`${c} · ${n("agent.jumpToNext")}`,"aria-label":`${c}: ${e}. ${n("agent.jumpToNext")}`,onClick:Z6,children:[s.jsx(Ol,{size:11,className:"shrink-0"}),s.jsx("span",{children:n("agent.needsReview")}),s.jsx("span",{className:"tabular-nums",children:e})]})}return s.jsxs("span",{className:a,title:r,children:[s.jsx("span",{className:l}),e]})}function Tj({runningCount:e,reviewCount:t,className:r=""}){const n=[];return e>0&&n.push({key:"running",count:e,className:"bg-[var(--success)] text-[color:var(--success-foreground)]"}),t>0&&n.push({key:"review",count:t,className:"bg-[var(--warning)] text-[color:var(--warning-foreground)]"}),n.length===0?null:s.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute -right-1 ${n.length>1?"top-0.5 flex flex-col gap-0.5":"-top-1"} ${r}`,children:n.map(a=>s.jsx("span",{className:`flex h-3 min-w-3 items-center justify-center rounded-full px-0.5 text-[7px] font-bold leading-3 shadow-sm ring-1 ring-background ${a.className}`,children:a.count>9?"9+":a.count},a.key))})}const Cj=380,g5=10,gh=10,em=52,Sj=104;function Lj(e,t,r){const n=Math.max(0,t.safeLeft??0),a=t.width-Math.max(0,t.safeRight??0),l=Math.max(0,t.safeTop??0),c=t.height-Math.max(0,t.safeBottom??0),h=gf,p=e.x+Ja/2>=n+(a-n)/2,m=p?e.x-gh-n-h:a-h-e.x-Ja-gh,x=Math.max(1,Math.min(Math.max(0,m),Math.max(168,r*Sj))),b=p?e.x-gh-x:e.x+Ja+gh,y=Math.min(Math.max(b,n+h),Math.max(n+h,a-h-x)),w=e.y+Ja/2-em/2,C=Math.min(Math.max(w,l+h),Math.max(l+h,c-h-em));return{left:y,top:C,width:x,height:em,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function x5(e,t,r,n){return t<e.left||t>e.left+e.width||r<e.top-14||r>e.top+e.height+14?null:Math.min(n-1,Math.max(0,Math.floor((t-e.left)/e.itemWidth)))}function _j(e,t){if(e.length===0)return null;const r=t?e.findIndex(n=>n.id===t):-1;return e[(r+1)%e.length]?.id??null}function kj({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:n,attentionButtonEnabled:a=!0,isDesktopLayout:l,containerElement:c,occlusionInsets:h}){const{t:p}=Xr(),m=Sr(oe=>oe.leftOpen),x=Sr(oe=>oe.rightOpen),{isOpen:b}=bb({enabled:!l}),y=l||!m&&!x&&!b,w=hj(e),[C,S]=L.useState(!1);L.useEffect(()=>{(!w.active||!y)&&S(!1)},[w.active,y]);const I=a&&w.total>0&&y,N=t.length>1||t.length===1&&t[0]?.id!==r,Q=n&&t.length>0&&N&&y,W=Math.max(0,h?.top??0),B=Math.max(0,h?.right??0),U=Math.max(0,h?.bottom??0),K=Math.max(0,h?.left??0),re=L.useCallback(()=>vj(l,c,{top:W,right:B,bottom:U,left:K}),[c,l,U,K,B,W]),H=L.useRef({attention:p5(h5,gj),running:p5(f5,xj)}),Oe=L.useCallback(()=>{const oe=re(),F=o5(oe,H.current.attention),we=o5(oe,H.current.running);return{attention:F,running:I&&Q?c5(oe,we,F):we}},[I,re,Q]),[ne,ce]=L.useState(()=>Oe()),Ne=L.useRef(ne);Ne.current=ne;const[Me,be]=L.useState(null),V=L.useRef(null),[Ke,he]=L.useState("idle"),[Be,ae]=L.useState(null),X=L.useRef(null),He=L.useRef({attention:!1,running:!1});L.useEffect(()=>()=>{const oe=X.current?.longPressTimer;oe!=null&&window.clearTimeout(oe)},[]),L.useEffect(()=>{if(Q)return;const oe=X.current?.longPressTimer;oe!=null&&window.clearTimeout(oe),X.current=null,he("idle"),ae(null)},[Q]),L.useLayoutEffect(()=>{const oe=()=>{const we=Oe();Ne.current=we,ce(we)};oe(),window.addEventListener("resize",oe),window.addEventListener("orientationchange",oe),window.visualViewport?.addEventListener("resize",oe);const F=typeof ResizeObserver>"u"?null:new ResizeObserver(oe);return c&&F?.observe(c),()=>{window.removeEventListener("resize",oe),window.removeEventListener("orientationchange",oe),window.visualViewport?.removeEventListener("resize",oe),F?.disconnect()}},[c,Oe]);const je=L.useCallback(oe=>oe==="attention"?Q:I,[I,Q]),ve=L.useCallback((oe,F)=>{if(!je(oe))return F;const we=oe==="attention"?"running":"attention";return c5(re(),F,Ne.current[we])},[re,je]),Fe=L.useCallback((oe,F,we,Qe)=>{const tt=re(),it=F.moved?Vc(tt,{x:F.startX+(we-F.originX),y:F.startY+(Qe-F.originY)}):Ne.current[oe],Rt=l5(tt,it),Xt=ve(oe,Rt.position),Zt=l5(tt,Xt);H.current[oe]=Zt.preference,bj(oe==="attention"?h5:f5,Zt.preference);const Lt={...Ne.current,[oe]:Zt.position};Ne.current=Lt,ce(Lt)},[ve,re]),lt=L.useCallback(oe=>{He.current[oe]=!0,window.setTimeout(()=>{He.current[oe]=!1},0)},[]),ye=L.useCallback(oe=>{const F=V.current;!F||F.kind!=="attention"||F.pointerId!==oe.pointerId||(V.current=null,be(null),Fe("attention",F,oe.clientX,oe.clientY),F.moved&&lt("attention"))},[Fe,lt]),de=$0(()=>{V.current&&(V.current.moved&&lt("attention"),V.current=null,be(null))}),nt={onPointerDown:oe=>{oe.stopPropagation(),oe.button===0&&(de(oe),oe.currentTarget.setPointerCapture(oe.pointerId),V.current={kind:"attention",pointerId:oe.pointerId,originX:oe.clientX,originY:oe.clientY,startX:ne.attention.x,startY:ne.attention.y,moved:!1})},onPointerMove:oe=>{const F=V.current;if(!F||F.kind!=="attention"||F.pointerId!==oe.pointerId)return;const we=oe.clientX-F.originX,Qe=oe.clientY-F.originY;if(!F.moved&&Math.hypot(we,Qe)<5)return;F.moved=!0,be("attention");const tt=re(),it=ve("attention",Vc(tt,{x:F.startX+we,y:F.startY+Qe})),Rt={...Ne.current,attention:it};Ne.current=Rt,ce(Rt)},onPointerUp:ye,onPointerCancel:ye},Xe=c?Lj(ne.running,re(),t.length):null,pt=oe=>{oe.longPressTimer!==null&&(window.clearTimeout(oe.longPressTimer),oe.longPressTimer=null)},xe=$0(()=>{const oe=X.current;oe&&(pt(oe),X.current=null,he("idle"),ae(null),oe.mode!=="pressing"&&lt("running"))}),mt={onPointerDown:oe=>{if(oe.stopPropagation(),oe.button!==0)return;xe(oe),oe.currentTarget.setPointerCapture(oe.pointerId);const F=oe.pointerId,we={pointerId:F,originX:oe.clientX,originY:oe.clientY,startX:ne.running.x,startY:ne.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};we.longPressTimer=window.setTimeout(()=>{const Qe=X.current;!Qe||Qe.pointerId!==F||Qe.mode!=="pressing"||(Qe.longPressTimer=null,Qe.mode="dragging",He.current.running=!0,he("dragging"))},Cj),X.current=we,he("pressing"),ae(null)},onPointerMove:oe=>{const F=X.current;if(!F||F.pointerId!==oe.pointerId)return;const we=oe.clientX-F.originX,Qe=oe.clientY-F.originY;if(F.mode==="pressing")if(Math.abs(we)>=g5&&Math.abs(we)>=Math.abs(Qe))pt(F),F.mode="selecting",He.current.running=!0,he("selecting");else if(Math.hypot(we,Qe)>=g5){pt(F),F.mode="cancelled",He.current.running=!0,he("idle");return}else return;if(F.mode==="selecting"){const Xt=Xe?x5(Xe,oe.clientX,oe.clientY,t.length):null;F.selectedIndex=Xt,ae(Xt);return}if(F.mode!=="dragging"||!F.moved&&Math.hypot(we,Qe)<5)return;F.moved=!0;const tt=re(),it=ve("running",Vc(tt,{x:F.startX+we,y:F.startY+Qe})),Rt={...Ne.current,running:it};Ne.current=Rt,ce(Rt)},onPointerUp:oe=>{const F=X.current;if(!F||F.pointerId!==oe.pointerId)return;pt(F);const we=F.mode;if(we==="selecting"){const Qe=Xe?x5(Xe,oe.clientX,oe.clientY,t.length):F.selectedIndex,tt=Qe===null?null:t[Qe]?.id;tt&&m5(tt)}else we==="dragging"&&Fe("running",F,oe.clientX,oe.clientY);X.current=null,he("idle"),ae(null),we!=="pressing"&&lt("running")},onPointerCancel:oe=>{const F=X.current;!F||F.pointerId!==oe.pointerId||(pt(F),X.current=null,he("idle"),ae(null),lt("running"))}},It=(oe,F)=>s.jsx("span",{className:`pointer-events-none absolute -right-1 -top-1 z-10 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-surface px-1 text-[9px] font-bold tabular-nums ring-2 ring-[var(--chrome-bg)] ${F==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:oe>9?"9+":oe}),At=()=>{const oe=w.hasOtherAttention?p("serviceAttention.title"):p("agent.jumpToNext"),F=ne.attention,we=Me==="attention";return s.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...nt,onClick:Qe=>{Qe.stopPropagation(),!He.current.attention&&(w.hasOtherAttention?S(!0):Z6())},className:`fixed z-chrome-hint inline-flex items-center justify-center rounded-full bg-[var(--warning)] text-[color:var(--warning-foreground)] shadow-[0_8px_24px_var(--app-shadow-strong)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.35)] animate-fade-in ${we?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{display:C?"none":void 0,left:F.x,top:F.y,width:Ja,height:Ja,touchAction:"none"},"aria-label":`${oe}: ${w.total}`,"aria-haspopup":w.hasOtherAttention?"dialog":void 0,title:oe,children:[s.jsx(Ol,{size:17,className:"shrink-0"}),It(w.total,"attention")]},"attention")},Nt=()=>{const oe=t.length,F=ne.running,we=Ke==="selecting",Qe=Ke==="dragging";return s.jsxs(L.Fragment,{children:[s.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":Ke,...mt,onClick:tt=>{if(tt.stopPropagation(),He.current.running)return;const it=_j(t,r);it&&m5(it)},className:`fixed z-chrome-hint inline-flex select-none items-center justify-center rounded-full bg-[var(--success)] text-[color:var(--success-foreground)] shadow-[0_8px_24px_var(--app-shadow-strong)] ring-1 ring-[rgb(var(--success-rgb)_/_0.35)] animate-fade-in ${Qe?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":we?"cursor-ew-resize scale-[1.04] ring-2 ring-[rgb(var(--success-rgb)_/_0.55)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{left:F.x,top:F.y,width:Ja,height:Ja,touchAction:"none"},"aria-label":`${p("agent.jumpToNextRunning")}: ${oe}`,title:p("agent.runningSessionGestureHint"),children:[s.jsx(Ti,{size:18,className:"shrink-0 animate-spin"}),It(oe,"running")]}),we&&Xe&&s.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":Xe.side,"aria-label":p("agent.selectRunningSession"),className:"pointer-events-none fixed z-popover flex overflow-hidden rounded-full border border-border/15 bg-surface/95 p-1 shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",style:{left:Xe.left,top:Xe.top,width:Xe.width,height:Xe.height},children:t.map((tt,it)=>{const Rt=it===Be,Xt=tt.id===r,Zt=`${tt.label}${tt.detail?` · ${tt.detail}`:""}${Xt?` · ${p("agent.currentSession")}`:""}`;return s.jsxs("div",{role:"option","aria-selected":Rt,"data-running-session-option":tt.id,"data-selected":Rt?"true":"false",title:Zt,className:`relative flex min-w-0 flex-1 items-center justify-center gap-1.5 rounded-full px-2 transition-[background-color,color,transform] duration-100 ${Rt?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":Xt?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-foreground"}`,children:[s.jsx("span",{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[9px] font-bold tabular-nums ${Rt?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:it+1}),s.jsx("span",{className:"truncate text-[10px] font-medium",children:tt.label})]},tt.id)})})]},"running")};return!I&&!Q&&!C||c===null||typeof document>"u"?null:s.jsxs(O7,{children:[I&&At(),Q&&!C&&Nt(),C&&w.active&&y&&s.jsx(fj,{groups:w.groups,currentKey:w.currentKey,onClose:()=>S(!1)})]})}const tm="min-h-11 w-full min-w-0 rounded-lg border border-border/40 bg-surface-2 px-3 py-2 text-base text-foreground outline-none focus:border-primary sm:text-sm";function Ij({agent:e,value:t,onChange:r}){const{t:n}=Xr(),a=v.useId(),l=v.useRef(null),c=v.useRef(null),{presets:h,selectedId:p}=ej(e.slug,e.command),m=p===null&&t.trim()===e.command.trim()?void 0:h.find(N=>N.id===p&&N.command===t.trim())??h.find(N=>N.command===t.trim()),[x,b]=v.useState(null),[y,w]=v.useState(!1),C=()=>{b(null),w(!1)};xc(l,!!x,C,()=>c.current);const S=m?.id??(!t.trim()||t.trim()===e.command.trim()?"__default__":"__current__"),I=N=>{if(w(!1),N==="__new__"){b({name:"",command:t||e.command});return}const Q=h.find(W=>W.id===N);r(Q?.command??e.command);try{Jm(e.slug,e.command,Q?.id??null)}catch{w(!0)}};return s.jsxs("div",{className:"min-w-0 space-y-1.5 text-sm",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("label",{htmlFor:a,className:"text-muted-foreground",children:n("sidebar.commandPreset")}),s.jsx("button",{type:"button",className:"min-h-9 shrink-0 px-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{w(!1),b({id:m?.id,name:m?.name??"",command:t||e.command})},children:n("sidebar.changeStartupCommand")})]}),s.jsxs("select",{ref:c,id:a,className:tm,value:S,onChange:N=>I(N.target.value),children:[s.jsx("option",{value:"__default__",children:n("sidebar.agentDefaultCommand")}),h.map(N=>s.jsx("option",{value:N.id,children:N.name},N.id)),S==="__current__"&&s.jsx("option",{value:"__current__",children:n("sidebar.currentAgentCommand")}),s.jsx("option",{value:"__new__",children:n("sidebar.addAgentCommand")})]}),y&&!x&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:n("sidebar.saveStartupCommandFailed")}),x&&Wi.createPortal(s.jsxs("div",{"data-sidebar-composer-popover":"sidebar-launch-options",children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:C,"aria-label":n("common.cancel")}),s.jsxs("section",{ref:l,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":`${a}-title`,className:"fixed bottom-[max(0.75rem,env(safe-area-inset-bottom,0px))] left-3 right-3 z-modal-panel flex max-h-[calc(100svh-2rem)] flex-col overflow-hidden rounded-2xl border border-border/30 bg-surface text-foreground shadow-xl sm:bottom-auto sm:left-1/2 sm:right-auto sm:top-1/2 sm:w-[28rem] sm:max-w-[calc(100vw-2rem)] sm:-translate-x-1/2 sm:-translate-y-1/2",children:[s.jsx("header",{className:"shrink-0 border-b border-border/20 px-5 py-4",children:s.jsx("h2",{id:`${a}-title`,className:"text-base font-semibold",children:n("sidebar.customStartupCommand")})}),s.jsxs("form",{className:"flex min-h-0 flex-col",onSubmit:N=>{N.preventDefault(),N.stopPropagation();try{const Q=q6(e.slug,e.command,x);r(Q.command),C()}catch{w(!0)}},children:[s.jsxs("div",{className:"min-h-0 space-y-4 overflow-y-auto overscroll-contain px-5 py-4",children:[s.jsxs("label",{className:"block space-y-2 text-sm text-muted-foreground",children:[n("sidebar.commandPresetName"),s.jsx("input",{className:tm,maxLength:80,value:x.name,placeholder:n("sidebar.commandPresetName"),onChange:N=>b({...x,name:N.target.value})})]}),s.jsxs("label",{className:"block space-y-2 text-sm text-muted-foreground",children:[n("sidebar.startupCommand"),s.jsx("input",{required:!0,className:`${tm} font-mono`,value:x.command,placeholder:e.command,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:N=>{b({...x,command:N.target.value}),w(!1)}})]}),s.jsx("p",{className:"text-xs leading-6 text-muted-foreground",children:n("sidebar.sharedAgentCommandsHint")}),y&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:n("sidebar.saveStartupCommandFailed")})]}),s.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border/20 px-4 py-3",children:[x.id&&s.jsx("button",{type:"button",className:"mr-auto min-h-11 px-2 text-xs text-muted-foreground hover:text-destructive",onClick:()=>{try{KM(e.slug,e.command,x.id),r(e.command),C()}catch{w(!0)}},children:n("sidebar.deleteStartupCommand")}),s.jsx("button",{type:"button",onClick:C,className:"min-h-11 rounded-lg px-3 text-sm text-muted-foreground hover:bg-surface-2",children:n("common.cancel")}),s.jsx("button",{type:"submit",disabled:!x.command.trim(),className:"min-h-11 rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground disabled:opacity-40",children:n("sidebar.saveStartupCommand")})]})]})]})]}),document.body)]})}const b5=Qf,pc="__saved_command__:";function xh(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith(pc)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function Bu(){return Bf()}function Ej({directories:e,tmuxAvailable:t,options:r,agents:n,selectedAgent:a,detecting:l,resumeHistory:c,resumeHistoryLoading:h,resumeHistoryPendingId:p,resumeHistoryError:m,onRefreshAgents:x,onSelectAgent:b,onLaunchAgent:y,onResumeHistory:w,onRemoveResumeHistory:C,onClose:S,onOptionsChange:I,additionalContent:N,footerActions:Q,launchPending:W=!1,launchError:B}){const{t:U,locale:K}=Xr(),re=v.useRef(null);xc(re,!0,S,()=>document.querySelector('[aria-controls="sidebar-launch-options"]'));const[H,Oe]=v.useState(a),[ne,ce]=v.useState(!1),[Ne,Me]=v.useState(!1),[be,V]=v.useState(Bu),[Ke,he]=v.useState(()=>xh(Bu())),[Be,ae]=v.useState(null),[X,He]=v.useState("idle"),je=Ne?"__custom__":H?.slug??"__terminal__",ve=H?.command??"",Fe=Ne?be.__custom__??be.__terminal__??"":H?be[je]??G6(H.slug,ve):"",lt=()=>{const oe=Fe.trim()||ve;if(!(Ne&&!oe))try{if(H&&!Ne){XM(H.slug,ve,oe),He("saved");return}const F={...Bu(),[je]:oe};if(Ne){for(const we of xh(Bu()))F[pc+we]=we;F[pc+oe]=oe}localStorage.setItem(b5,JSON.stringify(F)),he(xh(F)),Ne&&ae(oe),He("saved")}catch{He("error")}},ye=()=>{if(Be)try{const oe=Bu();for(const[F,we]of Object.entries(oe))(F.startsWith(pc)||F==="__custom__"||F==="__terminal__")&&we.trim()===Be&&delete oe[F];localStorage.setItem(b5,JSON.stringify(oe)),he(xh(oe)),V(F=>({...F,__custom__:""})),ae(null),He("idle")}catch{He("error")}},de=()=>{const oe=Fe.trim()||ve;W||Ne&&!oe||(lt(),y(H,oe))},nt=v.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),Xe=Ne?Be?pc+Be:"__custom__":H?.slug??"__terminal__",pt=oe=>{He("idle");const F=oe.startsWith(pc)?oe.slice(pc.length):null;ae(F),Me(oe==="__custom__"||F!==null),(F!==null||oe==="__custom__")&&V(we=>({...we,__custom__:F??""})),Oe(n.find(we=>we.slug===oe)??null)},xe=Ne?Be??U("sidebar.customStartupCommand"):H?.displayName??"Terminal",mt=a?.displayName??"Terminal",It=!Ne&&(H===null?a===null:a?.slug===H.slug);v.useEffect(()=>{if(ne)return;const oe=F=>{F.target instanceof Node&&(re.current?.contains(F.target)||F.target instanceof Element&&F.target.closest("[data-sidebar-composer-popover]")?.getAttribute("data-sidebar-composer-popover")===re.current?.id||F.target instanceof Element&&F.target.closest('[aria-controls="sidebar-launch-options"]')||S())};return document.addEventListener("pointerdown",oe,!0),()=>document.removeEventListener("pointerdown",oe,!0)},[ne,S]);const At=oe=>{I({...r,cwd:oe}),ce(!1)},Nt=oe=>new Intl.DateTimeFormat(K==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(oe));return s.jsxs("section",{ref:re,tabIndex:-1,"aria-busy":W,id:"sidebar-launch-options",className:`absolute inset-x-3 bottom-3 z-30 flex flex-col overflow-hidden rounded-2xl border border-border bg-surface shadow-[0_18px_50px_var(--app-shadow-strong),0_4px_14px_var(--app-shadow-soft)] animate-slide-down ${Q?"max-h-[min(70svh,42rem,calc(100%_-_4.5rem))]":"max-h-[min(56svh,36rem,calc(100%_-_4.5rem))]"}`,"aria-label":U("sidebar.newSessionComposerTitle"),children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 py-1.5",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground",children:s.jsx(Go,{size:14})}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:U("sidebar.newSessionComposerTitle")})})]}),s.jsx("button",{type:"button",onClick:S,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":U("common.close"),children:s.jsx(zn,{size:14})})]}),s.jsxs("fieldset",{disabled:W,className:"min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain border-0 px-3 pb-1",children:[s.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[s.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:U("sidebar.sessionMode")}),s.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-surface p-0.5",children:["shell","tmux"].map(oe=>s.jsx("button",{type:"button",disabled:oe==="tmux"&&!t,onClick:()=>I({...r,mode:oe}),"aria-pressed":r.mode===oe,title:oe==="tmux"?U(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===oe?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:U(oe==="shell"?"sidebar.newShell":"sidebar.newTmux")},oe))})]}),s.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:U("sidebar.startupCommand")}),s.jsx("button",{type:"button",onClick:x,disabled:l,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground disabled:opacity-50",title:U("sidebar.detectAgents"),"aria-label":U("sidebar.detectAgents"),children:s.jsx(sn,{size:12,className:l?"animate-spin":""})})]}),s.jsxs("div",{role:"radiogroup","aria-label":U("sidebar.startupCommand"),className:"flex flex-wrap gap-1",children:[n.map(oe=>{const F=!Ne&&H?.slug===oe.slug;return s.jsxs("button",{type:"button",role:"radio","aria-checked":F,onClick:()=>pt(oe.slug),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${F?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[s.jsx(Zc,{agent:oe,size:12}),s.jsx("span",{className:"max-w-[9rem] truncate",children:oe.displayName}),a?.slug===oe.slug&&s.jsx("span",{className:"ml-0.5 text-[9px] text-muted-foreground",children:U("sidebar.defaultAgent")})]},oe.slug)}),Ke.map(oe=>{const F=Ne&&Be===oe;return s.jsxs("button",{type:"button",role:"radio","aria-checked":F,onClick:()=>pt(pc+oe),title:oe,className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 transition ${F?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[s.jsx(j0,{size:10,className:"shrink-0"}),s.jsx("span",{className:"max-w-[9rem] truncate font-mono text-[10px]",children:oe})]},oe)}),s.jsxs("button",{type:"button",role:"radio","aria-checked":Xe==="__terminal__",onClick:()=>pt("__terminal__"),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${Xe==="__terminal__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[s.jsx(Go,{size:11,className:"shrink-0"}),s.jsx("span",{children:"Terminal"}),a===null&&s.jsx("span",{className:"ml-0.5 text-[9px] font-normal text-muted-foreground",children:U("sidebar.defaultAgent")})]}),s.jsxs("button",{type:"button",role:"radio","aria-checked":Xe==="__custom__",onClick:()=>pt("__custom__"),className:`inline-flex min-h-7 items-center gap-0.5 rounded-md px-2 text-[10.5px] font-medium transition ${Xe==="__custom__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[s.jsx(ui,{size:10,className:"shrink-0"}),s.jsx("span",{children:U("sidebar.addStartupCommand")})]})]}),!It&&!Ne&&s.jsxs("div",{className:"mt-1 flex min-h-8 items-center justify-between gap-2 px-0.5 text-[10px]",children:[s.jsx("span",{className:"truncate text-muted-foreground",children:U("sidebar.currentDefaultAgent",{name:mt})}),s.jsx("button",{type:"button",onClick:()=>b(H),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:U("sidebar.makeDefault")})]}),X==="error"&&s.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:U("sidebar.saveStartupCommandFailed")}),H&&!Ne&&s.jsx("div",{className:"mt-2",children:s.jsx(Ij,{agent:H,value:Fe,onChange:oe=>{V(F=>({...F,[je]:oe})),He("idle")}},H.slug)}),Ne&&s.jsxs("details",{open:Ne&&!Be||void 0,className:"group/command mt-0.5",children:[s.jsxs("summary",{className:"ml-auto flex min-h-8 w-fit cursor-pointer list-none items-center gap-1 rounded-md px-1 text-[10px] text-muted-foreground transition hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/50 [&::-webkit-details-marker]:hidden",children:[U(Ne&&!Be?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),s.jsx(O0,{size:11,className:"transition-transform group-open/command:rotate-180"})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("label",{htmlFor:"new-session-command",className:"sr-only",children:U("sidebar.startupCommand")}),H&&Fe!==ve&&s.jsx("button",{type:"button",onClick:()=>{V(oe=>({...oe,[je]:ve})),He("idle")},className:"min-h-8 rounded-md px-2 text-[10px] text-primary transition hover:bg-primary/10",children:U("sidebar.resetStartupCommand")})]}),s.jsx("input",{id:"new-session-command",value:Fe,onChange:oe=>{V(F=>({...F,[je]:oe.target.value})),He("idle")},placeholder:ve||U("sidebar.startupCommandPlaceholder"),autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoComplete:"off",className:"min-h-10 w-full rounded-lg border-0 bg-surface px-3 font-mono text-[16px] text-foreground outline-none ring-1 ring-inset ring-border transition focus:ring-primary/50 sm:text-[11px]"}),s.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2","aria-live":"polite",children:[Ne&&Be&&s.jsxs("button",{type:"button",onClick:ye,className:"mr-auto inline-flex min-h-9 items-center gap-1 rounded-md px-2 text-[10px] text-muted-foreground transition hover:text-destructive","aria-label":U("sidebar.deleteStartupCommand"),children:[s.jsx(Js,{size:11}),U("sidebar.deleteStartupCommand")]}),s.jsx("button",{type:"button",onClick:lt,disabled:X==="saved"||Ne&&!Fe.trim(),className:"min-h-8 rounded-md px-2 text-[10px] font-medium text-primary transition hover:bg-primary/10 disabled:cursor-default disabled:opacity-50",children:U(X==="saved"?"sidebar.startupCommandSaved":"sidebar.saveStartupCommand")})]}),s.jsx("p",{className:"mb-2 mt-1.5 px-0.5 text-[10px] leading-relaxed text-muted-foreground",children:U(H?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},Be??je),s.jsx("label",{htmlFor:"new-session-directory",className:"mt-2 block text-[11px] text-muted-foreground",children:U("sidebar.workingDirectory")}),s.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>ce(!0),className:"mt-1 flex min-h-11 w-full items-center gap-2 rounded-lg border border-transparent bg-surface px-2.5 font-mono text-[11px] text-foreground outline-none transition hover:bg-surface-2 focus-visible:border-primary",children:[s.jsx(od,{size:12,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{className:`min-w-0 flex-1 truncate text-left ${r.cwd?"":"text-muted-foreground"}`,children:r.cwd||U("sidebar.directoryPlaceholder")})]}),nt.length>0&&s.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":U("sidebar.recentDirectories"),children:nt.map(oe=>s.jsx("button",{type:"button",onClick:()=>At(oe),title:oe,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:yd(oe)||oe},oe))}),(c.length>0||m)&&s.jsxs("details",{className:"mt-1",children:[s.jsxs("summary",{className:"flex min-h-9 cursor-pointer list-none items-center gap-2 rounded-md px-1 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground transition hover:text-foreground",children:[s.jsx(j0,{size:11}),s.jsx("span",{className:"flex-1",children:U("sidebar.resumeHistory")}),h&&s.jsx(Ti,{size:10,className:"animate-spin"}),c.length>0&&s.jsx("span",{className:"normal-case tracking-normal",children:U("sidebar.resumeHistoryCount",{n:c.length})}),s.jsx(O0,{size:11})]}),c.length>0&&s.jsx("div",{className:"mt-1 divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:c.slice(0,6).map(oe=>{const F=p===oe.id;return s.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[s.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>w(oe),className:"flex min-h-11 min-w-0 flex-1 items-center gap-2.5 px-2.5 py-2 text-left disabled:cursor-wait disabled:opacity-60","aria-label":U("sidebar.resumeHistoryAction",{title:oe.title}),children:[s.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:F?s.jsx(Ti,{size:13,className:"animate-spin"}):s.jsx(Zc,{agent:oe.agent,size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[11px] font-semibold text-foreground",children:oe.title}),s.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[oe.agent.displayName," · ",Nt(oe.closedAt)]})]}),s.jsx(rb,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),s.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>C(oe.id),className:"relative inline-flex w-11 shrink-0 items-center justify-center text-muted-foreground transition hover:text-destructive disabled:opacity-40","aria-label":U("sidebar.resumeHistoryRemove",{title:oe.title}),children:[s.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-2 left-0 w-px bg-border opacity-30"}),s.jsx(Js,{size:12})]})]},oe.id)})}),m&&s.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:m})]}),N]}),s.jsxs("div",{className:"shrink-0 bg-surface px-3 pb-3 pt-2",children:[B&&s.jsx("p",{role:"alert",className:"mb-2 text-[11px] leading-relaxed text-destructive",children:B}),s.jsxs("button",{type:"button",onClick:de,disabled:W||Ne&&!Fe.trim(),className:"flex min-h-11 w-full items-center justify-center gap-2 rounded-lg bg-primary px-3 text-[12px] font-semibold text-primary-foreground transition hover:brightness-110 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-40","aria-label":U("sidebar.launchSessionWith",{name:xe}),children:[W?s.jsx(Ti,{size:14}):H?s.jsx(Zc,{agent:H,size:15}):s.jsx(Go,{size:14}),s.jsx("span",{className:"truncate",children:W?U("sidebar.sessionCreating"):U("sidebar.launchSessionWith",{name:xe})})]}),Q]}),s.jsx(wb,{open:ne,initialPath:r.cwd?.trim()||nt[0]||"/",title:U("sidebar.chooseDirectory"),onCancel:()=>ce(!1),onConfirm:At})]})}function Nj({onOpenSettings:e,serverAttention:t,actions:r,compact:n=!1}){const{t:a}=Xr(),[l,c]=v.useState(!1),h=v.useRef(null),p=v.useRef(null),m=v.useRef(null),x=v.useId();return v.useLayoutEffect(()=>{if(!l)return;const b=h.current,y=m.current;if(!b||!y)return;const w=window.visualViewport,C=()=>{const I=b.getBoundingClientRect(),N=(w?.offsetLeft??0)+8,Q=(w?.offsetTop??0)+8,W=(w?.width??window.innerWidth)-16,B=(w?.offsetTop??0)+(w?.height??window.innerHeight)-8,U=Math.max(0,Math.min(256,W)),K=Math.max(0,I.top-Q-4),re=Math.max(0,B-I.bottom-4),H=K>=180||K>=re;Object.assign(y.style,{width:`${U}px`,left:`${Math.max(N,Math.min(I.right-U,N+W-U))}px`,top:`${H?I.top-4:I.bottom+4}px`,maxHeight:`${H?K:re}px`,transform:H?"translateY(-100%)":"none"})};C();const S=typeof ResizeObserver>"u"?null:new ResizeObserver(C);return S?.observe(b),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),w?.addEventListener("resize",C),w?.addEventListener("scroll",C),()=>{S?.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0),w?.removeEventListener("resize",C),w?.removeEventListener("scroll",C)}},[l]),v.useEffect(()=>{if(!l)return;m.current?.querySelector('[role="menuitem"]')?.focus({preventScroll:!0});const b=y=>{y.target instanceof Node&&!h.current?.contains(y.target)&&!m.current?.contains(y.target)&&c(!1)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[l]),s.jsxs("div",{ref:h,role:"group","data-sidebar-gesture-ignore":!0,"aria-label":a("sidebar.moreActions"),className:n?"relative z-20 flex shrink-0 items-center":"relative z-20 mt-2 flex items-center justify-between gap-2",onKeyDown:b=>{l&&b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),c(!1),p.current?.focus({preventScroll:!0}))},children:[!n&&s.jsxs("button",{type:"button",onClick:e,title:t?a("sidebar.serverAttention"):void 0,className:"inline-flex min-h-9 items-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[s.jsx(Sb,{size:14,className:t?"text-destructive":void 0}),s.jsx("span",{children:a("sidebar.settings")})]}),s.jsxs("button",{ref:p,"data-session-sidebar-header-action":n?"":void 0,title:a("sidebar.moreActions"),"aria-label":a("sidebar.moreActions"),type:"button","aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?x:void 0,onClick:()=>c(b=>!b),onKeyDown:b=>{(b.key==="ArrowDown"||b.key==="ArrowUp")&&(b.preventDefault(),c(!0))},className:`relative inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-lg text-[11px] transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${n?"h-9 w-9 shrink-0":"min-h-9 px-2"} ${l?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[s.jsx(Ac,{size:15}),!n&&s.jsx("span",{children:a("sidebar.moreActions")}),n&&t&&s.jsx("span",{"aria-hidden":"true",className:"absolute right-0 top-0 h-1.5 w-1.5 rounded-full bg-destructive"})]}),l&&Wi.createPortal(s.jsx("div",{ref:m,id:x,role:"menu","data-sidebar-gesture-ignore":!0,"data-sidebar-composer-popover":"sidebar-launch-options","aria-label":a("sidebar.moreActions"),className:"fixed z-popover overflow-y-auto overscroll-contain rounded-xl border border-border/15 bg-surface p-1 shadow-[0_12px_32px_var(--app-shadow-soft)] animate-fade-in",onKeyDown:b=>{const y=[...b.currentTarget.querySelectorAll('[role="menuitem"]')],w=y.indexOf(document.activeElement);let C;if(b.key==="ArrowDown")C=(w+1)%y.length;else if(b.key==="ArrowUp")C=(w-1+y.length)%y.length;else if(b.key==="Home")C=0;else if(b.key==="End")C=y.length-1;else if(b.key==="Tab"){c(!1);return}else return;b.preventDefault(),y[C]?.focus({preventScroll:!0})},children:r.map(({label:b,icon:y,onSelect:w,separated:C})=>s.jsxs("div",{role:"none",children:[C&&s.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/40"}),s.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{c(!1),w()},className:"flex min-h-10 w-full items-center gap-2.5 whitespace-nowrap rounded-lg px-2.5 text-left text-[12px] text-foreground transition hover:bg-surface-2 focus:bg-surface-2 focus:outline-none",children:[s.jsx(y,{size:15,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:b})]})]},b))}),document.body)]})}const rm="inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-primary/15 hover:text-primary active:scale-95";function Rj({label:e,count:t,badge:r,actions:n,pinned:a,onTogglePinned:l,onClose:c,onOpenSettings:h,serverAttention:p}){const{t:m}=Xr(),x=v.useRef(null),b=v.useRef(null),[y,w]=v.useState(!0);return v.useLayoutEffect(()=>{const C=x.current;if(!C)return;const S=()=>{const N=getComputedStyle(C),Q=C.clientWidth-parseFloat(N.paddingLeft)-parseFloat(N.paddingRight),W=C.querySelector("button"),B=W?W.getBoundingClientRect().width:36,U=[...b.current?.children??[]],K=U.reduce((Oe,ne)=>Oe+ne.scrollWidth,0)+Math.max(0,U.length-1)*6,re=n.length+(l?1:0)+(a?0:1),H=K+re*B+Math.max(0,re-1)*4+6;w(Q<H+8)};S();const I=typeof ResizeObserver>"u"?null:new ResizeObserver(S);return I?.observe(C),window.addEventListener("resize",S),()=>{I?.disconnect(),window.removeEventListener("resize",S)}}),s.jsxs("div",{ref:x,"data-session-sidebar-header":!0,className:"relative z-20 shrink-0 px-3 py-0.5",children:[s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-3 bottom-0 z-10 h-px bg-border opacity-40"}),s.jsxs("div",{className:"flex min-w-0 w-full items-center gap-1.5",children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:s.jsxs("div",{ref:b,className:"flex min-w-0 items-center gap-1.5 whitespace-nowrap",children:[s.jsx("span",{className:"min-w-0 truncate text-[12px] font-medium text-muted-foreground",children:e}),s.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:t}),r&&s.jsx("span",{className:"flex shrink-0 items-center",children:r})]})}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[y?s.jsx(Nj,{compact:!0,actions:n,serverAttention:p,onOpenSettings:h}):n.map(({label:C,icon:S,onSelect:I})=>s.jsx("button",{"data-session-sidebar-header-action":!0,type:"button",className:rm,"aria-label":C,title:C,onClick:I,children:s.jsx(S,{size:16})},C)),l&&s.jsx("button",{"data-session-sidebar-header-action":!0,type:"button",className:rm,onClick:l,"aria-label":m(a?"sidebar.unpinSidebar":"sidebar.pinSidebar"),title:m(a?"sidebar.unpinSidebar":"sidebar.pinSidebar"),"aria-pressed":a,children:a?s.jsx($7,{size:16}):s.jsx(U7,{size:16})}),!a&&s.jsx("button",{"data-session-sidebar-header-action":!0,type:"button",className:rm,onClick:c,"aria-label":m("common.close"),children:s.jsx(zn,{size:16})})]})]})]})}const X6="termdock:new-session-agent:v1";function Mj(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(X6)||"null");return!e||typeof e.slug!="string"||typeof e.command!="string"?null:{slug:e.slug,command:e.command,displayName:typeof e.displayName=="string"?e.displayName:e.slug,capabilities:Array.isArray(e.capabilities)?e.capabilities.filter(t=>typeof t=="string"):void 0,accentColor:typeof e.accentColor=="string"?e.accentColor:"var(--muted-foreground)",icon:typeof e.icon=="string"?e.icon:null,isPlugin:e.isPlugin===!0,iconMode:e.iconMode==="native"?"native":e.iconMode==="mask"?"mask":void 0,iconVersion:typeof e.iconVersion=="number"?e.iconVersion:void 0}}catch{return null}}function nm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(X6,JSON.stringify(e))}catch{}}function jj(e,t){return e?t.find(r=>r.slug===e)??null:null}function Dj(){const[e,t]=v.useState(Mj),[r,n]=v.useState([]),[a,l]=v.useState(!0),c=v.useCallback(async()=>{l(!0);try{const[p,m]=await Promise.all([V0(),ib()]),x=jj(p.newSessionAgentSlug,m);n(m),t(x),nm(x)}finally{l(!1)}},[]);v.useEffect(()=>{const p=()=>{c().catch(()=>{})};if(performance.getEntriesByName("termdock:startup:initial-viewport-presented").length>0){p();return}return window.addEventListener("termdock:initial-viewport-presented",p,{once:!0}),()=>window.removeEventListener("termdock:initial-viewport-presented",p)},[c]);const h=v.useCallback(async p=>{const m=e;t(p),nm(p);try{await Ka({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(m),nm(m),x}},[e]);return{preference:e,agents:r,detecting:a,refresh:c,selectAgent:h}}function Qj({label:e,disabled:t,onRemove:r,children:n}){const[a,l]=v.useState(null),c=v.useRef(null),h=v.useRef(null),p=(m=!1)=>{l(null),m&&c.current?.querySelector("button")?.focus({preventScroll:!0})};return v.useEffect(()=>{t&&l(null)},[t]),v.useLayoutEffect(()=>{if(!a||!h.current)return;const m=h.current.getBoundingClientRect();h.current.style.left=`${Math.max(8,Math.min(a.x,window.innerWidth-m.width-8))}px`,h.current.style.top=`${Math.max(8,Math.min(a.y,window.innerHeight-m.height-8))}px`,h.current.querySelector("button")?.focus({preventScroll:!0})},[a]),v.useEffect(()=>{if(!a)return;const m=y=>{h.current?.contains(y.target)||p()},x=y=>{y.key==="Escape"?(y.preventDefault(),y.stopPropagation(),p(!0)):y.key==="Tab"&&p()},b=()=>p();return window.addEventListener("pointerdown",m,!0),window.addEventListener("keydown",x,!0),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("pointerdown",m,!0),window.removeEventListener("keydown",x,!0),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[a]),s.jsxs("span",{ref:c,className:"inline-flex max-w-full items-center gap-0.5",onContextMenu:m=>{t||(m.preventDefault(),m.stopPropagation(),l({x:m.clientX,y:m.clientY}))},onKeyDown:m=>{if(!t&&(m.key==="ContextMenu"||m.shiftKey&&m.key==="F10")){m.preventDefault(),m.stopPropagation();const x=c.current.getBoundingClientRect();l({x:x.left,y:x.bottom})}},children:[n,a&&Wi.createPortal(s.jsx("div",{ref:h,role:"menu","aria-label":`${e} 的成员操作`,style:{left:a.x,top:a.y},className:"fixed z-popover min-w-44 rounded-lg border border-border/30 bg-surface-2 p-1 shadow-xl",children:s.jsxs("button",{type:"button",role:"menuitem",className:"flex min-h-9 w-full items-center gap-2 rounded-md px-3 py-2 text-left text-xs text-destructive hover:bg-destructive/10 focus:bg-destructive/10 focus:outline-none",onClick:()=>{p(!0),r()},children:[s.jsx(Js,{size:14}),"从协作组移除"]})}),document.body)]})}function Bj({groups:e,sessions:t,busy:r,onOpen:n,onSettings:a,onCreate:l}){const[c,h]=v.useState(""),p=e.filter(m=>!c.trim()||`${m.name} ${m.sessionIds.map(x=>t.find(b=>b.sessionId===x)?.name??"").join(" ")}`.toLowerCase().includes(c.trim().toLowerCase()));return s.jsxs("section",{"aria-label":"协作组列表",className:"space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("p",{className:"text-xs leading-6 text-muted-foreground",children:"成员消息用于日常交流;看板用于目标、交付与验收。"}),s.jsxs("button",{type:"button",disabled:r,className:"inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded-lg bg-primary px-3 text-xs font-medium text-primary-foreground disabled:opacity-40",onClick:l,children:[s.jsx(ui,{size:14}),"新建协作组"]})]}),(e.length>5||c)&&s.jsxs("label",{className:"relative block",children:[s.jsx("span",{className:"sr-only",children:"搜索协作组"}),s.jsx($l,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{type:"search",value:c,onChange:m=>h(m.target.value),placeholder:"搜索组名或成员",className:"min-h-11 w-full rounded-lg border border-border/20 bg-surface-2 py-2 pl-9 pr-3 text-xs text-foreground outline-none focus:border-primary/60"})]}),s.jsxs("div",{className:"divide-y divide-border/15 rounded-xl border border-border/15",children:[p.map(m=>{const x=m.sessionIds.flatMap(b=>{const y=t.find(w=>w.sessionId===b);return y?[y]:[]});return s.jsxs("article",{"aria-label":m.name,className:"p-3 sm:flex sm:items-center sm:gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"break-words text-sm font-medium leading-6 text-foreground",children:m.name}),s.jsx("p",{className:"mt-1 break-words text-[11px] leading-5 text-muted-foreground",children:m.sessionIds.length?`${m.sessionIds.length} 位成员${x.length?` · ${x.slice(0,2).map(b=>_0(b,x)).join("、")}${x.length>2?"等":""}`:""}`:"尚未添加成员,可以稍后配置"})]}),s.jsxs("div",{className:"mt-2 flex shrink-0 items-center gap-1 sm:mt-0",children:[s.jsxs("button",{type:"button","aria-label":`成员消息:${m.name}`,disabled:r,className:"inline-flex min-h-11 items-center justify-center gap-1.5 rounded-lg bg-surface-2 px-3 text-xs text-foreground hover:bg-surface-elevated disabled:opacity-40",onClick:()=>n(m.id,"messages"),children:[s.jsx(wc,{size:14}),"成员消息"]}),s.jsxs("button",{type:"button","aria-label":`看板:${m.name}`,disabled:r,className:"inline-flex min-h-11 items-center justify-center gap-1.5 rounded-lg px-3 text-xs text-muted-foreground hover:bg-surface-2 disabled:opacity-40",onClick:()=>n(m.id,"tasks"),children:[s.jsx(T9,{size:14}),"看板"]}),s.jsx("button",{type:"button","aria-label":`设置:${m.name}`,title:"组设置",disabled:r,className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded-lg text-muted-foreground hover:bg-surface-2 disabled:opacity-40",onClick:b=>a(m.id,b.currentTarget),children:s.jsx(M0,{size:14})})]})]},m.id)}),!p.length&&s.jsx("p",{className:"px-3 py-6 text-xs text-muted-foreground",children:"没有匹配的协作组,试试其他名称。"})]})]})}const Fc="min-h-11 w-full rounded-lg border border-border/20 bg-surface px-3 py-2 text-xs text-foreground outline-none focus:border-primary",bh="inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-xs disabled:opacity-40",vh=e=>({profiles:e.launchProfiles??[],defaultId:e.defaultLaunchProfileId??"",group:e}),sm=new Map,Pu=e=>JSON.stringify(e.profiles)!==JSON.stringify(e.group.launchProfiles??[])||e.defaultId!==(e.group.defaultLaunchProfileId??"");function Pj({group:e,value:t,onChange:r,disabled:n}){if(!e.launchProfiles?.length&&!t)return null;const a=e.launchProfiles?.find(l=>l.id===t);return s.jsxs("div",{className:"mt-3 space-y-1",children:[s.jsxs("label",{className:"block space-y-1 text-xs text-muted-foreground",children:["启动方案",s.jsxs("select",{"aria-label":"启动方案",className:Fc,value:t,disabled:n,onChange:l=>r(l.target.value),children:[s.jsx("option",{value:"",children:"Agent 默认命令"}),e.launchProfiles?.map(l=>s.jsx("option",{value:l.id,children:l.name},l.id))]})]}),a&&s.jsxs("p",{className:"whitespace-pre-wrap break-words text-xs leading-5 text-muted-foreground",children:[a.notes||"未填写使用备注",s.jsx("code",{className:"block break-all",children:a.command})]}),t&&!a&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"原方案已删除,请重新选择。"})]})}function Oj({group:e,agents:t,busy:r,setBusy:n,refresh:a}){const l=`${window.location.origin}:${e.id}`,[c,h]=v.useState(()=>sm.get(l)??vh(e)),p=v.useRef(c);p.current=c;const[m,x]=v.useState(c.profiles[0]?.id??""),[b,y]=v.useState(null),[w,C]=v.useState(""),S=(U,K=!0)=>{p.current=U,h(U),Pu(U)?sm.set(l,U):sm.delete(l),K&&C("")};v.useEffect(()=>{!Pu(p.current)&&e.updatedAt>=p.current.group.updatedAt&&S(vh(e),!1)},[e.updatedAt]);const I=c.profiles.find(U=>U.id===m),N=U=>S({...c,profiles:c.profiles.map(K=>K.id===m?{...K,...U}:K)}),Q=c.profiles.every(U=>U.name.trim()&&U.agentSlug&&U.command.trim()&&!/[\x00-\x1f\x7f]/.test(U.command)),W=()=>{const U=t[0],K={id:`profile-${crypto.randomUUID()}`,name:"",agentSlug:U?.slug??"",command:U?.command??"",notes:""};S({...c,profiles:[...c.profiles,K]}),x(K.id)},B=async()=>{if(!(r||!Q||!Pu(c))){n("launch-profiles"),y(null),C("");try{const{group:U}=await ml({id:e.id,name:c.group.name,sessionIds:c.group.sessionIds,expectedUpdatedAt:c.group.updatedAt,launchProfiles:c.profiles,defaultLaunchProfileId:c.defaultId||null});S(vh(U)),C("启动方案已保存。新会话使用所选方案,正在运行的成员保持原配置。"),await a()}catch(U){y(U instanceof Error?U.message:"保存失败")}finally{n(null)}}};return s.jsxs("details",{className:"mt-3 border-t border-border/15 pt-2",children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs font-medium text-foreground",children:["Agent 启动方案 · ",c.profiles.length," 个",Pu(c)?" · 未保存":""]}),s.jsxs("section",{"aria-label":"Agent 启动方案",className:"space-y-3",children:[s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"保存不同模型和参数的启动命令,填写适用场景,让协调者按备注选择。保存配置不会启动 Agent。"}),s.jsxs("fieldset",{disabled:!!r,className:"space-y-3",children:[s.jsxs("label",{className:"block space-y-1 text-xs text-muted-foreground",children:["默认启动方案",s.jsxs("select",{"aria-label":"默认启动方案",className:Fc,value:c.defaultId,onChange:U=>S({...c,defaultId:U.target.value}),children:[s.jsx("option",{value:"",children:"使用 Agent 默认命令"}),c.profiles.map(U=>s.jsx("option",{value:U.id,children:U.name||"未命名方案"},U.id))]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("label",{className:"min-w-0 flex-1 text-xs text-muted-foreground",children:["编辑方案",s.jsxs("select",{"aria-label":"编辑方案",className:`${Fc} mt-1`,value:m,onChange:U=>x(U.target.value),children:[s.jsx("option",{value:"",children:"选择方案"}),c.profiles.map(U=>s.jsx("option",{value:U.id,children:U.name||"未命名方案"},U.id))]})]}),s.jsxs("button",{type:"button",className:`${bh} self-end bg-surface text-foreground`,disabled:c.profiles.length>=20,onClick:W,children:[s.jsx(ui,{size:14}),"新增方案"]})]}),I?s.jsxs("div",{className:"space-y-3 rounded-lg border border-border/20 p-3",children:[s.jsxs("label",{className:"block space-y-1 text-xs text-muted-foreground",children:["方案名称",s.jsx("input",{className:Fc,value:I.name,maxLength:100,onChange:U=>N({name:U.target.value}),placeholder:"例如:快速排查、深度实现"})]}),s.jsxs("label",{className:"block space-y-1 text-xs text-muted-foreground",children:["Agent 类型",s.jsxs("select",{"aria-label":"Agent 类型",className:Fc,value:I.agentSlug,onChange:U=>N({agentSlug:U.target.value,command:t.find(K=>K.slug===U.target.value)?.command??""}),children:[!t.some(U=>U.slug===I.agentSlug)&&s.jsxs("option",{value:I.agentSlug,children:[I.agentSlug||"选择 Agent","(当前不可用)"]}),t.map(U=>s.jsx("option",{value:U.slug,children:U.displayName},U.slug))]})]}),s.jsxs("label",{className:"block space-y-1 text-xs text-muted-foreground",children:["启动命令",s.jsx("input",{className:`${Fc} font-mono`,value:I.command,maxLength:4096,onChange:U=>N({command:U.target.value}),placeholder:"填写完整命令,包括模型和启动参数"})]}),s.jsxs("label",{className:"block space-y-1 text-xs text-muted-foreground",children:["使用备注",s.jsx("textarea",{"aria-label":"使用备注",className:`${Fc} min-h-24 resize-y`,value:I.notes,maxLength:2e3,onChange:U=>N({notes:U.target.value}),placeholder:"适合哪些任务、何时不要使用;协调者会读取这些备注。"})]}),s.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3",children:"CLI 方案标识"}),s.jsx("code",{className:"break-all",children:I.id})]}),s.jsxs("button",{type:"button",className:`${bh} text-destructive hover:bg-destructive/10`,onClick:()=>{const U=c.profiles.filter(K=>K.id!==m);S({...c,profiles:U,defaultId:c.defaultId===m?"":c.defaultId}),x(U[0]?.id??"")},children:[s.jsx(Js,{size:14}),"移除方案(保存后生效)"]})]}):s.jsx("p",{className:"text-xs text-muted-foreground",children:"尚未选择方案。新增后可填写模型、参数和备注。"})]}),b&&s.jsxs("p",{role:"alert",className:"text-xs leading-5 text-destructive",children:[b,"。草稿已保留;重新载入会放弃草稿。"]}),w&&s.jsx("p",{role:"status",className:"text-xs leading-5 text-primary",children:w}),s.jsxs("div",{className:"flex flex-wrap justify-between gap-2",children:[s.jsx("button",{type:"button",className:`${bh} bg-surface text-muted-foreground`,disabled:!!r,onClick:()=>{S(vh(e)),x(e.launchProfiles?.[0]?.id??""),y(null)},children:"重新载入(放弃方案草稿)"}),s.jsx("button",{type:"button",disabled:!!r||!Q||!Pu(c),className:`${bh} bg-primary text-primary-foreground`,onClick:()=>{B()},children:r==="launch-profiles"?"保存中…":"保存启动方案"})]})]})]})}function J6(e,t=[]){const r=(t.length?t:e.children??[]).filter(S=>S.status!=="closed"),n=r.filter(S=>S.status==="accepted").length,a=Jc(e),l=e.events.filter(S=>S.kind==="revise"&&S.attemptId===e.activeAttemptId).at(-1),c=e.artifacts.filter(S=>S.kind==="result"&&S.attemptId===e.activeAttemptId).at(-1),h=!!l&&(!c||l.createdAt>=c.createdAt),p=mf(e),m=e.attempts.find(S=>S.id===e.activeAttemptId)?.report,x=S=>S?.summarySource==="explicit"||S?.summarySource!=="excerpt"&&!!S?.summary?.trim(),b=e.events.filter(S=>S.kind==="coordinate"&&S.attemptId===e.activeAttemptId&&(!l||S.sequence>l.sequence)).at(-1),y=[...p?.createdAt&&(!l||p.createdAt>l.createdAt)?[{summary:p.summary,createdAt:p.createdAt,source:"成员报告",explicit:x(m),taskId:e.id,title:e.title}]:[],...b?[{summary:b.summary||b.content,createdAt:b.createdAt,source:"协调说明",explicit:!!b.summary?.trim(),taskId:e.id,title:e.title}]:[],...h?[]:t.filter(S=>S.status!=="closed").flatMap(S=>{const I=mf(S);return I?.createdAt?[{summary:I.summary,createdAt:I.createdAt,source:"执行报告",explicit:x(S.attempts.find(N=>N.id===S.activeAttemptId)?.report),taskId:S.id,title:S.title}]:[]})].filter(S=>S.summary.trim()&&Number.isFinite(S.createdAt)&&Number.isFinite(new Date(S.createdAt).getTime())).sort((S,I)=>I.createdAt-S.createdAt);let w=a,C="分派和报告会保存在这里;终端输出不能代替明确的任务报告。";return e.workflow?.kind==="goal"&&(e.status==="accepted"?(w="已完成 · 你已验收",C="结果与执行记录已保留;追加要求可以继续跟进。"):e.status==="closed"?C="此目标已关闭,已有报告仍保留。":Ji(e)||e.workflow.paused||c?C=a==="等待你验收"?"总结果已交付;查看结论后验收,或提出继续跟进。":a==="等待独立评审"?"总结果已提交,独立评审通过后交给你验收。":a==="需要你回答"?"回答当前问题后,成员可以继续原来的工作。":a==="需要你确认方案"?"确认这项必要决定后再继续;普通拆分不需要逐项批准。":h?"沿用原目标推进追加要求;上一版结果不代表本轮完成。":e.workflow.paused?"自动安排已暂停,恢复后才能继续安排后续工作。":"查看记录的阻塞原因,补充条件或重试;已有交付保留。":h?(w="已提出跟进 · 等待新报告",C="沿用原目标推进追加要求;旧报告保留为历史,等待本轮明确更新。"):r.length?(w=n===r.length?"执行交付已评审 · 等待总结果":"工作已拆分 · 执行与评审",C=n===r.length?"执行事项已交付评审,下一步由协调者汇总总结果,再交给你验收。":`已记录 ${r.length} 项工作,${n} 项交付已评审,${r.length-n} 项尚待交付或评审。`):p?(w=p.status==="ack"?"协调者已接手 · 等待拆分记录":a,C="尚未记录执行事项;协调者需说明工作划分、交付内容和下一步。"):C=a==="已写入终端 · 等待回复"?"目标已写入协调者终端,等待明确接手和拆分说明。":"目标已保存,等待分派、投递和协调者明确回复。"),{label:w,next:C,latest:y[0]??null,total:r.length,done:n}}function Fj(e,t){const r=e.dependsOn.filter(n=>t.find(a=>a.id===n)?.status!=="accepted");return r.length?`等待依赖:${r.map(n=>t.find(a=>a.id===n)?.title??"记录尚未同步").join("、")}`:e.dependsOn.length?"依赖交付已评审,可以接续":""}function ev(e){return e.explicit?e.summary:e.source==="协调说明"?"协调者已更新工作安排。此记录未提供简短摘要,详情保留原始说明。":`「${e.title}」有新的明确报告。此记录未提供简短摘要,详情保留原文。`}function v5(e,t=!1,r=""){e=e.filter(h=>h.purpose!=="automation");const n=new Map(e.map(h=>[h.id,h])),a=h=>n.get(h.parentTaskId??h.workflow?.rootTaskId??""),l=h=>{const p=[];let m=h;for(;;){const x=p.findIndex(y=>y.id===m.id);if(x!==-1)return p.slice(x).sort((y,w)=>y.id.localeCompare(w.id))[0];p.push(m);const b=a(m);if(!b||b.status==="closed"&&m.status!=="closed")return m;m=b}},c=new Map(e.map(h=>[h.id,l(h).id]));return e.filter(h=>t||!!r.trim()||c.get(h.id)===h.id).map(h=>{const p=t||r.trim()?[]:e.filter(b=>b.id!==h.id&&c.get(b.id)===h.id&&b.status!=="closed"),m=h.status==="open"&&!Ji(h)?p.find(b=>b.decisions.some(y=>y.status==="pending"))??p.find(b=>Ji(b)||b.workflow?.paused):void 0,x=p.filter(b=>Ji(b)||b.workflow?.paused).length;return{task:h,children:p,attention:m,attentionCount:x,rootId:c.get(h.id)}})}function t1(e,t=[]){const r=Jc(e),n={已验收:"已完成 · 你已验收",独立评审通过:"执行交付已评审",需要你回答:"请回答成员的问题",需要你确认方案:"请确认方案",等待你验收:"请查看结果并验收",成员报告受阻:"需要补充条件",成员报告失败:"成员报告执行失败",成员确认接手:"已接手 · 等待后续报告",成员报告进行中:"成员报告:进行中",等待独立评审:"结果已提交 · 等待评审","评审通过 · 等待接续":"交付已评审 · 等待接续","已要求跟进 · 等待新结果":"已提出跟进 · 等待新结果"};return e.status==="open"&&t.length&&!Ji(e)&&!e.artifacts.some(a=>a.kind==="result"&&a.attemptId===e.activeAttemptId)?t.every(a=>a.status==="accepted")?"执行交付已评审 · 等待总结果":"目标未完成 · 执行交付待齐":n[r]??r}function tv({task:e,children:t,onSelect:r,detail:n=!1,tasks:a=t,name:l}){const c=new Map(t.map(y=>[y.id,y])),h=(t.length?t:e.children??[]).filter(y=>y.status!=="closed");if(!h.length)return null;const p=(y,w)=>{const C=c.get(y);return C&&(Ji(C)||C.workflow?.paused)?0:w?2:1},m=[...h].sort((y,w)=>p(y.id,y.status==="accepted")-p(w.id,w.status==="accepted")||(c.get(w.id)?.updatedAt??0)-(c.get(y.id)?.updatedAt??0)),x=h.filter(y=>y.status==="accepted").length,b=y=>{const w=c.get(y.id),C=y.status==="accepted",S=w&&(Ji(w)||w.workflow?.paused),I=w?.status==="open"?Fj(w,a):"",N=w?.attempts.find(B=>B.id===w.activeAttemptId)?.assignee??w?.scheduledAssignee??null,Q=w?t1(w):C?y.completionMode==="reviewed"?"执行交付已评审":"已验收":"等待报告",W=C?ld:Tf;return s.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-start gap-2 rounded-lg px-1 py-2 text-left hover:bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",onClick:()=>r(y.id),children:[s.jsx(W,{size:14,className:`mt-0.5 shrink-0 ${C||S?"text-primary":"text-muted-foreground"}`}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{title:y.title,className:"line-clamp-2 break-words text-xs leading-5 text-foreground",children:y.title}),s.jsx("span",{className:`block text-[11px] leading-5 ${S?"text-primary":"text-muted-foreground"}`,children:Q}),n&&w?.parentTaskId&&w.parentTaskId!==e.id&&s.jsxs("span",{className:"block text-[11px] leading-5 text-muted-foreground",children:["所属事项:",a.find(B=>B.id===w.parentTaskId)?.title??"父任务记录尚未同步"]}),n&&w?.acceptance&&s.jsxs("span",{className:"mt-1 line-clamp-2 text-xs leading-5 text-muted-foreground",children:["交付标准:",w.acceptance]}),I&&s.jsx("span",{className:"line-clamp-2 text-[11px] leading-5 text-muted-foreground",children:I}),n&&l&&s.jsxs("span",{className:"block text-[11px] leading-5 text-muted-foreground",children:["负责人:",N?l(w,N):"尚未分派"]})]}),s.jsx(Ci,{size:12,className:"mt-1 shrink-0 text-muted-foreground"})]},y.id)};return s.jsxs("section",{"aria-label":"执行事项",className:n?"border-t border-border/15 py-2":"mx-4 border-t border-border/15 py-2",children:[!n&&s.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:"执行事项"}),s.jsxs("span",{children:[x,"/",h.length," 项已完成"]})]}),(n?m.filter(y=>x===h.length||y.status!=="accepted"):m.slice(0,3)).map(b),n&&x>0&&x<h.length&&s.jsxs("details",{children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:["查看 ",x," 项已完成的执行交付"]}),m.filter(y=>y.status==="accepted").map(b)]}),!n&&m.length>3&&s.jsxs("details",{children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-[11px] text-muted-foreground",children:["展开其余 ",m.length-3," 项"]}),m.slice(3).map(b)]})]})}function $j(e,t){const r=t.events.filter(p=>p.kind==="retry"&&!e.events.some(m=>m.id===p.id)).at(-1),n=new Set(e.deliveries.filter(p=>p.status==="delivered").map(p=>p.id)),a=new Set(e.outbox.filter(p=>!n.has(p.id)).map(p=>p.id)),l=r&&t.deliveries.some(p=>a.has(p.id)&&p.status==="delivered"&&p.deliveredAt!==null&&p.deliveredAt>=r.createdAt);let c=l?"重试请求已保存,匹配本次请求的投递已写入终端。":"重试请求已保存,服务将重新检查现有投递与协调条件。";!t.outbox.length&&!l&&(c+=" 当前没有待重试的投递记录。"),t.workflow?.paused&&(c+=" 后续自动安排仍已暂停。");const h=t.attempts.find(p=>p.id===t.activeAttemptId)?.report;return h&&["blocked","failed"].includes(h.status)&&(c+=" 成员原报告仍保留;请补齐条件并通知成员,收到新的明确回复后更新报告。"),c}function Uj(e,t){const r=Math.floor(Math.max(0,t-e)/6e4);return r<1?"刚刚更新":r<60?`${r} 分钟前更新`:r<1440?`${Math.floor(r/60)} 小时前更新`:r<10080?`${Math.floor(r/1440)} 天前更新`:`${new Date(e).toLocaleDateString([],{month:"numeric",day:"numeric"})} 更新`}function y5(e){return new Date(e).toLocaleString([],{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function xf({task:e,now:t,compact:r=!1}){const n=mf(e),a=Number.isFinite(e.updatedAt)&&e.updatedAt>0&&Number.isFinite(new Date(e.updatedAt).getTime());return r&&!n?null:s.jsxs("span",{className:"mt-1 block space-y-1 text-[11px] leading-5 text-muted-foreground",children:[s.jsx("span",{className:"block break-words",children:n?s.jsxs(s.Fragment,{children:["最近明确报告:",n.label," · ",n.createdAt===null?"报告时间未提供":s.jsx("time",{dateTime:new Date(n.createdAt).toISOString(),title:new Date(n.createdAt).toLocaleString(),children:y5(n.createdAt)})]}):"暂无明确报告"}),!r&&s.jsx("span",{className:"block",children:a?s.jsxs(s.Fragment,{children:["记录更新:",s.jsx("time",{dateTime:new Date(e.updatedAt).toISOString(),title:t===void 0?new Date(e.updatedAt).toLocaleString():Uj(e.updatedAt,t),children:y5(e.updatedAt)})]}):"记录更新时间未提供"})]})}function rv(e,t){const r=e.trim().split(/\n\s*\n/),n=c=>{const h=r.findIndex(m=>c.test(m.trim()));return h<0?"":r[h].trim().replace(c,"").trim()||r[h+1]?.trim()||""},a=t?.trim()||n(/^(?:#{1,6}\s*)?(?:结论|Summary|Conclusion|结果摘要)(?:[::]\s*|\s*$)/i),l=n(/^(?:#{1,6}\s*)?(?:限制与变更|限制|Limitations)(?:[::]\s*|\s*$)/i);return{summary:a||e.trim(),limitations:a?l:"",condensed:!!a&&a!==e.trim(),explicit:!!t?.trim()}}function Oh({inputKey:e,paneKey:t,label:r,value:n,onChange:a,active:l=!0,disabled:c=!1,required:h,autoFocus:p,placeholder:m,className:x,onUploadChange:b}){const y=v.useId(),w=v.useRef(null),C=v.useRef(null),S=v.useRef({value:n,onChange:a,onUploadChange:b});S.current={value:n,onChange:a,onUploadChange:b};const[I,N]=v.useState(0),[Q,W]=v.useState(""),B=v.useRef(Promise.resolve()),U=v.useRef(new Set),K=v.useRef({active:l,disabled:c,inputKey:e});K.current={active:l,disabled:c,inputKey:e},v.useEffect(()=>{const Me=()=>{for(const be of U.current)be.abort()};return window.addEventListener("termdock:secure-state",Me),window.addEventListener("auth:unauthorized",Me),()=>{Me(),window.removeEventListener("termdock:secure-state",Me),window.removeEventListener("auth:unauthorized",Me)}},[l,c,e]),v.useEffect(()=>{const Me=w.current;Me&&Me.setSelectionRange(Me.value.length,Me.value.length)},[e]);const re=()=>({value:S.current.value,start:w.current?.selectionStart??n.length,end:w.current?.selectionEnd??n.length}),H=(Me,be=re())=>{S.current.onChange(V=>V!==be.value?V+(V&&!/\s$/.test(V)?`
131
+ `:"")+Me:V.slice(0,be.start)+Me+V.slice(be.end))};v.useEffect(()=>{if(!l)return;const Me=ab(be=>H(be.replace(/\r\n?/g,`
132
+ `)),e,!!t,t);return t||Ju(e),Me},[l,e,t]);const Oe=()=>{const Me=fm();return`${location.origin}:${Me?.targetPeerId??""}:${Me?.serviceOrigin??""}`},ne=Me=>{if(!l||c)return;const be=new AbortController;U.current.add(be);const V=re(),Ke=Oe(),he=()=>!be.signal.aborted&&K.current.active&&!K.current.disabled&&K.current.inputKey===e&&Ke===Oe(),Be=S.current.onUploadChange;W(""),N(ae=>ae+1),Be?.(1),B.current=B.current.then(async()=>{try{if(!he())return;const ae=await Me(be.signal,he);if(!he())return;Array.isArray(ae)?H(ae.map(L0).join(" ")+" ",V):ae&&H(ae,V)}catch(ae){if(be.signal.aborted)return;const X=Ke!==Oe()?"目标服务已切换,请重新添加附件":ae instanceof Error?ae.message:"附件准备失败,请重试";W(X.includes("Upload did not return")?"附件上传未返回完整路径,请重试":X)}finally{U.current.delete(be),N(ae=>ae-1),Be?.(-1)}})},ce=async(Me,be)=>Me.length===1&&Me[0].type.startsWith("image/")?[await pb(Me[0],be)]:mb(Me,be),Ne=Me=>{const{files:be,text:V}=xb(Me.clipboardData),Ke=Nl();!Ke?.readClipboardFiles&&!be.length&&V||!Ke&&!be.length&&typeof navigator.clipboard?.read!="function"||(Me.preventDefault(),ne(async(he,Be)=>{const ae=await gb({files:be,text:V},Be);return ae.kind==="files"?[...ae.paths,...await ce(ae.files,he)]:ae.kind==="text"?ae.text:null}))};return s.jsxs("div",{className:"space-y-1.5",onFocusCapture:()=>Ju(e),onPointerDownCapture:()=>Ju(e),children:[s.jsx("label",{htmlFor:y,className:"block text-xs text-muted-foreground",children:r}),s.jsx("textarea",{ref:w,id:y,value:n,required:h,disabled:c,autoFocus:p,"aria-describedby":I||Q?`${y}-status`:void 0,placeholder:m,className:x,onChange:Me=>a(Me.target.value),onPaste:Ne,onDragOver:Me=>{!c&&Me.dataTransfer.types.includes("Files")&&Me.preventDefault()},onDrop:Me=>{const be=Array.from(Me.dataTransfer.files);!be.length||c||(Me.preventDefault(),Me.stopPropagation(),ne(V=>ce(be,V)))}}),s.jsxs("div",{className:"flex min-h-9 items-center gap-2",children:[s.jsx("input",{ref:C,type:"file",multiple:!0,hidden:!0,"aria-label":`选择附件:${r}`,onChange:Me=>{const be=Array.from(Me.target.files??[]);Me.target.value="",be.length&&ne(V=>ce(be,V))}}),s.jsxs("button",{type:"button","aria-label":`添加附件:${r}`,title:"添加附件",disabled:c,className:"inline-flex min-h-9 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs text-muted-foreground hover:bg-surface-2 disabled:opacity-40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",onClick:()=>C.current?.click(),children:[s.jsx(Nw,{size:14}),"附件"]}),I>0?s.jsxs("span",{id:`${y}-status`,role:"status",className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(sn,{size:12,className:"animate-spin"}),"正在准备附件…"]}):Q?s.jsx("span",{id:`${y}-status`,role:"alert",className:"break-words text-xs text-destructive",children:Q}):s.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"可粘贴图片、文件或拖入附件"})]})]})}function w5(e){return e.status!=="open"?"done":Ji(e)||e.workflow?.paused?"attention":e.activeAttemptId?"running":"backlog"}const Il=[{id:"backlog",label:"待开始",icon:Tf,hint:"等待分派或依赖完成"},{id:"running",label:"执行中",icon:Wh,hint:"分派后的任务会出现在这里"},{id:"attention",label:"需要你",icon:wc,hint:"问题、方案与验收都在这里"},{id:"done",label:"已完成",icon:ld,hint:"验收后的结果会保留在这里"}];function zj({tasks:e,selectedId:t,onSelect:r,name:n,storage:a,action:l,navigation:c,settings:h}){const p=v.useRef(null),m=v.useRef(null),x=v.useRef("backlog"),b=v.useRef(0),y=v.useRef(null),[w,C]=v.useState(Date.now);v.useEffect(()=>yc(()=>C(Date.now()),3e4),[]);const[S,I]=v.useState(!1);v.useEffect(()=>{const F=new ResizeObserver(we=>{const Qe=we[0].contentRect.width;I(Qe>=760),Qe!==b.current&&Qe<760&&m.current&&(m.current.scrollLeft=Il.findIndex(tt=>tt.id===x.current)*m.current.clientWidth),b.current=Qe});return p.current&&F.observe(p.current),()=>F.disconnect()},[]);const[N]=v.useState(()=>{try{return JSON.parse(localStorage.getItem(`${a}:board`)??"null")}catch{return null}}),[Q,W]=v.useState(()=>{if(Il.some(Qe=>Qe.id===N?.lane))return N.lane;const we=v5(e,N?.showSteps===!0,N?.query??"").map(Qe=>Qe.attention?"attention":w5(Qe.task));return we.includes("attention")?"attention":we.includes("running")?"running":we.includes("backlog")?"backlog":"done"});x.current=Q;function B(F,we=!0){W(F);const Qe=m.current;if(!Qe||!Qe.clientWidth)return;y.current=F;const tt=Il.findIndex(Rt=>Rt.id===F)*Qe.clientWidth,it=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;Qe.scrollTo?Qe.scrollTo({left:tt,behavior:we&&!it?"smooth":"auto"}):Qe.scrollLeft=tt}v.useEffect(()=>{S||B(x.current,!1)},[S]);const[U,K]=v.useState(typeof N?.scope=="string"?N.scope:"all"),[re,H]=v.useState(typeof N?.query=="string"?N.query:""),[Oe,ne]=v.useState(N?.closed===!0),[ce,Ne]=v.useState(N?.showSteps===!0),[Me,be]=v.useState(!!N?.query),[V,Ke]=v.useState(!1),[he,Be]=v.useState(!1),ae=v.useRef(null),X=v.useRef(null);v.useEffect(()=>{if(!he)return;ae.current?.querySelector('[aria-label="看板更多操作"] button')?.focus();const F=Qe=>{ae.current?.contains(Qe.target)||Be(!1)},we=Qe=>{Qe.key==="Escape"&&(Qe.preventDefault(),Qe.stopPropagation(),Be(!1),X.current?.focus())};return document.addEventListener("pointerdown",F),document.addEventListener("keydown",we),()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",we)}},[he]);const He=v.useRef(null),je=v.useRef(null),ve=v.useRef(null),Fe=v.useRef(null);v.useEffect(()=>{Me&&He.current?.focus()},[Me]),v.useEffect(()=>{if(!V)return;ve.current?.querySelector("select")?.focus();const F=Qe=>{ve.current?.contains(Qe.target)||Ke(!1)},we=Qe=>{Qe.key==="Escape"&&(Qe.preventDefault(),Qe.stopPropagation(),Ke(!1),(S?Fe:X).current?.focus())};return document.addEventListener("pointerdown",F),document.addEventListener("keydown",we),()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",we)}},[V]),v.useEffect(()=>{try{localStorage.setItem(`${a}:board`,JSON.stringify({lane:Q,scope:U,query:re,closed:Oe,showSteps:ce}))}catch{}},[a,Q,U,re,Oe,ce]);const lt=e.filter(F=>F.workflow?.kind==="goal"),ye=v5(e,ce,re),de=new Map(ye.map(F=>[F.task.id,F])),nt=F=>de.get(F.id)?.attention?"attention":w5(F),Xe=t?ye.find(F=>F.task.id===t||F.children.some(we=>we.id===t)):void 0,pt=Xe?nt(Xe.task):void 0;v.useEffect(()=>{pt&&B(pt,!1)},[t,pt]);const xe=ye.map(F=>F.task).filter(F=>(Oe||F.status!=="closed")&&(U==="all"||F.id===U||de.get(F.id)?.rootId===U)&&(!re.trim()||`${F.title} ${F.spec} ${F.attempts.map(we=>n(F,we.assignee)).join(" ")}`.toLocaleLowerCase().includes(re.trim().toLocaleLowerCase()))),mt=+(U!=="all")+Number(Oe)+Number(ce),It="inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center gap-1.5 rounded-lg px-2 text-xs text-muted-foreground hover:bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",At="flex min-h-11 w-full items-center justify-start gap-3 rounded-lg px-3 text-left text-sm font-medium text-foreground hover:bg-surface-2 active:bg-surface-elevated focus-visible:bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",Nt=s.jsxs("div",{className:`relative flex min-w-0 items-center ${S?"flex-1 max-w-[240px]":"w-full"}`,children:[s.jsx("span",{className:"sr-only",children:"搜索任务"}),s.jsx($l,{"aria-hidden":"true",size:15,className:"pointer-events-none absolute left-3 text-muted-foreground"}),s.jsx("input",{ref:He,"aria-label":"搜索任务",type:"search",value:re,onChange:F=>H(F.target.value),onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),re?H(""):(be(!1),requestAnimationFrame(()=>(S?je:X).current?.focus())))},placeholder:"搜索任务或负责人",className:"min-h-11 w-full rounded-lg border border-border/20 bg-transparent pl-9 pr-9 text-xs outline-none focus:border-primary"}),s.jsx("button",{type:"button","aria-label":"关闭搜索",className:"absolute right-0 flex min-h-11 w-9 items-center justify-center text-muted-foreground",onClick:()=>{H(""),be(!1),requestAnimationFrame(()=>(S?je:X).current?.focus())},children:s.jsx(zn,{size:14})})]}),oe=s.jsxs("div",{"aria-label":"任务筛选",className:"absolute right-0 top-full z-30 mt-1 w-64 space-y-3 rounded-xl border border-border/30 bg-surface p-3 shadow-xl",children:[s.jsxs("label",{className:"block space-y-1 text-xs text-muted-foreground",children:[s.jsx("span",{children:"目标范围"}),s.jsxs("select",{"aria-label":"按目标查看",value:U,onChange:F=>K(F.target.value),className:"min-h-11 w-full rounded-lg border border-border/20 bg-surface-2 px-3 text-xs text-foreground",children:[s.jsx("option",{value:"all",children:"所有目标"}),lt.map(F=>s.jsx("option",{value:F.id,children:F.title},F.id))]})]}),s.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox",checked:Oe,onChange:F=>ne(F.target.checked)}),"含已关闭"]}),s.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox",checked:ce,onChange:F=>Ne(F.target.checked)}),"显示执行子任务"]}),mt>0&&s.jsx("button",{type:"button",className:"min-h-11 w-full rounded-lg text-xs text-primary hover:bg-surface-2",onClick:()=>{K("all"),ne(!1),Ne(!1)},children:"清除筛选"})]});return s.jsxs("div",{ref:p,className:"flex min-h-0 min-w-0 flex-1 flex-col gap-2",children:[s.jsx("div",{ref:S?void 0:ve,"aria-label":"看板工具栏",className:"relative z-20 flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border/15 pb-2",children:S?s.jsxs(s.Fragment,{children:[c&&s.jsx("div",{className:"flex min-w-0 items-center mr-auto",children:c}),Me?Nt:s.jsx("button",{ref:je,type:"button","aria-label":"搜索任务",title:"搜索任务",className:`${It} ${c?"":"ml-auto"}`,onClick:()=>be(!0),children:s.jsx($l,{size:16})}),s.jsxs("div",{ref:ve,className:"relative shrink-0",children:[s.jsxs("button",{ref:Fe,type:"button","aria-label":mt?`筛选任务,${mt} 项已启用`:"筛选任务","aria-expanded":V,className:`${It} ${mt?"text-primary":""}`,onClick:()=>Ke(F=>!F),children:[s.jsx(bm,{size:15}),s.jsx("span",{children:"筛选"}),mt>0&&s.jsx("span",{className:"tabular-nums text-primary",children:mt})]}),V&&oe]}),h,l&&s.jsx("div",{className:"shrink-0",children:l})]}):s.jsxs(s.Fragment,{children:[c&&s.jsx("div",{className:"mr-auto flex min-w-0 items-center",children:c}),l&&s.jsx("div",{className:"shrink-0",children:l}),s.jsxs("div",{ref:ae,className:"relative shrink-0",children:[s.jsxs("button",{ref:X,type:"button","aria-label":"更多看板操作","aria-expanded":he,className:`${It} ${he?"bg-surface-2 text-foreground":mt||re.trim()?"text-primary":""}`,onClick:()=>{Be(F=>!F),Ke(!1)},children:[s.jsx(Ac,{size:18}),mt>0&&s.jsx("span",{className:"text-[10px]",children:mt})]}),he&&s.jsxs("div",{role:"group","aria-label":"看板更多操作",className:"absolute right-0 top-full z-30 mt-2 flex w-52 max-w-[calc(100vw-2rem)] flex-col gap-0.5 rounded-xl border border-border/40 bg-surface p-1.5 shadow-xl",onClick:()=>Be(!1),children:[s.jsxs("button",{ref:je,type:"button","aria-label":"搜索任务",className:At,onClick:()=>be(!0),children:[s.jsx($l,{size:18,className:"shrink-0 text-muted-foreground"}),"搜索任务"]}),s.jsxs("button",{ref:Fe,type:"button","aria-label":mt?`筛选任务,${mt} 项已启用`:"筛选任务",className:At,onClick:()=>Ke(!0),children:[s.jsx(bm,{size:18,className:"shrink-0 text-muted-foreground"}),"筛选任务",mt>0&&s.jsx("span",{className:"ml-auto rounded bg-primary/10 px-1.5 text-xs tabular-nums text-primary",children:mt})]}),h&&s.jsx("div",{className:"mt-1 border-t border-border/30 pt-1 [&>button]:min-h-11 [&>button]:w-full [&>button]:justify-start [&>button]:gap-3 [&>button]:px-3 [&>button]:text-left [&>button]:text-sm [&>button]:text-foreground [&>button:hover]:bg-surface-2 [&>button:active]:bg-surface-elevated [&>button:focus-visible]:bg-surface-2 [&>button>svg]:h-[18px] [&>button>svg]:w-[18px] [&>button>svg]:shrink-0 [&>button>svg]:text-muted-foreground [&>button>span]:not-sr-only",children:h})]})]}),Me&&Nt,V&&oe]})}),s.jsx("nav",{hidden:S,"aria-label":"看板阶段",className:`${S?"hidden":"grid"} shrink-0 grid-cols-4 gap-1`,children:Il.map(F=>s.jsxs("button",{type:"button","aria-pressed":Q===F.id,className:`min-h-11 rounded-lg px-1 text-xs ${Q===F.id?"bg-surface-2 text-foreground":"text-muted-foreground"}`,onClick:()=>B(F.id),children:[F.label,s.jsx("span",{className:"ml-1 tabular-nums",children:xe.filter(we=>nt(we)===F.id).length})]},F.id))}),s.jsxs("div",{ref:S?void 0:m,"data-kanban-scroll":!0,onPointerDown:()=>{y.current=null},onWheel:()=>{y.current=null},"aria-label":S?void 0:"可左右滑动的任务看板",onScroll:S?void 0:F=>{if(F.target!==F.currentTarget||!F.currentTarget.clientWidth)return;const we=y.current;if(we){const tt=Il.findIndex(it=>it.id===we)*F.currentTarget.clientWidth;if(Math.abs(F.currentTarget.scrollLeft-tt)>2)return;y.current=null}const Qe=Math.max(0,Math.min(Il.length-1,Math.round(F.currentTarget.scrollLeft/F.currentTarget.clientWidth)));W(Il[Qe].id)},className:S?"min-h-0 flex-1 overflow-auto pb-3":"min-h-0 flex-1 snap-x snap-mandatory overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[S&&s.jsx("div",{"aria-label":"看板列标题",className:"sticky top-0 z-10 grid min-w-[1000px] grid-cols-4 gap-4 border-b border-border/15 bg-[var(--chrome-bg)] pb-2",children:Il.map(F=>{const we=F.icon;return s.jsxs("h4",{className:`flex items-center gap-2 px-3 py-2 text-[13px] font-medium ${F.id==="attention"?"text-primary":"text-muted-foreground"}`,children:[s.jsx(we,{size:15}),F.label,s.jsx("span",{className:"ml-auto tabular-nums text-xs",children:xe.filter(Qe=>nt(Qe)===F.id).length})]},F.id)})}),s.jsx("div",{className:S?"grid min-h-full min-w-[1000px] grid-cols-4 items-start gap-4 pt-2":"flex h-full",children:Il.map(F=>{const we=xe.filter(Qe=>nt(Qe)===F.id).sort((Qe,tt)=>tt.updatedAt-Qe.updatedAt);return s.jsx("section",{"aria-label":`${F.label}任务`,"aria-hidden":!S&&Q!==F.id?!0:void 0,ref:Qe=>{Qe&&(Qe.inert=!S&&Q!==F.id)},style:S?void 0:{width:"100%"},className:S?"min-w-0 px-1":"h-full min-w-0 shrink-0 snap-start snap-always overflow-y-auto overscroll-y-contain px-1 pb-3 pt-2",children:s.jsxs("div",{className:"space-y-2",children:[we.map(Qe=>{const tt=de.get(Qe.id),it=tt.attention??Qe,Rt=it.attempts.find(Ce=>Ce.id===it.activeAttemptId),Xt=it.decisions.find(Ce=>Ce.status==="pending"),Zt=Jc(it),Lt=J6(Qe,tt.children),Lr=tt.attention?t1(it):Qe.workflow?.kind==="goal"?Lt.label:t1(it,tt.children),Qr=Pf(it),Pt=Qr[0],Dt=Qr.find(Ce=>Ce.source==="system"),pr=Qr.find(Ce=>Ce.source==="unknown"),pe=Dt?.content,Ge=F.id==="attention",at=Xt?"回答问题":pr?"查看详情核对记录":Pt?.source==="member"&&Dt?"查看条件与异常处理":Pt?.source==="member"?"查看阻塞并补充条件":pe?"查看原因与处理":Zt==="等待你验收"?"查看结果并验收":Zt==="需要你确认方案"?"查看并确认方案":"查看任务并处理",Mt=it.artifacts.filter(Ce=>Ce.kind==="result"&&Ce.attemptId===it.activeAttemptId).at(-1),er=it.events.filter(Ce=>Ce.kind==="revise"&&Ce.source==="user"&&Ce.attemptId===it.activeAttemptId&&(!Mt||Ce.createdAt>=Mt.createdAt)).at(-1),J=Xt?Xt.question||"成员提出了一个问题,打开后可查看并回答。":Pt?.summary||er?.content||(Qe.workflow?.kind==="goal"&&!tt.attention&&Lt.latest?Mt?.summary||ev(Lt.latest):Mt?.summary||(Rt?.report?.content?rv(Rt.report.content).summary:Rt?.report?.summary||"")),bt=e.find(Ce=>Ce.id===Qe.parentTaskId);return s.jsxs("article",{"aria-label":Qe.title,className:`overflow-hidden rounded-xl border bg-surface text-left shadow-sm ${t===Qe.id?"border-primary/60":pe?"border-destructive/35":"border-border/20"}`,children:[s.jsxs("button",{type:"button","data-task-id":Qe.id,"aria-pressed":t===Qe.id,className:"block w-full rounded-xl p-4 text-left transition hover:bg-surface-2/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",onClick:()=>r(it.id),children:[bt&&s.jsx("span",{className:"mb-2 block truncate text-[10px] text-muted-foreground",children:bt.title}),s.jsx("span",{title:Qe.title,className:"block line-clamp-3 break-words text-sm font-medium leading-6 text-foreground",children:Qe.title}),s.jsxs("span",{className:`mt-3 flex items-center gap-1.5 text-xs ${pe&&Pt?.source!=="member"?"text-destructive":Ge?"text-primary":"text-muted-foreground"}`,children:[pe&&Pt?.source!=="member"&&s.jsx(c1,{size:13,className:"shrink-0"}),Lr]}),tt.attention&&s.jsxs("span",{className:"mt-2 block truncate text-[11px] text-muted-foreground",children:["来自执行任务:",tt.attention.title]}),tt.attention&&tt.attentionCount>1&&s.jsxs("span",{className:"mt-1 block text-[11px] text-primary",children:["共 ",tt.attentionCount," 项执行需要你处理"]}),Qe.workflow?.kind==="goal"&&!tt.attention&&s.jsx("span",{className:"mt-2 block text-xs leading-5 text-muted-foreground",children:Lt.next}),J&&s.jsx("span",{className:"mt-2 line-clamp-3 break-words text-xs leading-5 text-foreground/80",children:J}),Dt&&Pt?.source==="member"&&s.jsxs("span",{className:"mt-2 block line-clamp-2 break-words text-xs leading-5 text-destructive",children:[Dt.label,":",Dt.summary]}),pr&&s.jsxs("span",{className:"mt-2 block line-clamp-2 break-words text-xs leading-5 text-muted-foreground",children:[pr.label,":",pr.summary]}),Ge&&s.jsxs("span",{className:`mt-4 flex min-h-9 items-center justify-between rounded-lg px-2.5 text-xs font-medium ${pe?"bg-destructive/10 text-destructive":"bg-primary/10 text-primary"}`,children:[at,s.jsx(Sh,{size:14})]}),!Ge&&(Qe.status==="accepted"||Qe.artifacts.some(Ce=>Ce.kind==="result"&&Ce.attemptId===Qe.activeAttemptId))&&s.jsxs("span",{className:"mt-3 flex min-h-9 items-center justify-between text-xs font-medium text-primary",children:[er?"查看跟进":"查看结果",s.jsx(Sh,{size:14})]}),!Ge&&Qe.workflow?.kind==="goal"&&!Mt&&s.jsxs("span",{className:"mt-3 flex min-h-9 items-center justify-between text-xs font-medium text-primary",children:["查看拆分与进展",s.jsx(Sh,{size:14})]})]}),s.jsx(tv,{task:Qe,children:tt.children,onSelect:r}),s.jsxs("div",{className:"mx-4 border-t border-border/10 py-3 text-[11px] text-muted-foreground",children:[s.jsxs("span",{className:"block truncate",children:[tt.attention?"待处理任务负责人:":Qe.workflow?.kind==="goal"?"协调者:":"负责人:",Rt?n(it,Rt.assignee):it.scheduledAssignee?n(it,it.scheduledAssignee):"未分派"]}),Qe.workflow?.kind==="goal"&&!Ge&&!tt.attention&&Lt.latest?s.jsxs("time",{className:"mt-1 block text-[11px]",dateTime:new Date(Lt.latest.createdAt).toISOString(),children:[Lt.latest.source," · ",new Date(Lt.latest.createdAt).toLocaleString([],{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]}):s.jsx(xf,{task:it,now:w,compact:!0})]})]},Qe.id)}),!we.length&&s.jsx("p",{className:"px-2 py-3 text-xs leading-6 text-muted-foreground/70",children:re||U!=="all"?"没有匹配的任务":e.length?"暂无任务":F.hint})]})},F.id)})})]})]})}const Bl=wd((e,t)=>({views:{},details:{},ensureDetail:(r,n)=>{const a=t().details[r];return a||(e(l=>({details:{...l.details,[r]:n}})),n)},updateDetail:(r,n,a)=>e(l=>{const c=l.details[r];if(!c)return l;const h=typeof a=="function"?a(c[n]):a;return Object.is(c[n],h)?l:{details:{...l.details,[r]:{...c,[n]:h}}}}),ensure:(r,n)=>{const a=t().views[r];return a||(e(l=>({views:{...l.views,[r]:n}})),n)},update:(r,n,a)=>e(l=>{const c=l.views[r];if(!c)return l;const h=typeof a=="function"?a(c[n]):a;return Object.is(c[n],h)?l:{views:{...l.views,[r]:{...c,[n]:h}}}})}));function yh(e,t){return r=>Bl.getState().update(e,t,r)}function im(e,t){return r=>Bl.getState().updateDetail(e,t,r)}const Hj=v.lazy(()=>Pl(()=>import("./RecordingSaveDialog-Czkjuaeu.js").then(e=>e.a),__vite__mapDeps([18,1,2,3,4,5,11,19])).then(e=>({default:e.DirectoryPickerDialog}))),Wj=v.lazy(()=>Pl(()=>import("./CollaborationTaskContent-C3Od6xQy.js"),__vite__mapDeps([20,1,2,3,4,5,8,9,10,11,12,13,14]))),va="inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-[13px] transition disabled:cursor-not-allowed disabled:opacity-40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",zs="w-full min-h-11 rounded-lg border border-border/30 bg-surface-2 px-3 py-2 text-sm text-foreground outline-none focus:border-primary",fl=`${va} bg-primary text-primary-foreground`,li=`${va} bg-surface-2 text-foreground hover:bg-surface-2/80`,Gj={created:"创建任务",assigned:"分派",report:"成员报告",respond:"答复",question:"提出问题",answer:"回答问题","submit-plan":"提交方案",review:"提交评审","request-review":"请求独立评审","approve-plan":"用户确认方案",accepted:"用户验收",revise:"要求修改",comment:"补充说明",coordinator:"协调者变更",close:"关闭",reopen:"重新打开",scheduled:"等待自动分派",coordinate:"协调说明","child-update":"子任务更新","review-passed":"独立评审通过","review-blocked":"评审受阻","automation-blocked":"自动安排受阻",pause:"暂停安排",resume:"继续安排",retry:"请求重新检查"},P0=e=>`${e.serviceId}:${e.sessionId}`,ma=e=>new Date(e).toLocaleString([],{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"});function wo(e,t){try{const r=JSON.parse(localStorage.getItem(e)??"null");return r===null||t!==null&&(typeof r!=typeof t||Array.isArray(r)!==Array.isArray(t))?t:r}catch{return t}}function Yi(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}const Ku={mode:"goal",isolated:!0,title:"",spec:"",constraints:"",acceptance:"",assignee:"",coordinator:"",parent:"",dependencies:[]},A5="__new_coordinator__";function qj(e){const t={...Ku,...wo(e,Ku)};return!t||!Array.isArray(t.dependencies)||t.dependencies.some(r=>typeof r!="string")||Object.keys(Ku).some(r=>!["dependencies","isolated"].includes(r)&&typeof t[r]!="string")?Ku:{...t,mode:t.mode==="task"?"task":"goal",isolated:t.isolated!==!1}}function nv(e,t){const r=e.workflow?.rootTaskId?t.find(l=>l.id===e.workflow?.rootTaskId):null;if(r?.workflow?.paused)return r;const n=new Set([e.id]);let a=e.parentTaskId;for(;a&&!n.has(a);){n.add(a);const l=t.find(c=>c.id===a);if(!l)break;if(l.workflow?.kind==="goal"&&l.workflow.paused)return l;a=l.parentTaskId}return e.workflow?.paused?e:null}function Vj({group:e,sessions:t,active:r,onOpenSession:n,onAttentionChange:a,onManageMembers:l,board:c=!1,boardNavigation:h,boardSettings:p,paneKey:m,agents:x=[],defaultCwd:b,onTeamReady:y}){const w=`termdock:tasks:${location.origin}:${e.id}`,[C,S]=v.useState([]),I=v.useRef(C);I.current=C;const[N,Q]=v.useState(null),[W]=v.useState(()=>Bl.getState().ensure(w,{draft:qj(`${w}:draft`),selectedId:wo(`${w}:selected`,null),creating:!1,mobileDetail:!1})),{selectedId:B,mobileDetail:U,creating:K,draft:re}=Bl(ee=>ee.views[w]??W),H=yh(w,"selectedId"),Oe=yh(w,"mobileDetail"),ne=yh(w,"creating"),ce=yh(w,"draft"),[Ne,Me]=v.useState(!1),[be,V]=v.useState(!1),Ke=v.useRef(null),he=v.useRef(null),Be=v.useRef(!1),ae=v.useCallback(ee=>{!ee&&he.current===document.activeElement&&(Be.current=!0),he.current=ee,ee&&Be.current&&(Be.current=!1,ee.focus())},[]);v.useEffect(()=>{const ee=Ke.current;if(!ee)return;const Ye=new ResizeObserver(qt=>Me(qt[0].contentRect.width>=(c?1100:760)));return Ye.observe(ee),()=>Ye.disconnect()},[c]);const[X,He]=v.useState(!1),[je,ve]=v.useState(null),Fe=ob(),[lt,ye]=v.useState(0),[de,nt]=v.useState(null),[Xe,pt]=v.useState(!1),[xe,mt]=v.useState(0),It=ee=>mt(Ye=>Math.max(0,Ye+ee)),[At,Nt]=v.useState("");v.useEffect(()=>{if(!At)return;const ee=setTimeout(()=>Nt(""),5e3);return()=>clearTimeout(ee)},[At]);const[oe,F]=v.useState("open"),[we,Qe]=v.useState(""),tt=v.useRef(!1),it=v.useRef(!0),Rt=v.useRef(new Map),Xt=v.useRef(!1),Zt=e.sessionIds.flatMap(ee=>{const Ye=t.find(qt=>qt.sessionId===ee);return Ye?[Ye]:[]}),Lt=Zt.map(ee=>({...ee,name:_0(ee,Zt)})),Lr=re.coordinator===A5,Qr=re.coordinator||wo(`${w}:lead`,""),Pt=Lt.find(ee=>ee.sessionId===re.coordinator&&ee.agent),Dt=!!re.coordinator&&!Lr&&!Pt,pr=Lr||Dt?"":Pt?.sessionId||Lt.find(ee=>ee.sessionId===Qr&&ee.agent)?.sessionId||Lt.find(ee=>ee.agent)?.sessionId||"",pe=Lt.filter(ee=>ee.sessionId!==pr&&ee.agent).map(ee=>ee.sessionId),[Ge,at]=v.useState(!1),[Mt,er]=v.useState(!1),[J,bt]=v.useState(()=>wo(`${w}:agent`,"")),[Ce,lr]=v.useState(()=>wo(`${w}:launch-profile`,e.defaultLaunchProfileId??"")),Ve=e.launchProfiles?.find(ee=>ee.id===Ce),zt=Lt.flatMap(ee=>ee.agent&&x.some(Ye=>Ye.slug===ee.agent.slug)?[ee.agent.slug]:[]),Jt=[...new Set(zt)].sort((ee,Ye)=>zt.filter(qt=>qt===Ye).length-zt.filter(qt=>qt===ee).length)[0],Wr=x.find(ee=>ee.slug===Pt?.agent?.slug)?.slug??Jt??x[0]?.slug??"",yn=Ve?.agentSlug??(J||Wr),[Ar,Jr]=v.useState(()=>wo(`${w}:cwd`,Lt[0]?.cwd??b??"")),Fr=!Lt.find(ee=>ee.sessionId===pr)?.agent||!pe.length,[$r,an]=v.useState(null),An=!!re.spec.trim()&&(!!$r||!Dt&&(!Fr||!e.federated&&(!Ce||!!Ve)&&!!x.find(ee=>ee.slug===yn)&&!!Ar.trim())),gt=C.find(ee=>ee.id===B)??null,fe=N?.id===B?N:null;v.useEffect(()=>(it.current=!0,()=>{it.current=!1}),[]),v.useEffect(()=>{Yi(`${w}:draft`,re)},[w,re]),v.useEffect(()=>{Yi(`${w}:selected`,B)},[w,B]),v.useEffect(()=>{const ee=qt=>{const Gt=qt.detail;Gt?.groupId===e.id&&(Yi(`${w}:open-task`,null),H(Gt.taskId),Oe(!0),ne(!1),F("all"),Vr())};window.addEventListener("open-collaboration-task",ee);const Ye=wo(`${w}:open-task`,null);return Ye&&(H(Ye),Oe(!0),F("all"),Yi(`${w}:open-task`,null)),()=>window.removeEventListener("open-collaboration-task",ee)},[e.id]),v.useEffect(()=>{if(!r||!gt||N?.id===gt.id&&N.revision===gt.revision)return;let ee=!1;return z7(gt.id).then(Ye=>{ee||(Q(Ye.task),ve(null))}).catch(Ye=>{ee||ve(Ye instanceof Error?Ye.message:"任务详情加载失败")}),()=>{ee=!0}},[r,gt?.id,gt?.revision,N?.id,N?.revision,lt]);const Vr=async()=>{if(!Xt.current){Xt.current=!0;try{const ee=await sb(e.id);it.current&&(S(ee.tasks),He(!0),ve(null),ye(Ye=>Ye+1))}catch(ee){it.current&&ve(ee instanceof Error?ee.message:"任务加载失败")}finally{Xt.current=!1}}};v.useEffect(()=>{if(r)return yc(()=>{navigator.onLine!==!1&&Vr()},2500,[Co,"pageshow"])},[r,e.id]);const ct=ee=>{const Ye=JSON.stringify(ee),qt=wo(`${w}:request`,null);let Gt=Rt.current.get(Ye)??(qt?.fingerprint===Ye?qt.key:void 0);return Gt||(Gt=crypto.randomUUID(),Rt.current.set(Ye,Gt)),Yi(`${w}:request`,{fingerprint:Ye,key:Gt}),Gt},Ue=ee=>{Rt.current.delete(JSON.stringify(ee)),Yi(`${w}:request`,null)},Tr=async(ee,Ye)=>{if(Xe||tt.current)return{ok:!1,error:"已有操作正在提交,请稍候。"};tt.current=!0,pt(!0),nt(null),Nt("");let qt={...Ye,expectedRevision:ee.revision};if(["comment","revise"].includes(Ye.kind)){const Gt=wo(`${w}:request`,null);try{const[Yr,Br]=JSON.parse(Gt?.fingerprint??"null"),{expectedRevision:Er,...ar}=Br;Yr===ee.id&&JSON.stringify(ar)===JSON.stringify(Ye)&&(qt=Br)}catch{}}try{const Gt=await K7(ee.id,{...qt,idempotencyKey:ct([ee.id,qt])});if(Ue([ee.id,qt]),Yu.getState().refresh(),it.current){const Yr=I.current.find(br=>br.id===Gt.task.id),Br=Yr&&Yr.revision>Gt.task.revision?Yr:Gt.task;S(br=>br.map(Hn=>Hn.id===Gt.task.id&&Hn.revision<=Gt.task.revision?Gt.task:Hn)),Q(br=>br?.id===Gt.task.id&&br.revision>Gt.task.revision?br:Gt.task);const Er=nv(Br,I.current),ar=`${Ye.kind==="answer"?"回答已保存":"方案确认已保存"},${Er?Er.workflow?.kind==="goal"?"目标仍暂停;恢复目标后才能投递。":"任务仍暂停;继续安排后才能投递。":"投递状态请查看任务记录。"}`;Nt(["comment","revise"].includes(Ye.kind)?"":Ye.kind==="retry"?$j(ee,Gt.task):["answer","approve-plan"].includes(Ye.kind)?ar:Ye.kind==="accept"?"已验收此版本结果。":"记录已保存。")}return{ok:!0}}catch(Gt){const Yr=Gt instanceof Error?Gt.message:"操作失败";return Yr.includes("任务已更新")&&Ue([ee.id,qt]),it.current&&(nt(["comment","revise"].includes(Ye.kind)?null:Yr),Vr()),{ok:!1,error:Yr}}finally{tt.current=!1,it.current&&pt(!1)}},wt=async ee=>{if(ee.preventDefault(),Xe||xe>0||(re.mode==="goal"?!An:!re.title.trim()||!re.spec.trim())||tt.current)return;tt.current=!0,pt(!0),nt(null);const Ye=re.mode==="goal",qt={groupId:e.id,title:re.title.trim()||re.spec.trim().split(`
133
+ `)[0].slice(0,100),spec:re.spec,constraints:re.constraints,acceptance:re.acceptance,assigneeSessionId:Ye?void 0:re.assignee||void 0,coordinatorSessionId:Ye?pr:re.coordinator||void 0,parentTaskId:Ye?void 0:re.parent||void 0,dependsOn:Ye?[]:re.dependencies,managed:Ye,isolated:re.isolated,reviewerSessionIds:Ye?pe:void 0};try{if(Ye&&(Fr||$r)){er(!0);const Yr=Lr?wo(`${w}:team-request`,"")||crypto.randomUUID():void 0;Yr&&Yi(`${w}:team-request`,Yr);const Br=$r??await G7(e.id,{agentSlug:yn,...Ce?{launchProfileId:Ce}:e.launchProfiles?.length?{launchProfileId:""}:{},cwd:Ar.trim(),...Lr?{coordinatorSessionId:null,coordinatorCreationKey:Yr}:pr?{coordinatorSessionId:pr}:{}});er(!1),an(Br),qt.coordinatorSessionId=Br.coordinatorSessionId,qt.reviewerSessionIds=Br.reviewerSessionIds,Yi(`${w}:agent`,J),Yi(`${w}:cwd`,Ar.trim()),Yi(`${w}:launch-profile`,Ce)}const{task:Gt}=await q7({...qt,idempotencyKey:ct(qt)});Ue(qt),it.current&&(S(Yr=>[Gt,...Yr.filter(Br=>Br.id!==Gt.id)]),H(Gt.id),Oe(!0),Q(Gt),Ye&&Yi(`${w}:lead`,qt.coordinatorSessionId),Yi(`${w}:team-request`,null),an(null),y?.(),ce(Ku),ne(!1),F("open"),Qe(""),Nt(Ye?"目标已提交,协调者收到后开始拆分与分派。后续评审和依赖由服务接续。":"任务已保存。分派后由服务端持续投递。"))}catch(Gt){it.current&&nt(Gt instanceof Error?Gt.message:"创建失败")}finally{tt.current=!1,it.current&&(pt(!1),er(!1))}},Tn=(ee,Ye)=>{if(!Ye)return"用户";const qt=ee.memberSessions[P0(Ye)];return Lt.find(Gt=>Gt.sessionId===qt)?.name??t.find(Gt=>Gt.sessionId===qt)?.name??"暂不可用的成员"},Nr=C.filter(ee=>(oe==="all"?!0:oe==="archive"?ee.status!=="open":ee.status==="open")&&(oe==="all"||oe==="attention"||ee.workflow?.kind!=="step")&&(oe!=="attention"||Ji(ee))&&(!we.trim()||`${ee.title} ${ee.spec} ${ee.attempts.map(Ye=>Tn(ee,Ye.assignee)).join(" ")}`.toLowerCase().includes(we.trim().toLowerCase()))),cn=C.filter(Ji).length;v.useEffect(()=>{a?.(cn)},[cn,a]);const Ie=!!gt&&(c?U:Ne||U),ht=()=>{ne(!1),requestAnimationFrame(()=>he.current?.focus())},Je=ee=>{Bl.getState().updateDetail(`${w}:${ee}`,"view","overview"),H(ee),Oe(!0),Nt("")},_r=C.filter(Ji).filter(ee=>!we.trim()||`${ee.title} ${ee.spec} ${ee.attempts.map(Ye=>Tn(ee,Ye.assignee)).join(" ")}`.toLowerCase().includes(we.trim().toLowerCase())),Zr=(ee,Ye=!1)=>{const qt=ee.attempts.find(br=>br.id===ee.activeAttemptId),Gt=ee.children?.filter(br=>br.status==="accepted").length??0,Yr=ee.children?.filter(br=>br.status!=="closed").length??0,Br=Pf(ee),Er=Br.length>1?Br.find(br=>br.source!=="member"):null,ar=(Ye?ee.decisions.find(br=>br.status==="pending")?.question:"")||Br[0]?.summary||qt?.report?.summary||qt?.report?.content;return s.jsxs("button",{type:"button","aria-pressed":B===ee.id,className:`group flex min-h-11 w-full items-start gap-3 rounded-xl p-3 text-left transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${B===ee.id?"bg-surface-2":"hover:bg-surface-2/70"}`,onClick:()=>Je(ee.id),children:[s.jsx("span",{className:`mt-0.5 shrink-0 ${Ye||ee.status==="accepted"?"text-primary":"text-muted-foreground"}`,children:Ye?s.jsx(wc,{size:16}):ee.status==="accepted"?s.jsx(ld,{size:16}):s.jsx(Tf,{size:16})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block break-words text-sm font-medium leading-5 text-foreground",children:ee.title}),s.jsx("span",{className:`mt-1 block text-xs leading-5 ${Ye?"text-primary":"text-muted-foreground"}`,children:Jc(ee)}),ar&&s.jsx("span",{className:"mt-1 block line-clamp-2 break-words text-xs leading-5 text-muted-foreground",children:ar}),Er&&s.jsxs("span",{className:`mt-1 block line-clamp-2 break-words text-xs leading-5 ${Er.source==="system"?"text-destructive":"text-muted-foreground"}`,children:[Er.label,":",Er.summary]}),Yr>0&&s.jsxs("span",{className:"mt-2 flex items-center gap-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"flex gap-1","aria-hidden":"true",children:(ee.children??[]).filter(br=>br.status!=="closed").slice(0,8).map(br=>s.jsx("span",{className:`h-1.5 w-3 rounded-full ${br.status==="accepted"?"bg-primary":"bg-border/30"}`},br.id))}),Gt,"/",Yr," 子任务已验收"]}),s.jsxs("span",{className:"mt-2 block text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"block truncate",children:qt?Tn(ee,qt.assignee):"尚未分派"}),s.jsx(xf,{task:ee})]})]}),s.jsx(Ci,{size:14,className:"mt-1 shrink-0 text-muted-foreground/60"})]},ee.id)},Gr=[],Ir=new Set([B]);let es=gt?.parentTaskId;for(;es&&!Ir.has(es);){Ir.add(es);const ee=C.find(Ye=>Ye.id===es);if(!ee)break;Gr.unshift(ee),es=ee.parentTaskId}const Ft=()=>{const ee=Array.from(Ke.current?.querySelectorAll("button[data-task-id]")??[]).find(Ye=>Ye.dataset.taskId===B);Oe(!1),requestAnimationFrame(()=>{ee&&!ee.closest("[hidden]")?ee.focus():he.current?.focus()})},hn=K||!c&&X&&C.length===0;return s.jsxs("section",{ref:Ke,"aria-label":"协作任务",className:c?"relative flex h-full min-h-0 min-w-0 flex-col gap-2":"space-y-5",children:[c&&(hn||!X)&&h&&s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/15 pb-2",children:[h,s.jsx("div",{className:"ml-auto",children:p})]}),(de||je&&Fe==="ready"&&!id(je))&&s.jsxs("div",{role:"alert",className:"flex items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[s.jsxs("span",{className:"min-w-0 flex-1 break-words",children:[de||je,!de&&X?" · 显示最近保存的记录":""]}),s.jsxs("button",{type:"button",className:va,onClick:()=>de?nt(null):void Vr(),children:[s.jsx(sn,{size:14}),de?"关闭提示":"重试"]})]}),je&&id(je)&&!c&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"正在恢复任务同步,现有记录和草稿已保留"}),At&&s.jsx("p",{role:"status",className:"rounded-lg bg-primary/10 px-3 py-2 text-xs leading-5 text-primary",children:At}),hn?s.jsxs("form",{onSubmit:ee=>{wt(ee)},className:`mx-auto w-full max-w-xl space-y-4 ${c?"overflow-auto px-1 py-5":""}`,onKeyDown:ee=>{ee.key==="Escape"&&K&&!ee.defaultPrevented&&!ee.nativeEvent.isComposing&&H7(ee.currentTarget)&&(ee.preventDefault(),ee.stopPropagation(),Xe||ht())},children:[s.jsxs("header",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"text-lg font-semibold text-foreground",children:re.mode==="goal"?"一起完成什么?":"新建手动任务"}),s.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:re.mode==="goal"?"交给协调者拆分,你在这里看交付、回答问题。":"选择负责人,保留分派和验收记录。"})]}),(C.length>0||c)&&s.jsx("button",{type:"button","aria-label":"取消创建,保留草稿",className:`${va} shrink-0 px-2 text-muted-foreground hover:bg-surface-2`,disabled:Xe,onClick:ht,children:s.jsx(zn,{size:16})})]}),re.mode==="task"&&s.jsx(Ya,{label:"任务标题",children:s.jsx("input",{className:zs,required:!0,maxLength:200,value:re.title,onChange:ee=>ce(Ye=>({...Ye,title:ee.target.value})),placeholder:"要完成什么?"})}),s.jsx(Oh,{paneKey:m,inputKey:`${w}:spec`,active:r&&hn,label:re.mode==="goal"?"协作目标":"目标与交付要求",className:`${zs} ${Fr&&re.mode==="goal"?"min-h-24":"min-h-32"} resize-y text-sm leading-6`,autoFocus:K,required:!0,disabled:Xe,value:re.spec,onUploadChange:It,onChange:ee=>ce(Ye=>({...Ye,spec:typeof ee=="function"?ee(Ye.spec):ee})),placeholder:"例如:完善附件预览体验,交付实现和评审结果,保留现有快捷键。"}),re.mode==="goal"&&$r&&s.jsxs("section",{role:"status","aria-label":"目标提交阶段",className:"space-y-2 rounded-lg bg-primary/10 px-3 py-2 text-xs leading-5",children:[s.jsx("p",{className:"text-primary",children:"成员已准备,目标尚未提交。重试会复用这些成员。"}),s.jsx("p",{className:"text-muted-foreground",children:"Agent 和工作目录已用于准备成员,因此暂时锁定;目标正文仍可修改。"}),l&&s.jsx("button",{type:"button",className:li,disabled:Xe,onClick:()=>{y?.(),l()},children:"查看已准备的成员"})]}),re.mode==="goal"&&s.jsxs(Ya,{label:"协调者",children:[s.jsxs("select",{"aria-label":"协调者",className:zs,disabled:Xe||!!$r,value:re.coordinator,onChange:ee=>{Yi(`${w}:team-request`,null),ce(Ye=>({...Ye,coordinator:ee.target.value}))},children:[s.jsx("option",{value:"",children:"自动选择(优先复用组内 Agent)"}),s.jsx("option",{value:A5,disabled:!!e.federated,children:"新建协调者"}),Dt&&s.jsx("option",{value:re.coordinator,disabled:!0,children:"原协调者已不可用,请重新选择"}),Lt.map(ee=>s.jsxs("option",{value:ee.sessionId,disabled:!ee.agent,children:[ee.name,ee.agent?` · ${ee.agent.displayName}`:"(需要启动 Agent)"]},ee.sessionId))]}),Dt&&!$r&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"所选协调者已离组或未运行 Agent,请重新选择。"})]}),re.mode==="goal"&&(Fr||$r)?s.jsxs("fieldset",{disabled:Xe||!!$r,className:"space-y-3",children:[s.jsx("legend",{className:"mb-2 text-xs text-muted-foreground",children:$r?"已用于准备成员的配置":"首次开始时配置 Agent"}),(!!e.launchProfiles?.length||!!Ce)&&s.jsxs(Ya,{label:"启动方案",children:[s.jsxs("select",{"aria-label":"协作启动方案",className:zs,value:Ce,onChange:ee=>lr(ee.target.value),children:[s.jsx("option",{value:"",children:"Agent 默认命令"}),e.launchProfiles?.map(ee=>s.jsxs("option",{value:ee.id,children:[ee.name," · ",x.find(Ye=>Ye.slug===ee.agentSlug)?.displayName??ee.agentSlug]},ee.id))]}),Ve&&s.jsxs("details",{className:"text-xs leading-5 text-muted-foreground",children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-2",children:s.jsx("span",{className:"line-clamp-2 break-words",children:Ve.notes||"查看启动命令与使用备注"})}),s.jsx("p",{"aria-label":"完整使用备注",className:"whitespace-pre-wrap break-words",children:Ve.notes}),s.jsx("code",{className:"mt-1 block break-all",children:Ve.command})]}),Ce&&!Ve&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"原方案已删除,请重新选择。"})]}),!Ve&&s.jsx(Ya,{label:"Agent",children:s.jsxs("select",{"aria-label":"协作 Agent",className:zs,disabled:!!Ve,value:yn,onChange:ee=>bt(ee.target.value),children:[s.jsx("option",{value:"",disabled:!0,children:"选择已安装的 Agent"}),x.map(ee=>s.jsx("option",{value:ee.slug,children:ee.displayName},ee.slug))]})}),s.jsxs(Ya,{label:"工作目录",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{"aria-label":"工作目录",className:`${zs} min-w-0 flex-1`,value:Ar,onChange:ee=>Jr(ee.target.value),placeholder:"选择项目所在的目录"}),s.jsx("button",{type:"button",className:li,onClick:()=>at(!0),children:"浏览目录"})]}),Ge&&s.jsx(v.Suspense,{fallback:s.jsx("p",{className:"text-xs",children:"正在打开目录…"}),children:s.jsx(Hj,{open:!0,initialPath:Ar.trim()||b||"/",title:"选择协作项目目录",onCancel:()=>at(!1),onConfirm:ee=>{Jr(ee),at(!1)}})})]}),!$r&&s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:Lr?"开始时新建协调者,并补齐执行/评审成员。":"保留所选协调者,开始时补齐执行/评审成员;自动选择会优先复用组内 Agent。"}),e.federated&&s.jsxs("p",{role:"alert",className:"text-xs text-muted-foreground",children:["跨服务组请从成员设置添加 Agent。",l&&s.jsx("button",{type:"button",className:li,onClick:l,children:"管理成员"})]}),!x.length&&s.jsxs("p",{role:"alert",className:"text-xs text-muted-foreground",children:["尚未检测到可启动的 Agent。安装后刷新,或从成员设置复用现有 Agent。",l&&s.jsx("button",{type:"button",className:li,onClick:l,children:"管理成员"})]})]}):re.mode==="task"&&s.jsx(Ya,{label:"分派给",children:s.jsxs("select",{className:zs,value:re.assignee,onChange:ee=>ce(Ye=>({...Ye,assignee:ee.target.value})),children:[s.jsx("option",{value:"",children:"先保存,稍后分派"}),Lt.map(ee=>s.jsx("option",{value:ee.sessionId,children:ee.name},ee.sessionId))]})}),s.jsxs("details",{className:"border-y border-border/15",children:[s.jsxs("summary",{className:"flex min-h-11 cursor-pointer items-center gap-2 text-xs text-muted-foreground",children:["验收标准与更多设置",(re.acceptance||re.constraints)&&s.jsx("span",{className:"text-primary",children:"已补充"})]}),s.jsxs("div",{className:"space-y-3 pb-4",children:[re.mode==="goal"&&s.jsxs(Ya,{label:"目标名称(选填)",children:[s.jsx("input",{"aria-label":"目标名称",className:zs,maxLength:100,value:re.title,onChange:ee=>ce(Ye=>({...Ye,title:ee.target.value})),placeholder:"用成果命名,例如:交付可安装的 Preview 客户端"}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"看板用这个名称辨认目标;未填写时使用正文第一行。"})]}),s.jsx(Ya,{label:"验收标准(选填)",children:s.jsx("textarea",{className:`${zs} min-h-20 resize-y`,value:re.acceptance,onChange:ee=>ce(Ye=>({...Ye,acceptance:ee.target.value})),placeholder:"什么结果满足要求?"})}),s.jsx(Ya,{label:"约束(选填)",children:s.jsx("textarea",{className:`${zs} min-h-20 resize-y`,value:re.constraints,onChange:ee=>ce(Ye=>({...Ye,constraints:ee.target.value})),placeholder:"必须保留什么?哪些操作需要先问你?"})}),re.mode==="goal"?s.jsxs("label",{className:"flex min-h-11 items-start gap-2 text-xs leading-5 text-muted-foreground",children:[s.jsx("input",{type:"checkbox",className:"mt-1",checked:re.isolated,onChange:ee=>ce(Ye=>({...Ye,isolated:ee.target.checked}))}),s.jsxs("span",{children:["代码任务使用独立目录",s.jsx("br",{}),s.jsx("span",{className:"text-[11px]",children:"协调者自动区分查询与代码任务;查询复用成员会话,只有代码需要目录与集成。"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ya,{label:"协调者",children:s.jsxs("select",{className:zs,value:re.coordinator,onChange:ee=>ce(Ye=>({...Ye,coordinator:ee.target.value})),children:[s.jsx("option",{value:"",children:"由用户协调"}),Lt.map(ee=>s.jsx("option",{value:ee.sessionId,children:ee.name},ee.sessionId))]})}),s.jsx(Ya,{label:"父任务",children:s.jsxs("select",{className:zs,value:re.parent,onChange:ee=>ce(Ye=>({...Ye,parent:ee.target.value})),children:[s.jsx("option",{value:"",children:"独立任务"}),C.filter(ee=>!ee.workflow).map(ee=>s.jsx("option",{value:ee.id,children:ee.title},ee.id))]})}),s.jsxs("fieldset",{className:"space-y-1",children:[s.jsx("legend",{className:"text-xs text-muted-foreground",children:"需先验收的依赖任务"}),C.filter(ee=>ee.status!=="closed").map(ee=>s.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-xs text-foreground",children:[s.jsx("input",{type:"checkbox",checked:re.dependencies.includes(ee.id),onChange:Ye=>ce(qt=>({...qt,dependencies:Ye.target.checked?[...qt.dependencies,ee.id]:qt.dependencies.filter(Gt=>Gt!==ee.id)}))}),ee.title]},ee.id))]})]}),s.jsx("button",{type:"button",className:`${va} text-muted-foreground hover:bg-surface-2`,onClick:()=>ce(ee=>({...ee,mode:ee.mode==="goal"?"task":"goal"})),children:re.mode==="goal"?"改为手动分派任务":"改为自动协作目标"})]})]}),s.jsxs("button",{className:`${fl} w-full`,disabled:Xe||xe>0||(re.mode==="goal"?!An:!re.title.trim()||!re.spec.trim()),children:[Xe?s.jsx(sn,{size:14,className:"animate-spin"}):s.jsx(_h,{size:14}),Xe?Mt?"正在准备成员…":"提交中…":re.mode==="goal"?$r?"重试提交目标":"开始协作":re.assignee?"创建并分派":"保存任务"]}),s.jsx("p",{className:"text-center text-[11px] leading-5 text-muted-foreground",children:re.mode==="goal"?"拆分任务 → 执行与独立评审 → 你验收结果":"草稿自动保存,分派后保留投递与回复记录。"})]}):c&&X?s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"sr-only",children:"任务看板"}),s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 gap-5",children:[s.jsx("div",{hidden:Ie,className:`${Ie?"hidden":"flex"} min-h-0 min-w-0 flex-1`,children:s.jsx(zj,{navigation:h,settings:p,action:s.jsxs("button",{ref:ae,type:"button",className:fl,disabled:Xe,onClick:()=>ne(!0),children:[s.jsx(ui,{size:14}),"新目标"]}),storage:w,tasks:C,selectedId:Ie?B:null,name:Tn,onSelect:Je})}),Ie&&s.jsxs("aside",{"aria-label":"任务详情",className:"mx-auto flex min-h-0 min-w-0 w-full max-w-[1040px] flex-col",children:[s.jsx("nav",{"aria-label":"任务位置",className:"mb-2 shrink-0",children:s.jsxs("ol",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground",children:[s.jsx("li",{className:"shrink-0",children:s.jsx("button",{type:"button","aria-label":"返回看板",title:"查看此协作组的任务看板",className:`${va} px-2 hover:bg-surface-2`,onClick:Ft,children:"看板"})}),Gr.map(ee=>s.jsxs("li",{className:"flex min-w-0 flex-1 items-center gap-1 sm:max-w-xs sm:flex-none",children:[s.jsx(Ci,{"aria-hidden":"true",size:12,className:"shrink-0"}),s.jsx("button",{type:"button","aria-label":`查看${ee.workflow?.kind==="goal"?"目标":"父任务"}:${ee.title}`,title:`查看${ee.workflow?.kind==="goal"?"目标":"父任务"}:${ee.title}`,className:`${va} min-w-0 px-2 hover:bg-surface-2`,onClick:()=>Je(ee.id),children:s.jsxs("span",{className:"truncate",children:[ee.workflow?.kind==="goal"?"目标":"父任务",":",ee.title]})})]},ee.id)),s.jsxs("li",{"aria-current":"page",className:"flex shrink-0 items-center gap-1",children:[s.jsx(Ci,{"aria-hidden":"true",size:12}),s.jsx("span",{className:"px-2",children:gt?.parentTaskId?"子任务详情":gt?.workflow?.kind==="goal"?"目标详情":"任务详情"})]})]})}),s.jsx("div",{className:"min-h-0 flex-1",children:fe?s.jsx(T5,{reader:!0,paneKey:m,active:r,task:fe,tasks:C,members:Lt,busy:Xe,name:ee=>Tn(fe,ee),act:ee=>Tr(fe,ee),storage:w,onSelectTask:Je,onOpenSession:async ee=>{const Ye=t.find(qt=>qt.sessionId===fe.memberSessions[P0(ee)]);if(!Ye){nt("成员会话暂不可用,任务历史已保留。");return}try{await n(Ye)}catch(qt){nt(qt instanceof Error?qt.message:"无法打开终端")}}},fe.id):s.jsx("p",{role:"status",className:"py-8 text-center text-xs text-muted-foreground",children:"正在加载任务详情…"})})]})]})]}):!X&&!C.length?s.jsxs("div",{role:"status",className:"space-y-3 py-8",children:[s.jsx("p",{className:"text-center text-xs text-muted-foreground",children:je?"任务暂时无法加载,请重试。":"正在加载目标…"}),!je&&[0,1,2].map(ee=>s.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-surface-2"},ee))]}):s.jsxs(s.Fragment,{children:[(!Ie||Ne)&&s.jsxs("header",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold text-foreground",children:"协作目标"}),s.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:[C.filter(ee=>ee.status==="open"&&ee.workflow?.kind!=="step").length," 个进行中 · ",C.filter(ee=>ee.status==="accepted"&&ee.workflow?.kind!=="step").length," 个已验收"]})]}),s.jsxs("button",{ref:ae,type:"button",className:fl,disabled:Xe,onClick:()=>ne(!0),children:[s.jsx(ui,{size:14}),"新目标"]})]}),s.jsxs("div",{className:Ne&&Ie?"grid items-start gap-6 grid-cols-[260px_minmax(0,1fr)]":"",children:[(!Ie||Ne)&&s.jsxs("div",{className:"min-w-0 space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{"aria-label":"任务筛选",className:`${zs} min-w-0 flex-1 border-transparent bg-transparent`,value:oe,onChange:ee=>F(ee.target.value),children:[s.jsx("option",{value:"open",children:"进行中的目标"}),s.jsxs("option",{value:"attention",children:["需要你处理(",cn,")"]}),s.jsx("option",{value:"archive",children:"已归档"}),s.jsx("option",{value:"all",children:"全部任务"})]}),s.jsx("button",{type:"button","aria-label":"搜索任务","aria-expanded":be,className:`${va} shrink-0 px-3 text-muted-foreground hover:bg-surface-2`,onClick:()=>{V(ee=>!ee),Qe("")},children:s.jsx($l,{size:16})})]}),be&&s.jsx("input",{"aria-label":"搜索任务或负责人",autoFocus:!0,className:zs,value:we,onChange:ee=>Qe(ee.target.value),placeholder:"搜索目标、内容或负责人"}),oe==="open"&&_r.length>0&&s.jsxs("section",{"aria-label":"需要你处理",className:"rounded-xl bg-surface-2/40 p-1",children:[s.jsxs("h4",{className:"flex items-center justify-between px-3 pb-1 pt-3 text-xs font-medium text-primary",children:["需要你处理",s.jsx("span",{className:"rounded-md bg-primary/15 px-2 py-0.5",children:_r.length})]}),_r.map(ee=>Zr(ee,!0))]}),(oe!=="open"||Nr.some(ee=>!Ji(ee))||Nr.length===0)&&s.jsxs("section",{className:"space-y-1",children:[s.jsx("h4",{className:"px-3 text-[11px] font-medium text-muted-foreground",children:oe==="attention"?"需要你处理":oe==="archive"?"已归档":oe==="all"?"全部任务":"当前目标"}),Nr.filter(ee=>oe!=="open"||!Ji(ee)).map(ee=>Zr(ee,oe==="attention")),!Nr.length&&s.jsxs("div",{className:"px-3 py-6 text-center text-xs leading-5 text-muted-foreground",children:[we.trim()?"没有匹配的任务。":oe==="attention"?"目前没有需要你处理的任务。":oe==="archive"?"还没有归档任务。":"当前没有进行中的目标。",(oe!=="all"||we)&&s.jsx("button",{type:"button",className:`${va} mt-2 text-primary`,onClick:()=>{F("all"),Qe("")},children:"查看全部任务"})]})]})]}),Ie&&s.jsxs("div",{className:"min-w-0",children:[!Ne&&s.jsxs("button",{type:"button",className:`${va} mb-4 -ml-2 text-muted-foreground hover:bg-surface-2`,onClick:()=>Oe(!1),children:[s.jsx(W7,{size:14}),"全部目标"]}),fe?s.jsx(T5,{paneKey:m,active:r,task:fe,tasks:C,members:Lt,busy:Xe,name:ee=>Tn(fe,ee),act:ee=>Tr(fe,ee),storage:w,onSelectTask:Je,onOpenSession:async ee=>{const Ye=t.find(qt=>qt.sessionId===fe.memberSessions[P0(ee)]);if(!Ye){nt("成员会话暂不可用,任务历史已保留。");return}try{await n(Ye)}catch(qt){nt(qt instanceof Error?qt.message:"无法打开终端")}}},fe.id):s.jsx("p",{role:"status",className:"py-8 text-center text-xs text-muted-foreground",children:"正在加载任务详情…"})]})]})]})]})}function Ya({label:e,children:t}){return s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e}),t]})}function T5({reader:e=!1,active:t,paneKey:r,task:n,tasks:a,members:l,name:c,busy:h,act:p,storage:m,onOpenSession:x,onSelectTask:b}){const[y,w]=v.useState(""),[C,S]=v.useState(""),[I,N]=v.useState(""),[Q,W]=v.useState(!1),[B,U]=v.useState(null),K=v.useRef(!1),re=v.useRef(!0);v.useEffect(()=>(re.current=!0,()=>{re.current=!1}),[]);const H=v.useRef(null),Oe=v.useRef(null);v.useEffect(()=>{!e&&B&&B.state!=="pending"&&t&&requestAnimationFrame(()=>Oe.current?.scrollIntoView({block:"nearest"}))},[B]);const ne=v.useRef(null),[ce,Ne]=v.useState(0),Me=J=>Ne(bt=>Math.max(0,bt+J)),be=v.useRef(null);v.useEffect(()=>{be.current?.focus()},[]);const V=`${m}:${n.id}`,[Ke]=v.useState(()=>Bl.getState().ensureDetail(V,{feedback:wo(`${V}:feedback`,""),answers:wo(`${V}:answers`,{}),view:"overview"})),{feedback:he,answers:Be,view:ae}=Bl(J=>J.details[V]??Ke),X=im(V,"feedback"),He=im(V,"answers"),je=im(V,"view");v.useEffect(()=>{ne.current&&(ne.current.scrollTop=0)},[ae]),v.useEffect(()=>Yi(`${m}:${n.id}:answers`,Be),[m,n.id,Be]),v.useEffect(()=>Yi(`${m}:${n.id}:feedback`,he),[m,n.id,he]);const ve=n.attempts.find(J=>J.id===n.activeAttemptId),Fe=n.status==="open",lt=nv(n,a),ye=n.artifacts.filter(J=>J.kind==="result"&&J.attemptId===n.activeAttemptId).at(-1);v.useEffect(()=>{B?.state==="saved"&&ye?.id!==B.resultId&&U(null)},[ye?.id,B]);const de=n.artifacts.filter(J=>J.kind==="plan"&&J.attemptId===n.activeAttemptId).at(-1),nt=n.events.filter(J=>J.kind==="revise"&&J.source==="user"&&J.attemptId===n.activeAttemptId).at(-1),Xe=ye&&n.events.some(J=>J.kind==="revise"&&J.attemptId===n.activeAttemptId&&J.createdAt>=ye.createdAt),pt=e&&Fe&&!!Xe,xe=B?.state==="saved"&&B.kind==="revise"&&B.resultId===ye?.id,mt=n.decisions.filter(J=>J.status==="pending"&&J.attemptId===n.activeAttemptId),It=n.dependsOn.some(J=>a.find(bt=>bt.id===J)?.status!=="accepted"),At=!n.workflow||n.artifacts.filter(J=>J.kind==="review"&&J.reviewsArtifactId===ye?.id).at(-1)?.verdict==="pass",Nt=n.children??[],oe=n.workflow?.kind==="goal"&&Nt.some(J=>!["accepted","closed"].includes(J.status)),F=`任务:${n.title}
134
+ 任务 ID:${n.id}
135
+ ${n.spec}
136
+ 约束:${n.constraints||"未补充"}
137
+ 验收标准:${n.acceptance||"由用户决定"}
138
+ ${ve?`当前尝试:${ve.id}
139
+ 负责人:${c(ve.assignee)}
140
+ `:""}${n.artifacts.filter(J=>J.attemptId===n.activeAttemptId).map(J=>`${J.kind} · 版本 ${J.id} · ${ma(J.createdAt)}
141
+ ${J.summary?`结果摘要:${J.summary}
142
+ `:""}${J.content}`).join(`
143
+
144
+ `)}
145
+ ${mt.map(J=>`待回答:${J.question}`).join(`
146
+ `)}`,we=v.useCallback(J=>V7(new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),`termdock-task-${n.id}.json`,J),[n]),Qe=Z7(we,n.id,t),tt=n.events.filter(J=>J.kind==="coordinate"&&(!J.attemptId||J.attemptId===n.activeAttemptId)).at(-1),it=ae==="results"?n.artifacts.slice().reverse():n.artifacts.filter(J=>J.id===ye?.id||J.id===de?.id&&n.approvedPlanArtifactId!==J.id||J.kind==="review"&&J.reviewsArtifactId===ye?.id).sort((J,bt)=>(J.kind==="result"?-1:1)-(bt.kind==="result"?-1:1)||bt.createdAt-J.createdAt),Rt=Nt.flatMap(J=>{const bt=a.find(Ce=>Ce.id===J.id);return bt?[bt]:[]}),Xt=J6(n,Rt),Zt=Nt.filter(J=>J.status!=="closed"),Lt=Zt.filter(J=>J.status!=="accepted"),Lr=tt&&(!nt||tt.createdAt>=nt.createdAt)?tt:void 0,Qr=ve?.report&&(!nt||ve.report.createdAt>=nt.createdAt)?ve.report:void 0,Pt=Xe?"等待新结果通过评审后可验收。":mt.length?"回答当前问题后可验收。":It?"依赖任务验收后可验收。":At?oe?"子任务完成并通过评审后可验收。":null:"独立评审通过后可验收。",Dt=()=>{je("overview"),W(!0),requestAnimationFrame(()=>{H.current?.scrollIntoView({block:"nearest"}),H.current?.querySelector("textarea")?.focus()})},pr=Pf(n),pe=pr[0],Ge=pr.some(J=>J.source==="member"),at=async J=>{if(h||ce||!he.trim()||K.current)return;const bt=he;K.current=!0,U({kind:J,state:"pending",content:bt,resultId:ye?.id});const Ce=await p({kind:J,content:bt});if(K.current=!1,Ce.ok){if(X(lr=>lr===bt?"":lr),Yi(`${V}:feedback`,Bl.getState().details[V]?.feedback??""),!re.current)return;U({kind:J,state:"saved",content:bt,resultId:ye?.id}),e&&Bl.getState().details[V]?.feedback===""&&W(!1)}else re.current&&U({kind:J,state:"error",content:bt,error:Ce.error,resultId:ye?.id})},Mt=J=>s.jsx(v.Suspense,{fallback:s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-6 text-foreground",children:J}),children:s.jsx(Wj,{content:J})}),er=J=>{const bt=rv(J.content,J.summary);return s.jsxs("section",{className:"space-y-3 rounded-xl border border-border/20 bg-surface-2/30 p-4",children:[s.jsxs("header",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h4",{className:"min-w-0 flex-1 text-sm font-semibold text-foreground",children:J.kind==="result"?Xe&&J.id===ye?.id?"上一版结果":"交付结果":J.kind==="plan"?n.approvedPlanArtifactId===J.id?"已确认的方案":"方案":"独立评审"}),J.verdict&&s.jsx("span",{className:`rounded-md px-2 py-1 text-[11px] ${J.verdict==="pass"?"bg-primary/10 text-primary":"bg-surface-2 text-foreground"}`,children:J.verdict==="pass"?"通过":J.verdict==="changes"?"需要修改":"受阻"}),n.acceptedArtifactId===J.id&&s.jsx("span",{className:"text-xs text-primary",children:n.completionMode==="reviewed"?"评审通过":"已验收"}),n.approvedPlanArtifactId===J.id&&s.jsx("span",{className:"text-xs text-primary",children:"方案已确认"})]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[c(J.actor)," · ",ma(J.createdAt),J.attemptId!==n.activeAttemptId&&J.kind!=="review"?" · 历史分派":""]}),J.kind==="result"&&bt.condensed?s.jsxs(s.Fragment,{children:[s.jsx("div",{"aria-label":"结果结论",className:"text-base leading-7",children:Mt(!bt.explicit&&!bt.summary.includes(`
147
+ `)?bt.summary.replace(/([。;])\s*(?=\S)/g,`$1
148
+
149
+ `):bt.summary)}),bt.limitations&&s.jsxs("div",{className:"border-l-2 border-border/40 pl-3",children:[s.jsx("h5",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"适用范围与限制"}),Mt(bt.limitations)]}),s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"完整报告与原始证据"}),s.jsx("div",{className:"space-y-3 pb-3",children:Mt(J.content)})]})]}):Mt(J.content),J.evidence!==void 0&&s.jsxs("details",{className:"text-xs text-muted-foreground",children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3",children:"交付证据"}),s.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 p-3 text-[11px]",children:JSON.stringify(J.evidence,null,2)})]}),Fe&&J.attemptId===n.activeAttemptId&&J.kind!=="review"&&(!e||J.kind==="plan"||!n.workflow)&&s.jsxs("div",{className:"space-y-2 border-t border-border/15 pt-3",children:[!e&&ye?.id===J.id&&n.workflow?.kind!=="step"&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:`${fl} w-full`,disabled:h||!!Pt,onClick:()=>{p({kind:"accept",artifactId:J.id})},children:[s.jsx(Ba,{size:14}),"验收此结果"]}),Pt&&s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:Pt})]}),de?.id===J.id&&n.approvedPlanArtifactId!==J.id&&s.jsxs("button",{type:"button",className:`${fl} w-full`,disabled:h,onClick:()=>{p({kind:"approve-plan",artifactId:J.id})},children:[s.jsx(Ba,{size:14}),lt?"确认方案":"确认方案并继续"]}),!n.workflow&&s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"请其他成员评审此版本"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("select",{"aria-label":"独立评审成员",className:zs,value:C,onChange:Ce=>S(Ce.target.value),children:[s.jsx("option",{value:"",children:"选择独立评审成员"}),l.filter(Ce=>Ce.sessionId!==n.memberSessions[P0(J.actor)]).map(Ce=>s.jsx("option",{value:Ce.sessionId,children:Ce.name},Ce.sessionId))]}),s.jsx("button",{type:"button",className:li,disabled:h||!C||C===n.memberSessions[P0(J.actor)],onClick:()=>{p({kind:"request-review",artifactId:J.id,assigneeSessionId:C})},children:"请求评审"})]})]})]})]},J.id)};return s.jsxs("article",{className:e?"flex h-full min-h-0 flex-col":"space-y-5",children:[s.jsxs("div",{ref:ne,"data-task-reader-scroll":!0,className:e?"min-h-0 flex-1 space-y-4 overflow-auto pb-5 pr-1":"contents",children:[s.jsxs("header",{className:"space-y-2",children:[!e&&n.parentTaskId&&s.jsxs("button",{type:"button",className:`${va} -ml-2 max-w-full text-muted-foreground hover:bg-surface-2`,onClick:()=>b(n.parentTaskId),children:[s.jsxs("span",{className:"truncate",children:["所属任务:",a.find(J=>J.id===n.parentTaskId)?.title??"查看父任务"]}),s.jsx(Sh,{size:13,className:"shrink-0"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[s.jsx("h3",{ref:be,tabIndex:-1,className:"break-words text-lg font-semibold leading-7 text-foreground outline-none",children:n.title}),s.jsxs("span",{className:`inline-flex items-center gap-2 rounded-md px-2 py-1 text-xs ${Ji(n)?"bg-primary/10 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),n.workflow?.kind==="goal"?Xt.label:Jc(n)]})]}),!mt.length&&!ye&&n.spec.trim()!==n.title.trim()&&s.jsx("p",{className:"line-clamp-3 whitespace-pre-wrap break-words text-sm leading-6 text-muted-foreground",children:n.spec}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:n.workflow?.kind==="goal"?`协调者 · ${c(n.coordinator)}`:ve?`负责人 · ${c(ve.assignee)}`:"尚未分派"}),ve&&s.jsxs("button",{type:"button",className:`${va} px-2 text-muted-foreground hover:bg-surface-2 hover:text-primary`,onClick:()=>{x(ve.assignee)},children:[s.jsx(Hc,{size:13}),"打开终端"]})]}),n.workflow?.kind==="goal"&&s.jsx("p",{"aria-label":"目标下一步",className:"text-xs leading-5 text-muted-foreground",children:Xt.next}),!e&&s.jsx(xf,{task:n}),n.replica&&s.jsx("p",{className:"text-[11px] leading-5 text-muted-foreground",children:"此记录由来源服务同步,回答与决定会送回来源服务。"})]}),lt&&Fe&&s.jsxs("section",{role:"status","aria-label":"安排暂停说明",className:"space-y-2 rounded-xl bg-surface-2 p-3",children:[s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:lt.workflow?.kind==="goal"?"目标仍暂停。回答和方案确认会保存,恢复目标后才能投递;已投递的终端工作继续保留。":"任务仍暂停。回答和方案确认会保存,继续安排后才能投递;已投递的终端工作继续保留。"}),lt.id!==n.id&&s.jsx("button",{type:"button",className:li,onClick:()=>b(lt.id),children:"查看目标并恢复安排"})]}),s.jsx("nav",{"aria-label":"任务详情",className:"flex gap-4 border-b border-border/20",children:[["overview",pt?"进展":e&&ye?"结果":"概览"],["results",e?"历史交付":`交付${n.artifacts.length?` ${n.artifacts.length}`:""}`],["activity","动态"]].map(([J,bt])=>s.jsx("button",{type:"button","aria-pressed":ae===J,className:`min-h-11 border-b-2 px-1 text-xs font-medium transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${ae===J?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,onClick:()=>je(J),children:bt},J))}),ae==="overview"&&s.jsxs(s.Fragment,{children:[(()=>{const J=nt;if(!J)return null;const bt=n.deliveries.find(Ve=>Ve.id===J.deliveryId),Ce=n.outbox.find(Ve=>Ve.id===J.deliveryId),lr=ye&&ye.createdAt>J.createdAt;return s.jsxs("section",{"aria-label":"最近跟进",className:"space-y-1 rounded-lg bg-surface-2/50 px-3 py-2 text-xs leading-5",children:[s.jsx("p",{className:"font-medium text-primary",children:pt?"本次跟进要求":lr?At?"新结果已通过独立评审":"新结果已交付,等待独立评审":"已要求继续跟进,等待新结果"}),s.jsx("p",{className:"whitespace-pre-wrap break-words text-foreground",children:J.content}),s.jsxs("p",{className:"text-muted-foreground",children:[ma(J.createdAt),bt?.status==="delivered"?e?" · 已写入成员终端":` · 已写入${J.target?c(J.target):"成员"}终端${bt.deliveredAt?` · ${ma(bt.deliveredAt)}`:""}`:["failed","expired"].includes(bt?.status??"")||bt?.error||Ce?.lastError?" · 投递未成功,服务端继续重试":J.deliveryId?" · 等待写入终端":" · 要求已保存"]})]})})(),mt.map(J=>s.jsxs("form",{className:"space-y-3 rounded-xl border border-border/30 bg-surface-2/40 p-4",onSubmit:bt=>{bt.preventDefault(),!h&&!ce&&Be[J.id]?.trim()&&p({kind:"answer",decisionId:J.id,content:Be[J.id]})},children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-primary",children:[s.jsx(wc,{size:14}),"需要你的决定"]}),s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-6 text-foreground",children:J.question}),!!J.options.length&&s.jsx("div",{className:"flex flex-col gap-2",children:J.options.map((bt,Ce)=>s.jsxs("button",{type:"button","aria-pressed":Be[J.id]===bt,disabled:h,className:`${va} justify-start text-left ${Be[J.id]===bt?"bg-primary/15 text-primary":"bg-surface-2 text-foreground"}`,onClick:()=>He(lr=>({...lr,[J.id]:bt})),children:[Be[J.id]===bt?s.jsx(Ba,{size:14,className:"shrink-0"}):s.jsx(Tf,{size:14,className:"shrink-0"}),s.jsx("span",{className:"break-words",children:bt})]},Ce))}),s.jsx(Oh,{paneKey:r,inputKey:`${V}:answer:${J.id}`,active:t,label:"你的回答",className:`${zs} min-h-20 resize-y`,required:!0,disabled:h,value:Be[J.id]??"",onUploadChange:Me,onChange:bt=>He(Ce=>({...Ce,[J.id]:typeof bt=="function"?bt(Ce[J.id]??""):bt})),placeholder:"选择建议,或写下你的决定…"}),s.jsxs("button",{className:`${fl} w-full`,disabled:h||ce>0||!Be[J.id]?.trim(),children:[s.jsx(_h,{size:14}),lt?"保存回答":"回复并继续"]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[ma(J.createdAt)," · 回答会保存在任务记录中"]})]},J.id)),pr.map(J=>s.jsxs("section",{"aria-label":J.source==="member"?"成员阻塞报告":J.source==="unknown"?"待核对服务记录":"服务异常",role:J.source==="system"?"alert":"status",className:`space-y-3 rounded-xl p-4 ${J.source==="member"?"bg-primary/10":J.source==="unknown"?"bg-surface-2":"bg-destructive/10"}`,children:[s.jsx("h4",{className:`text-sm font-medium ${J.source==="member"?"text-primary":J.source==="unknown"?"text-muted-foreground":"text-destructive"}`,children:J.label}),s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-6 text-foreground",children:J.summary}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:J.source==="member"?`负责人:${c(ve?.assignee??null)}。先补齐报告中缺少的条件,再发送说明;需要登录时,请在对应服务完成授权。`:J.source==="unknown"?"此摘要未提供原报告正文和记录来源,请打开完整详情核对;确认前不提供服务异常重试。":"重试只请求服务重新检查现有投递与协调条件,保留原报告和执行尝试;成员新的明确回复才会更新报告。"}),J.source==="member"?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:li,disabled:h,onClick:Dt,children:"补充条件并通知成员"}),s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"完整阻塞报告"}),J.content?Mt(J.content):s.jsx("p",{className:"text-xs text-muted-foreground",children:"原始报告正文未提供。"})]})]}):J.source==="system"?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:li,disabled:h||!n.workflow,onClick:()=>{p({kind:"retry"})},children:[s.jsx(sn,{size:13}),n.outbox.length?"重试现有投递":J.content.startsWith("消息投递")?"重新检查投递记录":"重新检查自动安排"]}),!n.workflow&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"此任务未启用自动安排,请检查投递记录或成员终端。"})]}):null]},J.source)),n.workflow?.paused&&Fe&&s.jsxs("section",{className:"space-y-2 rounded-xl bg-surface-2 p-3",children:[s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"后续安排已暂停,已投递的终端工作继续保留。"}),s.jsx("button",{type:"button",className:li,disabled:h,onClick:()=>{p({kind:"resume"})},children:"继续安排"})]}),pt&&it.filter(J=>J.kind==="plan").map(er),pt&&s.jsxs("section",{"aria-label":"当前进展",className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"等待本轮新结果"}),s.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:Lt.length?`${Lt.length} 项执行尚未完成交付与评审`:"收到新的交付结果后,会在这里展示供你验收。"})]}),!!Lt.length&&s.jsx("ul",{className:"space-y-1",children:Lt.map(J=>s.jsx("li",{children:s.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-3 text-left text-xs text-muted-foreground hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",onClick:()=>b(J.id),children:[s.jsx("span",{className:"min-w-0 flex-1 break-words",children:J.title}),s.jsx(Ci,{size:14,className:"shrink-0"})]})},J.id))}),Lr||Qr?s.jsxs("details",{className:"group/record border-t border-border/15",children:[s.jsxs("summary",{className:"flex min-h-11 cursor-pointer items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(Ci,{size:13,className:"shrink-0 transition-transform group-open/record:rotate-90"}),s.jsx("span",{children:Lr?"协调者最近的更新":"成员最近的报告"}),s.jsx("span",{className:"ml-auto shrink-0",children:ma((Lr??Qr).createdAt)})]}),s.jsx("div",{className:"pb-3",children:Mt((Lr??Qr).content)})]}):s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"尚未收到这次跟进后的明确更新。"})]}),pt?s.jsxs("details",{className:"group/record border-t border-border/20",children:[s.jsxs("summary",{className:"flex min-h-11 cursor-pointer items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(Ci,{size:13,className:"shrink-0 transition-transform group-open/record:rotate-90"}),s.jsx("span",{children:"查看上一版结果"}),s.jsx("span",{className:"ml-auto shrink-0",children:ma(ye.createdAt)})]}),s.jsx("div",{className:"space-y-3 pb-3",children:it.filter(J=>J.kind!=="plan").map(er)})]}):s.jsx(s.Fragment,{children:it.map(J=>J.kind==="review"?s.jsxs("details",{className:"rounded-lg border border-border/20 px-3",children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:["独立评审 · ",J.verdict==="pass"?"通过":J.verdict==="changes"?"要求修改":"受阻"," · ",c(J.actor)]}),er(J)]},J.id):er(J))}),n.workflow?.kind==="goal"&&!ye&&!pe&&!mt.length&&s.jsx("section",{"aria-label":"最新明确更新",className:"space-y-2 rounded-xl bg-surface-2/40 p-3",children:Xt.latest?s.jsxs(s.Fragment,{children:[s.jsxs("h4",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:[Xt.latest.source,s.jsx("span",{className:"ml-auto shrink-0 text-[11px] font-normal text-muted-foreground",children:ma(Xt.latest.createdAt)})]}),Xt.latest.taskId!==n.id&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["来自:",Xt.latest.title]}),s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-6 text-foreground",children:ev(Xt.latest).slice(0,512)}),Xt.latest.taskId!==n.id?s.jsxs("button",{type:"button",className:li,onClick:()=>b(Xt.latest.taskId),children:["查看这项执行工作",s.jsx(Ci,{size:13})]}):s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"查看原始更新"}),Mt(Xt.latest.source==="协调说明"?tt?.content??"":ve?.report?.content??"")]})]}):s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"尚未收到本轮明确更新。拆分和报告到达后会显示在这里。"})}),n.workflow?.kind!=="goal"&&tt&&!ye&&s.jsxs("section",{className:"space-y-2",children:[s.jsxs("h4",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:["协调者更新",s.jsx("span",{className:"ml-auto text-[11px] font-normal text-muted-foreground",children:ma(tt.createdAt)})]}),s.jsx("div",{className:"rounded-xl bg-surface-2/50 p-3",children:Mt(tt.content)})]}),n.workflow?.kind!=="goal"&&!pe&&!tt&&ve?.report&&!ye&&s.jsxs("section",{className:"space-y-2",children:[s.jsxs("h4",{className:"text-xs font-medium text-foreground",children:["最近报告",s.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:ma(ve.report.createdAt)})]}),Mt(ve.report.content)]}),!!Nt.length&&s.jsxs("details",{className:"space-y-2",open:!ye||pt||Nt.some(J=>{const bt=a.find(Ce=>Ce.id===J.id);return bt&&Ji(bt)})||void 0,children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs font-medium text-foreground",children:[s.jsx("span",{children:"执行过程"}),s.jsx("span",{className:"ml-2 text-muted-foreground",children:"工作拆分"}),s.jsxs("span",{className:"ml-3 text-[11px] font-normal text-muted-foreground",children:[Xt.done,"/",Zt.length," 项交付已评审"]})]}),s.jsx(tv,{detail:!0,task:n,children:Rt,tasks:a,name:(J,bt)=>c(bt),onSelect:b})]}),!!n.dependsOn.length&&s.jsxs("section",{children:[s.jsx("h4",{className:"mb-2 text-xs font-medium text-foreground",children:"依赖任务"}),n.dependsOn.map(J=>s.jsxs("button",{type:"button",className:`${va} w-full justify-start text-left text-muted-foreground hover:bg-surface-2`,onClick:()=>b(J),children:[s.jsx("span",{className:"min-w-0 flex-1 break-words",children:a.find(bt=>bt.id===J)?.title??J}),s.jsx("span",{className:"shrink-0 text-[11px]",children:a.find(bt=>bt.id===J)?.status==="accepted"?"已验收":"待验收"})]},J))]}),Fe&&!ve&&!n.scheduledAssignee&&s.jsxs("section",{className:"space-y-3 rounded-xl bg-surface-2/50 p-4",children:[s.jsx(Ya,{label:"分派给",children:s.jsxs("select",{className:zs,value:y,onChange:J=>w(J.target.value),children:[s.jsx("option",{value:"",children:"选择负责人"}),l.map(J=>s.jsx("option",{value:J.sessionId,children:J.name},J.sessionId))]})}),s.jsx("button",{type:"button",className:`${fl} w-full`,disabled:h||!y||It,onClick:()=>{p({kind:"assign",assigneeSessionId:y})},children:"分派任务"}),It&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"依赖任务验收后可分派。"})]}),!pe&&!mt.length&&!tt&&!ve?.report&&!it.length&&!Nt.length&&s.jsxs("div",{className:"rounded-xl bg-surface-2/40 p-4",children:[s.jsx("h4",{className:"text-sm font-medium text-foreground",children:Fe?"等待第一条更新":"任务记录已保留"}),s.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:Fe?"成员明确回复后,报告、问题和交付会出现在这里。":"可在动态中查看分派与决定。"})]})]}),ae==="results"&&s.jsx("div",{className:"space-y-4",children:it.length?it.map(er):s.jsx("p",{className:"py-8 text-center text-xs leading-5 text-muted-foreground",children:"还没有交付。方案、结果和独立评审会保存在这里。"})}),ae==="activity"&&s.jsxs("section",{"aria-label":"任务动态",children:[s.jsx("ol",{className:"space-y-5",children:n.events.slice().reverse().map(J=>s.jsxs("li",{className:"relative border-l border-border/30 pl-4",children:[s.jsx("span",{className:"absolute -left-1 top-1 h-2 w-2 rounded-full bg-border"}),s.jsxs("p",{className:"text-xs font-medium text-foreground",children:[Gj[J.kind]??J.kind,J.reportStatus?` · ${pf[J.reportStatus]}`:""]}),s.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:[J.source==="system"?"服务自动接续":J.source==="integration"?`外部接入 ${J.origin?.integrationId??""}`:c(J.actor)," · ",ma(J.createdAt),J.attemptId&&J.attemptId!==n.activeAttemptId?" · 历史分派":""]}),s.jsx("div",{className:"mt-2",children:Mt(J.content)}),J.target&&s.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["接收人:",c(J.target)]})]},J.id))}),!n.events.length&&s.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"还没有动态记录。"})]}),Fe&&ae!=="activity"&&(!e||!ye)&&s.jsxs("section",{ref:H,className:"space-y-2 border-t border-border/20 pt-4",children:[s.jsx(Oh,{paneKey:r,inputKey:`${V}:feedback`,active:t,label:Ge?"补充处理说明":"补充说明或修改要求",className:`${zs} min-h-20 resize-y text-sm leading-6`,disabled:h,value:he,onUploadChange:Me,onChange:X,placeholder:Ge?"说明已补齐的条件,或调整本次检查范围…":"补充上下文,或写下需要修改的地方…"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("button",{type:"button",className:li,disabled:h||ce>0||!he.trim(),onClick:()=>{at("comment")},children:[B?.state==="pending"&&B.kind==="comment"?s.jsx(sn,{size:13,className:"animate-spin"}):s.jsx(_h,{size:13}),B?.state==="pending"&&B.kind==="comment"?"正在发送…":Ge?"发送条件说明":"发送补充"]}),!Ge&&s.jsxs("button",{type:"button",className:li,disabled:h||ce>0||!ve||!he.trim(),onClick:()=>{at("revise")},children:[B?.state==="pending"&&B.kind==="revise"&&s.jsx(sn,{size:13,className:"animate-spin"}),B?.state==="pending"&&B.kind==="revise"?"正在提交…":"要求修改"]})]}),B&&s.jsx("div",{ref:Oe,role:B.state==="error"?"alert":"status",className:`rounded-lg px-3 py-2 text-xs leading-5 ${B.state==="error"?"bg-destructive/10 text-destructive":"bg-primary/10 text-primary"}`,children:B.state==="pending"?"正在保存,请稍候…":B.state==="error"?`未确认保存:${B.error}。内容已保留,可重试。`:s.jsxs(s.Fragment,{children:[s.jsx("p",{children:B.kind==="comment"?Ge?"补充已保存,投递结果可在任务管理中查看凭证;成员原报告仍保留,等待新的明确回复。":"补充已保存,投递结果可在任务管理中查看凭证。":"修改要求已保存,等待新结果后可验收。"}),s.jsx("p",{className:"mt-1 line-clamp-2 whitespace-pre-wrap break-words text-foreground/80",children:B.content}),s.jsx("button",{type:"button",className:"mt-1 min-h-11 text-primary underline underline-offset-4",onClick:()=>je("activity"),children:"查看任务动态"})]})}),!B&&s.jsx("p",{className:"text-[11px] leading-5 text-muted-foreground",children:Ge?"说明会发送给本次负责人,成员明确回复后状态更新。":"发送补充会保留当前结果;需要更新结果时,请选择“要求修改”。"})]}),s.jsxs("details",{className:"border-t border-border/20",children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"任务管理与诊断"}),s.jsxs("div",{className:"space-y-4 pb-4",children:[e&&s.jsx(xf,{task:n}),s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"完整目标与验收标准"}),Mt(n.spec),n.acceptance&&Mt(n.acceptance),n.constraints&&Mt(n.constraints)]}),n.workflow&&Fe&&s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"后续执行与评审安排"}),s.jsx("button",{type:"button",className:li,disabled:h,onClick:()=>{p({kind:n.workflow.paused?"resume":"pause"})},children:n.workflow.paused?"继续安排":"暂停安排"})]}),n.workspace&&s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"交付目录与分支"}),s.jsxs("p",{className:"select-text break-all text-xs text-foreground",children:[n.workspace.cwd,s.jsx("br",{}),n.workspace.branch]}),s.jsx("p",{className:"mt-2 text-[11px] leading-5 text-muted-foreground",children:"基于已提交代码创建;合并到原分支或发布需另行操作。"})]}),Fe&&s.jsxs(s.Fragment,{children:[ve&&n.workflow?.kind!=="goal"&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("select",{"aria-label":"任务负责人",className:zs,value:y,onChange:J=>w(J.target.value),children:[s.jsx("option",{value:"",children:"选择负责人"}),l.map(J=>s.jsx("option",{value:J.sessionId,children:J.name},J.sessionId))]}),s.jsx("button",{type:"button",className:li,disabled:h||!y||It,onClick:()=>{p({kind:"assign",assigneeSessionId:y,content:he||void 0})},children:"开始新一轮分派"}),s.jsx("p",{className:"text-[11px] leading-5 text-muted-foreground",children:It?"依赖任务验收后可分派。":"新分派保留旧记录,并结束旧问题的回答入口。"})]}),s.jsx(Ya,{label:"协调者",children:s.jsxs("select",{className:zs,disabled:h||n.workflow?.kind==="step",value:n.coordinator?n.memberSessions[P0(n.coordinator)]??"":"",onChange:J=>{p({kind:"coordinator",coordinatorSessionId:J.target.value||null})},children:[!n.workflow&&s.jsx("option",{value:"",children:"由用户协调"}),l.map(J=>s.jsx("option",{value:J.sessionId,children:J.name},J.sessionId))]})}),s.jsx("button",{type:"button",className:`${va} text-muted-foreground hover:bg-surface-2`,disabled:h,onClick:()=>{p({kind:"close",content:he||void 0})},children:"关闭此任务"}),s.jsx("p",{className:"text-[11px] leading-5 text-muted-foreground",children:"关闭会保留历史和成员的终端工作。"})]}),!Fe&&s.jsx("button",{type:"button",className:li,disabled:h,onClick:()=>{p({kind:"reopen"})},children:"重新打开任务"}),s.jsxs("details",{children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:["投递凭证与执行尝试 · ",n.attempts.length," 轮"]}),s.jsxs("div",{className:"space-y-3 text-xs leading-5 text-muted-foreground",children:[n.outbox.map(J=>s.jsxs("p",{className:"break-words",children:[J.lastError?`等待重试:${J.lastError}`:"已保存 · 等待投递",J.messageId?` · 消息 ${J.messageId}`:""]},J.id)),n.attempts.map(J=>s.jsxs("div",{children:[s.jsxs("p",{children:[J.id===n.activeAttemptId?"当前分派":"历史分派"," · ",c(J.assignee)," · ",ma(J.createdAt)]}),s.jsxs("p",{className:"mt-1 break-all font-mono text-[11px]",children:["尝试 ID:",J.id]}),s.jsxs("p",{className:"mt-1",children:[J.deliveryStatus==="delivered"?`已写入终端 · ${J.deliveredAt?ma(J.deliveredAt):""}`:J.deliveryStatus==="failed"||J.deliveryStatus==="expired"?"本次消息投递未成功":"等待写入终端",J.report?` · ${pf[J.report.status]}(${ma(J.report.createdAt)})`:""]})]},J.id)),n.deliveries.filter(J=>J.kind!=="task").map(J=>s.jsxs("p",{className:"break-all",children:["后续消息 ",J.messageId," · ",J.status==="delivered"?"已写入终端":"等待投递",J.deliveredAt?` · ${ma(J.deliveredAt)}`:""]},J.id)),s.jsx("p",{className:"text-[11px]",children:"投递凭证确认终端写入;报告保留成员原始陈述。"})]})]}),s.jsxs("p",{className:"select-text break-all text-[11px] text-muted-foreground",children:["任务:",n.id,s.jsx("br",{}),"来源服务:",n.ownerServiceId,s.jsx("br",{}),"版本:",n.revision]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",className:li,onClick:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(F)).then(()=>N("任务上下文已复制。")).catch(()=>N("复制失败,可导出任务记录。"))},children:"复制上下文"}),s.jsx("button",{type:"button",className:li,disabled:Qe.status==="pending",onClick:()=>{Qe.start()},children:"导出记录"}),I&&s.jsx("span",{role:"status",className:"self-center text-[11px] text-muted-foreground",children:I}),s.jsx(Y7,{status:Qe.status,error:Qe.error,cancel:Qe.cancel})]})]})]})]}),e&&ye&&n.status!=="closed"&&s.jsxs("footer",{role:"region","aria-label":"结果验收",className:"shrink-0 space-y-2 border-t border-border/25 bg-[var(--chrome-bg)] py-3 [padding-bottom:max(0.75rem,env(safe-area-inset-bottom))]",children:[Q?s.jsxs("div",{ref:H,className:"space-y-2",children:[s.jsx(Oh,{paneKey:r,inputKey:`${V}:feedback`,active:t,label:"跟进要求",className:`${zs} min-h-20 max-h-32 resize-none text-sm leading-6`,disabled:h,value:he,onUploadChange:Me,onChange:X,placeholder:"说明哪里不满意,或写下接下来要完成的事…"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",className:li,disabled:h||ce>0,onClick:()=>W(!1),children:"取消,保留草稿"}),s.jsxs("button",{type:"button",className:`${fl} ml-auto`,disabled:h||ce>0||!ve||!he.trim(),onClick:()=>{at("revise")},children:[B?.state==="pending"?s.jsx(sn,{size:14,className:"animate-spin"}):s.jsx(_h,{size:14}),B?.state==="pending"?"正在发送…":"发送并继续跟进"]})]})]}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",className:`${li} flex-1 sm:flex-none`,disabled:h,onClick:Dt,children:he.trim()?"继续跟进 · 有草稿":"继续跟进"}),ae!=="overview"?s.jsx("button",{type:"button",className:`${fl} ml-auto flex-1 sm:flex-none`,onClick:()=>je("overview"),children:pt?"返回当前进展":"返回当前结果"}):(pt||xe)&&Fe?s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"等待新结果后可验收"}):Fe&&n.workflow?.kind!=="step"?s.jsxs("button",{type:"button",className:`${fl} ml-auto flex-1 sm:flex-none`,disabled:h||ce>0||!!Pt||B?.state==="saved"&&B.kind==="revise"&&B.resultId===ye.id,onClick:()=>{p({kind:"accept",artifactId:ye.id})},children:[s.jsx(Ba,{size:14}),"验收此结果"]}):s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:n.status==="accepted"?n.completionMode==="reviewed"?"已通过独立评审":"已验收":"由独立评审验收"})]}),B&&s.jsx("div",{role:B.state==="error"?"alert":"status",className:`text-xs leading-5 ${B.state==="error"?"text-destructive":"text-primary"}`,children:B.state==="pending"?"正在保存跟进要求…":B.state==="error"?`未确认保存:${B.error}。内容已保留,可重试。`:"跟进要求已保存,等待新结果。"}),!Q&&!pt&&Fe&&Pt&&B?.state!=="saved"&&s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:Pt})]})]})}const bf=new Map,sv=e=>`termdock-group-settings:${window.location.origin}:${e}`;function vf(e){return e.name!==e.savedName||e.rules!==e.savedRules}function K1(e,t=""){return{name:e.name,savedName:e.name,rules:e.instructions?.text??"",savedRules:e.instructions?.text??"",updatedAt:e.updatedAt,rulesVersion:e.instructions?.version??"",rulesMemberId:t}}function Zj(e,t){return{...K1(t,t.sessionIds.includes(e.rulesMemberId)?e.rulesMemberId:""),name:e.name!==e.savedName?e.name:t.name,rules:e.rules!==e.savedRules?e.rules:t.instructions?.text??"",sessionIds:[...t.sessionIds]}}function Yj(e,t){const r=K1(e,t),n=sv(e.id);if(bf.has(n))return bf.get(n)??r;try{const a=sessionStorage.getItem(n);if(!a)return r;const l=JSON.parse(a);return typeof l.updatedAt!="number"||!Number.isFinite(l.updatedAt)||["name","rules","savedName","savedRules","rulesVersion","rulesMemberId"].some(c=>typeof l[c]!="string")||l.sessionIds!==void 0&&(!Array.isArray(l.sessionIds)||l.sessionIds.some(c=>typeof c!="string"))?r:vf(l)?l:r}catch{return r}}function Kj(e,t){const r=sv(e);try{vf(t)?sessionStorage.setItem(r,JSON.stringify(t)):sessionStorage.removeItem(r),bf.delete(r)}catch{bf.set(r,vf(t)?t:null)}}function iv(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)?e.slice(0,10):e}function Fh(e,t){try{const r=`termdock-workbench:${window.location.origin}:${e}`;return t!==void 0&&localStorage.setItem(r,t),localStorage.getItem(r)}catch{return null}}function Xj(){const e=Fh("tab");return e==="automation"||e==="search"?e:"collaboration"}const Ks="w-full rounded-lg border border-border/20 bg-surface-2 px-3 py-2 text-[12px] text-foreground outline-none transition focus:border-primary/60",r1="inline-flex min-h-7 items-center justify-center rounded-md border px-2 py-1 text-[11px] leading-4 font-medium transition",xr="inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-40",$h=new WeakMap;function C5(e){const[t,r]=v.useState(null),[n,a]=v.useState(!1),l=Ds(m=>m.drafts),c=v.useCallback(m=>{const x=Ds.getState();for(const[b,y]of Object.entries(m))x.drafts[b]||x.setDraft(b,y)},[]),h=v.useCallback((m,x,b)=>{if(JSON.stringify(Ds.getState().drafts[m])===JSON.stringify(x))return;const y={...x};b&&$h.set(y,b),Ds.getState().setDraft(m,y)},[]),p={drafts:l,loadDrafts:c,updateDraft:h};return s.jsxs(s.Fragment,{children:[!n&&s.jsx(S5,{...e,...p,overlayObscured:!!t,onOpenOverlay:r,onClose:()=>{t?a(!0):e.onClose()}}),t&&s.jsx(S5,{...e,...p,overlayOnly:!0,initialFloating:t==="floating",onFloatingChange:void 0,onOpenOverlay:r,onClose:()=>{r(null),n&&e.onClose()}})]})}function S5({activeSessionId:e,initialCollaborationGroupId:t=null,initialFloating:r=!1,onFloatingChange:n,onEnterGroup:a,visible:l=!0,defaultSessionMode:c="shell",onClose:h,onNewSession:p,overlayOnly:m=!1,overlayObscured:x=!1,onOpenOverlay:b,drafts:y,loadDrafts:w,updateDraft:C}){const S=!!t,[I,N]=v.useState(r);v.useEffect(()=>{N(r)},[r]);const[Q,W]=v.useState(!1),[B,U]=v.useState(t),K=Hs(Ie=>Ie.docks[t??"workbench"]),re=Hs(Ie=>Ie.hosts[t??"workbench"]),[H,Oe]=v.useState("docked"),[ne,ce]=v.useState(null),[Ne,Me]=v.useState({x:16,y:80}),be=v.useRef(null),V=v.useRef(null);v.useEffect(()=>{const Ie=be.current;Ie&&(x?(Ie.contains(document.activeElement)&&(V.current=document.activeElement),Ie.inert=!0):(Ie.inert=!1,V.current?.isConnected&&V.current.focus({preventScroll:!0}),V.current=null))},[x]),v.useEffect(()=>{if(!m||I)return;const Ie=be.current;Ie?.querySelector('button[aria-label="收起展开视图"]')?.focus({preventScroll:!0});const ht=Je=>{if(Je.key!=="Tab"||Je.defaultPrevented||!Ie)return;const _r=Array.from(Ie.querySelectorAll('button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], summary, [tabindex="0"]')).filter(es=>!es.closest("[hidden], [inert]")&&es.getClientRects().length>0),Zr=_r[0],Gr=_r.at(-1),Ir=!Ie.contains(document.activeElement);Je.shiftKey&&(document.activeElement===Zr||Ir)?(Je.preventDefault(),Gr?.focus()):!Je.shiftKey&&(document.activeElement===Gr||Ir)&&(Je.preventDefault(),Zr?.focus())};return document.addEventListener("keydown",ht),()=>document.removeEventListener("keydown",ht)},[m,I]);const[Ke]=v.useState(()=>document.createElement("div")),he=v.useRef({x:.5,y:.5}),[Be,ae]=v.useState(null),[X,He]=v.useState(null);v.useEffect(()=>{let Ie=!1;return V0().then(ht=>{if(Ie)return;const Je=H3(ht.collaborationPanels?.[Nf()],t);Je.position&&(he.current=Je.position),Je.size&&ce(Je.size),w(Je.drafts??{}),m||Oe(Je.mode??"docked"),ae(Je)}).catch(()=>{Ie||He("面板草稿加载失败,请重新打开面板重试")}),()=>{Ie=!0}},[]);const[je,ve]=v.useState(null);v.useEffect(()=>{const Ie=ht=>He(String(ht.detail));return window.addEventListener("termdock-panel-save-error",Ie),()=>{window.removeEventListener("termdock-panel-save-error",Ie),m||Hs.getState().setDock(t??"workbench",null)}},[]);const Fe=!m&&I&&H==="docked"&&!!re;v.useLayoutEffect(()=>(Ke.className=Fe?"h-full min-h-0 w-full min-w-0":"contents",(Fe?re:document.body)?.appendChild(Ke),()=>Ke.remove()),[Ke,Fe,re]),v.useEffect(()=>{!m&&!I&&Hs.getState().setDock(t??"workbench",null)},[I]);const lt=async Ie=>{if(m||Q||Ie==="docked"&&!e)return;const ht={sessionId:e,side:"right"};W(!0);try{await Qa({mode:Ie,...Ie==="docked"?{dock:ht}:{}},t),Oe(Ie),Hs.getState().setDock(t??"workbench",Ie==="docked"?{...ht,...S?{preferredWidth:360}:{}}:null)}catch{He("面板布局保存失败,请重试")}finally{W(!1)}},ye=v.useRef(!1),de=$0(()=>{Xe.current=null}),nt=$0(()=>{ye.current=!1}),Xe=v.useRef(null),pt=v.useCallback((Ie,ht)=>{const Je=be.current?.getBoundingClientRect(),_r=window.visualViewport,Zr=(_r?.offsetLeft??0)+12,Gr=(_r?.offsetTop??0)+12;return{x:Math.max(Zr,Math.min(Ie,Zr+(_r?.width??window.innerWidth)-(Je?.width??440)-24)),y:Math.max(Gr,Math.min(ht,Gr+(_r?.height??window.innerHeight)-(Je?.height??340)-24))}},[]),[xe,mt]=v.useState(()=>t?"collaboration":Xj()),[It,At]=v.useState(()=>new Set([xe])),Nt=Ie=>{mt(Ie),At(ht=>new Set([...ht,Ie])),Dt(null),pe(null),!t&&!m&&Fh("tab",Ie)},[oe,F]=v.useState([]),[we,Qe]=v.useState([]),[tt,it]=v.useState([]),[Rt,Xt]=v.useState([]),[Zt,Lt]=v.useState([]),[Lr,Qr]=v.useState(null),[Pt,Dt]=v.useState(null),[pr,pe]=v.useState(null);v.useEffect(()=>{if(!pr)return;const Ie=setTimeout(()=>pe(null),5e3);return()=>clearTimeout(Ie)},[pr]);const[Ge,at]=v.useState("loading"),[Mt,er]=v.useState("loading"),[J,bt]=v.useState(null),[Ce,lr]=v.useState(null),[Ve,zt]=v.useState(),[Jt,Wr]=v.useState(null),yn=v.useRef(null),Ar=v.useRef(null),Jr=v.useRef(null),Fr=t?Rt.find(Ie=>Ie.id===t)??null:null,$r=v.useRef(!1);v.useEffect(()=>{if(t||Ge!=="loaded"||$r.current)return;$r.current=!0;const Ie=Fh("group"),ht=Rt.find(Je=>Je.id===Ie)??Rt.find(Je=>e&&Je.sessionIds.includes(e))??Rt[0];U(Je=>Je??ht?.id??null)},[t,Ge,Rt,e]),v.useEffect(()=>{!t&&!m&&B&&Rt.some(Ie=>Ie.id===B)&&Fh("group",B)},[B,Rt,t,m]);const an=B?Rt.find(Ie=>Ie.id===B)??null:Rt[0]??null,An=!!t&&Ge==="loaded"&&!Fr,gt=!!Be||!!X,fe=!m&&I&&H==="docked"&&!!(K??Be?.dock)&&!re,Vr=l&&gt&&!fe&&!!e&&(!t||!!re||!!an?.sessionIds.includes(e)||!!t&&(Ge!=="loading"&&!Fr||!!X));v.useLayoutEffect(()=>{if(!I||Fe||!Vr)return;const Ie=()=>{const Je=window.visualViewport;ve(Je?.height??window.innerHeight);const _r=be.current?.getBoundingClientRect();!_r?.width||!_r.height||ye.current||Me(pt((Je?.offsetLeft??0)+12+Math.max(0,(Je?.width??window.innerWidth)-_r.width-24)*he.current.x,(Je?.offsetTop??0)+12+Math.max(0,(Je?.height??window.innerHeight)-_r.height-24)*he.current.y))},ht=new ResizeObserver(Ie);return be.current&&ht.observe(be.current),window.addEventListener("resize",Ie),window.visualViewport?.addEventListener("resize",Ie),Ie(),()=>{ht.disconnect(),window.removeEventListener("resize",Ie),window.visualViewport?.removeEventListener("resize",Ie)}},[I,Fe,Vr,pt,Be,ne]),v.useLayoutEffect(()=>{if(m)return;const Ie=t??"workbench",ht=Hs.getState();if(An)ht.docks[Ie]&&ht.setDock(Ie,null);else if(gt&&I&&H==="docked"&&e&&(!t||Fr)){const Je=ht.docks[Ie],_r=!t||Fr?.sessionIds.includes(e)?e:Zt.find(Ir=>Fr?.sessionIds.includes(Ir.sessionId)&&!F0(Ir.sessionId))?.sessionId??e,Zr=Je??Be?.dock??{sessionId:_r,side:window.innerWidth<640?"bottom":"right"},Gr={...Zr,sessionId:Fr?.sessionIds.includes(e)?e:Zr.sessionId,...S?{preferredWidth:Je?.preferredWidth??360}:{}};(!Je||Gr.sessionId!==Je.sessionId||Gr.preferredWidth!==Je.preferredWidth)&&ht.setDock(Ie,Gr),S&&Je&&Gr.sessionId!==Je.sessionId&&Qa({dock:{sessionId:Gr.sessionId,side:Gr.side}},t).catch(()=>He("协作位置保存失败,当前面板仍可使用"))}},[An,Fr,I,H,Be,gt,e,t,K,Zt]);const ct=async(Ie,ht=!1)=>{if(!(Q||Ie&&!an)){if(!m&&!Ie&&!ht&&K){b("full");return}if(m){ht?h():(N(Ie),b(Ie?"floating":"full"));return}W(!0);try{await n?.(Ie?an.id:null),N(Ie),Ie&&H==="docked"&&e&&Hs.getState().setDock(t??"workbench",{sessionId:e,side:K?.side??Be?.dock?.side??"right"}),ht&&h()}catch(Je){Dt(`常驻浮窗状态保存失败,请重试:${Je instanceof Error?Je.message:"连接失败"}`)}finally{W(!1)}}},Ue=v.useCallback(Ie=>{Xt(Ie.groups),Lt(Ie.sessions),zt(Ie.peers),lr(null),at("loaded")},[]);v.useEffect(()=>cb(Ue),[Ue]);const Tr=v.useCallback(async(Ie={})=>{Ie.silent||Dt(null),!S&&!Ar.current&&(Ar.current=e8().then(ht=>{F(ht.automations),Qe(ht.runs),er("loaded"),bt(null)}).catch(ht=>{er("error"),bt(ht instanceof Error?ht.message:"自动任务加载失败")}).finally(()=>{Ar.current=null})),Jr.current||(Jr.current=ib().then(ht=>{it(ht),Wr(null)}).catch(()=>{Wr("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{Jr.current=null})),yn.current||(at(ht=>ht==="error"?"loading":ht),yn.current=o1().then(Ue).catch(ht=>{at("error"),lr(`协作会话加载失败:${ht instanceof Error?ht.message:"请重试"}`)}).finally(()=>{yn.current=null})),await Promise.all([yn.current,Ar.current])},[Ue,S]);v.useEffect(()=>yc(()=>{Tr({silent:!0})},1e4,["focus",Co,"pageshow"]),[Tr]),v.useEffect(()=>{const Ie=ht=>{ht.key==="Escape"&&!ht.defaultPrevented&&!I&&h()};return window.addEventListener("keydown",Ie),()=>window.removeEventListener("keydown",Ie)},[h,I]);const wt=Ie=>{S&&Ie&&Ie!==t&&Rt.some(ht=>ht.id===Ie)&&a?a(Ie).catch(ht=>Dt(ht instanceof Error?ht.message:"无法打开工作区")):U(Ie)},Tn=async Ie=>{await lD(Ie)},Nr=!I&&!S&&xe==="collaboration",cn=async(Ie,ht)=>{if(!Lr){Qr(`open-group:${Ie}`),Dt(null);try{await a?.(Ie),Ds.getState().open(Ie,ht),h()}catch(Je){Dt(Je instanceof Error?Je.message:"无法打开协作组,请重试")}finally{Qr(null)}}};return Wi.createPortal(s.jsxs(s.Fragment,{children:[!I&&s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:h,"aria-label":"关闭 Agent 工作台"}),s.jsxs("section",{"data-sidebar-gesture-ignore":!0,onPointerDown:Ie=>{Fe&&Ie.stopPropagation()},ref:be,role:m&&!I?"dialog":void 0,"aria-modal":m&&!I?!0:void 0,"aria-hidden":x||void 0,"aria-label":Fe?"工作组消息分屏":I?"工作组消息浮窗":"Agent 工作台",style:l?I&&!Fe?{display:Vr?void 0:"none",left:Ne.x,top:Ne.y,...ne?{width:`min(calc(100vw - 24px), max(280px, ${ne.width*100}vw))`,height:`min(calc(100dvh - 24px), max(220px, ${ne.height*100}dvh))`}:{},maxHeight:je?je-24:"calc(100dvh - 24px)"}:void 0:{display:"none"},className:Fe?"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface":I?"fixed z-menu-panel flex w-[min(400px,calc(100vw-24px))] flex-col overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-xl":`fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))] ${Nr?"max-h-[calc(var(--app-visible-vh,100dvh)-max(1.5rem,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))-max(1.5rem,env(safe-area-inset-bottom,0px)))]":"h-[calc(var(--app-visible-vh,100dvh)-max(1.5rem,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))-max(1.5rem,env(safe-area-inset-bottom,0px)))]"} z-modal-panel mx-auto flex ${S?"max-w-6xl":"max-w-3xl"} flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[calc(var(--app-visible-vh,100dvh)*0.08)] ${Nr?"sm:max-h-[calc(var(--app-visible-vh,100dvh)*0.84)]":"sm:h-[calc(var(--app-visible-vh,100dvh)*0.84)]"}`,children:[s.jsxs("header",{"data-pane-titlebar":Fe?"true":void 0,"data-panel-drag-title":Fe?"true":void 0,onDragStart:Ie=>Ie.preventDefault(),className:`flex items-center gap-2 border-b border-border/15 ${Fe?"min-h-9 shrink-0 cursor-grab select-none bg-[var(--chrome-bg)] px-3 active:cursor-grabbing":I?"px-3 py-2 cursor-move touch-none select-none":"px-4 py-3"}`,onPointerDown:Ie=>{!I||Fe||Ie.button!==0||Ie.target.closest("button, summary")||(de(Ie),Xe.current={x:Ie.clientX,y:Ie.clientY,left:Ne.x,top:Ne.y},Ie.currentTarget.setPointerCapture?.(Ie.pointerId))},onPointerMove:Ie=>{Xe.current&&Me(pt(Xe.current.left+Ie.clientX-Xe.current.x,Xe.current.top+Ie.clientY-Xe.current.y))},onPointerUp:()=>{if(!Xe.current)return;Xe.current=null;const Ie=be.current?.getBoundingClientRect(),ht=window.visualViewport;Ie&&(he.current=C2(Ne.x,Ne.y,(ht?.offsetLeft??0)+12,(ht?.offsetTop??0)+12,(ht?.width??window.innerWidth)-Ie.width-24,(ht?.height??window.innerHeight)-Ie.height-24),Qa({position:he.current},t).catch(()=>He("浮窗位置保存失败,请重新拖动重试")))},onPointerCancel:()=>{Xe.current=null},children:[s.jsx(Ad,{size:Fe?13:17,className:"shrink-0 text-primary"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:`${I?"truncate text-[12px]":"text-[14px]"} font-semibold text-foreground`,title:Fe?"拖动标题移动面板;放在边缘拆分,中央交换":Fr?.name,children:Fr?Fr.name:t?"协作工作区":"Agent 工作台"}),!Fe&&!S&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:I?"引用、文件路径和粘贴优先加入此处":Fr?"分派任务、回答问题、审阅与验收结果":"自动任务、会话协作与历史搜索"})]}),!Fe&&!m&&S&&xe==="collaboration"&&Rt.length>0&&s.jsx("button",{className:`${xr} shrink-0 text-primary hover:bg-primary/10`,disabled:Q,onClick:()=>{ct(!I)},children:I?"展开":"放到终端旁"}),S&&Fr&&s.jsxs("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:[Fr.sessionIds.length," 人"]}),Fe&&!a&&s.jsx("button",{type:"button","aria-label":"展开协作工作区",title:"展开查看目标与交付",disabled:Q,className:"flex min-h-11 shrink-0 items-center justify-center rounded-lg px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>b("full"),children:s.jsx(Vw,{size:15})}),Fe&&s.jsxs("details",{className:"relative z-20 shrink-0",children:[s.jsx("summary",{"aria-label":"面板布局",title:"面板布局",className:"flex min-h-8 cursor-pointer list-none items-center rounded px-2 text-muted-foreground hover:bg-surface-2 [&::-webkit-details-marker]:hidden",children:s.jsx(Ac,{size:16})}),s.jsx("div",{className:"absolute right-0 top-full z-30 w-36 rounded-lg border border-border/20 bg-surface-2 p-1 shadow-lg",children:s.jsxs("button",{type:"button",disabled:Q,className:`${xr} min-h-11 w-full justify-start text-foreground hover:bg-surface-elevated`,onClick:Ie=>{Ie.currentTarget.closest("details")?.removeAttribute("open"),lt("floating")},children:[s.jsx(Hc,{size:14}),"小浮窗"]})})]}),s.jsx("button",{className:`${Fe?"min-h-8 rounded px-2":"rounded-lg p-2"} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,disabled:Q,onClick:()=>{I?ct(!1,!0):h()},"aria-label":m?"收起展开视图":"关闭",children:s.jsx(zn,{size:16})})]}),I&&!Fe&&!m&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border/15 px-3 py-1.5",children:[s.jsx("button",{type:"button",disabled:Q,"aria-pressed":H==="floating",className:`${r1} ${H==="floating"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{lt("floating")},children:"浮窗"}),s.jsx("button",{type:"button",disabled:Q||!e||An,"aria-pressed":H==="docked",className:`${r1} ${H==="docked"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{lt("docked")},children:"放到终端旁"})]}),!S&&(!I||Fe)&&s.jsx("nav",{"aria-label":"工作台功能",className:"grid shrink-0 grid-cols-3 gap-1 border-b border-border/15 px-2 py-1",children:[["collaboration",t8,"协作组"],["automation",l1,"自动任务"],["search",$l,"历史搜索"]].map(([Ie,ht,Je])=>s.jsxs("button",{type:"button","aria-pressed":xe===Ie,"aria-controls":`workbench-${Ie}`,onClick:()=>Nt(Ie),className:`${xr} ${xe===Ie?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[s.jsx(ht,{size:14}),Je]},Ie))}),xe==="collaboration"&&Ce&&s.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[Ce,s.jsx("button",{className:`${xr} ml-2`,onClick:()=>{Tr()},children:"重新加载会话"})]}),!S&&xe!=="search"&&Jt&&s.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:Jt}),Pt&&s.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:Pt}),pr&&(!I||Fe)&&s.jsxs("div",{role:"status",className:"mx-3 mt-2 flex items-center gap-2 rounded-lg bg-primary/10 px-3 py-2 text-[11px] text-primary",children:[s.jsx(Ba,{size:13}),pr]}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[It.has("automation")&&s.jsx("div",{id:"workbench-automation",className:xe==="automation"?"h-full min-h-0 p-4":"hidden",children:s.jsx(Jj,{automations:oe,runs:we,agents:tt,sessions:Zt.filter(Ie=>!F0(Ie.sessionId)),activeSessionId:e,loading:Mt==="loading",loadError:J,busy:Lr,setBusy:Qr,setError:Dt,setNotice:pe,refresh:Tr,onClose:h})}),It.has("collaboration")&&s.jsxs("div",{id:"workbench-collaboration",className:xe==="collaboration"?`flex-1 min-h-0 overflow-x-hidden overflow-y-auto overscroll-y-contain ${I?"p-3":"p-4"}`:"hidden",children:[!Be&&!X&&s.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息面板…"}),t&&!Fr&&s.jsxs("div",{role:"status",className:"space-y-2 text-[11px] text-muted-foreground",children:[s.jsx("p",{children:Ge==="loading"?"正在加载协作组…":Ge==="error"?"协作组加载失败,恢复连接后可重试。":"此协作组暂不可用,已释放分屏位置。草稿和布局偏好仍保留。"}),Ge!=="loading"&&s.jsx("button",{className:xr,onClick:()=>{Tr()},children:"重新加载"})]}),X&&s.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:X}),Be&&(!t||Fr)&&s.jsx(tD,{active:xe==="collaboration",notice:pr,initialDrafts:y,onDraftChange:C,docked:Fe,inputKeySuffix:m?":overlay":"",selectedGroupId:B,setSelectedGroupId:wt,floatingVisible:Vr,floating:I,sessionsState:Ge,groups:Rt,sessions:Zt,agents:tt,activeSessionId:e,initialGroupId:t,onOpenSession:async Ie=>{await Tn(Ie),I||h()},onOpenTaskSession:Tn,onEnterGroup:a,onOpenGroup:cn,defaultSessionMode:c,busy:Lr,setBusy:Qr,setError:Dt,setNotice:pe,refresh:Tr}),!S&&Ve&&s.jsx(nD,{peers:Ve,currentGroupId:B==="new"?void 0:an?.id,busy:Lr,setBusy:Qr,setError:Dt,setNotice:pe,onSelectGroup:Ie=>{cn(Ie,"messages")}})]}),It.has("search")&&s.jsx("div",{id:"workbench-search",className:xe==="search"?"h-full min-h-0 overflow-y-auto overscroll-y-contain p-4":"hidden",children:s.jsx(fD,{active:xe==="search",onClose:h,onNewSession:p,setError:Dt})})]}),I&&!Fe&&s.jsx("button",{type:"button","aria-label":"调整协作浮窗大小",className:"absolute bottom-0 right-0 h-4 w-4 cursor-nwse-resize touch-none text-muted-foreground hover:text-primary",onPointerDown:Ie=>{Ie.preventDefault(),nt(Ie),ye.current=!0,Ie.currentTarget.setPointerCapture(Ie.pointerId)},onPointerMove:Ie=>{if(!ye.current)return;const ht=window.visualViewport,Je=ht?.width??window.innerWidth,_r=ht?.height??window.innerHeight;ce({width:Math.min(1,Math.max(280,Ie.clientX-Ne.x)/Je),height:Math.min(1,Math.max(220,Ie.clientY-Ne.y)/_r)})},onPointerUp:()=>{ye.current=!1;const Ie=be.current?.getBoundingClientRect(),ht=window.visualViewport;Ie&&(he.current=C2(Ne.x,Ne.y,(ht?.offsetLeft??0)+12,(ht?.offsetTop??0)+12,(ht?.width??window.innerWidth)-Ie.width-24,(ht?.height??window.innerHeight)-Ie.height-24)),ne&&Qa({size:ne,position:he.current},t).catch(()=>He("浮窗大小保存失败,请重新调整重试"))},onPointerCancel:()=>{ye.current=!1},onKeyDown:Ie=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Ie.key))return;Ie.preventDefault();const ht=be.current?.getBoundingClientRect(),Je={width:Math.max(.15,Math.min(1,(ne?.width??(ht?.width??400)/window.innerWidth)+(Ie.key==="ArrowRight"?.03:Ie.key==="ArrowLeft"?-.03:0))),height:Math.max(.15,Math.min(1,(ne?.height??(ht?.height??300)/window.innerHeight)+(Ie.key==="ArrowDown"?.03:Ie.key==="ArrowUp"?-.03:0)))};ce(Je),Qa({size:Je},t).catch(()=>He("浮窗大小保存失败,请重试"))},children:s.jsx("span",{"aria-hidden":"true",children:"⌟"})})]})]}),Ke)}function Jj({automations:e,runs:t,agents:r,sessions:n,activeSessionId:a,loading:l,loadError:c,busy:h,setBusy:p,setError:m,setNotice:x,refresh:b,onClose:y}){const[w,C]=v.useState(null),[S,I]=v.useState(!1),[N,Q]=v.useState(null),W=async(B,U,K)=>{p(B),m(null),x(null);try{await U(),await b(),x(K)}catch(re){m(re instanceof Error?re.message:"操作失败")}finally{p(null)}};return S?s.jsx(eD,{agents:r,sessions:n,activeSessionId:a,initial:w,onCancel:()=>{C(null),I(!1),m(null)},onSaved:async(B,U)=>{C(null),I(!1),await b(),x(w?`“${B}”已更新`:U?`“${B}”已创建,将按计划自动运行`:`“${B}”已创建,当前未启用`)},setError:m},w?.id??"new"):s.jsxs("div",{className:"h-full space-y-4 overflow-y-auto overscroll-y-contain",children:[c&&s.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/10 p-3 text-[11px] text-destructive",children:["自动任务同步失败:",c,s.jsx("button",{className:xr,onClick:()=>{b()},children:"重新加载"})]}),s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"自动任务"}),s.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"定时发送任务,打开运行会话查看输出。"})]}),!S&&e.length>0&&s.jsxs("button",{className:`${xr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{C(null),I(!0),x(null)},children:[s.jsx(ui,{size:13}),"新建任务"]})]}),l&&s.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在加载自动任务…"}),!l&&!c&&e.length===0&&s.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[s.jsx(i9,{size:24,className:"mx-auto text-primary"}),s.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"把重复工作交给 Agent"}),s.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[11px] leading-relaxed text-muted-foreground",children:"写清任务内容,选择运行频率。创建后可以先手动运行一次确认效果。"}),s.jsxs("button",{className:`${xr} mt-4 bg-primary text-primary-foreground`,onClick:()=>I(!0),children:[s.jsx(ui,{size:13}),"创建第一个任务"]})]}),s.jsx("div",{className:"space-y-2",children:e.map(B=>{const U=t.filter(re=>re.automationId===B.id).sort((re,H)=>H.startedAt-re.startedAt)[0],K=r.find(re=>re.command===B.command);return s.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:B.name}),s.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${B.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:B.enabled?"已启用":"已停用"}),B.lastRunStatus&&s.jsx("span",{className:`text-[10px] ${bD(B.lastRunStatus)}`,children:xD(B.lastRunStatus)})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(l1,{size:11}),mD(B)]}),s.jsx("span",{children:B.enabled&&B.nextRunAt?`下次 ${wf(B.nextRunAt)}`:"不会自动运行"})]}),s.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:B.targetSessionId?`发送到 ${n.find(re=>re.sessionId===B.targetSessionId)?.name??"指定会话"}`:`新建 ${K?.displayName??"Agent"} 会话 · ${B.cwd}`}),s.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:B.prompt}),B.lastRunAt&&s.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",wf(B.lastRunAt),B.lastRunMessage?` · ${B.lastRunMessage}`:""]})]}),s.jsx("button",{"aria-label":`编辑 ${B.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{C(B),I(!0),x(null)},children:s.jsx(M0,{size:13})})]}),s.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border/10 pt-3",children:N===B.id?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),s.jsx("button",{className:`${xr} bg-surface-elevated text-foreground`,onClick:()=>Q(null),children:"取消"}),s.jsxs("button",{disabled:h!==null,className:`${xr} bg-destructive text-destructive-foreground`,onClick:()=>{W(`delete:${B.id}`,()=>s8(B.id),`“${B.name}”已删除`).then(()=>Q(null))},children:[h===`delete:${B.id}`?s.jsx(sn,{size:13,className:"animate-spin"}):s.jsx(Js,{size:13}),"确认删除"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:`${xr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>Q(B.id),children:[s.jsx(Js,{size:13}),"删除"]}),s.jsxs("button",{disabled:h!==null,className:`${xr} ${B.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{W(`toggle:${B.id}`,()=>i8(B.id,!B.enabled),B.enabled?`“${B.name}”已暂停,不会自动运行`:`“${B.name}”已恢复,将按原计划运行`)},children:[h===`toggle:${B.id}`?s.jsx(sn,{size:13,className:"animate-spin"}):B.enabled?s.jsx(Fw,{size:13}):s.jsx(Wh,{size:13}),B.enabled?"暂停":"恢复"]}),U?.frontendSessionId&&s.jsxs("button",{className:`${xr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:U.frontendSessionId})),y()},children:[s.jsx(Hc,{size:13}),"打开上次会话"]}),s.jsxs("button",{disabled:h!==null,className:`${xr} bg-primary/15 text-primary`,onClick:()=>{W(`run:${B.id}`,()=>a8(B.id),`“${B.name}”已投递,可打开会话查看进度`)},children:[h===`run:${B.id}`?s.jsx(sn,{size:13,className:"animate-spin"}):s.jsx(Wh,{size:13}),"立即运行"]})]})})]},B.id)})})]})}function eD({agents:e,sessions:t,activeSessionId:r,initial:n,onCancel:a,onSaved:l,setError:c}){const[h,p]=v.useState(n?.name??""),m=t.find(F=>F.sessionId===r),x=n?.cwd??m?.cwd??t[0]?.cwd??"",[b,y]=v.useState(x),w=v.useRef(!1),[C,S]=v.useState(!1),[I,N]=v.useState(()=>e.find(F=>F.command===n?.command)?.slug??""),[Q,W]=v.useState(n?.prompt??""),[B,U]=v.useState(n?.targetSessionId??""),[K,re]=v.useState(n?.targetSessionId?"existing":"new"),[H,Oe]=v.useState(n?.schedule.kind??"interval"),[ne,ce]=v.useState(n?.schedule.kind==="interval"?n.schedule.everyMinutes:60),[Ne,Me]=v.useState(n?.schedule.kind==="daily"?n.schedule.time:"09:00"),[be,V]=v.useState(n?.schedule.kind==="daily"?n.schedule.weekdays:[1,2,3,4,5]),[Ke,he]=v.useState(()=>n?.schedule.kind==="interval"?![15,60,1440].includes(n.schedule.everyMinutes):!!n&&!["1,2,3,4,5","0,1,2,3,4,5,6"].includes([...n.schedule.weekdays].sort().join())),[Be,ae]=v.useState(!1),[X,He]=v.useState(n?.enabled??!0),[je,ve]=v.useState(!1),Fe=e.find(F=>F.slug===I)??null,lt=Fe?.command??n?.command??"";v.useEffect(()=>{if(!I){const F=n?e.find(we=>we.command===n.command):e[0];F&&N(F.slug)}},[e,n,I]),v.useEffect(()=>{!n&&!w.current&&x&&y(x)},[n,x]);const ye=h.trim()||Array.from(Q.trim().split(`
150
+ `)[0].trim()).slice(0,40).join(""),de=t.find(F=>F.sessionId===B),nt=Ke?`custom-${H}`:H==="interval"?String(ne):be.length===7?"daily":"workdays",Xe=F=>{he(F.startsWith("custom-")),["15","60","1440","custom-interval"].includes(F)?(Oe("interval"),F!=="custom-interval"&&ce(Number(F))):(Oe("daily"),F==="daily"&&V([0,1,2,3,4,5,6]),F==="workdays"&&V([1,2,3,4,5]))},pt=async()=>{if(!(je||!oe)){ve(!0),c(null);try{await h8({id:n?.id,name:ye,cwd:b,command:K==="new"?lt:"",prompt:Q,targetSessionId:K==="existing"&&B||null,enabled:X,schedule:H==="interval"?{kind:H,everyMinutes:ne}:{kind:H,time:Ne,weekdays:be}}),await l(ye,X)}catch(F){c(F instanceof Error?F.message:"保存失败")}finally{ve(!1)}}},xe=H==="interval"?{kind:H,everyMinutes:ne}:{kind:H,time:Ne,weekdays:be},[mt,It]=Ne.split(":"),At=(F,we)=>Me(`${F}:${we}`),Nt=Q.trim()?K==="existing"&&!t.some(F=>F.sessionId===B)?"请选择当前服务的可用会话":K==="new"&&!lt?"请选择可启动的 Agent":H==="interval"&&(!Number.isInteger(ne)||ne<1||ne>43200)?"间隔需要是 1–43200 分钟的整数":H==="daily"&&!be.length?"至少选择一天":"":"请填写任务内容",oe=!Nt;return s.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 pb-3",children:[s.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:n?"编辑自动任务":"创建自动任务"}),s.jsx("button",{disabled:je,className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground disabled:opacity-40",onClick:a,"aria-label":"关闭任务表单",children:s.jsx(zn,{size:14})})]}),s.jsx("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-y-contain pb-4",children:s.jsxs("fieldset",{disabled:je,className:"min-w-0 space-y-4",children:[s.jsxs("label",{className:"block space-y-1.5 text-[11px] text-muted-foreground",children:["任务内容",s.jsx("textarea",{autoFocus:!0,className:`${Ks} min-h-24 resize-y`,rows:3,value:Q,onChange:F=>W(F.target.value),placeholder:"例如:检查当前项目的待办,整理需要我处理的问题。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"block space-y-1.5 text-[11px] text-muted-foreground",children:["运行频率",s.jsxs("select",{className:Ks,value:nt,onChange:F=>Xe(F.target.value),children:[s.jsx("option",{value:"15",children:"每 15 分钟"}),s.jsx("option",{value:"60",children:"每小时"}),s.jsx("option",{value:"1440",children:"每 24 小时"}),s.jsx("option",{value:"daily",children:"每天定时"}),s.jsx("option",{value:"workdays",children:"工作日定时"}),s.jsx("option",{value:"custom-interval",children:"自定义间隔"}),s.jsx("option",{value:"custom-daily",children:"自定义星期"})]})]}),H==="interval"&&Ke&&s.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:["每隔多少分钟",s.jsx("input",{className:`${Ks} min-w-0 flex-1`,type:"number",min:1,max:43200,value:ne,onChange:F=>ce(Number(F.target.value))})]}),H==="daily"&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center rounded-lg border border-border/20 bg-surface-2 px-3 py-1.5 focus-within:border-primary/60",children:[s.jsx(l1,{size:14,className:"mr-2 shrink-0 text-primary"}),s.jsx(L5,{label:"小时",value:mt,options:24,onChange:F=>At(F,It)}),s.jsx("span",{"aria-hidden":"true",className:"px-2 text-[16px] text-muted-foreground",children:":"}),s.jsx(L5,{label:"分钟",value:It,options:60,onChange:F=>At(mt,F)}),s.jsx("span",{className:"ml-2 shrink-0 text-[10px] text-muted-foreground",children:"24 小时制"})]}),Ke&&s.jsx("div",{className:"grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map((F,we)=>{const Qe=be.includes(we);return s.jsx("button",{type:"button","aria-pressed":Qe,"aria-label":`星期${F}`,className:`rounded-lg py-2.5 text-[11px] transition ${Qe?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>V(tt=>Qe?tt.filter(it=>it!==we):[...tt,we].sort()),children:F},we)})}),be.length===0&&s.jsx("p",{className:"text-[10px] text-destructive",children:"至少选择一天"})]})]}),s.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[s.jsxs("p",{className:"flex items-center gap-1.5",children:[s.jsx(Ad,{size:13,className:"shrink-0"}),K==="new"?`每次新建会话 · ${Fe?.displayName??(n?.command?"原 Agent":"暂无可用 Agent")}`:`发送到现有会话 · ${de?.name??"目标会话不可用"}`]}),s.jsx("p",{className:"break-all pl-[19px] text-[10px]",children:K==="new"?b||"默认使用当前目录":"直接写入终端,目标会话需保持在线"})]}),s.jsxs("div",{className:"border-t border-border/15 pt-2",children:[s.jsxs("button",{type:"button","aria-expanded":Be,"aria-controls":"automation-more-settings",className:`${xr} -ml-2 px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>ae(F=>!F),children:[s.jsx(O0,{size:13,className:`transition-transform ${Be?"rotate-180":""}`}),"更多设置"]}),Be&&s.jsxs("div",{id:"automation-more-settings",className:"space-y-3 pt-2",children:[s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称(可选)",s.jsx("input",{className:Ks,value:h,onChange:F=>p(F.target.value),placeholder:ye||"留空则从任务内容自动生成"})]}),s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["运行方式",s.jsxs("select",{className:Ks,value:K,onChange:F=>{const we=F.target.value;re(we),we==="existing"&&!B&&U(m?.sessionId??t[0]?.sessionId??"")},children:[s.jsx("option",{value:"new",children:"每次新建会话"}),s.jsx("option",{value:"existing",disabled:t.length===0,children:"发送到现有会话"})]})]}),K==="new"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsxs("label",{className:"min-w-0 space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",s.jsxs("select",{className:Ks,value:I,onChange:F=>N(F.target.value),children:[n&&!e.some(F=>F.command===n.command)&&s.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(F=>s.jsxs("option",{value:F.slug,children:[F.displayName,F.isPlugin?" · Plugin":""]},F.slug))]})]}),s.jsxs("label",{className:"min-w-0 space-y-1 text-[10px] text-muted-foreground",children:["工作目录",s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Ks} min-w-0`,value:b,onChange:F=>{w.current=!0,y(F.target.value)},placeholder:"默认使用当前目录"}),s.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${xr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>S(!0),children:[s.jsx(ub,{size:13}),"选择"]})]})]})]}),e.length===0&&s.jsx("p",{className:"text-[10px] text-destructive",children:"没有检测到可启动的 Agent。请先在 Plugin 设置中安装或配置 Agent。"})]}):s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["目标会话",s.jsxs("select",{className:Ks,value:B,onChange:F=>U(F.target.value),children:[!de&&s.jsx("option",{value:B,children:B?"原目标会话不可用,请重新选择":"请选择会话"}),t.map(F=>s.jsxs("option",{value:F.sessionId,children:[F.name," · ",Uh(F)]},F.sessionId))]}),s.jsx("span",{className:"block leading-relaxed",children:"仅支持当前服务的会话。运行时会直接写入终端,请确保目标会话保持在线。"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[s.jsx("input",{type:"checkbox",checked:X,onChange:F=>He(F.target.checked)}),"保存后启用"]})]})]})]})}),s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border/15 pt-3",children:[s.jsx("p",{role:"status",className:"mr-auto min-w-0 flex-[1_1_160px] text-[10px] text-muted-foreground",children:Nt||(X?`${n?"下次运行":"首次运行"}:${wf(gD(xe,Date.now(),n?.createdAt))}`:"保存后暂停,不会自动运行")}),s.jsx("button",{disabled:je,className:`${xr} bg-surface-2 text-foreground`,onClick:a,children:"取消"}),s.jsx("button",{title:Nt||void 0,disabled:je||!oe,className:`${xr} bg-primary text-primary-foreground`,onClick:()=>{pt()},children:je?"保存中…":n?"保存修改":"创建任务"})]}),s.jsx(wb,{open:C,initialPath:b||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>S(!1),onConfirm:F=>{w.current=!0,y(F),S(!1)}})]})}function L5({label:e,value:t,options:r,onChange:n}){return s.jsxs("label",{className:"relative min-w-0 flex-1",children:[s.jsx("span",{className:"sr-only",children:e}),s.jsx("select",{"aria-label":e,className:"w-full appearance-none bg-transparent py-1 pl-1 pr-7 text-center text-[18px] font-semibold tabular-nums text-foreground outline-none",value:t,onChange:a=>n(a.target.value),children:Array.from({length:r},(a,l)=>{const c=String(l).padStart(2,"0");return s.jsx("option",{value:c,children:c},c)})}),s.jsx(O0,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function tD({fullWorkspace:e=!1,initialView:t="tasks",onOpenGroup:r,active:n,notice:a,initialDrafts:l,onDraftChange:c,docked:h,inputKeySuffix:p,selectedGroupId:m,setSelectedGroupId:x,floatingVisible:b,floating:y,sessionsState:w,groups:C,sessions:S,agents:I,activeSessionId:N,initialGroupId:Q,onOpenSession:W,onOpenTaskSession:B,onEnterGroup:U,onDockMessages:K,defaultSessionMode:re,busy:H,setBusy:Oe,setError:ne,setNotice:ce,refresh:Ne}){const Me=y&&!!Q&&!!U&&!e,[be,V]=v.useState(()=>Me?"messages":t);v.useEffect(()=>{e&&V(t)},[t,e]);const[Ke,he]=v.useState(!1),[Be,ae]=v.useState(0);v.useEffect(()=>ae(0),[m]);const[X,He]=v.useState(""),[je,ve]=v.useState(()=>new Set),[Fe,lt]=v.useState(""),[ye,de]=v.useState(()=>new Set),[nt,Xe]=v.useState(!1),[pt,xe]=v.useState(),[mt,It]=v.useState([]),[At,Nt]=v.useState(!1),[oe,F]=v.useState(null),we=ob(),[Qe,tt]=v.useState(null),[it,Rt]=v.useState(""),[Xt,Zt]=v.useState(!1),[Lt,Lr]=v.useState(!1),Qr=v.useRef(null),Pt=v.useRef(null),Dt=v.useRef(null),pr=()=>{Dt.current=null,Lr(!1),requestAnimationFrame(()=>requestAnimationFrame(()=>{Pt.current?.isConnected&&Pt.current.getClientRects().length?Pt.current.focus():Array.from(Qr.current?.querySelectorAll('button[aria-label="组设置"], button[aria-label="更多看板操作"], summary[aria-label="更多协作操作"]')??[]).find(q=>q.getClientRects().length)?.focus()}))},[pe,Ge]=v.useState(null),[at,Mt]=v.useState(new Set),[er,J]=v.useState(),[bt,Ce]=v.useState({}),[lr,Ve]=v.useState(!1),[zt,Jt]=v.useState(""),[Wr,yn]=v.useState(""),[Ar,Jr]=v.useState(""),[Fr,$r]=v.useState(""),[an,An]=v.useState(""),gt=v.useRef(null),fe=h,Vr=(m??C[0]?.id??"")+p,ct=v.useRef(!1),Ue=m==="new"?null:(m?C.find(q=>q.id===m):C[0])??null,Tr=Ue?.sessionIds.flatMap(q=>{const ke=S.find(rt=>rt.sessionId===q);return ke?[ke]:[]})??[],[wt,Tn]=v.useState(0),Nr=v.useRef(new Map(Object.entries(l??{}))),[cn]=v.useState(()=>({})),Ie=v.useRef(void 0),ht=v.useRef(!1),Je=v.useRef(Qe);Je.current=Qe;const _r=v.useRef(it);_r.current=it,v.useLayoutEffect(()=>{if(Ie.current===Ue?.id)return;if(Ie.current){const ke={content:_r.current,targets:Qe};Nr.current.set(Ie.current,ke),Qa({drafts:{[Ie.current]:ke}}).catch(()=>ne("草稿保存失败,请返回该组重试"))}Ie.current=Ue?.id,ht.current=!0;const q=Nr.current.get(Ue?.id??"");Rt(q?.content??""),tt(q?.targets??null)},[Ue?.id]),v.useEffect(()=>{Ge(null)},[Ue?.id]);const Zr=v.useRef(null),Gr=v.useRef(l);v.useLayoutEffect(()=>{if(Gr.current===l)return;Gr.current=l;for(const[ke,rt]of Object.entries(l??{}))$h.get(rt)!==cn&&Nr.current.set(ke,rt);const q=l?.[Ue?.id??""];!q||$h.get(q)===cn||q.content===_r.current&&JSON.stringify(q.targets)===JSON.stringify(Je.current)||(ht.current=!0,Zr.current=null,Rt(q.content),tt(q.targets))},[l,Ue?.id]);const Ir=v.useCallback(q=>{Qa(q).catch(()=>ne("草稿保存失败,请保持面板打开,修改内容后重试"))},[ne]);v.useLayoutEffect(()=>{if(ht.current){ht.current=!1;return}if(!Ue||Ie.current!==Ue.id)return;const q={drafts:{[Ue.id]:{content:it,targets:Qe}}};$h.set(q.drafts[Ue.id],cn),c(Ue.id,q.drafts[Ue.id],cn),Zr.current=q;const ke=setTimeout(()=>{Zr.current=null,Ir(q)},400);return()=>{clearTimeout(ke)}},[Ue?.id,it,Qe,Ir]),v.useEffect(()=>{const q=()=>{Zr.current&&(Ir(Zr.current),Zr.current=null)},ke=()=>{document.visibilityState==="hidden"&&q()};return document.addEventListener("visibilitychange",ke),window.addEventListener("pagehide",q),()=>{document.removeEventListener("visibilitychange",ke),window.removeEventListener("pagehide",q),q()}},[Ir]),v.useEffect(()=>{if(!(!(y||e)||!n||!b||!Ue||Lt||be!=="messages"))return ab(q=>{V("messages"),Rt(ke=>ke+(ke&&!/\s$/.test(ke)?`
151
+ `:"")+q.replace(/\r\n?/g,`
152
+ `))},Vr,fe)},[y,e,n,b,Ue?.id,fe,Vr,be,Lt]),v.useEffect(()=>{const q=gt.current;if(!y||!q)return;const ke=rt=>ne(String(rt.detail));return q.addEventListener("termdock:file-drop-error",ke),()=>q.removeEventListener("termdock:file-drop-error",ke)},[y,Ue?.id,ne]);const es=async q=>{const ke=Ue?.id;ne(null),Tn(rt=>rt+1);try{const rt=await X5("/tmp",q);if(rt.files.length!==q.length||rt.files.some($t=>!$t.path))throw new Error("文件路径准备失败,请重试");const or=rt.files.map($t=>L0($t.path)).join(" ")+" ";if(Ie.current===ke)Rt($t=>$t+($t&&!/\s$/.test($t)?`
153
+ `:"")+or);else if(ke){const $t=Nr.current.get(ke)??{content:"",targets:null},cr={...$t,content:$t.content+`
154
+ `+or};Nr.current.set(ke,cr),Ir({drafts:{[ke]:cr}})}}catch(rt){ne(rt instanceof Error?rt.message:"文件上传失败")}finally{Tn(rt=>rt-1)}},Ft=new Set(S.filter(am).map(q=>q.sessionId)),hn=je.size,ee=[...je].filter(q=>!Ft.has(q)),Ye=aD(Ue,S),qt=Fe.trim().toLocaleLowerCase(),Gt=S.filter(q=>!qt||[_0(q,S),q.name,q.serviceLabel??"",q.cwd,lm(q.currentTask)].some(ke=>ke.toLocaleLowerCase().includes(qt))),Yr=_5(Gt),Br=_5(Ye),Er=q=>!qt&&ye.has(q),ar=q=>de(ke=>{const rt=new Set(ke);return rt.has(q)?rt.delete(q):rt.add(q),rt});v.useEffect(()=>{Zt(!1),Dt.current!==Ue?.id&&Lr(!1),Dt.current=null,he(!1),Ve(!1),Xe(!1),Ce({}),Mt(new Set(Ue?.sessionIds??[])),yn(Ue?.defaultLaunchProfileId??"")},[Ue?.id]),v.useEffect(()=>{!zt&&I[0]&&Jt(I[0].slug)},[I,zt]),v.useEffect(()=>{It([]),F(null)},[Ue?.id]),v.useEffect(()=>{if(!Q||!n||y&&!b||!Ue){Nt(!1);return}Nt(!0);let q=!1,ke=0,rt=!1;const $t=yc(()=>{if(q||rt||document.hidden||navigator.onLine===!1)return;rt=!0;const cr=++ke;_g(Ue.id).then(Et=>{!q&&cr===ke&&(It(Et.messages),F(null))}).catch(Et=>{!q&&cr===ke&&F(Et instanceof Error?Et.message:"消息加载失败")}).finally(()=>{rt=!1,!q&&cr===ke&&Nt(!1)})},3e3,[Co,"pageshow"]);return()=>{q=!0,$t()}},[Ue?.id,n,y,b]),v.useEffect(()=>{!Q||Ue?.id!==Q||ct.current||(ct.current=!0,be==="messages"&&gt.current?.scrollIntoView?.({block:"nearest"}))},[Q,Ue?.id]);const br=async()=>{Oe("create-group"),ne(null),ce(null);try{if(ee.length)throw new Error("所选会话已变化,请先清除不可用选择");const q=await ml({name:X,sessionIds:[...je]});He(""),lt(""),x(q.group.id),await Ne(),ce(`“${q.group.name}”已创建。`),r?await r(q.group.id,"messages"):U&&await U(q.group.id)}catch(q){ne(q instanceof Error?q.message:"创建失败")}finally{Oe(null)}},Hn=Ue?.sessionIds.filter(q=>Qe===null||Qe.includes(q))??[],Qs=async()=>{if(!Ue||H||wt||!it.trim()||!Hn.length)return;const q=it,ke=Ue.id;Oe("send-message"),ne(null),ce(null);try{const rt=await X7(Ue.id,{fromSessionId:null,toSessionIds:Qe===null?void 0:Hn,kind:"message",content:it});if(Ie.current===ke){const Et=_r.current,fn=Et===q?"":Et.startsWith(q)?Et.slice(q.length).replace(/^\n/,""):Et;Rt(fn),Ir({drafts:{[ke]:{content:fn,targets:Je.current}}})}else{const Et=Nr.current.get(ke);if(Et){const fn={...Et,content:Et.content===q?"":Et.content.startsWith(q)?Et.content.slice(q.length).replace(/^\n/,""):Et.content};Nr.current.set(ke,fn),Ir({drafts:{[ke]:fn}})}}const or=await _g(ke).catch(()=>null);or&&Ie.current===ke&&It(or.messages);const $t=rt.deliveries?.filter(Et=>Et.serviceUnavailable).length??0,cr=rt.deliveries?.filter(Et=>Et.pending>0).length??0;ce($t>0?`已保存消息;${$t} 个接收成员的服务不可达,尚未送达,等待重连`:cr>0?`已保存消息;${cr} 个成员等待投递确认`:`消息已送达 ${rt.messages.length} 个会话`)}catch(rt){ne(rt instanceof Error?rt.message:"发送失败")}finally{Oe(null)}},hs=async()=>{if(!Ue)return;Oe(`delete:${Ue.id}`),ne(null),ce(null);const q=Ue.name;try{await lb(Ue.id,pt),x(null),Xe(!1),await Ne(),ce(`“${q}”已删除`)}catch(ke){ne(ke instanceof Error?ke.message:"删除失败")}finally{Oe(null)}},xs=async()=>{if(!Ue)return;const q=[...at];Oe("save-members"),ne(null),ce(null);try{const ke=await ml({id:Ue.id,name:Ue.name,sessionIds:q,expectedUpdatedAt:er});x(ke.group.id),Zt(!1),await Ne(),ce(`“${Ue.name}”成员已更新,共 ${q.length} 个会话`)}catch(ke){ne(ke instanceof Error?ke.message:"成员更新失败")}finally{Oe(null)}},On=async q=>{if(!Ue||!Ue.sessionIds.includes(q)){Ge(null);return}const ke=S.find(or=>or.sessionId===q)?.name??q,rt=Ue.name;Oe(`remove-member:${q}`),ne(null),ce(null);try{await ml({id:Ue.id,name:rt,sessionIds:Ue.sessionIds.filter(or=>or!==q),expectedUpdatedAt:Ue.updatedAt}),Ge(null),tt(or=>or?.filter($t=>$t!==q)??null),Mt(or=>new Set([...or].filter($t=>$t!==q))),Ce(or=>Object.fromEntries(Object.entries(or).filter(([$t])=>$t!==q))),await Ne(),ce(`已把“${ke}”移出“${rt}”`)}catch(or){ne(or instanceof Error?or.message:"移出成员失败")}finally{Oe(null)}},En=async q=>{if(!Ue)return;const ke=bt[q]??"";Oe(`role:${q}`),ne(null),ce(null);try{await n8(Ue.id,q,ke.trim()||null),await Ne(),ce(ke.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(rt){ne(rt instanceof Error?rt.message:"定位保存失败")}finally{Oe(null)}},Bs=()=>{yn(Ue?.defaultLaunchProfileId??"");const q=S.find(ke=>ke.sessionId===N)?.cwd??S.find(ke=>Ue?.sessionIds.includes(ke.sessionId))?.cwd??"";$r(q),Jr(""),An(""),Ve(!0),Zt(!1)},bs=async()=>{if(!(!Ue||!zt||Wr&&!Ue.launchProfiles?.some(q=>q.id===Wr))){Oe("spawn-agent"),ne(null),ce(null);try{const q=await J7(Ue.id,{agentSlug:Ue.launchProfiles?.find(ke=>ke.id===Wr)?.agentSlug??zt,...Wr||Ue.launchProfiles?.length?{launchProfileId:Wr}:{},name:Ar.trim()||void 0,cwd:Fr.trim()||void 0,task:an.trim()||void 0,mode:re});Ve(!1),await Ne(),ce(`“${q.session.name}”已创建并加入“${q.group.name}”`)}catch(q){ne(q instanceof Error?q.message:"Agent Session 创建失败")}finally{Oe(null)}}},Ur=dD(mt,S),Pr=q=>s.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[s.jsx("input",{className:"mt-0.5",type:"checkbox",disabled:!am(q),checked:je.has(q.sessionId),onChange:()=>ve(ke=>{const rt=new Set(ke);return rt.has(q.sessionId)?rt.delete(q.sessionId):rt.add(q.sessionId),rt})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-[12px] text-foreground",children:_0(q,S)}),s.jsx(om,{session:q}),s.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:Uh(q)})]}),s.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:q.currentTask?`${lm(q.currentTask)} · ${q.cwd}`:q.cwd||q.capability||"终端会话"})]})]},q.sessionId),kt=q=>{const ke=bt[q.sessionId]??"",rt=Ue?.roles?.[q.sessionId]??"";return s.jsxs("div",{className:"px-2 py-2 transition hover:bg-surface-2",children:[s.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[s.jsx("input",{type:"checkbox",disabled:!Ue?.sessionIds.includes(q.sessionId)&&!am(q),checked:at.has(q.sessionId),onChange:()=>Mt(or=>{const $t=new Set(or);return $t.has(q.sessionId)?$t.delete(q.sessionId):$t.add(q.sessionId),$t})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[11px] text-foreground",children:q.name}),s.jsx(om,{session:q}),s.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[Uh(q)," · ",q.cwd]})]})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-2 pl-7",children:[s.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:"定位"}),s.jsx("input",{"aria-label":`${q.name} 的定位`,className:`${Ks} min-h-8 py-1 text-[10px]`,value:ke,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:or=>Ce($t=>({...$t,[q.sessionId]:or.target.value}))}),s.jsx("button",{"aria-label":`保存 ${q.name} 的定位`,title:ke.trim()===rt?"定位未变化":"保存此成员的定位",disabled:H!==null||ke.trim()===rt,className:`${xr} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{En(q.sessionId)},children:H===`role:${q.sessionId}`?s.jsx(sn,{size:12,className:"animate-spin"}):s.jsx(Ba,{size:12})})]})]},q.sessionId)},ks=s.jsx("nav",{"aria-label":"协作工作区",className:"flex shrink-0 items-center gap-1",children:[["tasks",e||Me?"看板":"目标"],["messages","成员与消息"]].map(([q,ke])=>s.jsxs("button",{type:"button","aria-label":ke,"aria-pressed":be===q,className:`${xr} min-h-11 ${be===q?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface-2"}`,onClick:rt=>{if(Me&&q==="tasks"){U?.(Ue.id).catch(cr=>ne(cr instanceof Error?cr.message:"无法打开看板"));return}const or=rt.currentTarget.closest("[data-collaboration-views]"),$t=rt.currentTarget;V(q),requestAnimationFrame(()=>{const cr=document.activeElement;cr!==$t&&cr!==document.body&&cr?.isConnected&&!cr.closest("[hidden]")||Array.from(or?.querySelectorAll('nav[aria-label="协作工作区"] button')??[]).find(Et=>Et.getAttribute("aria-pressed")==="true"&&!Et.closest("[hidden]"))?.focus()})},children:[e&&q==="messages"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sm:hidden",children:"成员"}),s.jsx("span",{className:"hidden sm:inline",children:ke})]}):ke,!e&&q==="tasks"&&Be>0&&s.jsxs("span",{className:"rounded bg-primary/15 px-1.5 text-[11px] text-primary",children:[Be," 待处理"]})]},q))}),Yt=s.jsxs("button",{type:"button","aria-label":"组设置",title:"组设置","aria-expanded":Lt,className:`${xr} min-h-11 shrink-0 text-muted-foreground hover:bg-surface-2`,onClick:q=>{Pt.current=q.currentTarget,Lr(ke=>!ke),ne(null),ce(null)},children:[s.jsx(M0,{size:14}),e&&s.jsx("span",{className:"sm:sr-only",children:"组设置"})]});return s.jsxs("div",{ref:Qr,className:e?"flex min-h-0 flex-1 flex-col gap-3":Me?void 0:"space-y-3",children:[oe&&we==="ready"&&!id(oe)&&s.jsxs("p",{role:"alert",className:"rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:["消息同步暂时失败,正在自动重试:",oe]}),oe&&id(oe)&&!e&&s.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息同步,现有记录已保留"}),s.jsxs("div",{className:e?Lt?"min-h-0 flex-1 overflow-auto":"contents":void 0,children:[!Q&&m!=="new"&&C.length>0&&s.jsx("div",{hidden:Lt,children:s.jsx(Bj,{groups:C,sessions:S,busy:H!==null,onOpen:(q,ke)=>{r?.(q,ke)},onSettings:(q,ke)=>{Dt.current=q,x(q),Pt.current=ke,Lr(!0),ne(null),ce(null)},onCreate:()=>{x("new"),Xe(!1),ce(null)}})}),!Q&&(m==="new"||Lt)&&C.length>0&&s.jsx("button",{type:"button",className:`${xr} min-h-11 text-muted-foreground hover:bg-surface-2`,onClick:()=>{Lt?pr():x(C[0].id)},children:"返回协作组"}),Lt&&Ue&&s.jsx(rD,{group:Ue,agents:I,activeSessionId:N,sessions:S,busy:H,setBusy:Oe,setError:ne,setNotice:ce,refresh:Ne,onClose:pr},Ue.id),!Q&&w!=="loaded"&&!C.length&&s.jsx("p",{role:"status",className:"py-5 text-xs text-muted-foreground",children:w==="loading"?"正在加载协作组与会话…":"会话加载失败,请重试"}),!Ue&&(Q||m==="new"||w==="loaded")&&s.jsxs("section",{className:"border-y border-border/15 py-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"创建协作组"}),s.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"先给协作组命名。成员可以现在选择,也可以以后添加;消息和看板都能独立使用。"})]}),s.jsxs("span",{className:`shrink-0 text-[10px] ${hn>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",hn," 个"]})]}),s.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",s.jsx("input",{className:Ks,value:X,onChange:q=>He(q.target.value),placeholder:"例如:发布准备"})]}),s.jsxs("details",{className:"mt-3",children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:["复用已有会话(选填) · 已选 ",hn," 个"]}),S.length>5&&s.jsxs("label",{className:"relative mt-3 block",children:[s.jsx("span",{className:"sr-only",children:"筛选会话"}),s.jsx($l,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{className:`${Ks} pl-8`,value:Fe,onChange:q=>lt(q.target.value),placeholder:"按名称、目录或当前任务筛选"})]}),s.jsxs("div",{className:"mt-3 max-h-64 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[Yr.length<=1?Gt.map(Pr):Yr.map(q=>{const ke=Er(q.key);return s.jsxs("div",{children:[s.jsx(k5,{label:q.label,count:q.sessions.length,collapsed:ke,onToggle:()=>ar(q.key)}),!ke&&s.jsx("div",{className:"divide-y divide-border/10",children:q.sessions.map(Pr)})]},q.key)}),S.length===0&&s.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:w==="loading"?"正在加载会话…":w==="error"?"会话加载失败,请重试":"没有现有会话也可以创建,开始目标时会启动 Agent"}),S.length>0&&Gt.length===0&&s.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]})]}),ee.length>0&&s.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",ee.length," 个所选会话暂不可用。",s.jsx("button",{className:xr,onClick:()=>ve(q=>new Set([...q].filter(ke=>Ft.has(ke)))),children:"清除不可用选择"})]}),s.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[s.jsx("p",{className:`min-w-0 flex-1 text-[10px] ${hn<2?"text-muted-foreground":"text-primary"}`,children:X.trim()?"创建后进入成员消息,看板可随时使用":"请填写协作组名称"}),s.jsxs("div",{className:"flex justify-end gap-2",children:[C.length>0&&s.jsx("button",{className:`${xr} bg-surface-2 text-foreground`,onClick:()=>x(C[0]?.id??null),children:"取消"}),s.jsxs("button",{disabled:H!==null||!X.trim()||ee.length>0,className:`${xr} bg-primary text-primary-foreground`,onClick:()=>{br()},children:[H==="create-group"?s.jsx(sn,{size:13,className:"animate-spin"}):s.jsx(ui,{size:13}),"创建协作组"]})]})]})]})]}),Ue&&Q&&s.jsxs("div",{"data-collaboration-views":!0,hidden:Lt,className:e?`${Lt?"hidden":"flex"} min-h-0 flex-1 flex-col gap-3`:Me?void 0:"space-y-3",children:[!Me&&(!e||be==="messages")&&s.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border/15 pb-2",children:[ks,s.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[e&&be==="messages"&&s.jsxs("button",{type:"button","aria-label":"放到终端旁",title:K?"在当前终端分屏中使用成员与消息":"先打开一个终端,再嵌入消息面板",disabled:!K||H!==null,className:`${xr} min-h-11 text-muted-foreground hover:bg-surface-2`,onClick:()=>{Oe("dock-messages"),ne(null),K?.().catch(q=>ne(q instanceof Error?q.message:"消息面板打开失败,草稿已保留")).finally(()=>Oe(null))},children:[s.jsx(Hc,{size:14}),s.jsx("span",{className:"hidden sm:inline",children:"放到终端旁"})]}),Yt]})]}),!Me&&be==="messages"&&s.jsx("div",{className:"flex gap-1 overflow-x-auto","aria-label":"工作组终端",children:Tr.map(q=>s.jsx("button",{type:"button","aria-pressed":q.sessionId===N,title:`${q.name} · ${q.cwd||"终端会话"}`,className:`${xr} min-h-9 shrink-0 ${q.sessionId===N?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2"}`,onClick:()=>{B(q).catch(ke=>ne(ke instanceof Error?ke.message:"无法打开终端"))},children:_0(q,Tr)},q.sessionId))}),!Me&&s.jsx("div",{hidden:be!=="tasks",className:e?`${be==="tasks"?"flex":"hidden"} min-h-0 flex-1 flex-col`:void 0,children:s.jsx(Vj,{paneKey:h?Vr:void 0,boardNavigation:e?ks:void 0,boardSettings:e?Yt:void 0,board:e,group:Ue,sessions:S,agents:I,defaultCwd:S.find(q=>q.sessionId===N)?.cwd??void 0,onTeamReady:Ne,active:n&&!Lt&&be==="tasks"&&(!y||b),onAttentionChange:ae,onManageMembers:()=>V("messages"),onOpenSession:B},Ue.id)}),s.jsxs("div",{hidden:be!=="messages",className:e?"min-h-0 flex-1 overflow-auto":void 0,children:[s.jsxs("section",{onFocusCapture:()=>Ju(Vr),onPointerDownCapture:()=>Ju(Vr),"data-termdock-terminal-dropzone":y?N??"collaboration-composer":void 0,onDragOver:q=>{y&&q.preventDefault()},onDrop:q=>{if(!y)return;const ke=Array.from(q.dataTransfer.files);if(!(ke.length&&Nl()))if(q.preventDefault(),q.stopPropagation(),ke.length)es(ke);else{const rt=q.dataTransfer.getData("text/plain")||q.dataTransfer.getData("text/uri-list");rt&&Rt(or=>or+(or?`
155
+ `:"")+rt)}},ref:gt,className:y?"":"rounded-xl border border-primary/20 bg-primary/5 px-3 py-3",children:[!y&&s.jsxs("h4",{className:"truncate text-[12px] font-medium text-foreground",children:[Ue.name," · 发送给成员"]}),s.jsxs("div",{className:y?"space-y-2":"mt-2 space-y-2",children:[Me&&s.jsxs("div",{className:"relative z-20 flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["发送给 ",s.jsx("span",{className:"text-[9px]",children:"· 可多选"})]}),s.jsxs("details",{className:"relative",onKeyDown:q=>{q.key==="Escape"&&(q.currentTarget.removeAttribute("open"),q.currentTarget.querySelector("summary")?.focus(),q.stopPropagation())},children:[s.jsx("summary",{"aria-label":"更多协作操作",className:"flex min-h-11 min-w-11 cursor-pointer list-none items-center justify-center rounded text-muted-foreground hover:bg-surface-2 sm:min-h-8 sm:min-w-8 [&::-webkit-details-marker]:hidden",children:s.jsx(Ac,{size:16})}),s.jsxs("div",{className:"absolute right-0 top-full z-30 w-44 rounded-lg border border-border/20 bg-surface-2 p-1 shadow-lg",children:[s.jsxs("button",{type:"button",className:`${xr} min-h-11 w-full justify-start text-foreground hover:bg-surface-elevated`,onClick:q=>{q.currentTarget.closest("details")?.removeAttribute("open"),U?.(Ue.id).catch(ke=>ne(ke instanceof Error?ke.message:"无法打开看板"))},children:[s.jsx(Hc,{size:14}),"看板"]}),s.jsx("button",{type:"button","aria-expanded":Ke,className:`${xr} min-h-11 w-full justify-start text-foreground hover:bg-surface-elevated`,onClick:q=>{q.currentTarget.closest("details")?.removeAttribute("open"),he(ke=>!ke)},children:"成员管理"}),s.jsxs("button",{type:"button","aria-label":"组设置","aria-expanded":Lt,className:`${xr} min-h-11 w-full justify-start text-foreground hover:bg-surface-elevated`,onClick:q=>{q.currentTarget.closest("details")?.removeAttribute("open"),Pt.current=q.currentTarget,Lr(!0),ne(null),ce(null)},children:[s.jsx(M0,{size:14}),"组设置"]})]})]})]}),s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:Me?"sr-only":"mb-1 text-[10px] text-muted-foreground",children:"接收人(可多选)"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:[{id:"*",label:"全组成员"},...Ue.sessionIds.map(q=>({id:q,label:(()=>{const ke=Tr.find(rt=>rt.sessionId===q);return ke?_0(ke,Tr):void 0})()??`${q.slice(0,8)}(离线)`}))].map(({id:q,label:ke})=>{const rt=q==="*"?Qe===null:Qe?.includes(q)??!1,or=S.find($t=>$t.sessionId===q);return s.jsxs(Qj,{label:ke,disabled:q==="*"||H!==null,onRemove:()=>{On(q)},children:[s.jsxs("button",{type:"button","aria-pressed":rt,onClick:()=>tt($t=>q==="*"?null:$t?.includes(q)?$t.filter(cr=>cr!==q):[...$t??[],q]),className:`${r1} min-h-9 min-w-0 gap-1 sm:min-h-7 ${rt?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[rt&&s.jsx(Ba,{size:12,"aria-hidden":"true",className:"shrink-0"}),s.jsx("span",{className:"break-words text-left",children:ke})]}),or&&s.jsx("button",{type:"button","aria-label":`打开 ${ke} 的终端`,title:`打开 ${ke} 的终端`,className:"inline-flex h-9 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-2 hover:text-primary sm:h-7 sm:w-6",onClick:()=>{W(or).catch($t=>ne($t instanceof Error?$t.message:"无法打开会话"))},children:s.jsx(Hc,{size:12})})]},`${Ue.id}:${q}`)})})]})]}),s.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:[s.jsx("span",{className:Me?"sr-only":void 0,children:"内容"}),s.jsx("textarea",{onKeyDown:q=>{q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&!q.nativeEvent.isComposing&&q.keyCode!==229&&(q.preventDefault(),Qs())},onPaste:q=>{const ke=Array.from(q.clipboardData.files);ke.length&&(q.preventDefault(),es(ke))},className:`${Ks} min-h-16 max-h-48 resize-y`,value:it,onChange:q=>Rt(q.target.value),placeholder:"输入消息,可粘贴引用或文件…"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[s.jsx("p",{role:"status","aria-live":"polite",title:y&&a?a:void 0,className:`min-w-0 flex-1 text-[9px] leading-relaxed ${y?"truncate":""} ${y&&a?"text-primary":"text-muted-foreground"}`,children:wt>0?"正在准备文件路径…":y&&a?a:Ue.federated?"消息由服务端后台投递,可查看送达结果;无需保持客户端在线。":"在线成员立即入队;离线成员上线后送达。"}),s.jsxs("button",{disabled:H!==null||wt>0||!it.trim()||!Hn.length,className:`${xr} shrink-0 bg-primary text-primary-foreground`,title:"发送(⌘ / Ctrl + Enter)",onClick:()=>{Qs()},children:[H==="send-message"?s.jsx(sn,{size:13,className:"animate-spin"}):null,"发送"]})]})]}),s.jsxs("div",{children:[s.jsxs("details",{hidden:Me&&!Ke,open:Me?Ke:void 0,onToggle:q=>{Me&&he(q.currentTarget.open)},className:"mt-4 rounded-xl border border-border/15",children:[s.jsxs("summary",{className:"cursor-pointer px-3 py-3 text-[11px] font-medium text-foreground",children:["管理成员、角色与删除 · ",Ue.sessionIds.length," 个成员"]}),s.jsxs("section",{className:"border-t border-border/15 p-3",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:Ue.name}),s.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[Ue.sessionIds.length," 个成员 · 组 ID:",s.jsx("span",{className:"break-all font-mono",children:iv(Ue.id)})]})]}),nt?s.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[s.jsx("button",{className:`${xr} bg-surface-2 px-2 text-foreground`,onClick:()=>Xe(!1),children:"取消"}),s.jsxs("button",{disabled:H!==null,className:`${xr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{hs()},children:[H===`delete:${Ue.id}`?s.jsx(sn,{size:13,className:"animate-spin"}):null,"确认删除"]})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[s.jsxs("button",{className:`${xr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{Mt(new Set(Ue.sessionIds)),J(Ue.updatedAt);const q=!Xt;Zt(q),q&&Ce(Object.fromEntries(Ue.sessionIds.map(ke=>[ke,Ue.roles?.[ke]??""]))),Ve(!1)},children:[s.jsx(M0,{size:13}),"管理成员"]}),s.jsxs("button",{className:`${xr} px-2 text-primary hover:bg-primary/10`,onClick:Bs,children:[s.jsx(ui,{size:13}),"新建 Agent"]}),s.jsx("button",{"aria-label":`删除协作组 ${Ue.name}`,title:"删除协作组",disabled:H!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>{xe(Ue.updatedAt),Xe(!0)},children:s.jsx(Js,{size:14})})]})]}),nt&&s.jsxs("p",{role:"alert",className:"mt-2 rounded-lg bg-destructive/10 px-3 py-2 text-[10px] leading-relaxed text-destructive",children:["将删除“",Ue.name,"”协作组及其协作记录,",Ue.sessionIds.length," 个成员的终端会话会保留。"]}),s.jsx("div",{className:"mt-3 grid divide-y divide-border/10 border-y border-border/10 sm:grid-cols-2 sm:divide-x sm:divide-y-0",children:Ue.sessionIds.map(q=>{const ke=S.find($t=>$t.sessionId===q),rt=Ue.roles?.[q],or=ke?.name??q;return s.jsxs("div",{className:`flex min-w-0 items-stretch transition ${pe===q?"bg-destructive/5":"hover:bg-surface-2"}`,children:[s.jsxs("button",{disabled:!ke,onClick:()=>ke&&void W(ke).catch($t=>ne($t instanceof Error?$t.message:"无法打开会话")),className:"min-w-0 flex-1 px-3 py-2.5 text-left disabled:cursor-default",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${ke&&["ready","shell","terminal-connected","service-reachable","working","idle","done"].includes(ke.status)&&ke.serviceConnected!==!1?"bg-[var(--success)]":"bg-muted-foreground"}`}),s.jsx("span",{className:"truncate text-[11px] text-foreground",children:or}),ke&&s.jsx(om,{session:ke}),s.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:ke?Uh(ke):"已离线"})]}),s.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[rt?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",rt]}),s.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,ke?s.jsx("span",{className:"min-w-0 truncate",children:lm(ke.currentTask)}):s.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]}),s.jsx("button",{"aria-label":`把 ${or} 移出协作组`,"aria-expanded":pe===q,title:"移出协作组",disabled:H!==null,className:`mr-1 shrink-0 self-center rounded-lg p-2 transition ${pe===q?"text-destructive":"text-muted-foreground hover:bg-destructive/10 hover:text-destructive"}`,onClick:()=>Ge(pe===q?null:q),children:s.jsx(Js,{size:13})})]},q)})}),pe&&Ue.sessionIds.includes(pe)&&(()=>{const q=S.find(rt=>rt.sessionId===pe)?.name??pe,ke=H===`remove-member:${pe}`;return s.jsxs("div",{role:"group","aria-label":`确认移除成员 ${q}`,className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-y border-destructive/25 bg-destructive/5 px-3 py-2.5",children:[s.jsx("p",{className:"min-w-0 flex-1 text-[10px] leading-relaxed text-destructive",children:`把“${q}”移出“${Ue.name}”?移出后它不再收到这个组的消息,可以随时重新加入`}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx("button",{className:`${xr} min-h-8 bg-surface-2 px-2 text-[10px] text-foreground`,onClick:()=>Ge(null),children:"取消"}),s.jsxs("button",{disabled:H!==null,className:`${xr} min-h-8 px-2 text-[10px] bg-destructive text-destructive-foreground`,onClick:()=>{On(pe)},children:[ke?s.jsx(sn,{size:12,className:"animate-spin"}):s.jsx(Js,{size:12}),"移出"]})]})]})})(),Xt&&s.jsxs("div",{className:"mt-4 border-t border-border/15 pt-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"管理成员"}),s.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"暂不可用的原成员会保留,只有取消勾选才会移出;定位(角色)在每行独立保存,成员收到消息时会看到自己的定位。"})]}),s.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["已选 ",at.size]})]}),s.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:Br.length<=1?Ye.map(kt):Br.map(q=>{const ke=Er(q.key);return s.jsxs("div",{children:[s.jsx(k5,{label:q.label,count:q.sessions.length,collapsed:ke,onToggle:()=>ar(q.key)}),!ke&&s.jsx("div",{className:"divide-y divide-border/10",children:q.sessions.map(kt)})]},q.key)})}),s.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[s.jsx("button",{className:`${xr} bg-surface-2 text-foreground`,onClick:()=>{Zt(!1),Ce({})},children:"取消"}),s.jsxs("button",{disabled:H!==null||w!=="loaded",className:`${xr} bg-primary text-primary-foreground`,onClick:()=>{xs()},children:[H==="save-members"?s.jsx(sn,{size:13,className:"animate-spin"}):s.jsx(Ba,{size:13}),"保存成员"]})]})]}),lr&&s.jsxs("div",{className:"mt-4 border-t border-primary/20 pt-4",children:[s.jsxs("div",{children:[s.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"创建 Agent Session"}),s.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"新会话启动后自动加入本组,并收到初始任务和成员信息。"})]}),s.jsx(Pj,{group:Ue,value:Wr,onChange:yn,disabled:H!==null}),s.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[s.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["Agent / Plugin",s.jsx("select",{"aria-label":"新 Agent 类型",className:Ks,disabled:!!Wr,value:Ue.launchProfiles?.find(q=>q.id===Wr)?.agentSlug??zt,onChange:q=>Jt(q.target.value),children:I.map(q=>s.jsxs("option",{value:q.slug,children:[q.displayName,q.isPlugin?" · Plugin":""]},q.slug))})]}),s.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",s.jsx("input",{"aria-label":"新 Agent 会话名称",className:Ks,value:Ar,onChange:q=>Jr(q.target.value),placeholder:"留空则自动命名"})]})]}),s.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["工作目录",s.jsx("input",{"aria-label":"新 Agent 工作目录",className:Ks,value:Fr,onChange:q=>$r(q.target.value),placeholder:"默认继承当前会话"})]}),s.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["初始任务",s.jsx("textarea",{"aria-label":"新 Agent 初始任务",className:`${Ks} min-h-16 resize-y`,value:an,onChange:q=>An(q.target.value),placeholder:"说明它加入后要先完成什么"})]}),s.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[s.jsx("button",{className:`${xr} bg-surface-2 text-foreground`,onClick:()=>Ve(!1),children:"取消"}),s.jsxs("button",{disabled:H!==null||!zt||!!Wr&&!Ue.launchProfiles?.some(q=>q.id===Wr),className:`${xr} bg-primary text-primary-foreground`,onClick:()=>{bs()},children:[H==="spawn-agent"?s.jsx(sn,{size:13,className:"animate-spin"}):s.jsx(Ad,{size:13}),"创建并加入"]})]})]})]})]},Ue.id),s.jsxs("section",{className:"mt-4",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[s.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"协作记录"}),s.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[Ur.length," 条"]})]}),s.jsxs("div",{className:"divide-y divide-border/10 border-y border-border/10 [overflow-wrap:anywhere]",children:[Ur.map(q=>s.jsxs("div",{className:"px-2 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-primary",children:q.responseKind==="ack"?"收到确认":q.responseKind==="progress"?"进展":q.responseKind==="result"?"结果":uD(q.kind)}),s.jsx("span",{children:q.fromName}),s.jsx("span",{children:"→"}),s.jsx("span",{className:"truncate",children:q.toNames.join("、")}),s.jsx("span",{className:"ml-auto shrink-0",children:new Date(q.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),s.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:q.content}),s.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:q.status==="pending"?"已入队 · 等待投递":q.status==="failed"?"投递失败":q.status==="expired"?"消息已过期,未继续投递":q.status==="stored"?"答复已持久保存 · 供后台接收":"已写入接收方终端 · 等待接手确认"}),q.deliveryErrors.map(ke=>s.jsx("p",{role:"status",className:"mt-1 text-[10px] text-destructive",children:ke==="TMUX_PANE_CHANGED"?"目标会话绑定已变化,投递暂停。原消息已保留,请确认目标会话后继续。":`投递暂停:${ke}。原消息已保留,请检查目标会话。`},ke)),(q.task||q.failureReason)&&s.jsxs("details",{className:"mt-2 text-[10px] text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer",children:"任务详情与证据"}),s.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:JSON.stringify(q.task??{failure_reason:q.failureReason},null,2)})]})]},q.key)),Ur.length===0&&s.jsx(vD,{text:At?"正在加载协作记录…":"还没有消息。可以直接给成员发送说明或问题。"})]})]})]})]})]})]})}function rD({group:e,agents:t,activeSessionId:r,sessions:n,busy:a,setBusy:l,setError:c,setNotice:h,refresh:p,onClose:m}){const x=n.filter(be=>e.sessionIds.includes(be.sessionId)&&!F0(be.sessionId)),[b,y]=v.useState(()=>Yj(e,r&&x.some(be=>be.sessionId===r)?r:"")),w=v.useRef(b),[C,S]=v.useState(null),I=be=>{const V={...w.current,...be};w.current=V,Kj(e.id,V),y(V)},{name:N,rules:Q,savedName:W,savedRules:B,rulesVersion:U,rulesMemberId:K}=b,re=vf(b),H=new TextEncoder().encode(Q).length,Oe=x.some(be=>be.sessionId===K),ne=async()=>{if(!(a||!N.trim())){l("group-name"),c(null),h(null);try{const be=await ml({id:e.id,name:N.trim(),sessionIds:b.sessionIds??e.sessionIds,expectedUpdatedAt:b.updatedAt});S(null),I({savedName:be.group.name,name:be.group.name,updatedAt:be.group.updatedAt,sessionIds:be.group.sessionIds,...Q===B?{rules:be.group.instructions?.text??"",savedRules:be.group.instructions?.text??"",rulesVersion:be.group.instructions?.version??""}:{}}),await p(),h("协作组名称已更新")}catch(be){S(null),c(be instanceof Xu&&be.status===409?"组设置已被其他人修改。请查看最新状态并确认,名称与群规草稿仍保留。":be instanceof Error?be.message:"改名失败")}finally{l(null)}}},ce=async()=>{if(!(a||!Oe||H>8192)){l("group-rules"),c(null),h(null);try{const be=await r8(e.id,{sessionId:K,text:Q,expectedVersion:U});S(null),I({savedName:be.group.name,...N===W?{name:be.group.name}:{},updatedAt:be.group.updatedAt,sessionIds:be.group.sessionIds,rules:be.group.instructions?.text??"",savedRules:be.group.instructions?.text??"",rulesVersion:be.group.instructions?.version??""}),await p(),h(Q.trim()?"群规已保存,变更通知已入队":"群规已清空,变更通知已入队")}catch(be){S(null),c(be instanceof Xu&&be.status===409?"群规已被其他人修改。请查看最新状态并确认,名称与群规草稿仍保留。":be instanceof Error?be.message:"群规保存失败")}finally{l(null)}}},Ne=()=>{I(K1(e,K)),S(null),c(null)},Me=async()=>{if(!a){l("group-latest"),c(null),h(null),S(null);try{const V=(await o1()).groups.find(Ke=>Ke.id===e.id);if(!V)throw new Error("协作组已删除;草稿仍保留,请返回看板查看。");S(V)}catch(be){c(be instanceof Error?be.message:"最新状态读取失败;草稿仍保留,请重试。")}finally{l(null)}}};return s.jsxs("section",{"aria-label":"协作组设置",onKeyDown:be=>{be.key!=="Escape"||be.defaultPrevented||be.nativeEvent.isComposing||(be.preventDefault(),be.stopPropagation(),a||m())},className:"mt-3 rounded-xl border border-border/20 bg-surface-2 p-3",children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[s.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"组设置"}),s.jsx("button",{type:"button",disabled:!!a,"aria-label":"关闭组设置",className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-elevated",onClick:m,children:s.jsx(zn,{size:14})})]}),s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",s.jsx("input",{autoFocus:!0,className:Ks,value:N,maxLength:240,disabled:!!a,onChange:be=>I({name:be.target.value})})]}),s.jsx("div",{className:"mt-2 flex justify-end",children:s.jsx("button",{type:"button",disabled:!!a||!!C||!N.trim()||N.trim()===W,className:`${xr} min-h-9 bg-primary text-primary-foreground`,onClick:()=>{ne()},children:a==="group-name"?"保存中…":"保存名称"})}),s.jsx(Oj,{group:e,agents:t,busy:a,setBusy:l,refresh:p}),s.jsxs("div",{className:"mt-3 space-y-2 border-t border-border/15 pt-3",children:[s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["由本组成员发布群规变更",s.jsxs("select",{className:Ks,value:K,disabled:!!a||!x.length,onChange:be=>I({rulesMemberId:be.target.value}),children:[s.jsx("option",{value:"",children:"选择当前服务的一个成员"}),!x.some(be=>be.sessionId===K)&&K&&s.jsx("option",{value:K,children:"原成员已不在组内,请重新选择"}),x.map(be=>s.jsx("option",{value:be.sessionId,children:be.name},be.sessionId))]})]}),s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["群规与协作约定",s.jsx("textarea",{className:`${Ks} min-h-24 resize-y`,value:Q,maxLength:8192,disabled:!!a,onChange:be=>I({rules:be.target.value}),placeholder:"例如:说明分工、交接要求和结果格式。清空后保存可移除群规。"})]})]}),!Oe&&s.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:x.length?"选择发布变更的成员后即可保存,不需要关闭工作台。":"当前服务没有本组成员,请先添加成员或切换到成员所在的服务。已有群规可在此查看。"}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx("p",{className:`text-[9px] ${H>8192?"text-destructive":"text-muted-foreground"}`,children:H>8192?"内容过长,请缩短群规":"保存或清空群规会通知本组其他成员"}),s.jsx("button",{type:"button",disabled:!!a||!!C||!Oe||H>8192||Q===B,className:`${xr} min-h-9 shrink-0 bg-primary text-primary-foreground`,onClick:()=>{ce()},children:a==="group-rules"?"保存中…":Q.trim()?"保存群规":"清空群规"})]}),re&&s.jsx("p",{role:"status",className:"mt-3 text-[11px] leading-5 text-muted-foreground",children:"有未保存修改。关闭、Escape 或切换组后,草稿仍保留在本标签页;名称与群规需分别保存。"}),re&&s.jsx("button",{type:"button",disabled:!!a,className:`${xr} mt-2 min-h-11 text-primary hover:bg-surface-elevated`,onClick:()=>{Me()},children:a==="group-latest"?"读取中…":"查看最新状态并保留草稿"}),C&&s.jsxs("section",{"aria-label":"最新组设置",className:"mt-3 space-y-2 rounded-lg bg-surface p-3 text-[11px] leading-5",children:[s.jsx("p",{className:"font-medium text-foreground",children:"确认最新状态后,再分别保存草稿"}),s.jsxs("p",{className:"break-words text-muted-foreground",children:["当前名称:",C.name]}),s.jsxs("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:["当前群规:",C.instructions?.text||"未设置"]}),s.jsxs("p",{className:"break-words text-muted-foreground",children:["当前成员(",C.sessionIds.length,"):",C.sessionIds.map(be=>n.find(V=>V.sessionId===be)?.name??iv(be)).join("、")||"暂无成员"]}),s.jsx("p",{className:"text-muted-foreground",children:"保留你的未保存内容;名称保存将保留以上成员,群规保存会通知当前成员。再次发生修改时仍会检查冲突。"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",disabled:!!a,className:`${xr} min-h-11 bg-primary text-primary-foreground`,onClick:()=>{I(Zj(w.current,C)),S(null),c(null),h("已确认最新状态,草稿仍保留;请分别保存名称与群规。")},children:"确认最新状态,保留草稿"}),s.jsx("button",{type:"button",className:`${xr} min-h-11 text-muted-foreground`,onClick:()=>S(null),children:"取消确认"})]})]}),s.jsxs("div",{className:"mt-3 flex justify-between gap-2 border-t border-border/15 pt-2",children:[s.jsxs("button",{type:"button",disabled:!!a,className:`${xr} min-h-9 text-muted-foreground hover:bg-surface-elevated`,onClick:Ne,children:[s.jsx(sn,{size:12}),"重新载入",re&&"(放弃草稿)"]}),s.jsx("button",{type:"button",disabled:!!a,className:`${xr} min-h-9 bg-surface text-foreground`,onClick:m,children:re?"关闭并保留草稿":"关闭"})]})]})}function nD({peers:e,currentGroupId:t,busy:r,setBusy:n,setError:a,setNotice:l,onSelectGroup:c}){const[h,p]=v.useState(null),[m,x]=v.useState(!1),b=e.services??[],y=e.removedServices??[],w=b.filter(I=>!I.connected),C=w.some(I=>I.groups?.some(N=>N.id===t)),S=async(I,N)=>{if(!r){n(`peer:${I}`),a(null),l(null);try{N?await l8(I):await c8(I),p(null),x(!1),l(N?"协作连接已恢复,正在连接服务":"协作连接已移除,不会再自动重连;已有会话和消息保留")}catch(Q){a(Q instanceof Error?Q.message:N?"重新连接失败":"移除连接失败")}finally{n(null)}}};return s.jsxs("details",{className:"mt-4 shrink-0 rounded-lg border border-border/15",open:C||void 0,children:[s.jsxs("summary",{className:"cursor-pointer px-3 py-2.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"协作连接与管理"}),s.jsx("span",{className:"ml-2",children:e.state==="loading"?"正在加载…":`${b.length-w.length} 个已连接${w.length?` · ${w.length} 个离线`:""}`})]}),s.jsxs("div",{className:"max-h-64 overflow-y-auto border-t border-border/15 px-3 py-2",children:[b.length>0&&s.jsx("p",{className:"mb-1 text-[10px] leading-relaxed text-muted-foreground",children:"与以下服务进行跨服务协作,名称与服务切换器一致。"}),w.length>0&&s.jsx("p",{className:"mb-2 text-[10px] leading-relaxed text-muted-foreground",children:C?"当前协作组的部分服务不可达,消息会保留并等待重连。":"其他服务暂时离线;当前服务内的协作可以继续。不再使用的连接可移除。"}),e.error&&s.jsx("p",{role:"status",className:"mb-2 break-words text-[10px] text-destructive",children:e.error}),e.state==="unsupported"&&s.jsx("p",{className:"mb-2 text-[10px] text-muted-foreground",children:"请更新客户端以管理跨服务连接。"}),s.jsx("div",{className:"divide-y divide-border/10",children:b.map(I=>s.jsxs("div",{className:"py-2.5",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-[11px] text-foreground",children:[Fl({serviceLabel:I.label,serviceOrigin:I.origin}),s.jsx("span",{className:`ml-2 text-[9px] ${I.connected?"text-[var(--success)]":"text-muted-foreground"}`,children:I.connected?"已连接":I.error==="CONNECTING"?"连接中":"暂时离线"})]}),s.jsx(sD,{service:I})]}),I.serviceId&&s.jsxs("button",{type:"button",disabled:!!r,"aria-label":`移除协作连接 ${I.origin}`,className:`${xr} min-h-9 shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,onClick:()=>p(h===I.serviceId?null:I.serviceId),children:[s.jsx(Js,{size:12}),"移除"]})]}),!!I.groups?.length&&s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1 text-[9px] text-muted-foreground",children:[s.jsx("span",{children:"用于"}),I.groups.map(N=>s.jsx("button",{type:"button",className:"rounded px-1.5 py-1 text-primary hover:bg-primary/10",onClick:()=>c(N.id),children:N.name},N.id))]}),!I.connected&&I.error&&I.error!=="CONNECTING"&&s.jsxs("details",{className:"mt-1 text-[9px] text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer",children:hD(I.error)}),s.jsx("p",{className:"mt-1 select-text break-words",children:I.error})]}),h===I.serviceId&&s.jsxs("div",{role:"group","aria-label":"确认移除协作连接",className:"mt-2 rounded-lg bg-surface-2 p-2.5",children:[s.jsx("p",{className:"text-[10px] leading-relaxed text-foreground",children:I.groups?.length?"请先处理上方协作组的成员,再移除这条连接。":"移除后停止与该服务协作,保留已有会话和消息;以后可重新连接。"}),s.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[s.jsx("button",{type:"button",disabled:!!r,className:`${xr} min-h-9 text-muted-foreground`,onClick:()=>p(null),children:"取消"}),s.jsx("button",{type:"button",disabled:!!r||!!I.groups?.length,className:`${xr} min-h-9 bg-destructive text-destructive-foreground`,onClick:()=>{S(I.serviceId,!1)},children:r===`peer:${I.serviceId}`?"正在移除…":"确认移除"})]})]})]},I.serviceId||I.origin))}),b.length===0&&e.state==="ready"&&s.jsx("p",{className:"py-2 text-[10px] text-muted-foreground",children:"当前没有其他协作服务,当前服务内仍可创建协作组。"}),w.length>0&&s.jsxs("button",{type:"button",className:`${xr} mt-1 min-h-9 text-primary hover:bg-primary/10`,onClick:o8,children:[s.jsx(sn,{size:12}),"重试连接"]}),y.length>0&&s.jsxs("div",{className:"mt-2 border-t border-border/15 pt-1",children:[s.jsx("button",{type:"button","aria-expanded":m,className:`${xr} min-h-9 text-muted-foreground hover:bg-surface-2`,onClick:()=>x(I=>!I),children:m?"收起恢复列表":"恢复已移除连接"}),m&&s.jsxs("section",{"aria-label":"恢复已移除连接",className:"mt-1 rounded-lg bg-surface-2 px-2.5 py-2",children:[s.jsx("p",{className:"text-[10px] leading-relaxed text-muted-foreground",children:"以下是恢复记录,连接已停用,不会自动重连。点击恢复后才会重新启用协作。"}),s.jsx("div",{className:"mt-1 divide-y divide-border/10",children:y.map(I=>s.jsxs("div",{className:"flex items-start gap-2 py-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"break-words text-[10px] text-foreground",children:[Fl({serviceLabel:I.label,serviceOrigin:I.origin}),s.jsx("span",{className:"ml-2 text-[9px] text-muted-foreground",children:"已停用"})]}),s.jsx("p",{className:"mt-0.5 select-text break-all text-[9px] text-muted-foreground",children:I.accessUrl||I.origin})]}),s.jsx("button",{type:"button",disabled:!!r||!I.serviceId,className:`${xr} min-h-9 shrink-0 text-primary hover:bg-primary/10`,onClick:()=>{S(I.serviceId,!0)},children:r===`peer:${I.serviceId}`?"恢复中…":"恢复连接"})]},I.serviceId||I.origin))})]})]})]})]},C?"affected":"other")}function sD({service:e}){let t=!1;try{t=["localhost","127.0.0.1","[::1]"].includes(new URL(e.origin).hostname)}catch{}const r=e.accessUrl||(t?"":e.origin);return s.jsxs("details",{className:"mt-1 text-[9px] text-muted-foreground",children:[s.jsx("summary",{className:"w-fit cursor-pointer py-1",children:"连接详情"}),s.jsxs("dl",{className:"mt-1 space-y-1 select-text break-all",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"inline",children:"服务地址:"}),s.jsx("dd",{className:"inline",children:r||"暂未获取,请在服务切换器中查看"})]}),e.serviceId&&s.jsxs("div",{children:[s.jsx("dt",{className:"inline",children:"服务身份:"}),s.jsx("dd",{className:"inline",children:e.serviceId})]})]})]})}function am(e){return!F0(e.sessionId)||e.serviceConnected!==!1}function iD(e){return e.serviceOrigin?e.serviceOrigin===window.location.origin?"":e.serviceOrigin:F0(e.sessionId)?.origin??""}function _5(e){const t=new Map;for(const r of e){const n=iD(r),a=t.get(n)??{key:n,label:n?Fl(r):"本机服务",sessions:[]};n&&a.label==="远端服务"&&(a.label=Fl(r)),a.sessions.push(r),t.set(n,a)}return[...t.values()].sort((r,n)=>(r.key?1:0)-(n.key?1:0)||r.label.localeCompare(n.label))}function k5({label:e,count:t,collapsed:r,onToggle:n}){return s.jsxs("button",{type:"button","aria-expanded":!r,onClick:n,className:"flex w-full items-center gap-1.5 bg-surface-2/50 px-2 py-1.5 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[s.jsx(O0,{size:12,className:`shrink-0 transition-transform ${r?"-rotate-90":""}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wide",children:e}),s.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground/70",children:t})]})}function aD(e,t){const r=new Map(t.map(n=>[n.sessionId,n]));for(const n of e?.sessionIds??[]){if(r.has(n))continue;const a=e?.remoteSessions?.find(l=>l.sessionId===n);r.set(n,a?{...a,status:"offline",serviceConnected:!1}:{sessionId:n,name:n,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...F0(n)?{serviceConnected:!1}:{}})}return[...r.values()]}function om({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:s.jsxs("span",{className:"inline-flex max-w-28 shrink-0 items-center gap-1 rounded border border-border/20 px-1 py-0.5 text-[9px] text-muted-foreground",children:[s.jsx(Hc,{size:9}),s.jsx("span",{className:"truncate",children:Fl(e)})]})}function Uh(e){return e.serviceConnected===!1?"服务不可达":e.status==="recovering"&&e.route_error==="ROUTE_NOT_CHECKED"?"投递目标未检查":cD(e.status)}function oD(e,t=[]){if(!e)return;const r=t.some(a=>a.sessionId!==e.sessionId&&a.name.trim()===e.name.trim()),n=e.sessionId.startsWith("remote:")?Fl(e):"本机服务";return r?`${e.name} · ${n}`:e.name}async function lD(e){e.sessionId.startsWith("remote:")?await V6(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function cD(e){return{ready:"终端可达",shell:"Shell 终端",recovering:"正在检查投递目标",unchecked:"投递目标未检查","terminal-connected":"终端已连接",detached:"终端未连接","agent-exited":"Agent 已退出",offline:"已离线",ambiguous:"需确认目标终端","identity-mismatch":"终端身份已变化",unavailable:"终端暂不可达","service-reachable":"服务可达","service-unreachable":"服务不可达"}[e]??"在线"}function lm(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return yf(t.prompt)||"暂无任务摘要"}catch{}return yf(e)||"暂无任务摘要"}function uD(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function dD(e,t){const r=new Map(t.map(a=>[a.sessionId,oD(a,t)])),n=new Map;for(const a of e){const l=`${a.threadId}:${a.createdAt}:${a.fromSessionId??a.integrationOrigin?.integrationId??"user"}:${a.kind}:${a.responseKind??""}:${JSON.stringify(a.task??null)}:${a.content}`,c=n.get(l),h=a.toPrincipalId?`后台接入 ${a.toPrincipalId}`:r.get(a.toSessionId)??a.toSessionId.slice(0,8);if(c){c.toNames.push(h),a.delivery?.stage==="blocked"&&a.delivery.error&&!c.deliveryErrors.includes(a.delivery.error)&&c.deliveryErrors.push(a.delivery.error);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2,stored:3};p[a.status]<p[c.status]&&(c.status=a.status);continue}n.set(l,{key:l,kind:a.kind,content:a.content,createdAt:a.createdAt,fromName:a.fromSessionId?r.get(a.fromSessionId)??a.fromSessionId.slice(0,8):a.integrationOrigin?`后台接入 ${a.integrationOrigin.integrationId}`:"你",toNames:[h],status:a.status,responseKind:a.responseKind,task:a.task,failureReason:a.failureReason,deliveryErrors:a.delivery?.stage==="blocked"&&a.delivery.error?[a.delivery.error]:[]})}return[...n.values()].sort((a,l)=>l.createdAt-a.createdAt)}function hD(e){return/timeout|timed out|超时|operation was aborted/i.test(e)?"连接超时,暂时无法访问该服务。请确认远端服务已启动,并检查网络或 VPN 连接。":/ECONNREFUSED|connection refused/i.test(e)?"远端拒绝连接,请确认服务已启动且端口正确。":/ENOTFOUND|EHOSTUNREACH|ENETUNREACH/i.test(e)?"无法访问远端地址,请检查地址和网络连接。":/certificate|fingerprint|TLS|证书/i.test(e)?"远端证书校验失败,请检查服务连接授权。":"服务连接暂时不可用,可查看连接详情并重试。"}function cm({value:e,query:t}){const r=t.trim().toLocaleLowerCase();if(!r)return s.jsx(s.Fragment,{children:e});const n=e.toLocaleLowerCase(),a=[];let l=0,c;for(;(c=n.indexOf(r,l))>=0;)a.push(e.slice(l,c)),a.push(s.jsx("mark",{className:"rounded bg-primary/15 text-primary",children:e.slice(c,c+r.length)},c)),l=c+r.length;return a.push(e.slice(l)),s.jsx(s.Fragment,{children:a})}function fD({active:e,onClose:t,onNewSession:r,setError:n}){const[a,l]=v.useState(""),[c,h]=v.useState([]),[p,m]=v.useState(0),[x,b]=v.useState(),[y,w]=v.useState(50),[C,S]=v.useState(0),[I,N]=v.useState(!1),[Q,W]=v.useState(null),[B,U]=v.useState(null),K=v.useRef(null),re=v.useRef(0);v.useEffect(()=>{e&&K.current?.focus({preventScroll:!0})},[e]),v.useEffect(()=>{if(!e)return;const ne=++re.current,ce=new AbortController;let Ne;W(null),N(!0);const Me=async()=>{try{const be=await u8(a.trim(),y,ce.signal);if(ne!==re.current)return;h(be.results),m(be.total??be.results.length),b(be.index),be.index?.building&&(Ne=window.setTimeout(()=>{Me()},2500))}catch(be){ne===re.current&&!ce.signal.aborted&&W(be instanceof Error?be.message:"搜索失败")}finally{ne===re.current&&N(!1)}};return Ne=window.setTimeout(()=>{Me()},a.trim()?250:0),()=>{window.clearTimeout(Ne),ce.abort(),++re.current}},[e,a,y,C]);const H=ne=>{n(null),l(ne),h([]),m(0),w(50)},Oe=async ne=>{if(!B){if(ne.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:ne.sessionId})),t();return}if(!(!ne.nativeKey&&!ne.resumeHistoryId)){U(ne.sessionId),n(null);try{const ce=ne.nativeKey?await d8(ne.nativeKey):await db(ne.resumeHistoryId);if("sessionId"in ce&&ce.sessionId)window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:ce.sessionId}));else if(ce.command)r({mode:"shell",cwd:ce.cwd,command:ce.command});else throw new Error("这条会话暂时无法恢复,请重新搜索");t()}catch(ce){n(ce instanceof Error?ce.message:"恢复失败")}finally{U(null)}}}};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"历史会话搜索"}),s.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"搜索当前服务的 Codex、Claude 历史对话和 Termdock 终端记录,未启动的会话也能找到并恢复。"})]}),s.jsxs("label",{className:"relative mt-3 block",children:[s.jsx("span",{className:"sr-only",children:"搜索历史会话"}),s.jsx($l,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:K,maxLength:512,className:`${Ks} pl-9 pr-9`,value:a,onChange:ne=>H(ne.target.value),placeholder:"搜索会话名称、对话关键词、目录或 session ID"}),I?s.jsx(sn,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):a&&s.jsx("button",{type:"button","aria-label":"清空搜索",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded-md p-1.5 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>H(""),children:s.jsx(zn,{size:13})})]}),x?.building&&s.jsxs("div",{role:"status",className:"mt-2 text-[10px] text-muted-foreground",children:["正在建立历史索引:",x.indexed,"/",x.total," 个会话。可以先搜名称和目录,对话结果会自动补齐。"]}),x?.warning&&s.jsx("p",{role:"status",className:"mt-2 text-[10px] text-destructive",children:x.warning}),!!x?.failed&&s.jsxs("p",{role:"status",className:"mt-2 text-[10px] text-destructive",children:[x.failed," 个会话暂未完成索引,其余结果可正常使用。请稍后刷新重试。"]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("p",{className:"text-[11px] text-foreground",children:[a.trim()?`找到 ${p} 个会话`:"最近的会话",p>c.length?` · 显示 ${c.length} 个`:""]}),s.jsxs("button",{type:"button",disabled:I,className:`${xr} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>S(ne=>ne+1),children:[s.jsx(sn,{size:12}),"刷新"]})]}),!a.trim()&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"记得之前讨论过什么?输入一句话中的关键词,就能找到对应会话。历史对话与索引保存在当前服务机器上。"}),s.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:c.map(ne=>{const ce=ne.live||!!(ne.nativeKey||ne.resumeHistoryId),Ne=B===ne.sessionId?"正在恢复…":ne.live?"打开会话":ce?"恢复会话":"仅供查阅",Me=ne.source==="codex"||ne.source==="claude"?ne.snippet:pD(ne),be=ne.source==="codex"?"Codex 历史":ne.source==="claude"?"Claude 历史":"终端记录",V=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"break-words text-[12px] font-medium text-foreground",children:s.jsx(cm,{value:ne.title,query:a})}),s.jsx("p",{className:"mt-0.5 break-all text-[9px] text-muted-foreground",children:s.jsx(cm,{value:ne.cwd||"项目目录待索引",query:a})})]}),s.jsx("span",{className:`shrink-0 text-[10px] ${ne.live?"text-[var(--success)]":ce?"text-primary":"text-muted-foreground"}`,children:Ne})]}),Me&&s.jsx("p",{className:"mt-2 line-clamp-3 break-words text-[10px] leading-relaxed text-foreground/75",children:s.jsx(cm,{value:Me,query:a})}),s.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[be," · ",wf(ne.updatedAt),a.trim()?` · ${ne.matchCount>=999?"999+":ne.matchCount} 处匹配`:"",ce?"":" · 没有可恢复记录"]}),ne.agentNativeSessionId&&s.jsx("p",{className:"mt-1 select-text break-all text-[9px] text-muted-foreground",children:ne.agentNativeSessionId})]});return ce?s.jsx("button",{disabled:!!B,onClick:()=>{Oe(ne)},className:"block w-full px-2 py-3 text-left transition hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none",children:V},ne.nativeKey||ne.sessionId):s.jsx("article",{className:"px-2 py-3",children:V},ne.sessionId)})}),p>c.length&&y<5e3&&s.jsx("button",{type:"button",disabled:I,className:`${xr} w-full bg-surface-2 text-foreground`,onClick:()=>w(ne=>ne+50),children:I?"正在加载…":"加载更多会话"}),Q&&s.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/10 p-3 text-[11px] text-destructive",children:["搜索失败:",Q,s.jsx("button",{type:"button",className:`${xr} ml-2`,onClick:()=>S(ne=>ne+1),children:"重试"})]}),!I&&!Q&&c.length===0&&s.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[s.jsx("p",{className:"text-[12px] text-foreground",children:x?.building?"历史对话仍在索引,请稍候":x?.warning||x?.failed?"暂未找到结果,部分历史记录尚不可搜索":a.trim()?`没有找到“${a.trim()}”`:"当前服务还没有可搜索的历史会话"}),s.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:x?.building?"新结果会自动显示,也可以先搜会话名称或目录。":"可尝试更短的关键词、项目目录或 session ID;其他机器的历史需切换到对应服务搜索。"}),a.trim()&&s.jsx("button",{className:`${xr} mt-3 bg-surface-2 text-foreground`,onClick:()=>H(""),children:"查看最近会话"})]})]})}function yf(e){return e.replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g," ").replace(/\u001B\[[0-?]*[ -/]*[@-~]/g," ").replace(/\(B/g," ").replace(/<[^>]{1,120}>/g," ").replace(/[─━│┃┄┅┆┇┈┉┊┋┌┐└┘├┤┬┴┼╭╮╯╰═║╔╗╚╝╠╣╦╩╬]+/g," ").replace(/([^\p{L}\p{N}\s])\1{3,}/gu," ").replace(/([A-Za-z])\1{12,}/g," ").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g," ").replace(/\s+/g," ").trim().slice(0,280)}function pD(e){let t=yf(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return yf(t)}function mD(e){if(e.schedule.kind==="interval")return e.schedule.everyMinutes===60?"每小时":e.schedule.everyMinutes===1440?"每天":`每 ${e.schedule.everyMinutes} 分钟`;const t=["日","一","二","三","四","五","六"];return`${e.schedule.weekdays.length===7?"每天":e.schedule.weekdays.map(n=>`周${t[n]}`).join("、")} ${e.schedule.time}`}function gD(e,t=Date.now(),r=t){if(e.kind==="interval"){const l=e.everyMinutes*6e4,c=Math.max(0,t-r);return r+(Math.floor(c/l)+1)*l}const[n,a]=e.time.split(":").map(Number);for(let l=0;l<=7;l+=1){const c=new Date(t);if(c.setDate(c.getDate()+l),c.setHours(n,a,0,0),c.getTime()>t&&e.weekdays.includes(c.getDay()))return c.getTime()}return t}function wf(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function xD(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function bD(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function vD({text:e}){return s.jsx("div",{className:"rounded-xl border border-dashed border-border/20 px-4 py-8 text-center text-[11px] text-muted-foreground",children:e})}const Ou=64,I5=10,yD=120;function wD({children:e,open:t,onOpenChange:r,onClose:n,closeLabel:a,closeTitle:l,compact:c}){const h=v.useRef(null),p=v.useRef(null),m=v.useRef(0),x=$0(()=>{p.current?.horizontal&&(m.current=Date.now()+600),p.current=null,y(null)}),[b,y]=v.useState(null),w=b??(t?Ou:0);return v.useEffect(()=>{if(!t)return;const C=S=>{S.target instanceof Node&&!h.current?.contains(S.target)&&r(!1)};return document.addEventListener("pointerdown",C,!0),()=>document.removeEventListener("pointerdown",C,!0)},[t,r]),s.jsxs("div",{ref:h,"data-sidebar-gesture-ignore":!0,"data-session-swipe":!0,className:`relative flex min-w-0 flex-1 items-center ${c?"":"gap-1"}`,style:{touchAction:"pan-y"},onPointerDown:C=>{if(m.current=0,!(C.pointerType!=="touch"&&C.pointerType!=="pen")){if(C.isPrimary===!1){p.current=null,y(null);return}!(C.target instanceof Element)||!C.target.closest(".sidebar-session-primary")||(x(C),p.current={pointerId:C.pointerId,x:C.clientX,y:C.clientY,startedAt:Date.now(),initialOffset:t?Ou:0,offset:t?Ou:0,horizontal:!1})}},onPointerMove:C=>{const S=p.current;if(!S||S.pointerId!==C.pointerId)return;const I=C.clientX-S.x,N=C.clientY-S.y;if(!S.horizontal){if(C.defaultPrevented||Date.now()-S.startedAt>=yD||Math.abs(N)>I5){p.current=null;return}if(Math.abs(I)<=I5)return;if(Math.abs(I)<Math.abs(N)*1.5||!t&&I<0){p.current=null;return}S.horizontal=!0,C.currentTarget.setPointerCapture?.(C.pointerId)}C.preventDefault(),S.offset=Math.max(0,Math.min(Ou,S.initialOffset+I)),y(S.offset)},onPointerUp:C=>{const S=p.current;!S||S.pointerId!==C.pointerId||(p.current=null,S.horizontal&&(m.current=Date.now()+600,r(S.offset>=Ou/2),y(null)))},onPointerCancel:()=>{p.current?.horizontal&&(m.current=Date.now()+600),p.current=null,y(null)},onClickCapture:C=>{if(Date.now()<m.current){m.current=0,C.preventDefault(),C.stopPropagation();return}t&&C.target instanceof Element&&C.target.closest(".sidebar-session-primary")&&(r(!1),C.preventDefault(),C.stopPropagation())},onKeyDown:C=>{t&&C.key==="Escape"&&(C.stopPropagation(),r(!1))},children:[s.jsx("div",{className:"shrink-0 overflow-hidden rounded-md transition-[width] duration-150 ease-out motion-reduce:transition-none",style:{width:w,transition:b===null?void 0:"none"},children:w>0&&s.jsxs("button",{type:"button",tabIndex:t?0:-1,"aria-hidden":!t,"aria-label":l,className:"flex min-h-8 w-16 flex-col items-center justify-center gap-0.5 bg-destructive py-1 text-[10px] text-destructive-foreground",onClick:C=>{C.stopPropagation(),r(!1),n(C)},children:[s.jsx(Js,{size:14}),a]})}),e]})}const E5="recoverable-tmux";function AD({sessions:e,loading:t,attachingName:r,onRefresh:n,onRestore:a,onClose:l}){const{t:c}=Xr(),h=Sr(N=>N.collapsedGroups.has(E5)),p=Sr(N=>N.toggleGroupCollapsed),[m,x]=v.useState(null),[b,y]=v.useState(null),[w,C]=v.useState(null),S=v.useRef(!1),I=async N=>{if(!(!l||S.current)){S.current=!0,y(N),C(null);try{await l(N),x(null)}catch(Q){C(Q instanceof Error?Q.message:c("sidebar.closeRecoverableSessionFailed"))}finally{S.current=!1,y(null)}}};return e.length===0?null:s.jsxs("section",{className:"mb-2 shrink-0 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":c("sidebar.recoverableSessions"),children:[s.jsxs("div",{className:"flex items-center gap-1 text-[10.5px] font-semibold text-[color:var(--tmux)]",children:[s.jsxs("button",{type:"button","aria-expanded":!h,onClick:()=>p(E5),className:"flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md px-2 text-left hover:bg-surface-elevated md:min-h-8",children:[s.jsx(Ci,{size:12,className:`shrink-0 ${h?"":"rotate-90"}`}),s.jsx(j0,{size:12,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:c("sidebar.recoverableSessions")}),s.jsx("span",{className:"text-muted-foreground",children:e.length})]}),n&&s.jsx("button",{type:"button",onClick:n,disabled:t||b!==null,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50 md:h-7 md:w-7","aria-label":c("sidebar.refreshRecoverableSessions"),title:c("sidebar.refreshRecoverableSessions"),children:s.jsx(sn,{size:11,className:t?"animate-spin":""})})]}),!h&&s.jsx("div",{className:"space-y-0.5",children:e.map(N=>{const Q=N.friendlyName?.trim()||N.label?.trim()||N.name,W=yd(N.cwd??null),B=r===N.name,U=m===N.name;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex min-w-0 items-center",children:[s.jsxs("button",{type:"button",disabled:r!==null||b!==null||U,onClick:()=>a(N),className:"group flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md px-2 text-left text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-60 md:min-h-10","aria-label":c("sidebar.restoreRecoverableSession",{name:Q}),title:N.cwd||N.name,children:[s.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--tmux-rgb)_/_0.11)] text-[color:var(--tmux)]",children:B?s.jsx(Ti,{size:12,className:"animate-spin"}):s.jsx(bc,{size:12})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[11.5px] font-semibold text-foreground",children:Q}),s.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[N.program,W].filter(Boolean).join(" · ")||`tmux:${N.name}`})]}),s.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:c(B?"sidebar.restoringRecoverableSession":"sidebar.restore")})]}),l&&s.jsx("button",{type:"button",disabled:r!==null||b!==null,onClick:()=>{x(N.name),C(null)},className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-destructive/15 hover:text-destructive disabled:opacity-50 md:h-7 md:w-7","aria-label":c("sidebar.closeSession",{name:Q}),title:c("sidebar.closeSession",{name:Q}),children:s.jsx(zn,{size:12})})]}),U&&s.jsxs("div",{role:"group","aria-label":c("sidebar.closeSession",{name:Q}),className:"space-y-2 rounded-md bg-surface px-2 py-2",children:[s.jsx("p",{className:"text-[11px] text-foreground",children:c("sidebar.confirmCloseRecoverableSession",{name:Q})}),w&&s.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:w}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{type:"button",disabled:b!==null,onClick:()=>{x(null),C(null)},className:"min-h-11 rounded-md px-2 text-[11px] text-muted-foreground hover:bg-surface-elevated disabled:opacity-50 md:min-h-8",children:c("common.cancel")}),s.jsx("button",{type:"button",disabled:b!==null,onClick:()=>{I(N.name)},className:"min-h-11 rounded-md bg-destructive/15 px-2 text-[11px] text-destructive hover:bg-destructive/25 disabled:opacity-50 md:min-h-8",children:b===N.name?c("common.loading"):c("sidebar.endRecoverableSession")})]})]})]},N.name)})})]})}const T0="flex min-h-11 w-full items-center gap-2.5 rounded-lg px-3 text-left text-xs transition hover:bg-surface-2 focus:bg-surface-2 focus:outline-none",N5="min-h-11 rounded-lg px-4 text-xs transition disabled:opacity-40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary";function TD({group:e,collapsed:t,onOpen:r,onMessages:n,onToggleCollapsed:a,onChanged:l,children:c}){const[h,p]=v.useState(null),[m,x]=v.useState(null),[b,y]=v.useState(""),[w,C]=v.useState(!1),S=v.useRef(!1),[I,N]=v.useState(""),Q=v.useRef(null),W=v.useRef(null),B=v.useRef(null),U=v.useRef(null),K=v.useRef(null),re=v.useId(),H=Df(),Oe=()=>K.current?.isConnected?K.current:W.current,ne=()=>{S.current||(x(null),N(""))};xc(B,!!h,()=>p(null),Oe),xc(U,!!m,ne,Oe);const ce=V=>{W0(),K.current=document.activeElement instanceof HTMLElement&&Q.current?.contains(document.activeElement)?document.activeElement:W.current;const Ke=W.current?.getBoundingClientRect();p(V??{x:Ke?.left??8,y:Ke?.bottom??8})};v.useEffect(()=>{h&&B.current?.querySelector('[role="menuitem"]')?.focus({preventScroll:!0})},[h]),v.useEffect(()=>{if(!h)return;const V=he=>{he.target instanceof Node&&!B.current?.contains(he.target)&&!Q.current?.contains(he.target)&&p(null)},Ke=he=>{he.target instanceof Node&&B.current?.contains(he.target)||p(null)};return document.addEventListener("pointerdown",V),window.addEventListener("resize",Ke),window.addEventListener("scroll",Ke,!0),()=>{document.removeEventListener("pointerdown",V),window.removeEventListener("resize",Ke),window.removeEventListener("scroll",Ke,!0)}},[h]),v.useLayoutEffect(()=>{if(!h||!B.current)return;const V=window.visualViewport,Ke=(V?.offsetLeft??0)+8,he=(V?.offsetTop??0)+8,Be=Math.min(240,(V?.width??innerWidth)-16),ae=he+(V?.height??innerHeight)-16;Object.assign(B.current.style,{width:`${Be}px`,maxHeight:`${ae-he}px`,left:`${Math.max(Ke,Math.min(h.x,Ke+(V?.width??innerWidth)-16-Be))}px`,top:`${Math.max(he,Math.min(h.y,ae-B.current.offsetHeight))}px`})},[h]);const Ne=V=>{p(null),V()},Me=V=>{N(""),y(e.name),x({kind:V,group:e})},be=async()=>{if(!(!m||S.current||m.kind==="rename"&&!b.trim())){S.current=!0,C(!0),N("");try{const V=m.group,Ke=m.kind==="delete"?(await lb(V.id,V.updatedAt),null):m.kind==="archive"||m.kind==="unarchive"?await f8(V,m.kind==="archive"):(await ml({id:V.id,name:b.trim(),sessionIds:V.sessionIds,expectedUpdatedAt:V.updatedAt})).group;x(null),l(Ke)}catch(V){const Ke=V instanceof Error?V.message:"操作失败,请重试";N(Ke.includes("协作组已变化")?"协作组刚刚发生变化,请取消后重新打开操作。":Ke)}finally{S.current=!1,C(!1)}}};return s.jsxs("div",{ref:Q,className:"flex min-w-0 items-center","data-sidebar-gesture-ignore":!0,...H(()=>ce()),onContextMenu:V=>{V.preventDefault(),V.stopPropagation(),ce({x:V.clientX,y:V.clientY})},onKeyDown:V=>{(V.key==="ContextMenu"||V.shiftKey&&V.key==="F10")&&(V.preventDefault(),V.stopPropagation(),ce())},children:[c,s.jsx("button",{ref:W,type:"button","aria-label":`协作组操作:${e.name}`,title:"协作组操作","aria-haspopup":"menu","aria-expanded":!!h,"aria-controls":h?`${re}-menu`:void 0,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-surface-elevated hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary md:h-[30px] md:w-7",onClick:V=>{V.stopPropagation(),h?p(null):ce()},children:s.jsx(Ac,{size:14})}),h&&Wi.createPortal(s.jsxs("div",{ref:B,id:`${re}-menu`,role:"menu",tabIndex:-1,"aria-label":`协作组操作:${e.name}`,"data-sidebar-gesture-ignore":!0,className:"fixed z-popover overflow-y-auto overscroll-contain rounded-xl border border-border/15 bg-surface p-1 shadow-[0_12px_32px_var(--app-shadow-soft)]",onKeyDown:V=>{const Ke=Array.from(V.currentTarget.querySelectorAll('[role="menuitem"]:not(:disabled)')),he=Ke.indexOf(document.activeElement),Be=V.key==="ArrowDown"?(he+1)%Ke.length:V.key==="ArrowUp"?(he-1+Ke.length)%Ke.length:V.key==="Home"?0:V.key==="End"?Ke.length-1:null;Be!==null&&(V.preventDefault(),V.stopPropagation(),Ke[Be]?.focus({preventScroll:!0})),V.key==="Tab"&&(V.preventDefault(),p(null))},children:[s.jsxs("button",{role:"menuitem",tabIndex:-1,className:T0,onClick:()=>Ne(r),children:[s.jsx(bc,{size:15}),"打开看板"]}),s.jsxs("button",{role:"menuitem",tabIndex:-1,disabled:!n,className:`${T0} disabled:opacity-40`,onClick:()=>Ne(()=>n?.()),children:[s.jsx(wc,{size:15}),"成员与消息"]}),s.jsxs("button",{role:"menuitem",tabIndex:-1,className:T0,onClick:()=>Ne(a),children:[s.jsx(Ci,{size:15,className:t?"":"rotate-90"}),t?"展开成员会话":"收起成员会话"]}),s.jsxs("button",{role:"menuitem",tabIndex:-1,className:T0,onClick:()=>Ne(()=>Me("rename")),children:[s.jsx(M0,{size:15}),"重命名协作组"]}),!e.federated&&s.jsxs("button",{role:"menuitem",tabIndex:-1,className:T0,onClick:()=>Ne(()=>Me(e.archivedAt===void 0?"archive":"unarchive")),children:[s.jsx(Hh,{size:15}),e.archivedAt===void 0?"归档协作组":"恢复显示"]}),s.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/30"}),s.jsxs("button",{role:"menuitem",tabIndex:-1,className:`${T0} text-destructive`,onClick:()=>Ne(()=>Me("delete")),children:[s.jsx(Js,{size:15}),"删除协作组"]})]}),document.body),m&&Wi.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-modal-backdrop bg-black/50 backdrop-blur-sm",onClick:ne}),s.jsxs("section",{ref:U,role:"dialog","aria-modal":"true","aria-labelledby":`${re}-title`,"aria-describedby":`${re}-description`,tabIndex:-1,className:"fixed left-1/2 top-1/2 z-modal-panel max-h-[calc(100dvh-2rem)] w-[min(24rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-2xl border border-border/15 bg-surface p-4 text-foreground shadow-[0_28px_70px_var(--app-shadow-strong)]",children:[s.jsxs("header",{className:"flex items-center gap-2",children:[s.jsx("h2",{id:`${re}-title`,className:"min-w-0 flex-1 text-sm font-semibold",children:m.kind==="delete"?"删除协作组":m.kind==="archive"?"归档协作组":m.kind==="unarchive"?"恢复协作组显示":"重命名协作组"}),s.jsx("button",{type:"button","aria-label":"关闭协作组操作",disabled:w,className:"flex h-11 w-11 items-center justify-center rounded-lg hover:bg-surface-2",onClick:ne,children:s.jsx(zn,{size:16})})]}),s.jsx("p",{id:`${re}-description`,className:"my-3 break-words text-xs leading-6 text-muted-foreground",children:m.kind==="delete"?s.jsxs(s.Fragment,{children:["确定删除“",m.group.name,"”?协作组及组内消息会被移除,成员终端会保留。此操作无法撤销。",m.group.federated&&"删除会同步到其他服务。"]}):m.kind==="archive"?s.jsxs(s.Fragment,{children:["归档“",m.group.name,"”后,它会从默认侧栏隐藏。组、成员、消息和历史都会保留,之后可以恢复显示。"]}):m.kind==="unarchive"?s.jsxs(s.Fragment,{children:["恢复“",m.group.name,"”的显示后,它会重新出现在侧栏;不会自动恢复已关闭的会话。"]}):"修改协作组的名称。"}),s.jsxs("form",{onSubmit:V=>{V.preventDefault(),be()},children:[m.kind==="rename"&&s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["协作组名称",s.jsx("input",{autoFocus:!0,required:!0,maxLength:256,disabled:w,className:"mt-2 min-h-11 w-full rounded-lg border border-border/30 bg-surface-2 px-3 text-sm text-foreground outline-none focus:border-primary",value:b,onChange:V=>y(V.target.value)})]}),I&&s.jsx("p",{role:"alert",className:"mt-3 break-words text-xs leading-5 text-destructive",children:I}),s.jsxs("footer",{className:"mt-4 flex justify-end gap-2",children:[s.jsx("button",{type:"button",disabled:w,className:`${N5} bg-surface-2`,onClick:ne,children:"取消"}),s.jsxs("button",{type:"submit",disabled:w||m.kind==="rename"&&!b.trim(),className:`${N5} inline-flex items-center gap-2 ${m.kind==="delete"?"bg-destructive text-destructive-foreground":"bg-primary text-primary-foreground"}`,children:[w&&s.jsx(sn,{size:14,className:"animate-spin"}),w?m.kind==="delete"?"正在删除…":"正在保存…":m.kind==="delete"?"确认删除":m.kind==="archive"?"归档并隐藏":m.kind==="unarchive"?"恢复显示":"保存名称"]})]})]})]})]}),document.body)]})}function CD({sessionId:e,groupId:t,label:r,detail:n,onOpen:a,children:l}){const{t:c}=Xr(),[h,p]=v.useState(null),m=v.useRef(null),x=v.useRef(null),b=v.useRef(null),y=Df(),w=v.useId(),C=()=>p(null);xc(b,!!h,C,()=>x.current);const S=I=>{W0();const N=m.current?.getBoundingClientRect();p(I??{x:N?.left??8,y:N?.bottom??8})};return v.useLayoutEffect(()=>{if(!h)return;const I=()=>{if(!b.current)return;const Q=window.visualViewport,W=Q?.offsetLeft??0,B=Q?.offsetTop??0,U=Q?.width??innerWidth,K=Q?.height??innerHeight,re=window.matchMedia("(min-width: 1024px)").matches,H=Math.min(re?320:384,U-24);b.current.style.width=`${H}px`,b.current.style.maxHeight=`${K-(re?16:48)}px`,b.current.style.left=`${re?Math.max(W+8,Math.min(h.x+8,W+U-H-8)):W+(U-H)/2}px`,b.current.style.top=`${re?Math.max(B+8,Math.min(h.y+8,B+K-b.current.offsetHeight-8)):B+K-b.current.offsetHeight-24}px`};I(),window.addEventListener("resize",I),window.visualViewport?.addEventListener("resize",I),window.visualViewport?.addEventListener("scroll",I);const N=new ResizeObserver(I);return b.current&&N.observe(b.current),()=>{N.disconnect(),window.removeEventListener("resize",I),window.visualViewport?.removeEventListener("resize",I),window.visualViewport?.removeEventListener("scroll",I)}},[h]),s.jsxs(s.Fragment,{children:[s.jsxs("div",{ref:m,className:"flex min-w-0 items-center rounded-sm hover:bg-surface-2","data-sidebar-gesture-ignore":!0,...y(()=>S()),onContextMenu:I=>{I.preventDefault(),I.stopPropagation(),S({x:I.clientX,y:I.clientY})},onKeyDown:I=>{(I.key==="ContextMenu"||I.shiftKey&&I.key==="F10")&&(I.preventDefault(),I.stopPropagation(),S())},children:[l,s.jsx("button",{ref:x,type:"button","aria-label":`成员操作:${r}`,title:"成员操作","aria-haspopup":"dialog","aria-expanded":!!h,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-surface-elevated hover:text-foreground md:h-7 md:w-7",onClick:I=>{I.stopPropagation(),S()},children:s.jsx(Ac,{size:14})})]}),h&&Wi.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default bg-[var(--app-backdrop-soft)] md:bg-transparent","aria-label":c("tab.closeMenu"),onClick:C}),s.jsxs("div",{ref:b,role:"dialog","aria-modal":"true","aria-labelledby":w,tabIndex:-1,className:"fixed z-menu-panel flex flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface-elevated text-foreground shadow-[0_18px_48px_var(--app-shadow-soft)]",children:[s.jsxs("header",{className:"shrink-0 border-b border-border/15 px-4 py-3",children:[s.jsx("h2",{id:w,className:"truncate text-sm font-medium",title:r,children:r}),s.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:n,children:n})]}),s.jsx("div",{className:"min-h-0 overflow-y-auto overscroll-contain py-1",children:s.jsx(F3,{sessionId:e,groupId:t,itemClassName:"flex min-h-11 items-center gap-3 px-4 py-3 text-left text-[13px] transition",iconClassName:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full",onOpen:()=>{C(),a()},onDone:C})}),s.jsx("footer",{className:"shrink-0 border-t border-border/15 px-3 py-2",children:s.jsx("button",{type:"button",className:"min-h-11 w-full rounded-full bg-surface-2 px-3 text-xs text-muted-foreground hover:text-foreground",onClick:C,children:c("tab.closeMenu")})})]})]}),document.body)]})}const um="termdock-left-sidebar-scroll-position";function SD(e,t,r){const[n]=v.useState(()=>cc(um,l=>typeof l=="number"&&Number.isFinite(l)&&l>=0)),a=v.useRef(null);v.useLayoutEffect(()=>{const l=e.current;!t||!r||!l||l.clientHeight===0||a.current===l||(n!==null&&(l.scrollTop=n),a.current=l)}),v.useEffect(()=>{const l=e.current;if(!l)return;const c=()=>{a.current!==l||l.clientHeight===0||p8(um,Math.max(0,l.scrollTop),150)},h=()=>{c(),m8(um)},p=()=>{document.hidden&&h()};return l.addEventListener("scroll",c,{passive:!0}),window.addEventListener("pagehide",h),window.addEventListener("termdock:before-update",h),document.addEventListener("visibilitychange",p),()=>{h(),l.removeEventListener("scroll",c),window.removeEventListener("pagehide",h),window.removeEventListener("termdock:before-update",h),document.removeEventListener("visibilitychange",p)}},[e])}function LD(e,t){return u1(e.filter(r=>r.archivedAt===void 0),t)}function Fu(e,t){const r=new Set(e),n=t.filter(l=>l.sessionIds.length>=2&&l.sessionIds.every(c=>r.has(c))),a=new Set;return e.flatMap(l=>{const c=n.find(h=>h.sessionIds.includes(l));return c?a.has(c.id)?[]:(a.add(c.id),[{sessionIds:c.sessionIds,workspace:c}]):[{sessionIds:[l]}]})}function $u(e,t,r,n=[]){const a=new Map,l=new Map,c=new Set(e.map(x=>x.id));for(const x of n){const b=x.sessionIds.filter(w=>c.has(w));if(!b.length)continue;const y=b.length===x.sessionIds.length?x:{...x,sessionIds:b};b.forEach(w=>a.set(w,y))}for(const x of t)if(!(x.sessionIds.length<2||!x.sessionIds.every(b=>c.has(b)))&&!x.sessionIds.some(b=>a.has(b)))for(const b of x.sessionIds)l.set(b,x);const h=new Set,p=new Set,m=[];for(const x of e){const b=a.get(x.id);if(b){if(h.has(b.id))continue;h.add(b.id);const C=b.sessionIds.flatMap(S=>{const I=r.get(S);return I?[I]:[]});m.push({kind:"collaboration",id:`collaboration:${b.id}`,group:b,members:C,sessionIds:b.sessionIds});continue}const y=l.get(x.id);if(!y){m.push({kind:"session",id:`session:${x.id}`,session:x,sessionIds:[x.id]});continue}if(p.has(y.id))continue;p.add(y.id);const w=y.sessionIds.flatMap(C=>{const S=r.get(C);return S?[S]:[]});m.push({kind:"workspace",id:`workspace:${y.id}`,workspace:y,members:w,sessionIds:y.sessionIds})}return m}function R5(e,t,r){const n=Math.min(e.length,Math.max(0,r)),a=e.slice(0,n).flatMap(c=>c.sessionIds.filter(h=>h!==t)),l=e.slice(n).flatMap(c=>c.sessionIds.filter(h=>h!==t));return[...a,t,...l]}function _D({progress:e,status:t,detail:r,needsReview:n,inCopyMode:a}){return s.jsx(Aj,{progress:e,status:t,detail:r,needsReview:n,inCopyMode:a})}function M5({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,sessions:a,activeSessionId:l,sessionStates:c,onJumpToNextAttention:h,onNewSession:p,onCloseSession:m,onSplitSession:x,onCloseSplit:b,onRemoveFromSplit:y,splitWorkspaces:w,onSetSplitLayout:C,onReorderSplitWorkspace:S,onCombineSplitSessions:I,onReorderSessions:N,onSessionMenu:Q,onOpenSettings:W,onOpenQuota:B,updateState:U,updateActionPending:K=!1,onConfirmUpdateRestart:re,onRetryUpdate:H,serverHealthState:Oe,tmuxAvailable:ne=!0,defaultSessionMode:ce="shell",push:Ne,pinned:Me,onTogglePinned:be,recoverableTmuxSessions:V=[],recoverableTmuxSessionsLoading:Ke=!1,onRefreshRecoverableTmuxSessions:he,onCloseRecoverableTmuxSession:Be}){const{t:ae}=Xr(),X=ZM(e||!!Me),[,He]=v.useState(0),[je,ve]=v.useState(null),[Fe,lt]=v.useState(!1),[ye,de]=v.useState(!1),[nt,Xe]=v.useState(null),pt=v.useRef(),xe=v.useCallback(()=>pt.current?.(),[]);jl(nt&&(!Fe||nt==="connection")?{message:ae(km(nt)),onAction:xe}:null),v.useEffect(()=>{if(!nt||Fe&&nt!=="connection")return;const $=()=>Xe(null),_e=window.setTimeout($,8e3);return nt==="connection"&&window.addEventListener(Co,$),()=>{clearTimeout(_e),window.removeEventListener(Co,$)}},[nt,Fe]);const mt=v.useRef(!1),It=v.useRef(0),At=v.useCallback($=>{$||(It.current+=1),lt($)},[]),[Nt,oe]=v.useState(!1),F=Ds($=>$.todoOpen?"__todos__":$.groupId),we=hb(),Qe=v.useMemo(()=>new Map(we.map($=>[$.sessionId,$.displayName])),[we]),[tt,it]=v.useState({}),Rt=Nt||Object.keys(tt).length>0,Xt=v.useRef(!1),Zt=v.useRef(!1),[Lt,Lr]=v.useState(null);v.useEffect(()=>{let $=!1;return V0().then(_e=>{$||Xt.current||it(Object.fromEntries(W3(_e.collaborationPanels?.[Nf()]).map(Pe=>[Pe,!0])))}).catch(()=>{}),()=>{$=!0}},[]);const Qr=async($,_e)=>{Xt.current=!0,await Qa({floatingGroupId:_e},$),it(Pe=>({...Pe,[$]:_e!==null}))},[Pt,Dt]=v.useState([]),[pr,pe]=v.useState(!1),[Ge,at]=v.useState(null),[Mt,er]=v.useState(null),[J,bt]=v.useState(null),[Ce,lr]=v.useState(null);jl(Ce?{message:Ce}:null);const Ve=Yu($=>$.tasks),zt=Yu($=>$.allTasks),[Jt,Wr]=v.useState(0),[yn,Ar]=v.useState(null),Jr=v.useRef(!1),[Fr,$r]=v.useState({}),an=Yu($=>$.error);jl(an&&(e||Me)?{tone:"recovering",message:"正在恢复待办同步…"}:null);const[An,gt]=v.useState(!1),[fe,Vr]=v.useState(!1);v.useEffect(()=>yc(()=>{Yu.getState().refresh()},5e3,[Co]),[]);const ct=async $=>(At(!1),Xt.current=!0,$?(Ds.getState().open($),Et(),!0):(oe(!0),Et(),!0)),Ue=G0($=>$.collaborationGroups),Tr=G0($=>$.setCollaborationGroups),[wt,Tn]=v.useState({mode:ce}),{preference:Nr,agents:cn,detecting:Ie,refresh:ht,selectAgent:Je}=Dj(),_r=v.useRef(null);let Zr=!1;if(U?.latestVersion)try{Zr=sj(U.latestVersion,U.currentVersion)>0}catch{}const Gr=!!(Zr&&U&&["checking","installing","ready","restarting","error"].includes(U.status)),Ir=!!Oe?.attention,es=[ae("sidebar.moreActions"),Gr&&U?.latestVersion?ae("sidebar.updateAvailable",{version:U.latestVersion}):null].filter(Boolean).join(": "),Ft=Sr($=>$.groupByFolder),hn=Sr($=>$.collapsedGroups),ee=Sr($=>$.toggleGroupCollapsed),Ye=v.useRef(void 0),qt=v.useCallback($=>{Ye.current=l,ee($)},[l,ee]),Gt=v.useRef(null),Yr=v.useRef(null);SD(Yr,e||!!Me,a.length>0);const Br=v.useRef(null),Er=v.useRef(0),ar=v.useRef(!1),br=v.useRef(null),Hn=v.useRef(null),[Qs,hs]=v.useState(!1),xs=v.useRef([]),On=v.useRef(null),En=v.useRef(null),Bs=v.useRef(new Set),bs=v.useRef(null),Ur=v.useMemo(()=>new Set(w.flatMap($=>$.sessionIds)),[w]),Pr=v.useMemo(()=>new Map(a.map($=>[$.id,$])),[a]),kt=v.useMemo(()=>LD(Ue,new Set(Pr.keys())),[Ue,Pr]),ks=v.useMemo(()=>u1(Ue.filter($=>$.archivedAt!==void 0),new Set(Pr.keys())),[Ue,Pr]),Yt=v.useCallback(async()=>{const $=++Er.current;try{const _e=await o1();if($!==Er.current)return;Tr(Array.isArray(_e.groups)?_e.groups:[])}catch{if($!==Er.current)return;Tr(_e=>_e.map(Pe=>({...Pe,remoteSessions:Pe.remoteSessions?.map(We=>({...We,status:"offline",serviceConnected:!1}))})))}},[]);v.useEffect(()=>cb($=>Tr($.groups)),[]),v.useEffect(()=>{const $=yc(()=>{Yt()},1e4,["focus",Co]);return()=>{Er.current+=1,$()}},[Yt]),v.useEffect(()=>{(e||!Rt)&&Yt()},[Rt,e,Yt]);const q=v.useCallback(()=>{xs.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap($=>{const _e=$.dataset.collaborationMember??"",Pe=$.hasAttribute("data-collaboration-background"),We=$.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!_e&&!Pe||!We)return[];const qe=[];for(let ft=$.parentElement;ft;ft=ft.parentElement)qe.push({element:ft,top:ft.scrollTop,left:ft.scrollLeft});return[{element:$,sessionId:_e,groupId:We,background:Pe,rect:$.getBoundingClientRect(),scrollParents:qe}]})},[]),ke=v.useCallback(($,_e)=>{if(!ar.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(G=>G.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(G=>G.removeAttribute("data-drop-active"));const We=document.elementsFromPoint($,_e).map(G=>G.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(We?.dataset.collaborationGroup){We.dataset.dropActive="true",En.current={kind:"collaboration",groupId:We.dataset.collaborationGroup,background:!0};return}const qe=xs.current.find(G=>{if(G.sessionId===Hn.current||!G.element.isConnected)return!1;const le=G.scrollParents.reduce(($e,ot)=>$e+ot.element.scrollLeft-ot.left,0),ge=G.scrollParents.reduce(($e,ot)=>$e+ot.element.scrollTop-ot.top,0);return $>=G.rect.left-le&&$<=G.rect.right-le&&_e>=G.rect.top-ge+G.rect.height*.25&&_e<=G.rect.bottom-ge-G.rect.height*.25});if(qe?.background){qe.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),En.current={kind:"collaboration",groupId:qe.groupId,background:!0};return}if(qe&&!w.find(le=>le.sessionIds.includes(qe.sessionId))?.sessionIds.includes(Hn.current??"")){qe.element.dataset.dropActive="true",En.current={kind:"split",sessionId:qe.sessionId,groupId:qe.groupId};return}const ft=document.elementsFromPoint($,_e).filter(G=>{const le=G.closest("[data-rfd-draggable-id]");return!le||!["session:","split-member:","collaboration-member:"].some(ge=>le.dataset.rfdDraggableId===`${ge}${Hn.current}`)}),Ct=ft.map(G=>G.closest("[data-collaboration-group]")).find(G=>G?.dataset.collaborationGroup);if(Ct?.dataset.collaborationGroup){const G=Ct.dataset.collaborationGroup,le=ft.map(xt=>xt.closest("[data-collaboration-split]")).find(Boolean),ge=ft.map(xt=>xt.closest("[data-collaboration-member]")).find(Boolean),$e=ge?.dataset.collaborationMember??le?.dataset.splitAnchor,ot=G===br.current&&w.some(xt=>xt.sessionIds.includes($e??"")&&xt.sessionIds.includes(Hn.current??""));if($e&&!ot&&(G!==br.current||!ge&&le)){Ct.dataset.dropActive="true";const xt=ge??le;xt&&(xt.dataset.dropActive="true"),En.current={kind:"split",sessionId:$e,groupId:G}}else{const xt=ft.some(Tt=>Tt.closest("[data-collaboration-background]"));(G!==br.current||xt)&&(Ct.dataset.dropActive="true"),En.current={kind:"collaboration",groupId:G,background:xt}}return}const st=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(G=>G.dataset.sidebarEntityListId===On.current).find(G=>{const le=G.getBoundingClientRect();return $>=le.left&&$<=le.right&&_e>=le.top-8&&_e<=le.bottom+8});if(!st){En.current=null;return}const vt=Array.from(st.children).filter(G=>G instanceof HTMLElement&&G.hasAttribute("data-sidebar-entity-index")),sr=vt.findIndex(G=>{const le=G.getBoundingClientRect();return _e<le.top+le.height/2}),yt=sr<0?vt.length:sr;En.current={kind:"list",listId:st.dataset.sidebarEntityListId??"",index:yt};const P=Array.from(st.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(G=>G.dataset.splitExitDropIndex===String(yt));P instanceof HTMLElement&&(P.dataset.active="true")},[w]);v.useEffect(()=>{const $=Pe=>ke(Pe.clientX,Pe.clientY),_e=Pe=>{const We=Pe.touches[0];We&&ke(We.clientX,We.clientY)};return window.addEventListener("pointermove",$),window.addEventListener("touchmove",_e,{passive:!0}),()=>{window.removeEventListener("pointermove",$),window.removeEventListener("touchmove",_e)}},[ke]);const rt=v.useCallback(($,_e)=>{try{$(_e)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(Pe=>{delete Pe.dataset.sidebarDragging}),ar.current=!1,xs.current=[],hs(!1),br.current=null,Hn.current=null,On.current=null,En.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(Pe=>Pe.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(Pe=>Pe.removeAttribute("data-drop-active"))}},[]),or=v.useMemo(()=>a.filter($=>!Ur.has($.id)),[a,Ur]),$t=v.useMemo(()=>{let $=0;for(const _e of a)c.get(_e.id)?.agentStatus==="working"&&($+=1);return $},[a,c]);v.useLayoutEffect(()=>{const $=Ye.current!==void 0&&Ye.current===l;Ye.current=void 0;const _e=Gt.current,Pe=Yr.current;if(!(e||Me)||!_e||!Pe){Br.current=null;return}const We=Pe.getBoundingClientRect(),qe=_e.getBoundingClientRect(),ft={item:_e,top:Math.round(qe.top-We.top+Pe.scrollTop),height:Math.round(qe.height),viewportHeight:Pe.clientHeight},Ct=Br.current;if(Br.current=ft,Ct?.item===ft.item&&Ct.top===ft.top&&Ct.height===ft.height&&Ct.viewportHeight===ft.viewportHeight||$||ar.current||Pe.clientHeight===0)return;const Qt=8,st=qe.top-We.top,vt=qe.bottom-We.top;st<Qt?Pe.scrollTop+=st-Qt:vt>Pe.clientHeight-Qt&&(Pe.scrollTop+=vt-Pe.clientHeight+Qt)});const cr=v.useMemo(()=>{if(!Ft||!l)return null;const $=c.get(l)?.cwd??null;return V9($)},[Ft,l,c]);v.useEffect(()=>{if(!Ft){bs.current=null,Bs.current.clear();return}if(!l){bs.current=null;return}const $=Sr.getState(),_e=Bs.current,Pe=bs.current,We=cr;Pe!==null&&Pe!==We&&_e.has(Pe)&&($.collapsedGroups.has(Pe)||$.toggleGroupCollapsed(Pe),_e.delete(Pe)),We!==null&&We!==""&&$.collapsedGroups.has(We)&&($.toggleGroupCollapsed(We),_e.add(We)),bs.current=We},[Ft,l,cr]),v.useEffect(()=>{e||At(!1)},[e]),v.useEffect(()=>{Tn($=>({...$,command:Nr?.command}))},[Nr]),v.useEffect(()=>{if(!Fe)return;let $=!1;return pe(!0),er(null),kg().then(_e=>{$||Dt(_e)}).catch(()=>{$||er(ae("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{$||pe(!1)}),()=>{$=!0}},[Fe,ae]),v.useEffect(()=>{if(!je)return;const $=_e=>{_e instanceof KeyboardEvent&&_e.key!=="Escape"||_e instanceof PointerEvent&&_e.target instanceof Node&&_r.current?.contains(_e.target)||ve(null)};return window.addEventListener("pointerdown",$),window.addEventListener("keydown",$),()=>{window.removeEventListener("pointerdown",$),window.removeEventListener("keydown",$)}},[je]);const Et=()=>{!Ne&&!Me&&r()};v.useEffect(()=>{const $=_e=>{At(!1);const{groupId:Pe,dock:We}=_e.detail;Xt.current=!0,Hs.getState().setDock(Pe,{...We,preferredWidth:360}),it(qe=>({...qe,[Pe]:!0})),Ds.getState().terminal(),Et()};return window.addEventListener("termdock:open-collaboration-messages",$),()=>window.removeEventListener("termdock:open-collaboration-messages",$)},[Et]);const fn=ce==="tmux"&&!ne?"shell":ce,Ts=($,_e=!1)=>{if(mt.current)return;mt.current=!0,de(!0),Xe(null),pt.current=()=>Ts($,_e);const Pe=It.current;p({...$,shouldActivate:()=>Pe===It.current&&($.shouldActivate?.()??!0),onResult:We=>{if(mt.current=!1,de(!1),!We.ok){Xe(We.error);return}Xe(null),Pe===It.current&&(_e&&At(!1),Et())}})},_i=()=>{Ts({mode:fn})},Ps=()=>{Nr&&Ts({mode:fn,command:G6(Nr.slug,Nr.command)})},Wn=$=>{At(!1),bt($.name),p({mode:"tmux",tmuxSessionName:$.name,cwd:$.cwd??void 0}),Et()};v.useEffect(()=>{J&&(V.some($=>$.name===J)||bt(null))},[J,V]);const wa=($,_e)=>{Ts({...wt,cwd:wt.cwd?.trim()||void 0,command:_e??$?.command},!0)},di=async $=>{at($.id),er(null);try{const _e=await db($.id);Ts({mode:"shell",cwd:_e.cwd,command:_e.command},!0)}catch(_e){const Pe=_e&&typeof _e=="object"&&"code"in _e?String(_e.code??""):"";er(ae(Pe==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{at(null)}},Gn=async $=>{Dt(_e=>_e.filter(Pe=>Pe.id!==$));try{await C8($)}catch{er(ae("sidebar.resumeHistoryRemoveFailed")),kg().then(Dt).catch(()=>{})}},ls=()=>{if(Fe){At(!1);return}mt.current||(It.current+=1,mt.current||Xe(null),Tn({mode:ce==="tmux"&&!ne?"shell":ce,cwd:l?c.get(l)?.cwd??void 0:void 0,command:Nr?.command}),At(!0))},qr=v.useCallback($=>!F&&$===l?"sidebar-session-selected text-foreground":"text-muted-foreground hover:bg-surface-2",[l,F]),qn=Df(),[en,Ht]=v.useState(null);v.useEffect(()=>{e||Ht(null)},[e]);const Fn=v.useCallback(($,_e,Pe,We,qe)=>{const ft=!F&&$.id===l,Ct=Ur.has($.id),Qt=!!(Pe&&Ct),st=c.get($.id),vt=Qe.get($.id)??g8({...$,activeProgram:st?.activeProgram,cwd:st?.cwd,shellTitle:st?.shellTitle??x8($.id),promptState:st?.promptState,agent:st?.agent}).displayName,sr=Y1(st);return s.jsxs(wD,{open:en===$.id,onOpenChange:yt=>Ht(P=>yt?$.id:P===$.id?null:P),onClose:yt=>m($.id,yt,{skipConfirmation:!0}),closeLabel:ae("common.close"),closeTitle:ae("sidebar.closeSession",{name:vt}),compact:Pe,children:[s.jsxs("button",{ref:ft?Gt:null,"aria-current":ft?"page":void 0,type:"button",..._e??{},onContextMenu:yt=>{Q&&(yt.preventDefault(),yt.stopPropagation(),W0(),Ht(null),Q($.id,{x:yt.clientX,y:yt.clientY}))},onKeyDown:yt=>{if(!Q||!(yt.key==="ContextMenu"||yt.shiftKey&&yt.key==="F10"))return;yt.preventDefault(),yt.stopPropagation(),W0();const P=yt.currentTarget.getBoundingClientRect();Q($.id,{x:P.left,y:P.bottom})},onClick:()=>{At(!1),Ds.getState().terminal(),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:$.id})),Et()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${_e?"cursor-grab active:cursor-grabbing ":""}${Pe?"min-h-7 gap-1.5 py-0.5 pl-2 pr-0.5":"min-h-[30px] gap-1.5 py-1 pl-2 pr-1"}`,title:st?.cwd??$.name,children:[ft&&s.jsx("span",{"aria-hidden":"true",className:"absolute inset-y-1.5 left-0 w-[3px] rounded-full bg-primary"}),s.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${Pe?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${ft?$.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":$.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[st?.isConnecting||sr?s.jsx(Ti,{size:Pe?10:11,className:"animate-spin"}):st?.agent??Ig($.id)?s.jsx(Zc,{agent:st?.agent??Ig($.id),size:Pe?13:15}):$.mode==="tmux"?s.jsx(bc,{size:Pe?10:11}):s.jsx(Go,{size:Pe?10:11}),s.jsx(_D,{progress:st?.tuiProgress,status:st?.agentStatus??null,detail:st?.agentStatusDetail,needsReview:st?.agentNeedsReview,inCopyMode:st?.inCopyMode})]}),s.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${Pe?"text-[11px]":"text-[12px]"} ${ft?"font-medium text-foreground":""} ${st?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:vt}),s.jsx(a5,{sessionIds:[$.id]})]}),s.jsx(YM,{status:X.items[$.id],onChanged:()=>{X.refresh()}}),We,s.jsx("button",{type:"button",onClick:yt=>{yt.stopPropagation(),Qt?y($.id):Ct?b($.id):x($.id)},className:`sidebar-session-action inline-flex shrink-0 items-center justify-center rounded-md transition hover:bg-primary/15 hover:text-primary active:scale-95 ${Pe?"h-6 w-6":"h-[26px] w-[26px]"} text-muted-foreground`,"aria-label":`${ae(Qt?"tab.splitRemovePane":Ct?"tab.splitClose":"tab.split")} ${vt}`,title:ae(Qt?"tab.splitRemovePane":Ct?"tab.splitClose":"tab.split"),children:Qt?s.jsx(H9,{size:11}):s.jsx(Uc,{size:12})}),qe??s.jsx("button",{type:"button",onClick:yt=>{yt.stopPropagation(),m($.id,yt)},className:`sidebar-session-action inline-flex shrink-0 items-center justify-center rounded-md text-muted-foreground/70 transition hover:bg-destructive/15 hover:text-destructive active:scale-95 ${Pe?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":ae("sidebar.closeSession",{name:vt}),title:ae("common.close"),children:s.jsx(zn,{size:Pe?11:12})})]})},[l,F,Ur,c,Qe,m,x,b,y,Q,ae,en,X.items,X.refresh]),jr=v.useMemo(()=>qh(a,$=>c.get($.id)?.cwd??null,Ft,ae("sidebar.ungrouped"),w,kt).groups,[kt,Ft,a,c,w,ae]),mr=v.useMemo(()=>$u(a,w,Pr,kt),[kt,a,Pr,w]),Dr=v.useCallback($=>{hs($.draggableId.startsWith("collaboration:")||$.draggableId.startsWith("workspace:"));const _e=$.draggableId.replace(/^split-member:/,"");Hn.current=$.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const Pe=$.type==="split-member"?w.find(Qt=>Qt.sessionIds.includes(_e)):null,We=$.type==="collaboration-member"?$.source.droppableId.replace(/^collaboration-members:/,""):null,qe=We?kt.find(Qt=>Qt.id===We):null;ar.current=!!(Pe||qe||$.type==="session"&&$.draggableId.startsWith("session:")),ar.current&&document.querySelectorAll("[data-collaboration-group]").forEach(Qt=>{Qt.dataset.sidebarDragging="true"}),br.current=qe?.id??null;const ft=Pe?.sessionIds??qe?.sessionIds??[],Ct=ft.length>0?jr.find(Qt=>ft.every(st=>Qt.sessions.some(vt=>vt.id===st))):null;On.current=Ft?Ct?`group-sessions:${Ct.key}`:null:ft.length>0?"sidebar-entities":null,En.current=null},[kt,jr,Ft,w]),wn=v.useCallback(($,_e,Pe)=>{if(_e===Pe)return;const We=_e?Ue.find(st=>st.id===_e):null,qe=Pe?Ue.find(st=>st.id===Pe):null;if(Pe&&!qe)return;if(qe){const st=a.map(sr=>sr.id).filter(sr=>sr!==$);let vt=-1;st.forEach((sr,yt)=>{qe.sessionIds.includes(sr)&&(vt=yt)}),vt>=0&&(st.splice(vt+1,0,$),N(st))}const ft=We?.sessionIds.filter(st=>st!==$)??[],Ct=qe?[...qe.sessionIds.filter(st=>st!==$),$]:[];Tr(st=>st.flatMap(vt=>vt.id===_e?[{...vt,sessionIds:ft}]:vt.id===Pe?[{...vt,sessionIds:Ct}]:[vt])),lr(null),(We&&qe?b8({sourceGroupId:We.id,targetGroupId:qe.id,sessionId:$,expectedSourceUpdatedAt:We.updatedAt,expectedTargetUpdatedAt:qe.updatedAt}):We?ml({id:We.id,name:We.name,sessionIds:ft,expectedUpdatedAt:We.updatedAt}):qe?ml({id:qe.id,name:qe.name,sessionIds:Ct,expectedUpdatedAt:qe.updatedAt}):Promise.resolve()).then(()=>Yt(),st=>(lr(st instanceof Error?st.message:"协作成员移动失败"),Yt()))},[Ue,Yt,a,N]),Ln=v.useCallback(($,_e,Pe,We=!1)=>{const qe=Ue.find(le=>le.id===$);if(!qe||_e===Pe)return;const ft=qe.sessionIds.filter(le=>!le.startsWith("remote:")),Ct=Fu(ft,w).flatMap(le=>le.sessionIds),Qt=r5(zt,qe.id),st=We&&!Fr[qe.id]?Ct.filter(le=>!Qt.has(le)||le===l||Ur.has(le)):Ct.slice(),vt=new Set(st),[sr]=st.splice(_e,1);if(!sr)return;st.splice(Pe,0,sr);let yt=0;const P=Ct.map(le=>vt.has(le)?st[yt++]:le),G=w.find(le=>le.sessionIds.includes(sr));if(G&&G.sessionIds.every(le=>qe.sessionIds.includes(le))){const le=P.filter(ge=>G.sessionIds.includes(ge));S(G.id,le)}P.push(...qe.sessionIds.filter(le=>le.startsWith("remote:"))),Tr(le=>le.map(ge=>ge.id===$?{...ge,sessionIds:P}:ge)),lr(null),ml({id:qe.id,name:qe.name,sessionIds:P,expectedUpdatedAt:qe.updatedAt}).then(()=>Yt(),le=>(lr(le instanceof Error?le.message:"成员排序失败"),Yt()))},[Ue,Yt,w,S,zt,Fr,l,Ur]);v.useEffect(()=>{const $=_e=>{const{sourceId:Pe,targetId:We}=_e.detail;if(!Pe||!We||Pe===We)return;const qe=qh(a,$e=>c.get($e.id)?.cwd??null,Ft,"",w,kt).arranged.map($e=>$e.id),ft=qe.indexOf(Pe),Ct=qe.indexOf(We);if(ft<0||Ct<0)return;const Qt=kt.find($e=>$e.sessionIds.includes(Pe));if(Qt?.sessionIds.includes(We)){const $e=Fu(Qt.sessionIds,w).flatMap(ot=>ot.sessionIds);Ln(Qt.id,$e.indexOf(Pe),$e.indexOf(We));return}const st=w.filter($e=>$e.sessionIds.length>=2&&$e.sessionIds.every(ot=>Pr.has(ot))&&!kt.some(ot=>$e.sessionIds.some(xt=>ot.sessionIds.includes(xt)))),vt=st.find($e=>$e.sessionIds.includes(Pe));if(vt?.sessionIds.includes(We)){const $e=[...vt.sessionIds];$e.splice($e.indexOf(Pe),1),$e.splice(vt.sessionIds.indexOf(We),0,Pe),S(vt.id,$e);return}const sr=$e=>kt.find(ot=>ot.sessionIds.includes($e))?.sessionIds??st.find(ot=>ot.sessionIds.includes($e))?.sessionIds??[$e],yt=new Set(sr(Pe)),P=new Set(sr(We)),G=qe.filter($e=>!yt.has($e)),le=G.flatMap(($e,ot)=>P.has($e)?[ot]:[]),ge=ft<Ct?Math.max(...le)+1:Math.min(...le);G.splice(ge,0,...qe.filter($e=>yt.has($e))),N(G)};return window.addEventListener("reorder-navigation-session",$),()=>window.removeEventListener("reorder-navigation-session",$)},[a,c,Ft,w,kt,Pr,Ln,S,N]);const Vn=v.useCallback($=>{if($.type!=="collaboration-member")return!1;if($.reason==="CANCEL")return!0;const _e=$.source.droppableId.replace(/^collaboration-members:/,""),Pe=$.draggableId.replace(/^collaboration-member:/,""),We=En.current;if(We?.kind==="split")return wn(Pe,_e,We.groupId),I(We.sessionId,Pe),!0;if(We?.kind==="collaboration"&&We.groupId!==_e)return wn(Pe,_e,We.groupId),!0;if(We?.kind==="collaboration"&&We.background)return Ur.has(Pe)&&y(Pe),!0;if($.destination&&$.destination.droppableId!==$.source.droppableId){const qe=$.destination.droppableId.replace(/^collaboration-members:/,"");if(kt.some(ft=>ft.id===qe))return wn(Pe,_e,qe),!0}if($.combine){const qe=$.combine.droppableId.replace(/^collaboration-members:/,"");qe!==_e&&wn(Pe,_e,qe);const ft=$.combine.draggableId.replace(/^collaboration-member:/,"");if(w.find(Qt=>Qt.sessionIds.includes(Pe))?.sessionIds.includes(ft)){const Qt=kt.find(vt=>vt.id===_e),st=Qt?Fu(Qt.sessionIds,w).flatMap(vt=>vt.sessionIds).indexOf(ft):-1;st>=0&&Qt&&Ln(_e,Fu(Qt.sessionIds,w).flatMap(vt=>vt.sessionIds).indexOf(Pe),st)}else Pr.has(ft)&&I(ft,Pe);return!0}if($.destination?.droppableId===$.source.droppableId)return Ln(_e,$.source.index,$.destination.index,!0),!0;if(We?.kind!=="list")return!0;if(We?.kind==="list"){const qe=jr.find(Ct=>`group-sessions:${Ct.key}`===We.listId),ft=We.listId==="sidebar-entities"?mr:qe?$u(qe.sessions,w,Pr,kt):null;if(ft){const Ct=R5(ft,Pe,We.index);We.listId==="sidebar-entities"?N(Ct):qe&&N(jr.flatMap(Qt=>Qt.key===qe.key?Ct:Qt.sessions.map(st=>st.id)))}}return wn(Pe,_e,null),!0},[kt,mr,jr,wn,N,Ln,Pr,w,Ur,y,I]),Zn=v.useCallback($=>{if($.type!=="split-member")return!1;if($.reason==="CANCEL")return!0;const _e=$.draggableId.replace(/^split-member:/,""),Pe=w.find(st=>st.sessionIds.includes(_e));if(!Pe?.sessionIds.includes(_e))return!0;const We=Pe.id,qe=En.current;if(qe?.kind==="split")return wn(_e,null,qe.groupId),I(qe.sessionId,_e),!0;if(qe?.kind==="collaboration")return wn(_e,null,qe.groupId),!0;if(!$.destination&&qe?.kind==="list"){const st=jr.find(yt=>`group-sessions:${yt.key}`===qe.listId),vt=qe.listId==="sidebar-entities"?mr:st?$u(st.sessions,w,Pr,kt):null;if(!vt)return!0;const sr=R5(vt,_e,qe.index);return y(_e),qe.listId==="sidebar-entities"?N(sr):st&&N(jr.flatMap(yt=>yt.key===st.key?sr:yt.sessions.map(P=>P.id))),!0}if(!$.destination)return!0;const ft=$.destination.droppableId.replace(/^split-members:/,"");if(ft!==We){const vt=w.find(sr=>sr.id===ft)?.sessionIds[0];return vt&&I(vt,_e),!0}if($.source.index===$.destination.index)return!0;const Ct=[...Pe.sessionIds],[Qt]=Ct.splice($.source.index,1);return Qt&&(Ct.splice($.destination.index,0,Qt),S(We,Ct)),!0},[kt,mr,jr,wn,I,y,N,S,Pr,w]),cs=($,_e="top")=>s.jsx("div",{"data-split-exit-drop-index":$,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${_e==="top"?"-top-1":"-bottom-1"}`,children:s.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-1 top-1/2 h-px -translate-y-1/2 rounded-full bg-transparent transition-colors group-data-[active=true]/split-exit:bg-primary"})}),ts=v.useCallback(($,_e,Pe)=>{if(Vn($)||Zn($)||$.reason==="CANCEL")return;const We=_e.find(st=>st.id===$.draggableId);if(!We)return;const qe=En.current;if(qe?.kind==="split"&&We.kind==="session"){wn(We.session.id,null,qe.groupId),I(qe.sessionId,We.session.id);return}if(qe?.kind==="collaboration"&&We.kind==="session"){wn(We.session.id,null,qe.groupId);return}if($.combine&&We.kind!=="session"){const st=_e.findIndex(vt=>vt.id===$.combine?.draggableId);if(st<0)return;$={...$,combine:null,destination:{...$.source,index:st}}}if($.combine){const st=_e.find(G=>G.id===$.combine?.draggableId);if(!st)return;const vt=st.kind==="workspace"?st:We.kind==="workspace"?We:st,sr=vt===We?st:We,yt=vt.sessionIds[0],P=sr.sessionIds[0];yt&&P&&yt!==P&&I(yt,P);return}if(!$.destination||$.source.index===$.destination.index)return;const ft=[..._e],[Ct]=ft.splice($.source.index,1);if(!Ct)return;ft.splice($.destination.index,0,Ct);const Qt=ft.flatMap(st=>st.sessionIds);if(Pe===void 0){N(Qt);return}N(jr.flatMap(st=>st.key===Pe?Qt:st.sessions.map(vt=>vt.id)))},[jr,Vn,Zn,wn,I,N]),Cn=v.useCallback($=>{if($.reason==="CANCEL"||Vn($)||Zn($))return;if($.type==="group"){if(!$.destination||$.source.index===$.destination.index)return;N(kb(jr,$.source.index,$.destination.index));return}const _e=$.source.droppableId.replace(/^group-sessions:/,""),Pe=jr.find(qe=>qe.key===_e);if(!Pe)return;const We=$u(Pe.sessions,w,Pr,kt);if($.combine||En.current?.kind==="collaboration"||En.current?.kind==="split"){ts($,We,_e);return}!$.destination||$.destination.droppableId!==$.source.droppableId||ts($,We,_e)},[kt,jr,Pr,w,Vn,ts,Zn,N]),ki=($,_e)=>{const Pe=je===$.id,We=[{layout:"horizontal",label:ae("tab.splitHorizontal"),icon:Uc},{layout:"vertical",label:ae("tab.splitVertical"),icon:Qg},...$.sessionIds.length>=3||$.layout==="grid"?[{layout:"grid",label:ae("tab.splitGrid"),icon:Dg}]:[]],qe=$.layout==="vertical"?Qg:$.layout==="grid"?Dg:Uc,ft=We.find(Ct=>Ct.layout===$.layout)?.label??ae("tab.splitHorizontal");return s.jsxs("div",{ref:Pe?_r:void 0,className:"relative shrink-0",onPointerDown:Ct=>Ct.stopPropagation(),children:[s.jsx("button",{..._e??{},type:"button",className:`sidebar-session-action inline-flex h-6 w-6 items-center justify-center rounded-md transition active:scale-95 ${Pe?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${ae("tab.splitLayout")}: ${ft}`,"aria-haspopup":"menu","aria-expanded":Pe,title:_e?`${ae("tab.splitLayout")} · 按住拖动分屏组`:ae("tab.splitLayout"),onClick:Ct=>{Ct.stopPropagation(),ve(Qt=>Qt===$.id?null:$.id)},children:s.jsx(qe,{size:12})}),Pe&&s.jsx("div",{role:"menu","aria-label":ae("tab.splitLayout"),className:"absolute right-0 top-full z-30 mt-1 flex gap-0.5 rounded-md border border-border bg-surface-elevated p-1 shadow-lg",children:We.map(Ct=>{const Qt=Ct.icon,st=Ct.layout===$.layout;return s.jsx("button",{type:"button",role:"menuitemradio","aria-checked":st,"aria-label":Ct.label,title:Ct.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${st?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:vt=>{vt.stopPropagation(),C($.sessionIds[0],Ct.layout),ve(null)},children:s.jsx(Qt,{size:13})},Ct.layout)})})]})},Cs=($,_e,Pe=!1,We=!1,qe)=>{if(_e.length<2)return null;const ft=$.name?.trim()||`${ae("tab.splitWorkspace")} ${w.findIndex(Qt=>Qt.id===$.id)+1}`,Ct=je===$.id;return s.jsx("section",{"data-split-workspace":$.id,"aria-label":ft,className:`group/split relative rounded-md my-1 p-0.5 before:opacity-40 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors ${We?"bg-primary/15 ring-1 ring-primary/40":Pe?"bg-surface-elevated opacity-90 shadow-lg":"bg-[var(--chrome-bg)]"}`,children:s.jsx(Ml,{droppableId:`split-members:${$.id}`,type:"split-member",direction:"vertical",children:(Qt,st)=>s.jsxs("div",{ref:Qt.innerRef,...Qt.droppableProps,"data-split-members":!0,className:st.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[_e.map((vt,sr)=>s.jsx(Rl,{draggableId:`split-member:${vt.id}`,index:sr,disableInteractiveElementBlocking:!0,children:(yt,P)=>s.jsx("div",{ref:yt.innerRef,...yt.draggableProps,...Q?qn(()=>Q(vt.id)):{},className:`sidebar-session-row ${sr===0&&Ct?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${P.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${qr(vt.id)}`,children:Fn(vt,yt.dragHandleProps,!0,sr===0?ki($,qe):void 0)})},vt.id)),Qt.placeholder]})})})},_n=($,_e)=>{const Pe=l??_e;Zt.current||!Pe||(At(!1),Zt.current=!0,Lr($),lr(null),E_($,Pe).catch(We=>lr(We instanceof Error?We.message:"消息面板打开失败,请重试")).finally(()=>{Zt.current=!1,Lr(null)}))},Nn=($,_e)=>{Er.current+=1,Tr(Pe=>_e?Pe.map(We=>We.id===$?_e:We):Pe.filter(We=>We.id!==$)),_e||(Ds.getState().groupId===$&&Ds.getState().terminal(),Hs.getState().setDock($,null),it(Pe=>{const We={...Pe};return delete We[$],We}),requestAnimationFrame(()=>Gt.current?.focus({preventScroll:!0})),Qa({floatingGroupId:null},$).catch(()=>lr("协作组已删除,面板布局保存失败,请刷新后检查。"))),Yt()},Kr=($,_e,Pe,We=!1,qe=!1)=>{const ft=`collaboration:${$.id}`,Ct=hn.has(ft),Qt=`collaboration-members-${$.id}`,st=r5(zt,$.id),vt=$.sessionIds.filter(ge=>st.has(ge)&&ge!==l&&!Ur.has(ge)),sr=Fr[$.id]===!0,yt=sr?$.sessionIds:$.sessionIds.filter(ge=>!vt.includes(ge)),P=Fu(yt,w),G=P.flatMap(ge=>ge.sessionIds),le=P.length===1?P[0]?.workspace:void 0;return s.jsxs("section",{"data-collaboration-group":$.id,"data-collaboration-group-name":$.name,"aria-label":`Agent 工作组:${$.name}`,className:`group/collaboration relative my-1 rounded-lg p-1 before:pointer-events-none before:absolute before:inset-0 before:rounded-lg before:border before:border-border/60 transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${qe?"bg-primary/15 ring-1 ring-primary/40":We?"bg-surface-elevated opacity-90 shadow-lg":"bg-[var(--chrome-bg)]"}`,children:[s.jsx("div",{className:"rounded-md bg-surface",children:s.jsxs(TD,{group:Ue.find(ge=>ge.id===$.id)??$,collapsed:Ct,onOpen:()=>{ct($.id)},onMessages:Lt===null&&(l||_e.length)?()=>_n($.id,_e[0]?.id):void 0,onToggleCollapsed:()=>qt(ft),onChanged:ge=>Nn($.id,ge),children:[s.jsx("button",{type:"button","aria-label":`${Ct?"展开":"收起"} ${$.name} 的成员会话`,"aria-expanded":!Ct,"aria-controls":Qt,title:`${Ct?"展开":"收起"}成员会话`,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-surface-elevated hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary md:h-[30px] md:w-5",onClick:ge=>{ge.stopPropagation(),qt(ft)},children:s.jsx(Ci,{size:14,className:Ct?"":"rotate-90"})}),s.jsxs("button",{...Pe??{},type:"button",className:"flex min-h-11 min-w-0 flex-1 cursor-grab items-center gap-1.5 rounded-sm px-1 text-left text-xs font-medium text-foreground transition hover:text-primary active:cursor-grabbing md:min-h-[30px]",title:`打开 ${$.name} 的协作工作区 · 按住标题拖动排序`,"aria-label":`打开协作工作区:${$.name}`,"aria-current":F===$.id?"page":void 0,onClick:ge=>{ge.stopPropagation(),ct($.id)},children:[s.jsx(lp,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:$.name}),Ve.some(ge=>ge.groupId===$.id)&&s.jsxs("span",{className:"shrink-0 text-[10px] font-normal text-primary",children:[Ve.filter(ge=>ge.groupId===$.id).length," 待处理"]})]}),s.jsx("button",{type:"button","aria-label":`成员与消息:${$.name}`,title:"在终端旁打开成员与消息",disabled:Lt!==null||!l&&!_e.length,"aria-busy":Lt===$.id,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-surface-elevated hover:text-primary disabled:opacity-40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary md:h-[30px] md:w-7",onClick:ge=>{ge.stopPropagation(),_n($.id,_e[0]?.id)},children:Lt===$.id?s.jsx(sn,{size:14,className:"animate-spin"}):s.jsx(wc,{size:14})})]})}),s.jsx("div",{id:Qt,className:Ct?void 0:"px-0.5 pt-1",children:!Ct&&s.jsxs(s.Fragment,{children:[vt.length>0&&s.jsxs("button",{type:"button","aria-expanded":sr,className:"flex min-h-11 w-full items-center gap-2 rounded-sm px-2 text-left text-[11px] text-muted-foreground hover:bg-surface-elevated md:min-h-8",title:"展开后可查看或归档执行会话,任务结果保留。",onClick:()=>$r(ge=>({...ge,[$.id]:!sr})),children:[s.jsx(Ci,{size:12,className:sr?"rotate-90":""}),"已完成的执行会话 · ",vt.length]}),s.jsx(Ml,{droppableId:`collaboration-members:${$.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(ge,$e)=>s.jsxs("div",{ref:ge.innerRef,...ge.droppableProps,"data-collaboration-members":!0,className:`${$e.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[P.map(ot=>s.jsx("div",{"data-collaboration-split":ot.workspace?.id,"data-split-anchor":ot.workspace?.sessionIds[0],role:ot.workspace?"region":void 0,"aria-label":ot.workspace?`${ae("tab.splitWorkspace")} · ${ot.sessionIds.length}`:void 0,className:ot.workspace&&!le?`relative my-0.5 rounded-sm before:pointer-events-none before:absolute before:inset-0 before:rounded-sm before:border before:border-border data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${ot.sessionIds.includes(l??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:ot.sessionIds.map(xt=>{const Tt=Pr.get(xt);return Tt?s.jsx(Rl,{draggableId:`collaboration-member:${Tt.id}`,index:G.indexOf(Tt.id),disableInteractiveElementBlocking:!0,children:(Rr,mn)=>s.jsxs("div",{ref:Rr.innerRef,...Rr.draggableProps,"data-collaboration-member":Tt.id,"data-split-member":Ur.has(Tt.id)?"true":void 0,...Q?qn(()=>Q(Tt.id)):{},className:`${ot.workspace&&xt===ot.sessionIds[0]&&je===ot.workspace.id?"z-20 ":""}sidebar-session-row relative flex items-center rounded-sm pr-0.5 transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${mn.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":mn.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${qr(Tt.id)}`,children:[Fn(Tt,Rr.dragHandleProps,!0,ot.workspace&&xt===ot.sessionIds[0]?ki(ot.workspace):void 0,st.has(xt)?s.jsxs("button",{type:"button","aria-label":`归档 ${Tt.name}`,title:"保存 Agent 会话 ID 并停止终端;只回收干净的执行目录,结果和分支保留",disabled:yn!==null,className:"sidebar-session-action inline-flex h-11 min-w-11 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-muted-foreground hover:bg-primary/15 hover:text-primary disabled:opacity-40 md:h-6 md:min-w-6 md:px-1",onClick:St=>{St.stopPropagation(),!Jr.current&&(Jr.current=!0,Ar(xt),lr(null),A8(xt).then(async()=>{Wr(tn=>tn+1),await Yt()}).catch(tn=>lr(tn instanceof Error?tn.message:"归档失败,终端已保留")).finally(()=>{Jr.current=!1,Ar(null)}))},children:[yn===xt?s.jsx(sn,{size:13,className:"animate-spin"}):s.jsx(Hh,{size:13}),s.jsx("span",{className:"text-[10px] md:sr-only",children:"归档"})]}):void 0),!ot.workspace&&Ur.has(Tt.id)&&s.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${w.find(St=>St.sessionIds.includes(Tt.id))?.sessionIds.filter(St=>St!==Tt.id).map(St=>Pr.get(St)?.name??St).join("、")} 分屏`,"aria-label":`查看 ${Tt.name} 的跨组分屏`,onClick:()=>{At(!1),Ds.getState().terminal(),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Tt.id})),Et()},children:s.jsx(Uc,{size:10})})]})},Tt.id):null})},ot.workspace?.id??ot.sessionIds[0])),ge.placeholder]})}),s.jsx(tj,{groupId:$.id,version:Jt,onRestore:async ge=>{At(!1),window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:"tmux",cwd:ge.cwd,preferredFrontendSessionId:ge.sessionId,requireExisting:!0}})),await Yt(),Ds.getState().terminal(),Et()}}),$.remoteSessions?.map(ge=>{const $e=T8(ge),ot=$e==="connected",xt=$e==="unknown"?"连接状态未知":"连接已断开";return s.jsx(CD,{sessionId:ge.sessionId,groupId:$.id,label:ge.name,detail:`${Fl(ge)} · ${ot?"服务已连接":xt}`,onOpen:()=>{ct($.id)},children:s.jsxs("button",{type:"button",title:`${Fl(ge)} · ${ot?"服务已连接":xt}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[11px] text-muted-foreground hover:bg-surface-2",onClick:()=>{At(!1),V6(ge.sessionId).catch(()=>{ct($.id)})},children:[s.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ot?"bg-primary":"bg-muted-foreground"}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:ge.name}),s.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:Fl(ge)}),!ot&&s.jsx("span",{className:"shrink-0 text-[9px]",children:xt})]})},ge.sessionId)})]})}),s.jsx("div",{"data-collaboration-background":!0,className:Ct?"absolute inset-0 pointer-events-none":"h-1.5"})]})},Ss=($,_e,Pe)=>s.jsx(k0,{onBeforeCapture:q,onDragStart:Dr,onDragEnd:We=>rt(qe=>ts(qe,$,Pe),We),children:s.jsx(Ml,{droppableId:_e,direction:"vertical",isCombineEnabled:!Qs,children:We=>s.jsxs("div",{ref:We.innerRef,...We.droppableProps,"data-sidebar-entity-list-id":_e,className:"flex-1 space-y-0.5",children:[$.map((qe,ft)=>s.jsx(Rl,{draggableId:qe.id,index:ft,disableInteractiveElementBlocking:!0,children:(Ct,Qt)=>s.jsxs("div",{ref:Ct.innerRef,...Ct.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":ft,className:"relative",children:[cs(ft),ft===$.length-1&&cs($.length,"bottom"),qe.kind==="workspace"?Cs(qe.workspace,qe.members,Qt.isDragging,!!Qt.combineTargetFor,Ct.dragHandleProps):qe.kind==="collaboration"?Kr(qe.group,qe.members,Ct.dragHandleProps,Qt.isDragging,!!Qt.combineTargetFor):s.jsx("div",{...Q?qn(()=>Q(qe.session.id)):{},className:`sidebar-session-row group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${Qt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":Qt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":qr(qe.session.id)} cursor-grab active:cursor-grabbing`,children:Fn(qe.session,Ct.dragHandleProps)})]})},qe.id)),We.placeholder]})})}),pn=s.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[s.jsx(Rj,{label:ae("sidebar.sessions"),count:a.length,badge:$t>0?s.jsx(K6,{count:$t,tone:"running",title:ae("agent.aiRunning")}):null,pinned:!!Me,onClose:r,onTogglePinned:be?()=>{At(!1),be()}:void 0,serverAttention:Ir,onOpenSettings:()=>{At(!1),W()},actions:[...B?[{label:ae("sidebar.subscriptionQuota"),icon:o9,onSelect:()=>{At(!1),B()}}]:[],{label:"Agent 工作台",icon:lp,onSelect:()=>{At(!1),ct(null)}},{label:"服务与设备",icon:v8,onSelect:()=>{At(!1),y8()}},{label:ae("sidebar.settings"),icon:Sb,onSelect:()=>{At(!1),W()}}]}),s.jsx($3,{onOpen:()=>{At(!1),Ds.getState().openTodos(),Et()}}),s.jsxs("div",{ref:Yr,className:"relative z-10 flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[Ve.length>0&&s.jsxs("section",{className:"mb-2 rounded-lg border border-primary/20 bg-primary/5","aria-label":"协作待处理事项",children:[Ve.length>0&&s.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 px-3 text-left text-xs text-primary","aria-expanded":An,onClick:()=>gt($=>!$),children:[s.jsx(lp,{size:14}),s.jsx("span",{className:"min-w-0 flex-1",children:"需要你处理"}),s.jsx("span",{children:Ve.length}),s.jsx(Ci,{size:12,className:An?"rotate-90":""})]}),(An||Ve.length===0)&&s.jsx("div",{className:"space-y-1 p-1 pt-0",children:Ve.map($=>s.jsxs("button",{type:"button",className:"min-h-11 w-full rounded-md px-2 py-2 text-left hover:bg-surface-2",onClick:()=>{s5($.groupId,$.id),ct($.groupId).then(_e=>{_e&&s5($.groupId,$.id)})},children:[s.jsx("span",{className:"block truncate text-xs text-foreground",children:$.title}),s.jsxs("span",{className:"mt-1 block truncate text-[10px] text-muted-foreground",children:[Ue.find(_e=>_e.id===$.groupId)?.name??"协作组"," · ",Jc($)]})]},$.id))})]}),s.jsx(AD,{sessions:V,loading:Ke,attachingName:J,onRefresh:he,onRestore:Wn,onClose:Be}),ks.length>0&&s.jsxs("section",{className:"mb-1","aria-label":"已归档协作组",children:[s.jsxs("button",{type:"button",className:"flex min-h-10 w-full items-center gap-2 rounded-md px-2 text-left text-[11px] text-muted-foreground hover:bg-surface-2","aria-expanded":fe,onClick:()=>Vr($=>!$),children:[s.jsx(Hh,{size:13}),s.jsx("span",{className:"flex-1",children:"已归档协作组"}),s.jsx("span",{children:ks.length}),s.jsx(Ci,{size:12,className:fe?"rotate-90":""})]}),fe&&s.jsx("div",{className:"space-y-1",children:ks.map($=>s.jsx(k0,{onDragEnd:()=>{},children:Kr($,$.sessionIds.flatMap(_e=>Pr.get(_e)??[]))},$.id))})]}),kt.filter($=>!$.sessionIds.length).map($=>s.jsx(k0,{onDragEnd:()=>{},children:Kr($,[])},$.id)),a.length===0?s.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[s.jsx(Go,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),s.jsx("p",{className:"text-[12px] text-muted-foreground",children:ae("sidebar.noSessions")})]}):or.length===0&&w.length===0?s.jsx("div",{className:"rounded-xl bg-surface-2/60 px-4 py-6 text-center",children:s.jsx("p",{className:"text-[12px] text-muted-foreground",children:ae("sidebar.noMatchingSessions")})}):Ft?s.jsx("div",{className:"flex flex-1 flex-col",children:s.jsx(k0,{onBeforeCapture:q,onDragStart:Dr,onDragEnd:$=>rt(Cn,$),children:s.jsx(Ml,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:$=>s.jsxs("div",{ref:$.innerRef,...$.droppableProps,className:"flex flex-1 flex-col space-y-1.5",children:[jr.map((_e,Pe)=>{const We=hn.has(_e.key),qe=!We&&Pe===jr.length-1,ft=$u(_e.sessions,w,Pr,kt);let Ct=0,Qt=0;for(const vt of _e.sessions){const sr=c.get(vt.id);sr?.agentStatus==="working"&&(Ct+=1),(sr?.agentStatus==="waiting"||sr?.agentNeedsReview)&&(Qt+=1)}const st=_e.key==="";return s.jsx(Rl,{draggableId:`sidebar-group:${_e.key||"__ungrouped__"}`,index:Pe,isDragDisabled:st,disableInteractiveElementBlocking:!0,children:(vt,sr)=>s.jsxs("div",{ref:vt.innerRef,...vt.draggableProps,className:`shrink-0 rounded-md transition-colors ${qe?"flex flex-1 flex-col ":""}${sr.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[s.jsxs("button",{type:"button",...st?{}:vt.dragHandleProps,onClick:()=>{qt(_e.key),Bs.current.delete(_e.key)},className:`flex w-full shrink-0 items-center gap-1.5 rounded-md px-1.5 pb-1 pt-2.5 text-left text-muted-foreground transition hover:bg-surface-2 ${st?"":"cursor-grab active:cursor-grabbing"}`,title:_e.key||_e.label,children:[s.jsx(Ci,{size:13,className:`shrink-0 transition-transform ${We?"":"rotate-90"}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold uppercase tracking-[0.08em]",children:_e.label}),Ct>0&&s.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),Qt>0&&s.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),s.jsx(a5,{sessionIds:_e.sessions.map(yt=>yt.id)}),s.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:_e.sessions.length})]}),!We&&s.jsx("div",{className:`mt-0.5 pl-2 ${qe?"flex flex-1 flex-col":""}`,children:s.jsx(Ml,{droppableId:`group-sessions:${_e.key}`,type:"session",direction:"vertical",isCombineEnabled:!Qs,children:yt=>s.jsxs("div",{ref:yt.innerRef,...yt.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${_e.key}`,className:`${qe?"flex-1 ":""}space-y-0.5`,children:[ft.map((P,G)=>s.jsx(Rl,{draggableId:P.id,index:G,disableInteractiveElementBlocking:!0,children:(le,ge)=>s.jsxs("div",{ref:le.innerRef,...le.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":G,className:"relative",children:[cs(G),G===ft.length-1&&cs(ft.length,"bottom"),P.kind==="workspace"?Cs(P.workspace,P.members,ge.isDragging,!!ge.combineTargetFor,le.dragHandleProps):P.kind==="collaboration"?Kr(P.group,P.members,le.dragHandleProps,ge.isDragging,!!ge.combineTargetFor):s.jsx("div",{...Q?qn(()=>Q(P.session.id)):{},className:`sidebar-session-row group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${ge.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":ge.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":qr(P.session.id)} cursor-grab active:cursor-grabbing`,children:Fn(P.session,le.dragHandleProps)})]})},P.id)),yt.placeholder]})})})]})},_e.key||"__ungrouped__")}),$.placeholder]})})})}):Ss(mr,"sidebar-entities")]}),s.jsx(w8,{onReselect:()=>{h&&(Br.current=null,He($=>$+1),h())}}),Fe&&s.jsx(Ej,{directories:a.flatMap($=>{const _e=c.get($.id)?.cwd;return _e?[_e]:[]}),tmuxAvailable:ne,options:wt,launchPending:ye,launchError:nt&&nt!=="connection"?ae(km(nt)):null,agents:cn,selectedAgent:Nr,detecting:Ie,resumeHistory:Pt,resumeHistoryLoading:pr,resumeHistoryPendingId:Ge,resumeHistoryError:Mt,onRefreshAgents:()=>{ht().catch(()=>{})},onSelectAgent:$=>{Je($).catch(()=>{})},onLaunchAgent:wa,onResumeHistory:$=>{di($)},onRemoveResumeHistory:$=>{Gn($)},onClose:()=>At(!1),onOptionsChange:Tn,additionalContent:Gr&&U?.latestVersion&&s.jsxs("div",{className:"mb-1 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-2.5 py-2.5 text-foreground",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]",children:s.jsx(sn,{size:13,className:U.status==="checking"||U.status==="installing"||U.status==="restarting"?"animate-spin":""})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-semibold",children:ae("sidebar.updateAvailable",{version:U.latestVersion})}),s.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:U.status==="checking"?ae("settings.updateChecking"):U.status==="installing"?ae("sidebar.updateInstalling"):U.status==="ready"?ae("sidebar.updateReady"):U.status==="restarting"?ae("sidebar.updateRestarting"):U.error||ae("sidebar.updateFailed")})]})]}),U.status==="ready"&&re&&s.jsx("button",{type:"button",disabled:K,onClick:re,className:"mt-2 flex w-full items-center justify-center rounded-md bg-[var(--warning)] px-2 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:ae("sidebar.updateRestart")}),U.status==="error"&&H&&s.jsx("button",{type:"button",disabled:K,onClick:H,className:"mt-2 flex w-full items-center justify-center rounded-md bg-surface-elevated px-2 py-1.5 text-[11px] font-semibold text-foreground transition hover:bg-surface-2 disabled:cursor-wait disabled:opacity-60",children:ae("sidebar.updateRetry")})]})}),Nt&&s.jsx(C5,{onEnterGroup:async $=>{if(!await ct($))throw new Error("协作组已保存,打开工作区失败,请重试");oe(!1)},onFloatingChange:async $=>{if($){if(!await ct($))throw new Error("打开协作工作区失败");oe(!1)}},activeSessionId:l,defaultSessionMode:ce,onClose:()=>oe(!1),onNewSession:$=>p($)}),Object.entries(tt).map(([$,_e])=>s.jsx(C5,{activeSessionId:l,initialCollaborationGroupId:$,initialFloating:_e,visible:!F,onEnterGroup:async Pe=>{if(Pe===$){await ct(Pe);return}if(!await ct(Pe))throw new Error("协作组已保存,打开工作区失败,请重试");await Qa({floatingGroupId:null},$),it(We=>{const qe={...We};return delete qe[$],qe})},onFloatingChange:Pe=>Qr($,Pe),defaultSessionMode:ce,onClose:()=>{Xt.current=!0,it(Pe=>{const We={...Pe};return delete We[$],We})},onNewSession:Pe=>p(Pe)},$)),!Fe&&s.jsx("div",{className:"relative z-10 shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-1 md:border-t md:border-border md:p-2",children:s.jsxs("div",{className:`grid gap-1.5 [&>button]:min-h-11 [&>button]:shadow-none [&>button]:ring-0 md:[&>button]:min-h-0 ${Nr?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[s.jsxs("button",{type:"button",onClick:_i,disabled:ye,"aria-busy":ye,className:`flex min-w-0 items-center justify-center gap-2 rounded-lg px-2 py-2.5 text-[12px] font-semibold transition active:scale-[0.99] ${Nr?"bg-surface-elevated text-foreground ring-1 ring-border/30 hover:bg-surface-2":"bg-primary text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90"}`,title:ae("sidebar.newSession"),"aria-label":ae("sidebar.newSession"),children:[s.jsx(Go,{size:15,className:"shrink-0"}),s.jsx("span",{className:"truncate",children:ye?ae("sidebar.sessionCreating"):"Terminal"})]}),Nr&&s.jsxs("button",{type:"button",onClick:Ps,disabled:ye,"aria-busy":ye,className:"flex min-w-0 items-center justify-center gap-2 rounded-lg bg-primary px-2 py-2.5 text-[12px] font-semibold text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 transition hover:bg-primary/90 active:scale-[0.99]",title:ae("sidebar.newSessionWithAgent",{agent:Nr.displayName}),"aria-label":ae("sidebar.newSessionWithAgent",{agent:Nr.displayName}),children:[s.jsx(Zc,{agent:Nr,size:15}),s.jsx("span",{className:"truncate",children:Nr.displayName})]}),s.jsxs("button",{type:"button",onClick:ls,disabled:ye,className:"relative inline-flex w-10 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-[0.97]",title:es,"aria-label":es,"aria-expanded":Fe,"aria-controls":"sidebar-launch-options",children:[s.jsx(Ac,{size:15}),Gr&&s.jsx("span",{className:"absolute right-0.5 top-0.5 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"})]})]})})]});return Me?s.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:pn}):s.jsx(Ab,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,push:Ne,children:pn})}const av=()=>Pl(()=>import("./RightSidebar-BvYh2_n2.js").then(e=>e.R),__vite__mapDeps([21,1,2,3,4,5,9,10,8,11,12,13,14,22,18,19,23,24,25,26,27,28,29,30,31,32,33,34,35,16,36])).then(e=>({default:e.RightSidebar})),kD=v.lazy(av);function j5(e){const t=v.useRef(!1);v.useEffect(()=>{const p=navigator.connection;if(!(p?.saveData||/2g|3g/.test(p?.effectiveType??"")))return M1(()=>{av().catch(()=>{})},3e3)},[]);const{t:r}=Xr(),n=Sr(p=>p.rootPath),a=Sr(p=>p.rightTab),l=Sr(p=>p.setRightTab),c=n?.replace(/\/+$/,"").split("/").pop()||r("rightSidebar.workspace");(e.isOpen||e.pinned)&&(t.current=!0);const h=s.jsx(Ab,{side:"right",isOpen:e.isOpen,drawerWidthPx:e.drawerWidthPx,onClose:e.onClose,onOpen:e.onOpen,pinned:e.pinned,children:s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("div",{className:"shrink-0 border-b border-border/15 bg-surface px-2 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"min-w-0 flex-1 px-1",children:s.jsx("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:s.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",children:c})})}),s.jsx("div",{"aria-hidden":"true",className:"flex items-center gap-1.5",children:[$l,$w,Ac].map((p,m)=>s.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-surface-2 text-muted-foreground",children:s.jsx(p,{size:14})},m))}),s.jsx("button",{type:"button",onClick:e.onClose,"aria-label":r("common.close"),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:s.jsx(zn,{size:14})})]}),s.jsx("div",{className:"mt-2 grid grid-cols-5 gap-0.5 rounded-md bg-surface-2 p-0.5",children:[["git",qw,"rightSidebar.tabGit"],["diff",Zw,"rightSidebar.tabChanges"],["files",od,"rightSidebar.tabFiles"],["architecture",Uw,"architecture.tab"],["computer",S8,"rightSidebar.tabComputer"]].map(([p,m,x])=>s.jsxs("button",{type:"button",onClick:()=>l(p),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium ${a===p?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:[s.jsx(m,{size:12}),r(x)]},p))}),s.jsx("div",{className:"h-2"})]}),s.jsx("div",{className:"min-h-0 flex-1 bg-surface",children:a==="architecture"?s.jsx("div",{role:"status",className:"p-3 text-xs text-muted-foreground",children:r("architecture.loading")}):a==="computer"?s.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:r("computer.loading")}):a==="git"?s.jsx(zw,{}):s.jsx(Hw,{})})]})});return t.current?s.jsx(v.Suspense,{fallback:h,children:s.jsx(kD,{...e})}):h}function ID(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function ED(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function ND(e){if(!e)return"";const t=new Date(e),r=Date.now(),n=t.getTime()-r;if(n<=0)return"";const a=Math.floor(n/6e4),l=Math.floor(a/60),c=Math.floor(l/24),h=l%24,p=a%60,m=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),x=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let b;return c>0?b=`${c}d ${h}h`:h>0?b=`${h}h ${p}m`:p>0?b=`${p}m`:b="soon",`resets in ${b} (${m} ${x})`}function RD(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function MD({result:e}){const{t}=Xr(),r=e.windows.filter(h=>h.percent===0&&!h.resetAt),n=e.windows.filter(h=>h.percent>0||h.resetAt),a=r.length>0?r.map(h=>h.label).join(" · "):"",l=!!e.error;let c=null;return!l&&e.entitlement&&(e.usagePercent>=90?c=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?c=t("quota.left",{n:e.remaining}):c=`${Math.round(e.usagePercent)}%`),s.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[s.jsx("span",{className:"shrink-0",children:RD(e.slug)}),s.jsx("span",{className:"truncate",children:e.displayName}),a&&s.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:a})]}),c&&s.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:c})]}),n.length>0?s.jsx("div",{className:"mt-2.5 space-y-2",children:n.map(h=>{const p=Math.max(0,Math.min(100,h.percent));return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[s.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:h.label}),s.jsx("div",{className:"flex-1",children:s.jsx("div",{className:"h-2 rounded-full",style:{background:ED(h.percent)},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:ID(h.percent)}})})}),s.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(h.percent),"%"]})]}),h.resetAt&&s.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:ND(h.resetAt)})]},h.label)})}):l?s.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function jD({isOpen:e,onClose:t}){const{t:r}=Xr(),[n,a]=v.useState([]),[l,c]=v.useState(!1),h=async(x=!1)=>{c(!0);try{const b=x?await L8():await _8();a(b.providers||[])}catch{}finally{c(!1)}};if(v.useEffect(()=>{e&&h()},[e]),v.useEffect(()=>{if(!e)return;const x=b=>{const y=b.detail;Array.isArray(y)&&a(y)};return window.addEventListener("termdock:quota-update",x),()=>{window.removeEventListener("termdock:quota-update",x)}},[e]),!e)return null;const p=n.filter(x=>!x.error),m=p.length>0?new Date(Math.max(...p.map(x=>x.fetchedAt||0))):null;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),s.jsxs("div",{className:"fixed inset-x-3 z-modal-panel mx-auto flex max-w-lg flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",style:{top:"max(1.5rem, env(safe-area-inset-top, 0px))",bottom:"max(1.5rem, env(safe-area-inset-bottom, 0px))"},children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-3 py-2.5 sm:px-6 sm:py-3",children:[s.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>h(!0),disabled:l,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":r("quota.refresh"),children:s.jsx(sn,{size:15,className:l?"animate-spin":""})}),s.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":r("quota.close"),children:s.jsx(zn,{size:17})})]})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[l&&p.length===0?s.jsx(i1,{label:r("common.loading"),className:"py-12"}):p.length===0?s.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[s.jsx("p",{children:r("quota.noProviders")}),s.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):s.jsx("div",{className:"space-y-2.5",children:p.map(x=>s.jsx(MD,{result:x},x.slug))}),m&&s.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:m.toLocaleTimeString()})})]})]})]})}const D5=[{label:"Esc",sequence:"\\u001b"},{label:"Tab",sequence:"\\t"},{label:"Enter",sequence:"\\r"},{label:"S-Tab",sequence:"\\u001b[Z"},{label:"C-c",sequence:"\\u0003"},{label:"C-d",sequence:"\\u0004"},{label:"C-l",sequence:"\\u000c"},{label:"C-r",sequence:"\\u0012"},{label:"C-z",sequence:"\\u001a"},{label:"C-w",sequence:"\\u0017"},{label:"Up",sequence:"\\u001b[A"},{label:"Down",sequence:"\\u001b[B"},{label:"Left",sequence:"\\u001b[D"},{label:"Right",sequence:"\\u001b[C"},{label:"PgUp",sequence:"\\u001b[5~"},{label:"PgDn",sequence:"\\u001b[6~"}],DD=2,QD=20;function BD({label:e}){return s.jsx("div",{className:"h-7 rounded-full bg-surface-2 px-3 text-[11px] leading-7 text-center text-muted-foreground truncate",children:e})}function PD({value:e,onChange:t,placeholder:r}){const{t:n}=Xr(),[a,l]=L.useState(""),c=b=>{const y=[];let w="",C=!1;const S=()=>{const N=w.trim();N&&y.push(N),w=""};for(let N=0;N<b.length;N+=1){const Q=b[N];if(!C&&Q==="/"&&w.trim().length===0){C=!0,w+=Q;continue}if(C){if(w+=Q,Q==="/"&&b[N-1]!=="\\"&&w.length>1){for(;N+1<b.length&&/[gimsuy]/.test(b[N+1]??"");)N+=1,w+=b[N];S(),C=!1}continue}if(Q===","||/\s/.test(Q)){S();continue}w+=Q}if(S(),y.length===0)return;const I=[...e];for(const N of y){const Q=D6(N);Q&&(I.includes(Q)||I.push(Q))}t(I),l("")},h=b=>{t(e.filter(y=>y!==b))},p=a.trim(),m=p.length>0&&Ox(p),x=m&&!uf(p);return s.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(b=>{const y=Ox(b),w=y&&!uf(b);return s.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${w?"bg-destructive/15 text-destructive":y?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:y?w?n("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[y&&s.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),b,s.jsx("button",{type:"button",onClick:()=>h(b),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":n("toolbarPresets.removeAction",{name:b}),children:s.jsx(zn,{size:12})})]},b)}),s.jsx("input",{type:"text",value:a,onChange:b=>l(b.target.value),onKeyDown:b=>{b.key==="Enter"||b.key===","&&!m?(b.preventDefault(),c(a)):b.key==="Backspace"&&a.length===0&&e.length>0&&h(e[e.length-1])},onBlur:()=>c(a),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${m?"font-mono":""} ${x?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function OD({value:e,min:t,max:r,onChange:n}){const{t:a}=Xr();return s.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[s.jsx("button",{type:"button",onClick:()=>n(Math.max(t,e-1)),disabled:e<=t,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":a("common.decrease"),children:s.jsx(jw,{size:14})}),s.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),s.jsx("button",{type:"button",onClick:()=>n(Math.min(r,e+1)),disabled:e>=r,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":a("common.increase"),children:s.jsx(ui,{size:14})})]})}const FD=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:n,onAddPreset:a,onRemovePreset:l,onResetDefaults:c})=>{const{t:h}=Xr(),p=e.find(N=>N.id===t)??e[0]??null,[m,x]=L.useState(null);if(!p)return null;const b=p.actions.length>0,y=[{id:"preview-auto",label:p.label,kind:"preset"},...p.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...b?p.actions.map((N,Q)=>({id:N.id,label:Wm(N,Q)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(N=>({id:N,label:N}))],w=Q6(y,p.rowLayout),C=(N,Q)=>{n(p.id,W=>{const B=W.actions.findIndex(re=>re.id===N);if(B===-1)return W;const U=B+Q;if(U<0||U>=W.actions.length)return W;const K=[...W.actions];return[K[B],K[U]]=[K[U],K[B]],{...W,actions:K}})},S=p.rowLayout.reduce((N,Q)=>N+Q,0),I=1+(p.includeAlt?1:0);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"sticky top-[-1rem] sm:top-[-1.5rem] z-10 -mx-4 -mt-4 sm:-mx-6 sm:-mt-6 border-b border-border/15 bg-surface/95 backdrop-blur px-4 py-3 sm:px-6",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.preview")}),s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[p.actions.length," button",p.actions.length===1?"":"s"," · ",S," slot",S===1?"":"s"]})]}),s.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:w.map((N,Q)=>{const W=N.items[0]?.kind==="preset",B=Math.max(2,N.columns),U=W?`${B6}px repeat(${Math.max(1,B-1)}, minmax(0, 1fr))`:`repeat(${B}, minmax(0, 1fr))`;return s.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:U},children:N.items.map(K=>K.kind==="preset"?s.jsx(P6,{mode:"auto",presetLabel:K.label,title:`Auto preset · ${K.label}`,disabled:!0},K.id):s.jsx(BD,{label:K.label},K.id))},`preview-row-${Q}`)})}),p.actions.length>S-I&&s.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:h("toolbarPresets.overCapacityHint")})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.presets")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[s.jsx(ui,{size:14}),h("toolbarPresets.new")]}),s.jsxs("button",{type:"button",onClick:c,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[s.jsx(sn,{size:14}),h("toolbarPresets.reset")]})]})]}),s.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(N=>s.jsxs("button",{type:"button",onClick:()=>r(N.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${N.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[N.label,N.actions.length>0&&s.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:N.actions.length})]},N.id))})]}),s.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.label")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:p.label,onChange:N=>n(p.id,Q=>({...Q,label:N.target.value})),className:"flex-1 rounded-full bg-surface-2 px-4 py-2.5 text-sm placeholder:text-muted/60 outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),p.id!=="default"&&s.jsx("button",{type:"button",onClick:()=>l(p.id),className:"shrink-0 rounded-full bg-surface-2 px-3 py-2.5 text-destructive hover:bg-destructive/15","aria-label":h("toolbarPresets.deletePreset",{name:p.label}),children:s.jsx(Js,{size:14})})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.matchPrograms")}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.typeEnterHint")})]}),s.jsx(PD,{value:p.programs,onChange:N=>n(p.id,Q=>({...Q,programs:N})),placeholder:h("toolbarPresets.programsPlaceholder")}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.programsHelp")})]}),s.jsxs("button",{type:"button",onClick:()=>n(p.id,N=>({...N,includeAlt:!N.includeAlt})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[s.jsxs("span",{children:[s.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.altSlot")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.altSlotHint")})]}),s.jsx(hl,{checked:p.includeAlt})]}),s.jsxs("button",{type:"button",onClick:()=>n(p.id,N=>({...N,showOnDesktop:!N.showOnDesktop})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[s.jsxs("span",{children:[s.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.desktopVisibility")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.desktopVisibilityHint")})]}),s.jsx(hl,{checked:p.showOnDesktop===!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.rowLayout")}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.rowLayoutHint")})]}),s.jsxs("button",{type:"button",onClick:()=>n(p.id,N=>({...N,rowLayout:[...z1(N.rowLayout),3]})),className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium hover:bg-surface-elevated",children:[s.jsx(ui,{size:12}),h("toolbarPresets.addRow")]})]}),s.jsx("div",{className:"space-y-2",children:p.rowLayout.map((N,Q)=>s.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[s.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:h("toolbarPresets.rowN",{n:Q+1})}),s.jsx("div",{className:"flex-1"}),s.jsx(OD,{value:N,min:DD,max:QD,onChange:W=>n(p.id,B=>({...B,rowLayout:B.rowLayout.map((U,K)=>K===Q?W:U)}))}),p.rowLayout.length>1&&s.jsx("button",{type:"button",onClick:()=>n(p.id,W=>({...W,rowLayout:W.rowLayout.filter((B,U)=>U!==Q)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeRow",{n:Q+1}),children:h("toolbarPresets.del")})]},`row-${Q}`))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.buttons")}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.buttonsHint")})]}),s.jsxs("button",{type:"button",onClick:()=>{const N=`${p.id}-action-${Date.now()}`;n(p.id,Q=>({...Q,actions:[...Q.actions,{id:N,label:`Key ${Q.actions.length+1}`,sequence:""}]})),x(N)},className:"inline-flex items-center gap-1 rounded-full bg-primary/15 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/25",children:[s.jsx(ui,{size:12}),h("toolbarPresets.addButton")]})]}),p.actions.length===0&&s.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:h("toolbarPresets.noCustomButtons")}),p.actions.map((N,Q)=>{const W=m===N.id;return s.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${W?"ring-1 ring-accent/40":""}`,children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("button",{type:"button",onClick:()=>C(N.id,-1),disabled:Q===0,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":h("toolbarPresets.moveUp"),children:s.jsx(Yw,{size:12})}),s.jsx("button",{type:"button",onClick:()=>C(N.id,1),disabled:Q===p.actions.length-1,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":h("toolbarPresets.moveDown"),children:s.jsx(Kw,{size:12})})]}),s.jsxs("button",{type:"button",onClick:()=>x(W?null:N.id),className:"min-w-0 flex-1 text-left",children:[s.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:Wm(N,Q)}),s.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[N.sequence?N.sequence:h("toolbarPresets.noSequence"),N.doubleTapSequence&&s.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",N.doubleTapSequence]})]})]}),s.jsx("button",{type:"button",onClick:()=>n(p.id,B=>({...B,actions:B.actions.filter(U=>U.id!==N.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeAction",{name:N.label}),children:s.jsx(Js,{size:14})})]}),W&&s.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.labelField")}),s.jsx("input",{type:"text",value:N.label,onChange:B=>n(p.id,U=>({...U,actions:U.actions.map(K=>K.id===N.id?{...K,label:B.target.value}:K)})),className:"w-full rounded-full bg-surface px-4 py-2.5 text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.labelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.sequence")}),s.jsx("input",{type:"text",value:N.sequence,onChange:B=>n(p.id,U=>({...U,actions:U.actions.map(K=>K.id===N.id?{...K,sequence:B.target.value}:K)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.sequencePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),s.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:D5.map(B=>s.jsx("button",{type:"button",onClick:()=>n(p.id,U=>({...U,actions:U.actions.map(K=>K.id===N.id?{...K,sequence:B.sequence}:K)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:B.label},B.label))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.doubleTap")}),!N.doubleTapSequence&&s.jsx("button",{type:"button",onClick:()=>n(p.id,B=>({...B,actions:B.actions.map(U=>U.id===N.id?{...U,doubleTapSequence:""}:U)})),className:"text-[10px] text-accent hover:text-accent/80",children:h("toolbarPresets.doubleTapAdd")})]}),N.doubleTapSequence!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:N.doubleTapSequence,onChange:B=>n(p.id,U=>({...U,actions:U.actions.map(K=>K.id===N.id?{...K,doubleTapSequence:B.target.value}:K)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.doubleTapPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[D5.map(B=>s.jsx("button",{type:"button",onClick:()=>n(p.id,U=>({...U,actions:U.actions.map(K=>K.id===N.id?{...K,doubleTapSequence:(K.doubleTapSequence??"")+B.sequence}:K)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:B.label},B.label)),s.jsx("button",{type:"button",onClick:()=>n(p.id,B=>({...B,actions:B.actions.map(U=>{if(U.id!==N.id)return U;const{doubleTapSequence:K,...re}=U;return re})})),className:"rounded-full bg-destructive/10 px-2.5 py-1 text-[11px] font-medium text-destructive/70 hover:bg-destructive/20 hover:text-destructive",children:h("toolbarPresets.remove")})]})]})]})]})]},N.id)})]})]})]})},$D={unverified:"text-[color:var(--warning)]",installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function UD(){const{t:e}=Xr(),[t,r]=L.useState(null),[n,a]=L.useState(null),[l,c]=L.useState(null),[h,p]=L.useState(null),[m,x]=L.useState(!1),[b,y]=L.useState(!1),[w,C]=L.useState(""),[S,I]=L.useState(""),[N,Q]=L.useState(null),[W,B]=L.useState([]),[U,K]=L.useState([]),[re,H]=L.useState(null),[Oe,ne]=L.useState(new Set),[ce,Ne]=L.useState(null),[Me,be]=L.useState("auto"),[V,Ke]=L.useState({}),[he,Be]=L.useState(null),[ae,X]=L.useState(null),[He,je]=L.useState(10),[ve,Fe]=L.useState(""),[lt,ye]=L.useState(""),[de,nt]=L.useState(12e3),[Xe,pt]=L.useState(null),[xe,mt]=L.useState(null),It=L.useCallback(async()=>{const[pe,Ge,at,Mt]=await Promise.allSettled([k8(),I8(),V0(),fu()]);if(r(pe.status==="fulfilled"?pe.value:[]),Ge.status==="fulfilled"){const er=Ge.value;B(er.plugins??[]),K(er.errors??[])}else B([]),K([]);if(at.status==="fulfilled"){const er=at.value;ne(new Set(er.autoRenameAgents??[])),be(er.autoRenameNamer??"auto"),Ke(er.autoRenameModels??{}),je(er.autoRenameIntervalMinutes??10),Fe(er.autoRenamePromptPreference??""),ye(er.autoRenamePromptPreference??""),nt(er.autoRenamePromptPayloadChars??12e3)}else ne(new Set);Be(Mt.status==="fulfilled"?Mt.value:[])},[]);L.useEffect(()=>{It()},[It]);const At=async(pe,Ge)=>{a(pe),c(null);try{Ge==="install"?(await E8(pe)).devMode&&p(pe):(await N8(pe),h===pe&&p(null)),await It()}catch(at){c(at instanceof Error?at.message:String(at))}finally{a(null)}},Nt=pe=>e(pe==="installed"?"settings.agentHooksInstalled":pe==="outdated"?"settings.agentHooksOutdated":pe==="needs-approval"?"settings.agentHooksNeedsApproval":pe==="unverified"?"settings.agentHooksUnverified":"settings.agentHooksNotInstalled"),oe=async()=>{Q(null);let pe;try{pe=JSON.parse(S)}catch{Q("Invalid JSON");return}try{await B8(pe),I(""),x(!1),await It()}catch(Ge){if(Ge instanceof P8&&Ge.migration){K(at=>[{slug:typeof pe.slug=="string"?pe.slug:"manifest.json",errors:Ge.message.split(`
156
+ `),code:Ge.code,migration:Ge.migration},...at.filter(Mt=>Mt.slug!==pe.slug)]);return}Q(Ge instanceof Error?Ge.message:String(Ge))}},F=async()=>{const pe=w.trim();if(pe){pt("install"),Q(null);try{await R8(pe),C(""),y(!1),await It()}catch(Ge){Q(Ge instanceof Error?Ge.message:String(Ge))}finally{pt(null)}}},we=async pe=>{pt(`remove:${pe}`);try{await Q8(pe),mt(Ge=>Ge?.slug===pe?null:Ge),await It()}catch(Ge){c(Ge instanceof Error?Ge.message:String(Ge))}finally{pt(null)}},Qe=async pe=>{pt(`check:${pe}`),c(null);try{await D8(pe),await It()}catch(Ge){c(Ge instanceof Error?Ge.message:String(Ge))}finally{pt(null)}},tt=async pe=>{pt(`update:${pe}`),c(null);try{const Ge=await j8(pe),at=[Ge.hookWarning,Ge.titleWarning].filter(Boolean).join(" ");at&&c(at),mt(Mt=>Mt?.slug===pe?null:Mt),await It()}catch(Ge){c(Ge instanceof Error?Ge.message:String(Ge))}finally{pt(null)}},it=async pe=>{pt(`doctor:${pe}`),c(null),mt(null);try{const Ge=await M8(pe);mt(Ge),Be(await fu())}catch(Ge){c(Ge instanceof Error?Ge.message:String(Ge))}finally{pt(null)}},Rt=async pe=>{const Ge=pe.migration?.aiPrompt??pe.errors.join(`
157
+ `);try{await navigator.clipboard.writeText(Ge),H(pe.slug),window.setTimeout(()=>H(at=>at===pe.slug?null:at),1800)}catch{Q(Ge)}},Xt=async pe=>{if(ce)return;const Ge=Oe,at=new Set(Ge);at.has(pe)?at.delete(pe):at.add(pe),ne(at),Ne(pe),c(null);try{const Mt=await Ka({autoRenameAgents:[...at]});ne(new Set(Mt.autoRenameAgents??[])),Be(await fu(!0))}catch(Mt){ne(Ge),c(Mt instanceof Error?Mt.message:String(Mt))}finally{Ne(null)}},Zt=async pe=>{const Ge=Me;be(pe),X("namer"),c(null);try{const at=await Ka({autoRenameNamer:pe});be(at.autoRenameNamer??"auto"),Be(await fu(!0))}catch(at){be(Ge),c(at instanceof Error?at.message:String(at))}finally{X(null)}},Lt=async(pe,Ge)=>{const at=V,Mt={...at};Ge?Mt[pe]=Ge:delete Mt[pe],Ke(Mt),X(pe),c(null);try{const er=await Ka({autoRenameModels:Mt});Ke(er.autoRenameModels??{})}catch(er){Ke(at),c(er instanceof Error?er.message:String(er))}finally{X(null)}},Lr=async pe=>{const Ge=He;je(pe),X("interval"),c(null);try{const at=await Ka({autoRenameIntervalMinutes:pe});je(at.autoRenameIntervalMinutes??10)}catch(at){je(Ge),c(at instanceof Error?at.message:String(at))}finally{X(null)}},Qr=async()=>{const pe=ve.trim();if(pe!==lt){X("preference"),c(null);try{const at=(await Ka({autoRenamePromptPreference:pe})).autoRenamePromptPreference??"";Fe(at),ye(at)}catch(Ge){Fe(lt),c(Ge instanceof Error?Ge.message:String(Ge))}finally{X(null)}}},Pt=async pe=>{const Ge=Math.max(1e3,Math.min(64e3,Math.round(pe||12e3))),at=de;nt(Ge),X("payload-limit"),c(null);try{const Mt=await Ka({autoRenamePromptPayloadChars:Ge});nt(Mt.autoRenamePromptPayloadChars??12e3)}catch(Mt){nt(at),c(Mt instanceof Error?Mt.message:String(Mt))}finally{X(null)}},Dt=new Set(W.map(pe=>pe.slug)),pr=xe?{ok:e("settings.agentPluginDoctorStatusOk"),"missing-title-namer":e("settings.agentPluginDoctorStatusMissing"),"cli-default":e("settings.agentPluginDoctorStatusCliDefault"),"no-models":e("settings.agentPluginDoctorStatusNoModels"),"probe-failed":e("settings.agentPluginDoctorStatusFailed")}[xe.status]:"";return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[s.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentAutoRename")}),s.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameHint")}),s.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameNamer")}),s.jsxs("select",{value:Me,disabled:ae!==null,onChange:pe=>{Zt(pe.target.value)},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[s.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),he?.filter(pe=>pe.available).map(pe=>s.jsx("option",{value:pe.slug,children:pe.displayName},pe.slug))]})]}),s.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),s.jsx("select",{value:He,disabled:ae!==null,onChange:pe=>{Lr(Number(pe.target.value))},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[5,10,30,60].map(pe=>s.jsxs("option",{value:pe,children:[pe," ",e("settings.agentAutoRenameMinutes")]},pe))})]}),s.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[s.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),s.jsxs("label",{className:"mt-2 block",children:[s.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),s.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),s.jsx("textarea",{value:ve,maxLength:2e3,rows:3,disabled:ae!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:pe=>Fe(pe.target.value),onBlur:()=>{Qr()},className:"mt-1.5 w-full resize-y rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:ring-1 focus:ring-primary/50 disabled:opacity-50"}),s.jsx("span",{className:"mt-1 block text-right text-[10px] text-muted-foreground",children:ae==="preference"?e("settings.saving"):`${ve.length}/2000`})]}),s.jsxs("label",{className:"mt-2 block",children:[s.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePayloadLimit")}),s.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePayloadLimitHint")}),s.jsx("input",{type:"number",min:1e3,max:64e3,step:1e3,value:de,disabled:ae!==null,onChange:pe=>nt(Number(pe.target.value)),onBlur:pe=>{Pt(Number(pe.target.value))},className:"mt-1.5 w-full rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]})]}),s.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),s.jsx("button",{type:"button",onClick:async()=>{Be(null);try{Be(await fu(!0))}catch{Be([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:s.jsx(sn,{size:11,className:he===null?"animate-spin":""})})]}),he?.filter(pe=>pe.available).map(pe=>{const Ge=pe.models.find(at=>at.id===pe.recommendedModel);return s.jsxs("label",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:pe.displayName}),s.jsxs("select",{value:V[pe.slug]??"",disabled:ae!==null,onChange:at=>{Lt(pe.slug,at.target.value)},className:"min-w-0 max-w-[68%] rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[s.jsx("option",{value:"",children:Ge?`${e("settings.agentAutoRenameAutomatic")} · ${Ge.displayName}`:e("settings.agentAutoRenameCliDefault")}),pe.models.map(at=>s.jsx("option",{value:at.id,children:at.displayName},at.id))]})]},pe.slug)}),he?.length===0&&s.jsx("div",{className:"text-[10px] text-[color:var(--warning)]",children:e("settings.agentAutoRenameNoCli")})]})]}),t===null&&s.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[s.jsx(Ti,{size:12,className:"animate-spin"})," …"]}),t?.map(pe=>{const Ge=n===pe.slug,at=pe.state!=="not-installed"&&pe.state!=="outdated",Mt=Dt.has(pe.slug);return s.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[s.jsx(Zc,{agent:{slug:pe.slug,displayName:pe.displayName,accentColor:pe.accentColor??"#878580",icon:pe.icon,isPlugin:Mt,iconMode:pe.iconMode,iconVersion:pe.iconVersion??void 0},size:18}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[13px] font-medium text-foreground",children:pe.displayName}),Mt&&s.jsx("span",{className:"rounded bg-[rgb(var(--success-rgb)_/_0.12)] px-1 py-px text-[9px] font-medium text-[color:var(--success)]",children:"plugin"}),s.jsxs("span",{className:`text-[10px] ${$D[pe.state]}`,children:[pe.state==="installed"&&s.jsx(ld,{size:10,className:"mr-0.5 inline"}),(pe.state==="outdated"||pe.state==="needs-approval"||pe.state==="unverified")&&s.jsx(c1,{size:10,className:"mr-0.5 inline"}),Nt(pe.state)]})]}),s.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:pe.targetDisplay,children:[e("settings.agentHooksTarget")," ",pe.targetDisplay]}),h===pe.slug&&s.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),pe.state==="needs-approval"&&s.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")}),pe.state==="unverified"&&s.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksUnverifiedHint")})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("button",{type:"button",disabled:ce!==null,onClick:()=>{Xt(pe.slug)},className:"flex shrink-0 items-center gap-1.5 rounded-full px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-pressed":Oe.has(pe.slug),title:e("settings.agentAutoRenameToggle"),children:[s.jsx("span",{children:e("settings.agentAutoRenameShort")}),s.jsx(hl,{checked:Oe.has(pe.slug),disabled:ce!==null,size:"sm"})]}),s.jsxs("button",{type:"button",disabled:Ge,onClick:()=>{At(pe.slug,at?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${at?"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)]"} disabled:opacity-50`,children:[Ge?s.jsx(Ti,{size:11,className:"animate-spin"}):at?s.jsx(Js,{size:11}):pe.state==="outdated"?s.jsx(sn,{size:11}):s.jsx(Eg,{size:11}),Ge?"…":at?e("settings.agentHooksUninstall"):pe.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},pe.slug)}),l&&s.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:l}),s.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),s.jsxs("button",{type:"button",onClick:()=>y(!b),className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-2.5 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[s.jsx(ui,{size:11}),e("settings.agentPluginAdd")]})]}),s.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),b&&s.jsxs("div",{className:"mt-2 space-y-2",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:w,onChange:pe=>C(pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&F()},className:"min-w-0 flex-1 rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none",placeholder:e("settings.agentPluginSourcePlaceholder")}),s.jsxs("button",{type:"button",disabled:!w.trim()||Xe!==null,onClick:()=>{F()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] transition hover:bg-[rgb(var(--success-rgb)_/_0.22)] disabled:opacity-50",children:[Xe==="install"?s.jsx(Ti,{size:11,className:"animate-spin"}):s.jsx(Eg,{size:11}),e("settings.agentPluginInstallPackage")]})]}),s.jsx("button",{type:"button",onClick:()=>x(!m),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),W.map(pe=>{const Ge=pe.revision?.slice(0,8),at=Xe?.endsWith(`:${pe.slug}`)===!0;return s.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[s.jsx("span",{className:"truncate",children:pe.displayName}),pe.updateAvailable&&s.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),s.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:pe.source??void 0,children:[pe.source??e("settings.agentPluginManualSource"),Ge?` · ${Ge}`:""]})]}),s.jsxs("button",{type:"button",disabled:Xe!==null,onClick:()=>{it(pe.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",title:e("settings.agentPluginDoctorHint"),children:[Xe===`doctor:${pe.slug}`?s.jsx(Ti,{size:10,className:"animate-spin"}):s.jsx(F9,{size:10}),e("settings.agentPluginDoctor")]}),pe.updateSupported&&s.jsxs("button",{type:"button",disabled:Xe!==null,onClick:()=>{pe.updateAvailable?tt(pe.slug):Qe(pe.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",children:[at?s.jsx(Ti,{size:10,className:"animate-spin"}):s.jsx(sn,{size:10}),pe.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),s.jsx("button",{type:"button",disabled:Xe!==null,onClick:()=>{we(pe.slug)},className:"rounded-full p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-[color:var(--warning)] disabled:opacity-50",title:e("settings.agentPluginDelete"),children:s.jsx(Js,{size:11})})]},pe.slug)}),xe&&s.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${xe.status==="ok"||xe.status==="cli-default"?"bg-[rgb(var(--success-rgb)_/_0.10)] text-[color:var(--success)]":"bg-[rgb(var(--warning-rgb)_/_0.10)] text-[color:var(--warning)]"}`,children:[s.jsxs("div",{className:"font-medium",children:[xe.displayName,": ",pr]}),s.jsx("div",{className:"mt-1 text-muted-foreground",children:xe.models.length>0?`${xe.models.length} ${e("settings.agentPluginDoctorModels")}${xe.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${xe.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),xe.error&&s.jsx("div",{className:"mt-1 break-words",children:xe.error}),xe.warnings.length>0&&s.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:xe.warnings.map(pe=>s.jsxs("div",{children:["• ",pe]},pe))}),xe.nextSteps.length>0&&s.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:xe.nextSteps.map(pe=>s.jsxs("div",{children:["→ ",pe]},pe))})]}),U.map(pe=>s.jsxs("div",{className:"mt-2 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[10px] text-[color:var(--warning)]",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"font-medium",children:[pe.slug,": ",pe.code??e("settings.agentPluginInvalid")]}),s.jsxs("button",{type:"button",onClick:()=>{Rt(pe)},className:"flex shrink-0 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-1 font-medium transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)]",children:[re===pe.slug?s.jsx(ld,{size:10}):s.jsx(Tb,{size:10}),re===pe.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),s.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:pe.errors.join(`
158
+ `)}),pe.migration?.guideCommand&&s.jsx("code",{className:"mt-1 block select-all text-foreground",children:pe.migration.guideCommand})]},pe.slug)),b&&m&&s.jsxs("div",{className:"mt-2 space-y-2",children:[s.jsx("textarea",{value:S,onChange:pe=>I(pe.target.value),rows:10,className:"w-full rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none resize-y",placeholder:`{
159
+ "version": 2,
160
+ "slug": "my-agent",
161
+ "displayName": "My Agent",
162
+ "aliases": ["my-agent"],
163
+ "accentColor": "#4385BE",
164
+ "statuses": [
165
+ { "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
166
+ { "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
167
+ { "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
168
+ ],
169
+ "hooks": {
170
+ "target": "~/.my-agent/settings.json",
171
+ "events": [
172
+ { "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
173
+ { "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
174
+ { "hook": "Stop", "event": "stop", "status": "complete" }
175
+ ]
176
+ }
177
+ }`}),N&&s.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:N}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>{oe()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[s.jsx(g9,{size:11}),e("settings.agentPluginCreate")]}),s.jsx("button",{type:"button",onClick:()=>{x(!1),I(""),Q(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function zD({state:e,pending:t,onCheck:r,onConfirmRestart:n,desktopState:a,desktopPending:l=!1,desktopSnapshot:c,desktopActions:h,onCheckDesktop:p,onInstallDesktop:m}){const{t:x}=Xr(),b=e?.status??"idle",y=t||b==="checking"||b==="installing"||b==="restarting",w=b==="ready"&&!!e?.latestVersion,C=b==="checking"?x("settings.updateChecking"):b==="installing"?x("sidebar.updateInstalling"):b==="ready"?x("sidebar.updateReady"):b==="restarting"?x("sidebar.updateRestarting"):b==="current"?x("settings.updateCurrent"):b==="error"?e?.error||x("sidebar.updateFailed"):x("settings.updateHint"),S=a?.currentVersion||c?.appVersion,I=a?.status??"idle",N=l||I==="checking"||I==="downloading"||I==="installing",Q=I==="ready",W=a?.error||(I==="unsupported"?x("settings.desktopUpdateUnsupported"):I==="checking"?x("settings.desktopUpdateChecking"):I==="current"?x("settings.desktopUpdateCurrent"):I==="downloading"?x("settings.desktopUpdateDownloading"):I==="ready"?x("settings.desktopUpdateReady"):I==="installing"?x("settings.desktopUpdateInstalling"):I==="error"&&a?.error||x("settings.desktopUpdateHint"));return s.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[s.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:x("settings.updateTitle")}),s.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${w?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:s.jsx(sn,{size:15,className:y?"animate-spin":""})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-foreground",children:x("settings.updateRuntimeTitle")}),s.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:C}),e&&s.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:w&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),w?s.jsx("button",{type:"button",disabled:y,onClick:n,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:x("sidebar.updateRestart")}):s.jsx("button",{type:"button",disabled:y,onClick:r,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:x(b==="checking"?"settings.updateCheckingShort":b==="installing"?"settings.updateInstallingShort":b==="error"?"sidebar.updateRetry":b==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),(a||h)&&s.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${Q?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:s.jsx(sn,{size:15,className:N?"animate-spin":""})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-foreground",children:x("settings.desktopUpdateTitle")}),s.jsx("div",{className:`mt-0.5 text-[10px] leading-relaxed ${a?.error?"text-destructive":"text-muted-foreground"}`,role:a?.error?"alert":void 0,children:a?W:x(p?"settings.desktopStatusLoading":"settings.desktopUpdateUnsupported")}),s.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:Q&&a?.latestVersion?`${a.currentVersion} → ${a.latestVersion}`:S?`v${S}`:null})]})]}),Q?s.jsx("button",{type:"button",disabled:N||!m,onClick:m,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:x("settings.desktopUpdateRestart")}):s.jsx("button",{type:"button",disabled:!a||N||I==="unsupported"||!p,onClick:p,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:x(I==="installing"?"settings.updateInstallingShort":I==="downloading"?"settings.desktopUpdateDownloadingShort":I==="checking"?"settings.updateCheckingShort":I==="current"||I==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]}),h]})}function HD({quality:e}){const{locale:t}=Xr(),r=(h,p)=>t==="zh"?h:p,n=h=>h==null||!Number.isFinite(h)?"—":`${h.toFixed(1)} ms`,a=e?.diagnostics,l=h=>s.jsx("dl",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1.5 tabular-nums",children:h.map(([p,m])=>s.jsxs(L.Fragment,{children:[s.jsx("dt",{children:p}),s.jsx("dd",{className:"text-right text-foreground break-all",children:m})]},p))}),c=(h,p)=>s.jsxs("section",{className:"mt-3 border-t border-border/30 pt-3",children:[s.jsx("h3",{className:"mb-2 font-medium text-foreground",children:h}),p]});return s.jsxs("div",{className:"text-[11px] leading-relaxed",children:[c(r("往返统计","Round-trip statistics"),s.jsxs(s.Fragment,{children:[l([[r("平均延迟","Average latency"),n(e?.average)],["P95",n(e?.p95)],[r("服务端回包处理","Server reply handler"),n(e?.handlerMs)]]),s.jsx("p",{className:"mt-2",children:r("8 秒未响应计为超时,不等于网络丢包。回包处理仅含消息解析至构造回复,不含解密、排队和发包。","A probe times out after 8s; this is not packet loss. Handler timing covers parsing through reply creation, excluding decryption, queues and transmission.")})]})),c(r("当前发送与排队","Current buffers and queues"),a?s.jsxs(s.Fragment,{children:[l([[r("当前传输","Current transport"),a.transport==="webtransport"?"QUIC / HTTP/3":"WebSocket / TCP"],[r("传输层发送缓冲","Transport send buffer"),`${a.bufferedBytes} B`],[r("加密通道待发送","Channel writes pending"),a.pendingWrites?r("有","Yes"):r("无","No")],[r("进行中的非终端请求","Active non-terminal requests"),a.activeRequests],[r("等待通道的请求","Requests waiting for capacity"),a.waitingRequests]]),s.jsx("p",{className:"mt-2",children:a.transport==="webtransport"?r("此终端使用独立加密流,文件请求使用其他流。","This terminal has an independent encrypted stream; file requests use other streams."):r("属于此服务共用的连接,包含文件等其他请求。","Shared by this service, including file transfers and other requests.")})]}):s.jsx("p",{children:r("尚无连接记录。","No connection record yet.")})),c(r("本次连接建立 · 历史耗时","Connection setup · recorded timings"),s.jsxs(s.Fragment,{children:[l([[r("传输通道就绪","Transport ready"),n(a?.transportOpenMs)],...a?.relay?[[r("其中:连上入口 WebSocket","Within transport: entry WebSocket"),n(a.relay.entryOpenMs)],[r("其中:请求中转至通道打开","Within transport: relay open request"),n(a.relay.routeOpenMs)]]:[],[r("Noise 加密握手","Noise handshake"),n(a?.handshakeMs)],[r("终端逻辑通道就绪","Terminal logical channel ready"),n(a?.socketOpenMs)],[r("其中:等待本地通道名额","Within logical open: local capacity wait"),n(a?.socketQueueMs)]]),s.jsx("p",{className:"mt-2",children:r("这是建链时的历史耗时,不代表当前延迟。“其中”为子项,不能重复相加;中转耗时含处理和建链,不含之前的授权。","Recorded setup timings, not live latency. “Within” rows are subsets, not additive. Relay timing includes processing and setup, excluding earlier authorization.")})]}))]})}function WD({backendSessionId:e}){const{locale:t}=Xr(),r=t==="zh",[n,a]=L.useState(null),[l,c]=L.useState(!1);L.useEffect(()=>{if(a(null),!l||!e)return;const b=()=>a(O8(e));b();const y=setInterval(b,1e3);return document.addEventListener("visibilitychange",b),()=>{clearInterval(y),document.removeEventListener("visibilitychange",b)}},[e,l]);const h=n?.diagnostics,p=n?.rtt,m=n?.connected?n.waiting?r?"等待响应…":"Waiting for reply…":p==null?r?"测量中…":"Measuring…":`${p} ms · ${p<150?r?"流畅":"Low latency":p<300?r?"有延迟":"Moderate latency":r?"高延迟":"High latency"}`:r?"未连接":"Disconnected",x=b=>b==null?"—":`${Math.round(b)} ms`;return s.jsxs("div",{className:"mt-3 rounded-xl bg-surface-2 px-3 text-muted-foreground",children:[s.jsxs("button",{type:"button","aria-expanded":l,onClick:()=>c(b=>!b),className:"flex min-h-11 w-full items-center gap-2 py-2 text-[12px] tabular-nums hover:text-foreground","aria-label":`${r?"连接质量":"Connection quality"}${l?`: ${m}`:""}`,children:[s.jsx("span",{"aria-hidden":"true",className:`h-1.5 w-1.5 rounded-full ${l&&n&&(!n.connected||n.waiting||p!=null&&p>=300)?"bg-destructive":"bg-current"}`}),s.jsxs("span",{className:"flex-1 text-left",children:[r?"连接质量":"Connection quality",l?` · ${m}`:""]}),s.jsx("span",{"aria-hidden":"true",children:l?"▾":"▸"})]}),l&&s.jsxs("div",{className:"pb-3 text-[11px] leading-relaxed",children:[!e&&s.jsx("p",{children:r?"请先打开一个终端会话,再查看连接质量。":"Open a terminal session to measure connection quality."}),s.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 tabular-nums",children:[s.jsx("dt",{children:r?"近期延迟":"Recent latency"}),s.jsx("dd",{className:"text-right text-foreground",children:n?.minimum==null?"—":`${Math.round(n.minimum)}–${Math.round(n.maximum??n.minimum)} ms`}),s.jsx("dt",{children:r?"波动":"Jitter"}),s.jsx("dd",{className:"text-right text-foreground",children:x(n?.jitter)}),s.jsx("dt",{children:r?"探测超时":"Probe timeouts"}),s.jsx("dd",{className:"text-right text-foreground",children:n?.samples?`${n.timeouts} / ${n.samples}`:"—"}),s.jsx("dt",{children:r?"连接路径":"Connection route"}),s.jsx("dd",{className:"text-right text-foreground break-words",children:h?`${h.path==="relay"?r?"经入口中转":"Via relay":r?"直连":"Direct"} · ${h.endpoint}`:"—"})]}),s.jsx("p",{className:"mt-2",children:r?"每 5 秒更新,统计最近 20 次;波动越小越稳定。":"Updates every 5s, using the last 20 probes. Lower jitter means more consistent latency."}),s.jsxs("details",{className:"mt-3 border-t border-border/30 pt-2",children:[s.jsx("summary",{className:"cursor-pointer py-1 hover:text-foreground",children:r?"诊断详情":"Diagnostics"}),s.jsx(HD,{quality:n})]})]})]})}const Q5={"startup-failure":"settings.serverHealthEventStartupFailure",crash:"settings.serverHealthEventCrash","crash-native":"settings.serverHealthEventCrashNative",killed:"settings.serverHealthEventKilled",wedge:"settings.serverHealthEventWedge","port-conflict":"settings.serverHealthEventPortConflict","gave-up":"settings.serverHealthEventGaveUp","exit-zero-unexpected":"settings.serverHealthEventExitZero","terminated-externally":"settings.serverHealthEventTerminated","supervisor-lost":"settings.serverHealthEventSupervisorLost","uncaught-exception":"settings.serverHealthEventUncaughtException","unhandled-rejection":"settings.serverHealthEventUnhandledRejection","exit-nonzero":"settings.serverHealthEventExitNonzero"};function GD(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}function qD({state:e,onDismiss:t}){const{t:r}=Xr(),[n,a]=v.useState(!1),[l,c]=v.useState(!1),h=v.useRef(!1),p=v.useRef(!0);v.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]),v.useEffect(()=>{e?.supervised&&(h.current=!1,a(!1),c(!1))},[e?.supervised]),v.useEffect(()=>{if(!n)return;const W=window.setTimeout(()=>{h.current=!1,a(!1),c(!0)},45e3);return()=>window.clearTimeout(W)},[n]);const m=async()=>{if(!h.current){h.current=!0,c(!1),a(!0);try{await F8()}catch{if(!p.current)return;h.current=!1,a(!1),c(!0)}}};if(!e)return null;const x=e.incident,b=!e.supervised&&e.supervisor?.phase==="gave-up",y=!e.supervised&&e.supervisor!==null&&!e.supervisor.alive,w=b||y||e.attention,C=e.supervised&&e.supervisor?.alive&&e.supervisor.phase==="running",S=b?r("settings.serverHealthGaveUp",{count:e.supervisor?.consecutiveCrashes??0}):y?r("settings.serverHealthSupervisorLost"):e.supervised?r("settings.serverHealthSupervised"):r("settings.serverHealthUnsupervised"),I=x?r(Q5[x.event]??"settings.serverHealthUnknownEvent"):"",N=x?.causeEvent?r(Q5[x.causeEvent]??"settings.serverHealthUnknownEvent"):"",Q=x?[new Date(x.at).toLocaleString(),x.uptimeMs!==null?r("settings.serverHealthUptime",{duration:GD(x.uptimeMs)}):null,x.signal?`signal ${x.signal}`:null,x.exitCode!==null?`exit ${x.exitCode}`:null].filter(Boolean).join(" · "):"";return s.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"server-health-title",children:[s.jsx("div",{id:"server-health-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:r("settings.serverHealthTitle")}),s.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${w?"bg-destructive/15 text-destructive":"bg-primary/15 text-primary"}`,children:w?s.jsx(Q9,{size:15}):s.jsx(P9,{size:15})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-foreground",children:S}),s.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:x?`${r(C?"settings.serverHealthHistory":"settings.serverHealthLastIncident")}: ${I}${N?` · ${N}`:""}`:r("settings.serverHealthClean")}),x&&C&&s.jsx("div",{className:"mt-1 text-[11px] text-primary",children:r("settings.serverHealthRunningNow")}),x&&s.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:Q}),x?.detail&&s.jsx("div",{className:"mt-1 break-words text-[10px] text-muted-foreground/75",children:x.detail}),x?.oomSuspect&&s.jsx("div",{className:"mt-1 text-[10px] text-[color:var(--warning)]",children:r("settings.serverHealthOomNote")}),e.supervisor&&e.supervisor.restarts>0&&!b&&s.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:r("settings.serverHealthRestarted",{count:e.supervisor.restarts})})]})]}),e.attention&&s.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated",children:r("settings.serverHealthDismiss")})]}),!e.supervised&&s.jsxs("div",{className:"border-t border-border px-3 py-3",children:[s.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:e.canEnableSupervision?r("settings.serverHealthEnableHint"):r("settings.serverHealthEnableUnavailable")}),e.canEnableSupervision&&s.jsx("button",{type:"button",onClick:m,disabled:n,className:"mt-2 min-h-11 rounded-lg bg-primary px-3 text-[12px] font-medium text-primary-foreground disabled:opacity-60",children:r(n?"settings.serverHealthEnabling":"settings.serverHealthEnable")}),n&&s.jsx("p",{role:"status",className:"mt-2 text-[11px] text-muted-foreground",children:r("settings.serverHealthEnablePending")}),l&&s.jsx("p",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:r("settings.serverHealthEnableError")})]})]})}const VD=()=>()=>{},ZD=()=>1/0;function YD(){const{t:e}=Xr(),t=v.useId(),r=zo(),n=v.useSyncExternalStore(r?.subscribe??VD,r?.retentionLimit??ZD);if(!r)return null;const a=$8+1,l=n===1/0?e("settings.workspaceUnlimited"):String(n);return s.jsxs("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("label",{htmlFor:t,className:"shrink-0 text-[12px] font-medium text-foreground/90",children:e("settings.workspaceLimit")}),s.jsx("input",{id:t,type:"range",min:3,max:a,step:1,value:n===1/0?a:n,"aria-valuetext":l,"aria-describedby":`${t}-hint`,onChange:c=>{const h=Number(c.target.value);r.setRetentionLimit(h===a?1/0:h)},className:"h-8 min-w-0 flex-1"}),s.jsx("output",{htmlFor:t,className:"min-w-12 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:l})]}),s.jsx("p",{id:`${t}-hint`,className:"text-[11px] leading-relaxed text-muted-foreground",children:e("settings.workspaceLimitHint")})]})}function KD(e,t){const[r,n]=v.useState(e||t);return v.useEffect(()=>{(e||t)&&n(!0)},[e,t]),!r&&!e&&!t}const n1="mobile-session-destroy";function XD(e,t){return t&&e.type==="session"&&e.destination?.droppableId===n1}const Ma="termdock-program-rules-cache",wh="termdock-toolbar-presets-cache",Uu="termdock-settings-cache",B5="termdock-color-theme",P5="termdock:right-sidebar:file-preview-open-by-session:v2",zu="termdock:running-session-button-enabled:v1",Hu="termdock:attention-button-enabled:v1",JD=60,O5=280,F5=420,Uo=8;function $5(e,t,r){return Math.min(Math.max(e,t),r)}function dm(e,t=F5){if(typeof window>"u")return{left:Uo,top:Uo};const r=window.innerWidth/2,n=Math.min(64,window.innerHeight/4),a=e?.x??r,l=e?.y??n,c=Math.max(Uo,window.innerWidth-O5-Uo),h=Math.max(Uo,window.innerHeight-t-Uo);return{left:$5(a+Uo,Uo,c),top:$5(l+Uo,Uo,h),width:O5,maxHeight:`min(${F5}px, calc(100vh - ${Uo*2}px))`}}function eQ(e){return e==="dark"||e==="light"}function tQ(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.entries(e).every(([t,r])=>{if(!t||!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.updatedAt=="number"&&Number.isFinite(n.updatedAt)})}function hm(e){const t=Object.entries(e).filter(([r,n])=>r&&Number.isFinite(n.updatedAt)).sort(([,r],[,n])=>n.updatedAt-r.updatedAt).slice(0,JD);return Object.fromEntries(t)}function rQ(e){return Array.isArray(e)&&e.every(t=>{if(!t||typeof t!="object")return!1;const r=t;return typeof r.id=="string"&&typeof r.pattern=="string"&&typeof r.output=="string"&&(r.matchType==="exact"||r.matchType==="includes"||r.matchType==="prefix"||r.matchType==="regex")})}function nQ(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function sQ(e,t){const r=bd(),n=new Set(TR()),a=Array.isArray(e)?e:[],l=N0(a),c=t<Zu;if(l.length===0)return r;if(c){const p=new Map(l.map(y=>[y.id,y])),m=new Map(a.map(y=>[typeof y.id=="string"?y.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",y])),x=l.filter(y=>!n.has(y.id));return[...r.map(y=>{const w=p.get(y.id),C=m.get(y.id);return w?{...y,rowLayout:w.rowLayout,showOnDesktop:typeof C?.showOnDesktop=="boolean"?C.showOnDesktop:y.showOnDesktop}:y}),...x]}const h=new Set(l.map(p=>p.id));return[...l,...r.filter(p=>!h.has(p.id))]}function iQ(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const aQ={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},Ff="__termdockOverlay",$f="__termdockBaseAnchor",Uf="__termdockBaseGuard",oQ=3,U5=250,lQ="termdock-notification-target-v1",z5="/__termdock-notification-target",H5=3e4;function cQ(e){return e==="left-sidebar"||e==="right-sidebar"||e==="right-sidebar-repo-picker"||e==="right-sidebar-file-preview"||e==="settings"||e==="markdown-outline"||e==="markdown-image-lightbox"}function C0(e){if(!e||typeof e!="object")return null;const t=e[Ff];return cQ(t)?t:null}function X1(e){return e&&typeof e=="object"?{...e}:{}}function ov(e){const t=X1(e);return delete t[Ff],t}function uQ(e){const t=ov(e);return delete t[Uf],{...t,[$f]:!0}}function dQ(){typeof window>"u"||window.history.pushState({...ov(window.history.state),[$f]:!0,[Uf]:!0},"",window.location.href)}function lv(){for(let e=0;e<oQ;e+=1)dQ()}function Ah(){typeof window>"u"||(window.history.replaceState(uQ(window.history.state),"",window.location.href),lv())}function Wu(e){typeof window>"u"||window.history.pushState({...X1(window.history.state),[$f]:!0,[Ff]:e,[Uf]:!1},"",window.location.href)}function hQ(e){typeof window>"u"||window.history.replaceState({...X1(window.history.state),[$f]:!0,[Ff]:e,[Uf]:!1},"",window.location.href)}const cv=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let ja=new Set(cv);function W5(e){const t=new Map;for(const[r,n]of e)t.set(r,{cwd:n.cwd,activeProgram:n.activeProgram,activeProgramRaw:n.activeProgramRaw,inCopyMode:n.inCopyMode,isConnecting:n.isConnecting,agentStatus:n.agentStatus,agentIndicator:n.agentIndicator,agentStatusDetail:n.agentStatusDetail,agent:n.agent,agentMessage:n.agentMessage,agentNativeSessionId:n.agentNativeSessionId,agentResumeRecovered:n.agentResumeRecovered,terminalSessionId:n.terminalSessionId,agentNeedsReview:n.agentNeedsReview,gitStatus:n.gitStatus,shellTitle:n.shellTitle,promptState:n.promptState,tuiProgress:n.tuiProgress});return t}function fQ(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t){const a=e.get(r);if(!a||a.cwd!==n.cwd||a.activeProgram!==n.activeProgram||a.activeProgramRaw!==n.activeProgramRaw||a.inCopyMode!==n.inCopyMode||a.isConnecting!==n.isConnecting||a.agentStatus!==n.agentStatus||a.agentIndicator!==n.agentIndicator||a.agentStatusDetail!==n.agentStatusDetail||a.agent!==n.agent||a.agentMessage!==n.agentMessage||a.agentNativeSessionId!==n.agentNativeSessionId||a.agentResumeRecovered!==n.agentResumeRecovered||a.terminalSessionId!==n.terminalSessionId||a.agentNeedsReview!==n.agentNeedsReview||a.gitStatus!==n.gitStatus||a.shellTitle!==n.shellTitle||a.promptState!==n.promptState||a.tuiProgress?.state!==n.tuiProgress?.state||a.tuiProgress?.progress!==n.tuiProgress?.progress||a.tuiProgress?.source!==n.tuiProgress?.source||a.tuiProgress?.app!==n.tuiProgress?.app||a.tuiProgress?.message!==n.tuiProgress?.message||a.tuiProgress?.kind!==n.tuiProgress?.kind)return!1}return!0}function G5(e,t){return s.jsx(wj,{sessionMode:e,state:t})}function pQ(e,t){const r=new Map(e.map(c=>[c.id,c])),n=t.map(c=>r.get(c)).filter(c=>c!==void 0),a=new Set(t),l=e.filter(c=>!a.has(c.id));return[...n,...l]}const mQ=L.lazy(()=>Pl(()=>import("./CollaborationMainWorkspace-BVeBgGMT.js"),__vite__mapDeps([37,1,2,3,4,5,38,6,7,9,10,31,32,18,11,19,33,34,22,39,27,35,40,30,25,16,41]))),gQ=L.lazy(()=>Pl(()=>import("./TodoWorkspace-CCL-wZTu.js"),__vite__mapDeps([42,1,2,3,4,5,18,11,19,22,31,32,33,34,35,38,6,7,9,10,39,27,40,30,25,16,41])));async function uv(e,t){return fb(e,t)}function xQ(){const{t:e,locale:t,setLocale:r}=Xr(),n="env(safe-area-inset-top, 0px)",a="env(safe-area-inset-bottom, 0px)";U8();const l=L.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[c,h]=L.useState(!1),[p,m]=L.useState(()=>cc(B5,eQ)??"dark"),x=L.useRef(cc(Uu,iQ)).current,[b,y]=L.useState(x?.preventSleep??!1),[w,C]=L.useState(x?.networkAvailable??!0),[S,I]=L.useState(z8),[N,Q]=L.useState(H8),[W,B]=L.useState(W8),[U,K]=L.useState(G8),[re,H]=L.useState(ap),[Oe,ne]=L.useState(x?.localAccess??aQ),[ce,Ne]=L.useState(x?.localAccess?.name??""),[Me,be]=L.useState(!1),[V,Ke]=L.useState(null),[he,Be]=L.useState(null),{state:ae,apply:X,refresh:He}=qM(),[je,ve]=L.useState(!1),Fe=v.useRef({busy:!1}),lt=v.useRef(0),ye=v.useRef(ae?.latestVersion);ye.current=ae?.latestVersion;const[de,nt]=v.useState(null);jl(de?{message:de}:null),v.useEffect(()=>{const T=()=>{lt.current++};for(const D of["pagehide","auth:unauthorized",pl])window.addEventListener(D,T);return()=>{T();for(const D of["pagehide","auth:unauthorized",pl])window.removeEventListener(D,T)}},[]);const[Xe,pt]=L.useState(null),xe=L.useMemo(()=>Nl(),[]),mt=!!(xe?.desktopUpdateState&&xe.checkDesktopUpdate&&xe.installDesktopUpdate),[It,At]=L.useState(null),[Nt,oe]=L.useState(null),[F,we]=L.useState(!1),Qe=v.useRef({busy:!1}),tt=v.useRef(Nt);tt.current=Nt;const[it,Rt]=L.useState(null),[Xt,Zt]=L.useState(!1),[Lt,Lr]=L.useState(()=>hm(cc(P5,tQ)??{})),[Qr,Pt]=L.useState(0),[Dt,pr]=L.useState(!1),[pe,Ge]=L.useState(0),[at,Mt]=L.useState(!1),[er,J]=L.useState(0),[bt,Ce]=L.useState(!1),[lr,Ve]=L.useState(0),zt=L.useRef(null),[Jt,Wr]=L.useState({}),{terminalSettings:yn,updateTerminalSettings:Ar}=OM(),Jr=yn.fontSize,Fr=yn.rendererMode,[$r,an]=L.useState(!1),An=L.useRef(q8()).current,[gt,fe]=v.useState(()=>An.sessions.map(T=>({id:T.sessionId,name:T.name,customName:T.customName,mode:T.mode,tmuxSessionName:T.tmuxSessionName}))),Vr=Ds(T=>T.groupId),ct=Ds(T=>T.todoOpen),Ue=hb(),Tr=L.useMemo(()=>new Map(Ue.map(T=>[T.sessionId,T])),[Ue]);L.useEffect(()=>{const T=()=>Ds.getState().terminal();return window.addEventListener("switch-terminal-session",T),()=>window.removeEventListener("switch-terminal-session",T)},[]);const[wt,Tn]=L.useState(An.activeSessionId),[Nr,cn]=L.useState(!1),Ie=ct||!!Vr,ht=KD(Nr,Ie);L.useEffect(()=>{(Nr||Ie)&&V8({rendered:!0})},[Nr,Ie]);const[Je,_r]=L.useState(null),[Zr,Gr]=L.useState(null);jl(Zr);const[Ir,es]=L.useState([]),[Ft,hn]=v.useState(()=>{const T=Mr.getState();return An.sessions.forEach(D=>{D.backendSessionId&&T.setTerminalSession(D.sessionId,{sessionId:D.backendSessionId,cols:80,rows:24,mode:D.mode,tmuxSessionName:D.tmuxSessionName}),D.activeProgram!=null&&T.setSessionActiveProgram(D.sessionId,D.activeProgram),D.cwd!=null&&T.setSessionCwd(D.sessionId,D.cwd),D.shellTitle!=null&&T.setSessionShellTitle(D.sessionId,D.shellTitle)}),R0("session-chrome-hydrated"),W5(Mr.getState().sessions)});v.useEffect(()=>{!xe||!$r||Promise.all([xe.snapshot(),xe.desktopUpdateState?.()??Promise.resolve(null)]).then(([T,D])=>{At(T),oe(D)}).catch(T=>Rt(T instanceof Error?T.message:String(T)))},[xe,$r]),v.useEffect(()=>{xe?.onDesktopUpdateState&&xe.onDesktopUpdateState(oe)},[xe]),v.useEffect(()=>Mr.subscribe(T=>{const D=W5(T.sessions);hn(ie=>fQ(ie,D)?ie:D)}),[]);const ee=v.useCallback(async(T,D)=>{Gr(null),_r({sessionId:T,status:"submitting",error:null});try{await Z8(D),_r(ie=>ie?.sessionId===T?{...ie,status:"waiting",error:null}:ie)}catch(ie){const dt=(ie&&typeof ie=="object"&&"code"in ie?String(ie.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):ie instanceof Error&&/busy/i.test(ie.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");_r(Ot=>Ot?.sessionId===T?{...Ot,error:dt}:Ot),Gr({tone:"error",message:dt})}},[e]);v.useEffect(()=>{if(!Je||Je.status!=="waiting")return;const T=Ft.get(Je.sessionId);if(!T||T.agentResumeRecovered||T.agentStatus===null&&!T.agent)return;const D=T.agent?.displayName??"Agent";_r(null),Gr({tone:"success",message:e("tab.resumeAgentSuccess",{agent:D})})},[Je,Ft,e]),v.useEffect(()=>{if(!Je||Je.status!=="waiting"||Je.error)return;const T=Je.sessionId,D=window.setTimeout(()=>{const ie=e("tab.resumeAgentTimeout");_r(De=>De?.sessionId===T&&De.status==="waiting"?{...De,error:ie}:De),Gr({tone:"error",message:ie})},15e3);return()=>window.clearTimeout(D)},[Je,e]),v.useEffect(()=>{if(Zr?.tone!=="success")return;const T=window.setTimeout(()=>Gr(null),3200);return()=>window.clearTimeout(T)},[Zr]),v.useEffect(()=>{let T=!1;Y8().then(ie=>{T||pt(ie)}).catch(()=>{});const D=xm(ie=>{T||ie.type==="server-health"&&pt(ie.state)});return()=>{T=!0,D()}},[]);const Ye=v.useCallback(async()=>{try{pt(await K8())}catch(T){Ng(T instanceof Error?T.message:String(T))}},[]),qt=v.useCallback(async()=>{const T=ae?.latestVersion;if(!T||je)return;const D=lt.current,ie=as(),De=Ki(),dt=()=>D===lt.current&&ie===as()&&De===Ki()&&!De?.closed&&ye.current===T,Ot=xe?.confirmationUI==="page-v1"&&typeof xe.confirm=="function";nt(null),await uv(Fe.current,{current:dt,submit:wr=>ww(wr,T),apply:X,pending:ve,expiredMessage:t==="zh"?"连接已变化,请重新确认。":"Connection changed. Please confirm again.",confirm:()=>Ot?xe.confirm({title:e("sidebar.updateRestart"),message:e("sidebar.updateRestartConfirm",{version:T}),confirmLabel:e("sidebar.updateRestart"),cancelLabel:e("common.cancel")}):window.confirm(e("sidebar.updateRestartConfirm",{version:T})),failure:wr=>{Ot?nt(wr):window.alert(wr)}}),dt()&&He()},[ae?.latestVersion,e,je,xe,t,X,He]),Gt=v.useCallback(async()=>{if(je)return;const T=lt.current,D=as(),ie=()=>T===lt.current&&D===as();ve(!0);try{await X8(),ie()&&He()}catch(De){ie()&&Ng(De instanceof Error?De.message:String(De))}finally{ve(!1)}},[je,He]),Yr=v.useCallback(async()=>{if(!(!xe?.checkDesktopUpdate||F)){we(!0);try{oe(await xe.checkDesktopUpdate())}catch(T){Rt(T instanceof Error?T.message:String(T))}finally{we(!1)}}},[xe,F]),Br=v.useCallback(async()=>{const T=Nt;if(!xe?.installDesktopUpdate||F||T?.status!=="ready")return;const D=lt.current,ie=as(),De=Ki(),dt=()=>D===lt.current&&T===tt.current&&T.status==="ready"&&ie===as()&&De===Ki()&&!De?.closed;await fb(Qe.current,{current:dt,confirm:()=>J8({title:e("settings.desktopUpdateRestartConfirm"),message:e("settings.desktopUpdateRestartConfirm"),confirmLabel:e("sidebar.updateRestart"),cancelLabel:e("common.cancel")}),submit:async()=>{if(!dt())throw new Error("Desktop update context changed");return xe.installDesktopUpdate()},apply:oe,pending:we,failure:Rt,expiredMessage:t==="zh"?"连接已变化,请重新确认。":"Connection changed. Please confirm again."})},[xe,F,Nt,e,t]);v.useEffect(()=>{document.documentElement.dataset.theme=p,ew(p),Bn(B5,p)},[p]),v.useEffect(()=>{Bn(P5,hm(Lt))},[Lt]);const Er=Sr(T=>T.leftOpen),ar=Sr(T=>T.rightOpen),br=Sr(T=>T.leftPinned),Hn=Sr(T=>T.leftSidebarWidth),Qs=Sr(T=>T.rightPinned),hs=Sr(T=>T.rightSidebarWidth),xs=Sr(T=>T.rootPath),On=Sr(T=>T.contextKey),En=Sr(T=>T.selectedFilePath),Bs=Sr(T=>T.groupByFolder),bs=G0(T=>T.collaborationGroups),Ur=Sr(T=>T.collapsedGroups),Pr=Sr(T=>T.toggleGroupCollapsed),[kt,ks]=v.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[Yt,q]=v.useState(()=>typeof window>"u"?1024:window.innerWidth),[ke,rt]=v.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[or,$t]=v.useState([]),[cr,Et]=v.useState({available:!0,version:null,reason:null}),[fn,Ts]=v.useState(!1),[_i,Ps]=v.useState(null),[Wn,wa]=v.useState(null),[di,Gn]=v.useState(null),[ls,qr]=v.useState(null),[qn,en]=v.useState(null),[Ht,Fn]=v.useState(null),[jr,mr]=v.useState(null),[,Dr]=v.useState(0),[wn,Ln]=v.useState(null),[Vn,Zn]=v.useState(null),[cs,ts]=v.useState(null),[Cn,ki]=v.useState(!1),[Cs,_n]=v.useState(()=>cc(zu,T=>typeof T=="boolean")??!1),Nn=v.useCallback(async T=>{const D=Cs;_n(T),Bn(zu,T);try{const ie=await Ka({runningSessionButtonEnabled:T});_n(ie.runningSessionButtonEnabled),Bn(zu,ie.runningSessionButtonEnabled)}catch{_n(D),Bn(zu,D)}},[Cs]),[Kr,Ss]=v.useState(()=>cc(Hu,T=>typeof T=="boolean")??!0),pn=v.useCallback(async T=>{const D=Kr;Ss(T),Bn(Hu,T);try{const ie=await Ka({attentionButtonEnabled:T});Ss(ie.attentionButtonEnabled),Bn(Hu,ie.attentionButtonEnabled)}catch{Ss(D),Bn(Hu,D)}},[Kr]),[$,_e]=v.useState(null),Pe=v.useCallback(T=>{_e(T)},[]),We=v.useRef(!1),[qe,ft]=v.useState(null),Ct=L.useRef(null),Qt=v.useCallback(T=>{const D=gt.find(ie=>ie.id===T);D&&(Ct.current={id:T,target:as(),client:Ki(),backend:Mr.getState().sessions.get(T)?.terminalSessionId??null,mode:D.mode,tmux:D.tmuxSessionName},ft(T))},[gt]),st=v.useCallback(()=>{const T=Ct.current,D=T&&gt.find(ie=>ie.id===T.id);return!!T&&!T.client?.closed&&WM(T,D?{id:D.id,target:as(),client:Ki(),backend:Mr.getState().sessions.get(D.id)?.terminalSessionId??null,mode:D.mode,tmux:D.tmuxSessionName}:null)},[gt]),[vt,sr]=v.useState(null),yt=L.useRef(null),P=L.useRef(!1),G=L.useRef(null),le=L.useRef(!1),ge=v.useRef(null),$e=v.useCallback(()=>{Fn(null),mr(null)},[]),[ot,xt]=v.useState(null);jl(ot?{message:ot}:null);const Tt=v.useCallback(async T=>{xt(null),$e(),await MM(T,` ${RM} `)==="failed"&&xt("会话输入暂未就绪,提示词未插入,请稍后重试。")},[$e]);xc(ge,!!Ht,$e),L.useLayoutEffect(()=>{const T=ge.current;if(!Ht||!kt||!T)return;const D=()=>{const{top:De,left:dt}=dm(jr,T.getBoundingClientRect().height);T.style.top=`${De}px`,T.style.left=`${dt}px`};D();const ie=new ResizeObserver(D);return ie.observe(T),window.addEventListener("resize",D),()=>{ie.disconnect(),window.removeEventListener("resize",D)}},[Ht,jr,kt]),v.useEffect(()=>{Ht&&!gt.some(T=>T.id===Ht)&&$e()},[gt,Ht,$e]);const Rr=L.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[mn,St]=L.useState(Rr.current),[tn,rn]=L.useState(!0),Os=L.useRef(Rr.current),kn=L.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));v.useEffect(()=>{if(typeof window>"u")return;const T=window.matchMedia("(min-width: 1024px)"),D=()=>{ks(T.matches),q(window.innerWidth)};return D(),T.addEventListener("change",D),window.addEventListener("resize",D),()=>{T.removeEventListener("change",D),window.removeEventListener("resize",D)}},[]),v.useEffect(()=>{if(typeof window>"u")return;const T=window.matchMedia("(orientation: landscape)"),D=()=>rt(T.matches);return D(),T.addEventListener("change",D),()=>T.removeEventListener("change",D)},[]);const on=L.useMemo(()=>wt?Ir.find(T=>T.sessionIds.includes(wt))??null:null,[wt,Ir]),gr=on?.id??null,Vt=on?.sessionIds[0]??wt,Yn=L.useRef([]);L.useLayoutEffect(()=>{const T=Yn.current;if(Yn.current=Ir,T.length===0)return;const D=new Set(Ir.flatMap(ie=>ie.sessionIds));for(const ie of T){const De=ie.sessionIds.filter(dt=>!D.has(dt)).map(dt=>({sessionId:dt,rootPath:Mr.getState().sessions.get(dt)?.cwd??null}));De.length>0&&Sr.getState().inheritRightSidebarStateFromSplitWorkspace(ie.id,De)}},[Ir]),L.useLayoutEffect(()=>((()=>{const D=Vt?Mr.getState().sessions.get(Vt)?.cwd??null:null;Sr.getState().setRootPath(D,Vt,gr)})(),Mr.subscribe((D,ie)=>{const De=Vt?D.sessions.get(Vt)?.cwd??null:null,dt=Vt?ie.sessions.get(Vt)?.cwd??null:null;De!==dt&&Sr.getState().setRootPath(De,Vt,gr)})),[gr,Vt]);const vs=L.useRef(Sw(window.location.search)??Lw(as()?.targetPeerId)),[Ii,hi]=L.useState("");jl(Ii?{message:Ii}:null),L.useEffect(()=>{const T=vs.current;if(!T)return;if(T.peerId&&T.peerId!==as()?.targetPeerId){const De=tw().find(dt=>dt.targetPeerId===T.peerId);if(De&&zo()){try{_w(T)}catch{hi(t==="zh"?"无法在此浏览器打开架构链接。":"Cannot open this architecture link in this browser.");return}if(rw(De)){vs.current=null;const dt=new URL(window.location.href);dt.searchParams.delete("architecture"),window.history.replaceState(window.history.state,"",dt);return}}hi(t==="zh"?`此架构属于 ${T.serviceName??T.peerId}。请先连接该 Termdock 服务,再打开链接。`:`This architecture belongs to ${T.serviceName??T.peerId}. Connect to that Termdock service, then open this link.`);return}hi("");try{sessionStorage.setItem(`termdock.architecture.selection:${T.root}`,T.file)}catch{}const D=Sr.getState();D.setRootPath(T.root,Vt,gr),D.setRightTab("architecture"),D.openRight();const ie=new URL(window.location.href);ie.searchParams.delete("architecture"),window.history.replaceState(window.history.state,"",ie),Vt&&(vs.current=null)},[Vt,gr,t]);const qo=kt||ke,ei=Yt*.95,Pa=qo?Math.min(Math.max(Yt*.22,280),340):Math.min(Yt*.86,380),Rn=wt&&xs?`${wt}\0${xs}`:"",Ei=!!(Rn&&En&&Lt[Rn]),ea=v.useCallback(T=>{Rn&&(T&&!Sr.getState().selectedFilePath||Lr(D=>{if(!!D[Rn]===T)return D;if(T)return hm({...D,[Rn]:{updatedAt:Date.now()}});const De={...D};return delete De[Rn],De}))},[Rn]);v.useEffect(()=>{VM(Rn,On,En)&&Lr(T=>{if(!T[Rn])return T;const D={...T};return delete D[Rn],D})},[Rn,On,En]);const rs=bt?"markdown-image-lightbox":at?"markdown-outline":Dt?"right-sidebar-repo-picker":ar&&Ei?"right-sidebar-file-preview":$r?"settings":ar&&!(Qs&&kt)?"right-sidebar":Er&&!(br&&kt)?"left-sidebar":null,ns=L.useRef(rs),Ws=L.useRef(rs),Gs=L.useRef(!1),ys=L.useRef(!1),Ls=v.useCallback(()=>{if(typeof window>"u")return;const T=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!kt||!T||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[kt]),fs=v.useCallback(T=>{if(T==="markdown-image-lightbox"){Ce(!1),Ve(D=>D+1);return}if(T==="markdown-outline"){Mt(!1),J(D=>D+1);return}if(T==="right-sidebar-file-preview"){Mt(!1),J(D=>D+1),ea(!1),Pt(D=>D+1);return}if(T==="right-sidebar-repo-picker"){pr(!1),Ge(D=>D+1);return}if(T==="settings"){an(!1),no(!1),Sa(!1),Se(!1);return}if(T==="left-sidebar"){Sr.getState().closeLeft();return}Mt(!1),J(D=>D+1),pr(!1),Ge(D=>D+1),Ce(!1),Ve(D=>D+1),Sr.getState().closeRight()},[ea]),nn=v.useCallback(T=>{if(!l&&typeof window<"u"&&ns.current===T&&C0(window.history.state)===T){window.history.back();return}fs(T)},[fs,l]),qs=v.useCallback(()=>{an(!1);const T=Sr.getState();T.closeRight(),T.openLeft()},[]),Ni=v.useCallback(()=>{an(!1);const T=Sr.getState();T.closeLeft(),T.openRight()},[]),Ri=v.useCallback(()=>{an(!1);const T=Sr.getState();T.closeLeft(),T.openRight(),T.setRightTab("files"),T.openRightSearch()},[]),Mi=v.useCallback(()=>{const T=Sr.getState();if(T.leftPinned){T.setLeftPinned(!1),T.closeLeft();return}if(Er){nn("left-sidebar");return}qs()},[qs,nn,Er]),ro=v.useCallback(()=>{const T=Sr.getState();T.leftPinned?(T.setLeftPinned(!1),T.openLeft()):(T.setLeftPinned(!0),T.openLeft())},[]),gl=v.useCallback(()=>{const T=Sr.getState();T.setLeftPinned(!1),T.closeLeft()},[]),ko=v.useCallback(()=>{const T=Sr.getState();T.rightPinned?(T.setRightPinned(!1),T.openRight()):(T.setRightPinned(!0),T.openRight())},[]),Tc=v.useCallback(()=>{const T=Sr.getState();T.setRightPinned(!1),T.closeRight()},[]),Vo=v.useRef(null),Mn=v.useRef(null);v.useEffect(()=>()=>Mn.current?.(),[]);const Aa=v.useCallback(T=>{if(T.button!==0||!Vo.current)return;T.preventDefault(),Mn.current?.();const D=Sr.getState();Mn.current=nw(Vo.current,T.clientX,D.leftSidebarWidth,ie=>Math.min(Math.max(ie,200),500),ie=>Sr.getState().setLeftSidebarWidth(ie))},[]),xl=v.useRef(0),ta=v.useRef(0),Oa=v.useRef(null),jn=v.useRef(null);v.useEffect(()=>()=>jn.current?.(),[]);const ra=v.useCallback(T=>{if(T.button!==0)return;jn.current?.(),T.preventDefault();const D=document.body.style.cursor,ie=document.body.style.userSelect;xl.current=T.clientX;const De=Sr.getState(),dt=De.leftPinned?De.leftSidebarWidth:0;ta.current=Ch(De.rightSidebarWidth,window.innerWidth,dt);const Ot=Dn=>{Oa.current===null&&(Oa.current=requestAnimationFrame(()=>{Oa.current=null;const bn=xl.current-Dn.clientX,ln=Sr.getState(),ii=ln.leftPinned?ln.leftSidebarWidth:0;ln.setRightSidebarWidth(Ch(ta.current+bn,window.innerWidth,ii))}))},wr=()=>{window.removeEventListener("mousemove",Ot),jn.current=null,Oa.current!==null&&(cancelAnimationFrame(Oa.current),Oa.current=null),document.body.style.cursor=D,document.body.style.userSelect=ie};document.body.style.cursor="col-resize",document.body.style.userSelect="none",jn.current=q5({onFinish:wr}),window.addEventListener("mousemove",Ot)},[]),ji=v.useCallback(()=>{const T=Sr.getState();if(T.rightPinned){T.setRightPinned(!1),T.closeRight();return}if(ar){nn("right-sidebar");return}Ni()},[Ni,nn,ar]),Io=v.useCallback(()=>{!Ei&&!l&&typeof window<"u"&&ns.current==="right-sidebar"&&C0(window.history.state)==="right-sidebar"&&(Wu("right-sidebar-file-preview"),Ws.current="right-sidebar-file-preview"),ea(!0)},[Ei,l,ea]),Ul=v.useCallback(()=>{nn("right-sidebar-file-preview")},[nn]),zl=v.useCallback(()=>{!Dt&&!l&&typeof window<"u"&&ns.current==="right-sidebar"&&C0(window.history.state)==="right-sidebar"&&(Wu("right-sidebar-repo-picker"),Ws.current="right-sidebar-repo-picker"),pr(!0)},[Dt,l]),bl=v.useCallback(()=>{nn("right-sidebar-repo-picker")},[nn]),Di=v.useCallback(()=>{!at&&!l&&typeof window<"u"&&ns.current&&C0(window.history.state)===ns.current&&(Wu("markdown-outline"),Ws.current="markdown-outline"),Mt(!0)},[at,l]),ti=v.useCallback(()=>{nn("markdown-outline")},[nn]),na=v.useCallback(()=>{!l&&typeof window<"u"&&ns.current&&C0(window.history.state)===ns.current&&(Wu("markdown-image-lightbox"),Ws.current="markdown-image-lightbox"),Ce(!0)},[l]),sa=v.useCallback(()=>{nn("markdown-image-lightbox")},[nn]),ia=v.useCallback(()=>{!l&&typeof window<"u"&&ns.current&&C0(window.history.state)===ns.current&&(hQ("settings"),Ws.current="settings"),Sr.getState().closeAll(),an(!0)},[l]),ri=v.useCallback(()=>{nn("settings")},[nn]);v.useEffect(()=>{if(!xe)return;const T=()=>ia();return window.addEventListener("termdock:open-settings",T),()=>window.removeEventListener("termdock:open-settings",T)},[xe,ia]);const Zo=v.useCallback(()=>{Zt(!0),zt.current!==null&&(window.clearTimeout(zt.current),zt.current=null)},[]),vl=v.useCallback(()=>{zt.current!==null&&(window.clearTimeout(zt.current),zt.current=null),Zt(!1),ys.current=!0,Ah(),ys.current},[]);v.useEffect(()=>()=>{zt.current!==null&&window.clearTimeout(zt.current)},[]),v.useEffect(()=>{l||Ah()},[l]),v.useEffect(()=>{if(typeof window>"u"||l)return;let T=null;const D=()=>{T!==null&&(window.clearTimeout(T),T=null)},ie=Dn=>{if(ns.current,ys.current,ns.current){ns.current;return}!Dn?.force&&ys.current||(Dn?.userActivated&&(ys.current=!0),Ah(),ys.current,void 0)},De=()=>{D(),T=window.setTimeout(()=>{T=null,ie({force:!0})},U5)},dt=()=>{ie({userActivated:!0})},Ot=()=>{De()},wr=()=>{document.visibilityState==="visible"&&De()};return window.addEventListener("pointerdown",dt,{capture:!0,passive:!0}),window.addEventListener("touchstart",dt,{capture:!0,passive:!0}),window.addEventListener("keydown",dt,{capture:!0}),window.addEventListener("pageshow",Ot),document.addEventListener("visibilitychange",wr),()=>{D(),window.removeEventListener("pointerdown",dt,{capture:!0}),window.removeEventListener("touchstart",dt,{capture:!0}),window.removeEventListener("keydown",dt,{capture:!0}),window.removeEventListener("pageshow",Ot),document.removeEventListener("visibilitychange",wr)}},[l]),v.useEffect(()=>{ns.current=rs},[rs]),v.useEffect(()=>{if(typeof window>"u"||rs||l)return;const T=window.setTimeout(()=>{ns.current?(ns.current,void 0):Ah()},U5);return()=>window.clearTimeout(T)},[rs,l]),v.useEffect(()=>{if(typeof window>"u"||l)return;const T=Ws.current;Gs.current,rs&&rs!==T&&!Gs.current&&Wu(rs),!rs&&T&&Ls(),Ws.current=rs,!rs&&Gs.current&&window.setTimeout(()=>{Gs.current=!1},0)},[rs,l,Ls]),v.useEffect(()=>{if(typeof window>"u"||l)return;const T=()=>{const D=ns.current;if(ys.current,!D){ys.current=!1,ys.current,Zo(),lv();return}Gs.current=!0,fs(D)};return window.addEventListener("popstate",T),()=>window.removeEventListener("popstate",T)},[fs,Zo,l]),v.useEffect(()=>{const T=D=>{const ie=D.metaKey||D.ctrlKey;if(ie&&D.key==="b"&&!D.shiftKey&&(D.preventDefault(),Mi()),ie&&D.shiftKey&&D.key==="E"&&(D.preventDefault(),ji()),ie&&D.shiftKey&&D.key==="P"&&(D.preventDefault(),Ri()),ie&&!D.shiftKey&&D.altKey&&(D.key==="ArrowLeft"||D.key==="ArrowRight")){D.preventDefault();const De=D.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:De}}));return}if(ie&&D.shiftKey&&!D.altKey&&(D.code==="BracketLeft"||D.code==="BracketRight")){D.preventDefault();const De=D.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:De}}));return}};return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}},[Mi,ji,Ri]);const Qi=v.useCallback(async()=>{be(!0),Ke(null);try{const T=await Ka({localAccess:{name:ce}});ne(T.localAccess),Ne(T.localAccess.name),Bn(Uu,{preventSleep:T.preventSleep,networkAvailable:T.networkAvailable,localAccess:T.localAccess})}catch(T){Ke(T instanceof Error?T.message:"Failed to save local access name")}finally{be(!1)}},[ce]),Fa=v.useCallback(async()=>{be(!0),Ke(null);try{const T=await Ka({localAccess:{reset:!0}});ne(T.localAccess),Ne(T.localAccess.name),Bn(Uu,{preventSleep:T.preventSleep,networkAvailable:T.networkAvailable,localAccess:T.localAccess})}catch(T){Ke(T instanceof Error?T.message:"Failed to reset local access name")}finally{be(!1)}},[]),gn=v.useCallback(async(T,D="url")=>{if(T)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(T);else{const ie=document.createElement("textarea");ie.value=T,ie.style.position="fixed",ie.style.left="-9999px",document.body.appendChild(ie),ie.focus(),ie.select(),document.execCommand("copy"),document.body.removeChild(ie)}Be(D),window.setTimeout(()=>Be(ie=>ie===D?null:ie),1600)}catch{Be(null)}},[]),Is=v.useCallback(T=>{const D=pQ(gt,T);D.map(ie=>ie.id).join("\0")!==gt.map(ie=>ie.id).join("\0")&&(fe(D),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:D.map(ie=>ie.id)}})))},[gt]),Fs=v.useCallback(T=>{kt||T.type!=="session"||(We.current=!1,ki(!1),ts(T.draggableId))},[kt]),Ta=v.useCallback(T=>{if(kt||T.type!=="session")return;const D=T.destination?.droppableId===n1;D!==We.current&&(We.current=D,ki(D),D&&navigator.vibrate?.(20))},[kt]),aa=v.useCallback(T=>{const D=XD(T,!kt);if(We.current=!1,ki(!1),ts(null),!D)return!1;const ie=gt.find(dt=>dt.id===T.draggableId),De=ie?Ft.get(ie.id):null;return ie&&t5({mode:ie.mode,activeProgram:De?.activeProgram??null,promptState:De?.promptState??null,shellNames:ja})?(sr(null),Qt(ie.id),Gn(null)):ie&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:ie.id,source:"other",closeMode:ie.mode==="tmux"?"destroy":"auto"}})),!0},[kt,gt,Ft,Qt]),{groups:Ca,arranged:$s}=L.useMemo(()=>qh(gt,T=>Ft.get(T.id)?.cwd??null,Bs,e("sidebar.ungrouped"),Ir,bs),[gt,Ft,Bs,e,Ir,bs]),$a=v.useCallback(T=>{aa(T)||T.reason==="CANCEL"||!T.destination||T.source.index===T.destination.index||window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:$s[T.source.index]?.id,targetId:$s[T.destination.index]?.id}}))},[aa,$s]),Eo=v.useCallback((T,D)=>{const ie=D.trim();ie&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:T,name:ie}}))},[]),oa=v.useCallback(T=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:T}}))},[]),{newSessionMode:_s,newSessionTmuxName:Gi,userSelectedNewSessionMode:No,setNewSessionMode:ss}=UM(),[qi,Ro]=v.useState(null),[fi,no]=L.useState(!1),[Yo,so]=L.useState(!1),[Mo,Sa]=L.useState(!1),[ni,ws]=L.useState("idle"),se=L.useRef(cc(wh,nQ)).current,[Re,et]=L.useState(()=>{const T=se?.presets;if(T&&T.length>0){const D=N0(T);if(D.length>0)return D}return bd()}),[_t,ze]=L.useState(!1),[k,j]=L.useState("default"),O=L.useRef(typeof se?.updatedAt=="number"?se.updatedAt:null),z=L.useRef(!1),[Te,Se]=L.useState(!1),[Le,ut]=L.useState(!1),Wt=L.useRef(cc(Ma,rQ)).current,[fr,yr]=L.useState(Wt??[]),[us,ps]=L.useState(Wt!==null),[Kn,rr]=L.useState(!1),un=!Vr&&!ct&&(!rs||rs==="right-sidebar"||rs==="right-sidebar-file-preview"||rs==="left-sidebar")&&!Yo&&!Mo&&!fi&&!Te&&!Le&&!Ht&&!qe&&!qi,ms=un&&!rs,xn=L.useCallback(T=>{const D=typeof T.version=="number"?T.version:0,ie=sQ(Array.isArray(T.presets)?T.presets:[],D);O.current=typeof T.updatedAt=="number"?T.updatedAt:null,et(De=>sw(De,ie)?De:(z.current=!0,ie)),Bn(wh,{version:Zu,presets:ie,updatedAt:O.current??void 0})},[]);v.useEffect(()=>{const T=D=>{if(D.key!=="Escape"||D.defaultPrevented||D.isComposing||a1())return;if(Yo){D.preventDefault(),so(!1);return}if(Mo){D.preventDefault(),Sa(!1);return}if(fi){D.preventDefault(),no(!1);return}if(Te){D.preventDefault(),Se(!1);return}if(Le){D.preventDefault(),ut(!1);return}if(Ht){D.preventDefault(),$e();return}if(wn){D.preventDefault(),en(null),Ln(null);return}if($r){D.preventDefault(),ri();return}if(ar&&!(Qs&&kt)){D.preventDefault(),nn("right-sidebar");return}Er&&!(br&&kt)&&(D.preventDefault(),nn("left-sidebar"))};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[Yo,Mo,fi,Te,Ht,$e,$r,ar,Qs,Er,br,kt,ri,nn]),v.useEffect(()=>{ps(!0)},[]);const[io,Es]=L.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:cv}),[,Hl]=L.useState(!1),La=L.useCallback(()=>iw().then(T=>{Es(T),ja=new Set(T.shellNames),Gd(T.shellNames),Hl(!0)}).catch(()=>{}),[]);v.useEffect(()=>{La()},[La]),v.useEffect(()=>xm(T=>{if(T.type==="config-updated"){if(T.key==="toolbar-presets"){Rg().then(D=>xn(D)).catch(D=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",D)});return}T.key==="program-detection"&&La()}}),[xn,La]),v.useEffect(()=>{let T=!1;return(async()=>{try{const D=await Rg();if(T)return;xn(D)}catch(D){console.warn("[toolbar-presets] Failed to load from server:",D)}finally{T||ze(!0)}})(),()=>{T=!0}},[xn]),v.useEffect(()=>{if(_t){if(z.current){z.current=!1;return}Bn(wh,{version:Zu,presets:Re,updatedAt:O.current??void 0}),aw({version:Zu,presets:Re,baseUpdatedAt:O.current??void 0}).then(T=>{O.current=typeof T.updatedAt=="number"?T.updatedAt:null,Bn(wh,{version:Zu,presets:Re,updatedAt:O.current??void 0})}).catch(T=>{const D=T instanceof Error&&"current"in T?T.current:null;D&&typeof D=="object"&&xn(D),console.warn("[toolbar-presets] Failed to save to server:",T)})}},[xn,Re,_t]),v.useEffect(()=>{V0().then(T=>{y(D=>D===T.preventSleep?D:T.preventSleep),C(D=>D===T.networkAvailable?D:T.networkAvailable),ne(T.localAccess),Ne(T.localAccess.name),_n(T.runningSessionButtonEnabled),Bn(zu,T.runningSessionButtonEnabled),Ss(T.attentionButtonEnabled),Bn(Hu,T.attentionButtonEnabled),Bn(Uu,{preventSleep:T.preventSleep,networkAvailable:T.networkAvailable,localAccess:T.localAccess})}).catch(()=>{})},[]),v.useEffect(()=>{if(!S)return;const T=ap();H(T),T!=="granted"&&(I(!1),qd(!1))},[S]),v.useEffect(()=>{if(!S)return;pu();const T=()=>{document.visibilityState==="visible"&&(pu(),vw())},D=window.setInterval(()=>{pu()},360*60*1e3);return document.addEventListener("visibilitychange",T),window.addEventListener("focus",T),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",T),window.removeEventListener("focus",T)}},[S]);const yl=v.useCallback(async()=>{if(S){I(!1),qd(!1),ow(),H(ap());return}const T=await lw();if(H(T),T!=="granted"){I(!1),qd(!1);return}I(!0),qd(!0),await pu(!0,!0),ws("idle")},[S]),ru=v.useCallback(async()=>{ws("checking"),await Nl()?.prepareNotificationTest?.();const T=await cw({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});ws(T?"delivered":"failed")},[e]),e0=v.useCallback(T=>{Q(T),uw(T),op()},[]),t0=v.useCallback(T=>{B(T),dw(T),op()},[]),zf=v.useCallback(T=>{K(T),hw(T),op()},[]);v.useEffect(()=>{Re.some(T=>T.id===k)||j(Re[0]?.id??"default")},[k,Re]),v.useEffect(()=>{if(!cr.available&&_s==="tmux"){ss("shell",{userInitiated:!1});return}cr.available&&No!=="shell"&&_s!=="tmux"&&ss("tmux",{userInitiated:!1})},[_s,cr.available,No,ss]),v.useEffect(()=>{Ro(null)},[$r,_s,cr.available]),v.useEffect(()=>{const T={};typeof navigator<"u"&&(T.userAgent=navigator.userAgent,T.platform=navigator.platform,T.maxTouchPoints=navigator.maxTouchPoints,T.hasTouch=navigator.maxTouchPoints>0||"ontouchstart"in window,T.vendor=navigator.vendor),typeof window<"u"&&(T.screenWidth=window.innerWidth,T.screenHeight=window.innerHeight,T.pixelRatio=window.devicePixelRatio,T.orientation=window.screen?.orientation?.type||"unknown",T.hasVisualViewport=!!window.visualViewport,T.visualViewportHeight=window.visualViewport?.height,T.visualViewportWidth=window.visualViewport?.width,T.location=window.location.href),T.timestamp=new Date().toISOString(),T.isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,T.isAndroid=/Android/.test(navigator.userAgent),Wr(T)},[]);const Hf=v.useCallback(T=>{if(aa(T)||T.reason==="CANCEL"||!T.destination)return;if(T.type==="group"){if(T.source.index===T.destination.index)return;Is(kb(Ca,T.source.index,T.destination.index));return}if(T.source.droppableId!==T.destination.droppableId||T.source.index===T.destination.index)return;const D=T.source.droppableId.replace(/^group-sessions:/,""),ie=Ca.find(De=>De.key===D);ie&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:ie.sessions[T.source.index]?.id,targetId:ie.sessions[T.destination.index]?.id}}))},[Ca,Is,aa]),nu=L.useMemo(()=>$s.flatMap(T=>{const D=Ft.get(T.id);if(D?.agentStatus!=="working")return[];const{primary:ie,secondary:De}=cl(T,D?.activeProgram??null,D?.cwd??null,ja,D?.shellTitle??null,D?.promptState??null);return[{id:T.id,label:ie,detail:De}]}),[$s,Ft]),su=wt?$s.findIndex(T=>T.id===wt):-1,iu=$s.length>0&&su>=0?`${su+1}/${$s.length}`:`${$s.length}`,ao=L.useMemo(()=>{let T=0;for(const D of gt){const ie=Ft.get(D.id);(ie?.agentStatus==="waiting"||ie?.agentNeedsReview)&&(T+=1)}return{running:nu.length,review:T}},[nu.length,gt,Ft]),_d=L.useMemo(()=>$s.flatMap(T=>{const D=Ft.get(T.id);if(D?.agentStatus!=="waiting"&&!D?.agentNeedsReview)return[];const{primary:ie}=cl(T,D.activeProgram,D.cwd,ja,D.shellTitle,D.promptState);return[{id:D.terminalSessionId??T.id,label:ie,waiting:D.agentStatus==="waiting"}]}),[$s,Ft]);fw(ao.running,ao.review,_d);const _a=wt?gt.find(T=>T.id===wt)??null:null,Wl=_a?Ft.get(_a.id):void 0,au=!!(_a&&Wl?.agentResumeRecovered&&Wl.agentNativeSessionId&&Wl.terminalSessionId),ka=_a&&Je?.sessionId===_a.id?Je:null;L.useLayoutEffect(()=>{if(!tn)return;const T=G.current;if(!T)return;const D=!le.current;T.scrollIntoView({inline:"nearest",block:"nearest",behavior:D?"auto":"smooth"}),le.current=!0,D&&R0("active-tab-positioned")},[wt,tn]),v.useEffect(()=>{qn&&yt.current&&(yt.current.scrollIntoView({block:"nearest",inline:"nearest"}),yt.current.focus(),yt.current.select()),qn||(P.current=!1)},[qn]);const kd=v.useCallback(T=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:T}))},[]),wl=v.useCallback((T,D)=>{W0(),mr(D??null),Fn(T)},[]);v.useEffect(()=>{const T=D=>{const ie=D.detail;ie&&gt.some(De=>De.id===ie.sessionId)&&wl(ie.sessionId,{x:ie.x,y:ie.y})};return window.addEventListener("termdock:session-context-menu",T),()=>window.removeEventListener("termdock:session-context-menu",T)},[wl,gt]);const Wf=Df(),Ua=v.useCallback(T=>{if(!T)return;St(T),kn.current&&Da("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:kn.current,requestedSessionId:T,activeSessionId:wt,sessions:gt.map(ie=>({id:ie.id,terminalSessionId:Ft.get(ie.id)?.terminalSessionId??null}))}),pw(T);const D=gt.find(ie=>ie.id===T||Ft.get(ie.id)?.terminalSessionId===T);D?(Os.current=null,kn.current&&Da("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:kn.current,requestedSessionId:T,targetSessionId:D.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):(Os.current=T,kn.current&&Da("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:kn.current,requestedSessionId:T}))},[wt,gt,Ft]);v.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let T=!1;const D=async()=>{if(window.parent!==window&&zo()){rn(!0);return}try{const De=await caches.open(lQ),dt=await De.match(z5);if(!dt)return;await De.delete(z5);const Ot=await dt.json();if(T)return;const wr=typeof Ot.sessionId=="string"?Ot.sessionId:null,Dn=typeof Ot.traceId=="string"?Ot.traceId:null,bn=typeof Ot.clickedAt=="number"?Ot.clickedAt:0,ln=Date.now()-bn;Da("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:Dn,sessionId:wr,ageMs:ln,valid:!!(wr&&ln>=0&&ln<=H5),visibilityState:document.visibilityState}),wr&&ln>=0&&ln<=H5&&(kn.current=Dn,typeof Ot.targetPeerId=="string"&&Ot.targetPeerId!==as()?.targetPeerId?zo()?.focusSession(Ot.targetPeerId,wr):Ua(wr))}catch(De){Da("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:De instanceof Error?De.message:String(De)})}finally{T||rn(!0)}},ie=()=>{document.visibilityState==="visible"&&D()};return D(),document.addEventListener("visibilitychange",ie),window.addEventListener("pageshow",D),()=>{T=!0,document.removeEventListener("visibilitychange",ie),window.removeEventListener("pageshow",D)}},[Ua]),v.useEffect(()=>{if(typeof window>"u")return;const T=new URLSearchParams(window.location.search),D=T.get("session");if(!D)return;Da("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:kn.current,targetSessionId:D,href:window.location.href,visibilityState:document.visibilityState});const ie=T.get("service");ie&&ie!==as()?.targetPeerId?zo()?.focusSession(ie,D):Os.current=D,T.delete("service"),T.delete("session"),T.delete("_notifTrace");const De=T.toString(),dt=`${window.location.pathname}${De?`?${De}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",dt)},[]),v.useEffect(()=>{if(typeof window>"u")return;const T=new URLSearchParams(window.location.search);if(T.get("_notif")!=="1")return;const D=T.get("session");T.delete("_notif");const ie=T.toString(),De=`${window.location.pathname}${ie?`?${ie}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",De),window.parent!==window&&zo())return;const dt=new BroadcastChannel("termdock:notif");let Ot=!1;const wr=bn=>{bn.data?.type==="termdock:notif-pong"&&!Ot&&(Ot=!0,dt.close(),window.close())};dt.addEventListener("message",wr),dt.postMessage({type:"termdock:notif-ping",sessionId:D,targetPeerId:T.get("service")});const Dn=setTimeout(()=>{Ot||dt.close()},500);return()=>{clearTimeout(Dn),Ot||dt.close()}},[]),v.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&zo())return;const T=new BroadcastChannel("termdock:notif"),D=ie=>{ie.data?.type==="termdock:notif-ping"&&(T.postMessage({type:"termdock:notif-pong"}),typeof ie.data.sessionId=="string"&&(typeof ie.data.targetPeerId=="string"&&ie.data.targetPeerId!==as()?.targetPeerId?zo()?.focusSession(ie.data.targetPeerId,ie.data.sessionId):Ua(ie.data.sessionId)))};return T.addEventListener("message",D),()=>T.close()},[Ua]),v.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const T=D=>{const ie=D.data;if(ie&&ie.type==="termdock:focus-session"&&typeof ie.sessionId=="string"){if(typeof ie.targetPeerId=="string"&&ie.targetPeerId!==as()?.targetPeerId){zo()?.focusSession(ie.targetPeerId,ie.sessionId)&&D.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}D.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),Ua(ie.sessionId)}else ie?.type==="termdock:push-subscription-changed"?pu(!0):ie?.type};return navigator.serviceWorker.addEventListener("message",T),()=>navigator.serviceWorker.removeEventListener("message",T)},[Ua]),v.useEffect(()=>{const T=D=>{const ie=D.detail;typeof ie=="string"&&Ua(ie)};return window.addEventListener("termdock:focus-session",T),()=>window.removeEventListener("termdock:focus-session",T)},[Ua]),v.useEffect(()=>{const T=()=>{const D=yw(as()?.targetPeerId);D&&Ua(D)};return T(),window.addEventListener("termdock:workspace-session",T),()=>window.removeEventListener("termdock:workspace-session",T)},[Ua]),v.useEffect(()=>{const T=Os.current;if(!T)return;const D=gt.find(ie=>ie.id===T||Ft.get(ie.id)?.terminalSessionId===T);D?(Os.current=null,kn.current&&Da("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:kn.current,requestedSessionId:T,targetSessionId:D.id,activeSessionId:wt}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):kn.current&&Da("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:kn.current,requestedSessionId:T,activeSessionId:wt,sessions:gt.map(ie=>({id:ie.id,terminalSessionId:Ft.get(ie.id)?.terminalSessionId??null}))})},[wt,gt,Ft]);const za=L.useMemo(()=>{const T=[];for(const D of gt){const ie=Ft.get(D.id);(ie?.agentStatus==="waiting"||ie?.agentNeedsReview)&&T.push(D.id)}return T},[gt,Ft]),Gl=v.useCallback(()=>{if(za.length===0)return;wt&&Mr.getState().clearAgentNeedsReview(wt);const T=wt?gt.findIndex(ie=>ie.id===wt):-1,D=za.find(ie=>gt.findIndex(De=>De.id===ie)>T)??za[0];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[za,gt,wt]),Cc=v.useCallback(()=>{if(za.length===0)return;wt&&Mr.getState().clearAgentNeedsReview(wt);const T=wt?gt.findIndex(ie=>ie.id===wt):gt.length,D=[...za].reverse().find(ie=>gt.findIndex(De=>De.id===ie)<T)??za[za.length-1];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[za,gt,wt]);v.useEffect(()=>{const T=D=>{!D.altKey||!D.shiftKey||D.metaKey||D.ctrlKey||D.key!=="ArrowUp"&&D.key!=="ArrowDown"||(D.preventDefault(),D.key==="ArrowUp"?Cc():Gl())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[Gl,Cc]);const r0=v.useCallback(async T=>{const ie=Mr.getState().sessions.get(T)?.cwd;if(ie)try{await navigator.clipboard?.writeText(ie),Zn(ie),window.setTimeout(()=>{Zn(De=>De===ie?null:De)},1400)}catch{}},[]),n0=v.useCallback(T=>{fe(T.sessions),Tn(T.activeSessionId),es(T.splitWorkspaces),Mr.getState().setActiveSessionId(T.activeSessionId)},[]),Id=v.useCallback(()=>{cn(!0)},[]),Al=v.useCallback(()=>{cn(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);v.useEffect(()=>{if(!mn||!wt)return;gt.find(D=>D.id===mn||Ft.get(D.id)?.terminalSessionId===mn)?.id===wt&&St(null)},[wt,mn,gt,Ft]);const s0=v.useRef(!1),[ql,ou]=v.useState(!1),jo=v.useCallback(T=>{const D=!T?.onResult;if(D&&s0.current)return;D&&(s0.current=!0,ou(!0));const ie=T?.mode??_s,De=ie==="tmux"&&(T?.tmuxSessionName?.trim()||Gi.trim())||void 0,dt=T?.cwd||(wt?Mr.getState().sessions.get(wt)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:ie,tmuxSessionName:De,cwd:dt,command:T?.command,shouldActivate:T?.shouldActivate,onResult:T?.onResult??(Ot=>{s0.current=!1,ou(!1),Ot.ok||Gr({tone:"error",message:e(km(Ot.error))})})}}))},[_s,Gi,wt,e]),Ko=v.useCallback(async()=>{Ts(!0);try{const T=await pm();if(Et(T),!T.available){$t([]);return}const D=await mm();$t(D)}catch{Et({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),$t([])}finally{Ts(!1)}},[]),i0=v.useCallback(async T=>{const{cleanedSessions:D}=await tb(T);for(const ie of D)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:ie}));await Ko()},[Ko]),Gf=v.useCallback(async T=>{wa(T),Gn(null);try{await i0(T),Ps(null)}catch(D){Gn(D instanceof Error?D.message:"Failed to kill tmux session")}finally{wa(null)}},[i0]);v.useEffect(()=>{if(!ls)return;if(or.find(ie=>ie.name===ls&&(ie.connected||ie.boundFrontendSessionId))){qr(null);return}const D=setTimeout(()=>qr(null),1e4);return()=>clearTimeout(D)},[ls,or]);const Sc=v.useCallback(T=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:T}))},[]),Ed=v.useCallback(T=>{const D=T??wt;D&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:D}))},[wt]),lu=v.useCallback((T,D)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:T,layout:D}}))},[]),Ha=v.useCallback((T,D)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:T,sessionIds:D}}))},[]),oo=v.useCallback((T,D)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:T,name:D}}))},[]),Vl=v.useCallback((T,D)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:T,secondaryId:D}}))},[]),Do=v.useCallback((T,D,ie)=>{const De=gt.find(Ot=>Ot.id===T);if(!De)return;const dt=Ft.get(T);if(ie?.skipConfirmation||!t5({mode:De.mode,activeProgram:dt?.activeProgram??null,promptState:dt?.promptState??null,shellNames:ja})){Sc({sessionId:T,source:"sidebar",closeMode:De.mode==="tmux"?"destroy":"auto"});return}sr(D?{x:D.clientX,y:D.clientY}:null),Qt(T),Gn(null)},[gt,Ft,Sc,Qt]);v.useEffect(()=>{if(!xe)return;const T=D=>{const ie=D.detail;ie==="new-session"?jo():ie==="close-session"?wt&&!qe&&Do(wt):ie==="previous-session"||ie==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:ie==="next-session"?"next":"prev"}})):ie==="toggle-left-sidebar"?Mi():ie==="toggle-right-sidebar"?ji():ie==="previous-attention"?Cc():ie==="next-attention"&&Gl()};return window.addEventListener("termdock:native-command",T),()=>window.removeEventListener("termdock:native-command",T)},[wt,qe,xe,jo,Do,Mi,ji,Gl,Cc]);const si=L.useMemo(()=>gt.find(T=>T.id===qe)??null,[gt,qe]),Zl=v.useCallback(()=>{if(!si||!st()){ft(null),sr(null);return}Sc({sessionId:si.id,source:"sidebar",closeMode:"destroy"}),ft(null),sr(null)},[si,Sc,st]),Nd=L.useRef(null),Wa=v.useCallback(()=>{ft(null),sr(null),Gn(null)},[]);L.useLayoutEffect(()=>{if(!qe)return;const T=()=>{st()||Wa()},D=()=>Wa();T();const ie=Mr.subscribe(T);return window.addEventListener(pl,T),window.addEventListener("auth:unauthorized",D),()=>{ie(),window.removeEventListener(pl,T),window.removeEventListener("auth:unauthorized",D)}},[qe,Ft,st,Wa]);const a0=L.useMemo(()=>{if(!si)return"";const T=Ft.get(si.id);return cl(si,T?.activeProgram??null,T?.cwd??null,ja,T?.shellTitle??null,T?.promptState??null).primary},[si,Ft]);v.useEffect(()=>{if(!$r)return;let T=!1,D=!1;const ie=async()=>{if(!D)try{const dt=await pm();if(T||Et(dt),!dt.available){T||$t([]);return}const Ot=await mm();T||$t(Ot)}catch{D=!0,T||(Et({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),$t([]))}};ie();const De=setInterval(()=>{ie()},4e3);return()=>{T=!0,clearInterval(De)}},[$r]);const cu=qi??_s,o0=cu==="shell",l0=cu==="tmux"&&cr.available,Rd=L.useMemo(()=>_b(or.map(T=>({...T,id:T.name})),T=>T.cwd??null,e("sidebar.ungrouped")),[or,e]),uu=L.useMemo(()=>or.filter(T=>T.recoveryCandidate===!0&&!T.connected&&!T.boundFrontendSessionId).sort((T,D)=>(D.lastActiveAt??D.createdAt??0)-(T.lastActiveAt??T.createdAt??0)),[or]);v.useEffect(()=>{!Er&&!(br&&kt)||Ko()},[Er,br,kt,gt.length,Ko]);const c0=(T,D,ie,De=!1)=>{const dt=T.id===wt,Ot=T.id===qn,wr=Ft.get(T.id),Dn=cl(T,wr?.activeProgram??null,wr?.cwd??null,ja,wr?.shellTitle??null,wr?.promptState??null),bn=Tr.get(T.id)?.displayName??Dn.primary,ln=Tr.get(T.id)?.displaySubtitle??Dn.secondary,ii=yd(wr?.cwd??null),Sn=D?ln??(ii&&ii!==bn?ii:null):null,Bi=wr?.gitStatus,Qo=`${wr?.cwd||T.name}${Bi?`
178
+ ⎇ ${Bi.branch} +${Bi.added} −${Bi.removed}`:""}`,Xo=Y1(wr),Kl=wr?.agentStatus==="working"||Xo?"var(--success)":wr?.agentStatus==="waiting"||wr?.agentNeedsReview?"var(--warning)":wr?.inCopyMode?"var(--tmux)":null;if(Ot&&kt&&!wn){const $n=T.customName?T.name:bn,kc=(Ga,Bd)=>{const u0=Bd.trim();u0?u0!==$n&&Eo(Ga,u0):oa(Ga),en(null)};return s.jsx("input",{ref:Ga=>{yt.current=Ga},type:"text",defaultValue:$n,className:"h-8 shrink-0 rounded-md bg-surface-elevated px-2 text-[12px] leading-none text-foreground outline-none ring-1 ring-primary/50 sm:h-8 min-w-[5rem]",style:{width:`${Math.max($n.length,5)}ch`},onKeyDown:Ga=>{Ga.key==="Enter"?kc(T.id,Ga.target.value):Ga.key==="Escape"&&en(null)},onBlur:Ga=>kc(T.id,Ga.target.value)})}return s.jsx("div",{ref:dt?G:null,onContextMenu:$n=>{$n.preventDefault(),$n.stopPropagation(),wl(T.id,{x:$n.clientX,y:$n.clientY})},onKeyDown:$n=>{if(!($n.key==="ContextMenu"||$n.shiftKey&&$n.key==="F10"))return;$n.preventDefault(),$n.stopPropagation();const kc=$n.currentTarget.getBoundingClientRect();wl(T.id,{x:kc.left,y:kc.bottom})},...Wf(()=>wl(T.id)),className:De?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${dt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/40 hover:text-foreground"}`:`group relative inline-flex h-8 shrink-0 items-center rounded-md text-[12px] leading-none transition sm:h-8 ${dt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!De&&dt&&Kl?{boxShadow:`inset 2px 0 0 0 ${Kl}`}:!De&&dt?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Qo,children:s.jsx("button",{type:"button",...ie??{},onClick:()=>kd(T.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${De?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${ie?"cursor-grab active:cursor-grabbing":""}`,title:Qo,children:s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 overflow-hidden",children:[s.jsxs("span",{className:"inline-flex shrink-0 items-center",children:[G5(T.mode,wr),wr?.agentResumeRecovered&&s.jsx(j0,{size:De?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")})]}),Sn?s.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[s.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${wr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:bn}),s.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:Sn})]}):s.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${wr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:bn})]})})})},Md=()=>s.jsx(Ml,{droppableId:n1,type:"session",isDropDisabled:kt,children:(T,D)=>{const ie=Cn||D.isDraggingOver;return s.jsxs("div",{ref:T.innerRef,...T.droppableProps,className:"pointer-events-none fixed left-1/2 top-[42%] z-toast flex h-32 w-32 -translate-x-1/2 -translate-y-1/2 items-center justify-center",role:"status","aria-live":"polite","aria-hidden":!cs,"data-mobile-session-destroy-target":"","data-active":ie?"true":"false",children:[s.jsxs("div",{className:`flex h-28 w-28 flex-col items-center justify-center gap-2 rounded-full border bg-surface-elevated/95 shadow-2xl backdrop-blur transition duration-200 ${cs?ie?"scale-110 border-destructive bg-destructive text-destructive-foreground opacity-100":"scale-100 border-destructive/50 text-destructive opacity-100":"scale-75 border-transparent opacity-0"}`,children:[s.jsx(Js,{size:28,strokeWidth:1.8}),s.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(ie?"tab.releaseToClose":"tab.dragToClose")})]}),T.placeholder]})}}),pi=br&&kt,Lc=Qs&&kt,du=Ch(hs,Yt,pi?Hn:0),_c=Lc?du+eb:0,Yl=pi?gt.find(T=>T.id===wt):null,Vs=Yl?Ft.get(Yl.id):void 0,qf=Yl?cl(Yl,Vs?.activeProgram??null,Vs?.cwd??null,ja,Vs?.shellTitle??null,Vs?.promptState??null).primary:"",jd=kt?on:null,Vf=pi&&!jd&&Vs?Vs.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":Vs.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":Vs.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":Vs.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",Dd=s.jsxs("div",{className:"w-full h-full flex flex-col app-chrome-bg text-foreground",children:[s.jsx("main",{className:"relative min-h-0 flex-1 overflow-visible px-0 pb-0 pt-0",children:s.jsxs(v_,{rightInset:_c,workspace:ct?s.jsx(L.Suspense,{fallback:s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[var(--chrome-bg)] text-sm text-muted-foreground",children:"正在打开待办…"}),children:s.jsx(gQ,{activeSessionId:wt,onOpenSidebar:Mi,leftSidebarVisible:Er||pi})}):Vr&&s.jsx(L.Suspense,{fallback:s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[var(--chrome-bg)] text-sm text-muted-foreground",children:"正在打开协作工作区…"}),children:s.jsx(mQ,{groupId:Vr,activeSessionId:wt,defaultSessionMode:_s,onOpenSidebar:Mi,leftSidebarVisible:Er||pi,onToggleRightSidebar:ji,rightSidebarOpen:ar||Lc},Vr)}),children:[s.jsxs("div",{"data-termdock-window-header":"true",className:`${kt?"absolute inset-x-0 top-0 z-20":"relative"} shrink-0 items-center gap-1 app-chrome-bg px-1 sm:px-1.5 transition-colors duration-500 ${pi?"flex justify-end":"flex justify-between"} ${Bs?"h-10 sm:h-10":"h-9 sm:h-10"} ${Vf}`,style:{position:kt?"absolute":void 0,marginRight:_c||void 0,display:jd?"none":void 0},children:[!pi&&s.jsxs("button",{type:"button",onClick:Mi,className:"relative inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-surface-elevated hover:text-foreground sm:h-8 sm:w-8","aria-label":e("tab.sessionsTitle"),title:`${e("tab.sessionsTitle")} · ${e("agent.aiRunning")}: ${ao.running} · ${e("agent.needsReview")}: ${ao.review}`,children:[s.jsx(N9,{size:14}),s.jsx(Tj,{runningCount:ao.running,reviewCount:ao.review,className:"sm:hidden"})]}),pi?s.jsx("div",{className:"absolute left-1/2 flex max-w-[40%] min-w-0 -translate-x-1/2 items-center justify-center gap-1.5 overflow-hidden",children:Yl?s.jsxs(s.Fragment,{children:[G5(Yl.mode,Vs),s.jsx("span",{className:`truncate text-[12px] font-medium ${Vs?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:qf}),Vs?.agentStatus==="working"&&s.jsx("span",{title:Vs?.agentMessage??void 0,children:s.jsx(Ti,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),Vs?.agentStatus==="waiting"&&s.jsx("span",{title:Vs?.agentMessage??void 0,children:s.jsx(Gh,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!Vs?.agentStatus&&Vs?.agentNeedsReview&&s.jsx("span",{title:Vs?.agentMessage??void 0,children:s.jsx(Ol,{size:13,className:"shrink-0 animate-pulse text-[color:var(--warning)]"})})]}):s.jsx("span",{className:"truncate px-2 text-[12px] text-muted-foreground",children:e("sidebar.sessions")})}):Bs?s.jsxs(k0,{onDragStart:Fs,onDragUpdate:Ta,onDragEnd:Hf,children:[Md(),s.jsx(Ml,{droppableId:"groups",type:"group",direction:"horizontal",children:T=>s.jsxs("div",{ref:T.innerRef,...T.droppableProps,className:"scrollbar-hidden flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden whitespace-nowrap px-0.5 py-0.5",style:{touchAction:"pan-x"},children:[Ca.map((D,ie)=>{let De=0,dt=0;for(const bn of D.sessions){const ln=Ft.get(bn.id);ln?.agentStatus==="working"&&(De+=1),(ln?.agentStatus==="waiting"||ln?.agentNeedsReview)&&(dt+=1)}const Ot=D.sessions.some(bn=>bn.id===wt),wr=Ur.has(D.key),Dn=D.key==="";return s.jsx(Rl,{draggableId:`group-${D.key||"__ungrouped__"}`,index:ie,isDragDisabled:Dn,disableInteractiveElementBlocking:!0,children:(bn,ln)=>s.jsxs("div",{ref:bn.innerRef,...bn.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${ln.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":Ot?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[s.jsxs("button",{type:"button",...Dn?{}:bn.dragHandleProps,onClick:()=>Pr(D.key),className:`flex ${wr?"":D.sessions.length>1?"w-0 min-w-full":""} items-center gap-0.5 rounded text-[9px] font-semibold uppercase tracking-[0.08em] leading-none transition hover:bg-surface-elevated/40 ${Dn?"":"cursor-grab active:cursor-grabbing"} ${Ot?"text-primary/80":"text-muted-foreground/55"}`,title:D.key||D.label,children:[s.jsx(Ci,{size:9,className:`shrink-0 opacity-70 transition-transform ${wr?"":"rotate-90"}`}),s.jsx("span",{className:"min-w-0 truncate",children:D.label}),De>0&&s.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),dt>0&&s.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${De>0?"":"ml-auto"}`})]}),wr?s.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:D.sessions.length})}):s.jsx(Ml,{droppableId:`group-sessions:${D.key}`,type:"session",direction:"horizontal",children:ii=>s.jsxs("div",{ref:ii.innerRef,...ii.droppableProps,className:"flex items-center gap-px",children:[D.sessions.map((Sn,Bi)=>s.jsx(Rl,{draggableId:Sn.id,index:Bi,disableInteractiveElementBlocking:!0,children:(Qo,Xo)=>s.jsx("div",{ref:Qo.innerRef,...Qo.draggableProps,className:`flex shrink-0 items-center ${Xo.isDragging?"opacity-70":""}`,children:c0(Sn,!1,Qo.dragHandleProps,!0)})},Sn.id)),ii.placeholder]})})]})},D.key||"__ungrouped__")}),T.placeholder,s.jsx("button",{type:"button",onClick:()=>jo(),disabled:ql,"aria-busy":ql,className:"my-auto inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":e("tab.new"),title:e("tab.new"),children:s.jsx(ui,{size:14})})]})})]}):s.jsxs(k0,{onDragStart:Fs,onDragUpdate:Ta,onDragEnd:$a,children:[Md(),s.jsx(Ml,{droppableId:"tabs",type:"session",direction:"horizontal",children:T=>s.jsxs("div",{ref:T.innerRef,...T.droppableProps,className:"scrollbar-hidden flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden whitespace-nowrap",style:{touchAction:"pan-x"},children:[$s.map((D,ie)=>D.id===qn?s.jsx(L.Fragment,{children:s.jsx(Rl,{draggableId:D.id,index:ie,isDragDisabled:!0,children:dt=>s.jsx("div",{ref:dt.innerRef,...dt.draggableProps,className:"flex h-full items-center",children:c0(D,!0)})})},D.id):s.jsx(L.Fragment,{children:s.jsx(Rl,{draggableId:D.id,index:ie,disableInteractiveElementBlocking:!0,children:(dt,Ot)=>s.jsx("div",{ref:dt.innerRef,...dt.draggableProps,className:`flex h-full shrink-0 items-center ${Ot.isDragging?"opacity-70":""}`,children:c0(D,!0,dt.dragHandleProps)})})},D.id)),s.jsx("button",{type:"button",onClick:()=>jo(),disabled:ql,"aria-busy":ql,className:"ml-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":e("tab.new"),title:e("tab.new"),children:s.jsx(ui,{size:14})}),T.placeholder]})})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!pi&&ao.running>0&&s.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:s.jsx(K6,{count:ao.running,tone:"running",title:e("agent.aiRunning")})}),!pi&&gt.length>0&&s.jsx("span",{className:"inline-flex shrink-0 items-center px-1 text-[10px] uppercase tracking-[0.16em] text-muted-foreground sm:text-[11px]",title:`Session ${su+1} of ${gt.length}`,children:iu}),wt&&s.jsx(jM,{sessionId:wt}),!pi&&s.jsx($3,{placement:"toolbar",onOpen:()=>Ds.getState().openTodos()}),!Lc&&s.jsx("button",{type:"button",onClick:ji,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-surface-elevated hover:text-foreground sm:h-8 sm:w-8","aria-label":e("tab.explorerTitle"),title:e("tab.explorerTitle"),children:s.jsx(J5,{size:14})})]})]}),au&&_a&&Wl?.terminalSessionId&&s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/15 bg-surface/80 px-3 py-2 animate-fade-in sm:px-4",style:{marginRight:_c||void 0},role:"status","data-testid":"agent-resume-recovery-banner",children:[s.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] text-[color:var(--warning)]",children:!ka?.error&&(ka?.status==="submitting"||ka?.status==="waiting")?s.jsx(Ti,{size:14,className:"animate-spin"}):s.jsx(j0,{size:14})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:e("tab.resumeAgentRecoveredTitle",{agent:Wl.agent?.displayName??"Agent"})}),s.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${ka?.error?"text-destructive":"text-muted-foreground"}`,children:ka?.error??(ka?.status==="submitting"?e("tab.resumeAgentSubmitting"):ka?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),s.jsx("button",{type:"button",disabled:!ka?.error&&(ka?.status==="submitting"||ka?.status==="waiting"),onClick:()=>{ee(_a.id,Wl.terminalSessionId)},className:"shrink-0 rounded-full bg-primary px-3 py-1.5 text-[11px] font-semibold text-primary-foreground transition hover:opacity-90 active:scale-95 disabled:cursor-wait disabled:opacity-60 sm:text-[12px]",children:ka?.error?e("common.retry"):e("tab.resumeAgentNow")}),s.jsx("button",{type:"button",onClick:()=>{Mr.getState().setAgentResumeRecovered(_a.id,!1),_r(T=>T?.sessionId===_a.id?null:T)},className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":e("tab.resumeAgentLater"),title:e("tab.resumeAgentLater"),children:s.jsx(zn,{size:13})})]}),s.jsx("div",{ref:Pe,className:"min-h-0 flex-1 flex overflow-hidden app-chrome-bg",children:s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(EM,{terminalSettings:yn,colorTheme:p,toolbarPresets:Re,showDebug:c&&kt,terminalFocusAvailable:ms,terminalReferenceAvailable:un,defaultSessionMode:_s,defaultTmuxSessionName:Gi,connectionPrioritySessionId:mn,connectionPriorityReady:tn,desktopRightSidebarEnabled:kt,onToggleRightSidebar:ji,desktopFloatingTitle:kt,desktopLeftSidebarPinned:pi,desktopPinnedLeftSidebarWidth:pi?Hn:0,desktopViewportWidth:Yt,onSessionDataUpdate:n0,onInitialViewportReady:Al,onInitialRecoveryRequired:Id})})})]})}),!Vr&&!ct&&s.jsx(kj,{reviewCount:ao.review,runningSessions:nu,activeSessionId:wt,runningButtonEnabled:Cs,attentionButtonEnabled:Kr,isDesktopLayout:kt,containerElement:$,occlusionInsets:{right:_c}}),$r&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-drawer-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm animate-fade-in cursor-default",onClick:ri,"aria-label":e("settings.closeSettings")}),s.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-dialog-title",className:"pointer-events-none fixed inset-0 z-drawer-panel flex items-stretch justify-center p-0 animate-fade-in sm:p-4 md:p-6",children:s.jsxs("div",{className:"pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden bg-surface shadow-[0_28px_90px_var(--app-shadow-strong),0_14px_34px_var(--app-shadow-soft)] sm:max-h-[calc(100dvh-3rem)] sm:rounded-3xl sm:border sm:border-border/15",style:{paddingTop:n,paddingBottom:a},children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border/15 px-4 py-3 sm:px-6 sm:py-4",children:[s.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[s.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-primary/15 text-primary sm:h-9 sm:w-9",children:s.jsx(bm,{size:15})}),s.jsx("h2",{id:"settings-dialog-title",className:"text-[15px] font-semibold text-foreground sm:text-[16px]",children:e("settings.title")})]}),s.jsx("button",{type:"button",onClick:ri,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive","aria-label":e("common.close"),children:s.jsx(zn,{size:16})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background/25 px-3 py-3 sm:px-6 sm:py-5 md:px-8",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.font")}),s.jsx("button",{type:"button",onClick:()=>Ar({fontSize:Math.max(8,Jr-1)}),className:"h-8 w-8 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:"−"}),s.jsx("input",{type:"range",min:"8",max:"32",value:Jr,onChange:T=>Ar({fontSize:parseInt(T.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),s.jsx("button",{type:"button",onClick:()=>Ar({fontSize:Math.min(32,Jr+1)}),className:"h-8 w-8 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:"+"}),s.jsxs("span",{className:"w-8 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:[Jr,"px"]})]}),s.jsx(YD,{}),s.jsx("div",{"data-terminal-renderer-controls":"browser-fallback",className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.render")}),s.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["auto","webgl","canvas"].map(T=>{const D=Fr===T;return s.jsx("button",{type:"button",onClick:()=>Ar({rendererMode:T}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(T==="auto"?"settings.auto":T==="webgl"?"settings.webgl":"settings.canvas")},T)})})]})}),s.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.theme")}),s.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[["dark",Xw,e("settings.darkTheme")],["light",Jw,e("settings.lightTheme")]].map(([T,D,ie])=>{const De=p===T;return s.jsxs("button",{type:"button",onClick:()=>m(T),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${De?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[s.jsx(D,{size:12}),s.jsx("span",{children:ie})]},T)})})]})}),s.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.newTab")}),s.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["shell","tmux"].map(T=>{const D=_s===T,ie=T==="tmux"&&!cr.available;return s.jsx("button",{type:"button",disabled:ie,onClick:()=>ss(T,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":ie?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:ie?cr.reason||e("settings.installTmuxHint"):void 0,children:e(T==="shell"?"settings.shell":"settings.tmux")},T)})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>h(!c),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${c?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,children:[s.jsx("span",{className:"font-medium",children:e("settings.debug")}),s.jsx(hl,{checked:c,size:"sm"})]}),s.jsxs("button",{type:"button",onClick:async()=>{const T=!b;y(T);try{const D=await Ka({preventSleep:T});y(D.preventSleep),C(D.networkAvailable),ne(D.localAccess),Bn(Uu,{preventSleep:D.preventSleep,networkAvailable:D.networkAvailable,localAccess:D.localAccess})}catch{y(!T)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${b?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!w&&b?e("settings.noSleepUnavailable"):void 0,children:[s.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),s.jsx(hl,{checked:b,size:"sm"})]})]})]}),s.jsxs("div",{className:"mt-3 space-y-2",children:[s.jsxs("button",{type:"button",role:"switch","aria-checked":Cs,"aria-label":e("sidebar.runningSessionButton"),onClick:()=>{Nn(!Cs)},className:"flex w-full items-center gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[s.jsx(Wh,{size:14,className:Cs?"shrink-0 text-[color:var(--success)]":"shrink-0 text-muted-foreground"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium text-foreground",children:e("sidebar.runningSessionButton")}),s.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:e("sidebar.runningSessionButtonHint")})]}),s.jsx(hl,{checked:Cs,size:"sm"})]}),s.jsxs("button",{type:"button",role:"switch","aria-checked":Kr,"aria-label":e("sidebar.attentionButton"),onClick:()=>{pn(!Kr)},className:"flex w-full items-center gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[s.jsx(Ol,{size:14,className:Kr?"shrink-0 text-[color:var(--warning)]":"shrink-0 text-muted-foreground"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium text-foreground",children:e("sidebar.attentionButton")}),s.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:e("sidebar.attentionButtonHint")})]}),s.jsx(hl,{checked:Kr,size:"sm"})]})]}),s.jsxs("button",{type:"button",onClick:()=>Sa(!0),className:"mt-3 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(Dw,{size:14,className:S?"shrink-0 text-primary":"shrink-0 text-muted-foreground"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block font-medium text-foreground",children:e("settings.notifications")}),s.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:e(S?N&&W?"settings.notificationsBothOnSummary":N?"settings.notificationsAiOnSummary":W?"settings.notificationsExitOnSummary":"settings.notificationsNoEventsSummary":"settings.notificationsOffSummary")})]})]}),s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:e(S?"common.on":"common.off")}),s.jsx("span",{children:"›"})]})]}),s.jsxs("button",{type:"button",onClick:()=>so(!0),className:"mt-3 flex w-full items-center justify-between gap-3 rounded-xl bg-surface-2 px-3 py-3 text-left transition hover:bg-surface-elevated",children:[s.jsxs("span",{children:[s.jsx("span",{className:"block text-[12px] font-medium text-foreground/90",children:e("settings.localAccess")}),s.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.localAccessHint")})]}),s.jsx(Ci,{size:16,className:"shrink-0 text-muted-foreground"})]}),s.jsx(zD,{state:ae,pending:je,onCheck:()=>{Gt()},onConfirmRestart:()=>{qt()},desktopState:mt?Nt:void 0,desktopPending:F,onCheckDesktop:mt?()=>{Yr()}:void 0,onInstallDesktop:()=>{Br()},desktopSnapshot:It,desktopActions:xe?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-1 gap-px border-t border-border/10 bg-border/10 sm:grid-cols-2",children:[s.jsxs("button",{type:"button",onClick:()=>{xe.showConnectionCenter()},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[s.jsx(n9,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),s.jsxs("button",{type:"button",onClick:()=>{Rt(null),xe.revealDataDirectory().catch(T=>Rt(T instanceof Error?T.message:String(T)))},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[s.jsx(ub,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),it&&s.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:it})]}):void 0}),s.jsx(WD,{backendSessionId:wt?Ft.get(wt)?.terminalSessionId??null:null}),s.jsx(qD,{state:Xe,onDismiss:()=>{Ye()}}),s.jsxs("div",{className:"mt-3 flex gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>{Ro(null),jo({mode:"shell"}),ri()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${o0?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:e(qi==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[s.jsx(ui,{size:14,className:o0?"shrink-0":"hidden"}),s.jsx(Go,{size:12}),s.jsx("span",{className:o0?"whitespace-nowrap":"hidden",children:e(qi==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),s.jsxs("button",{type:"button",disabled:!cr.available,onClick:()=>{cr.available&&(Ro(null),jo({mode:"tmux"}),ri())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${cr.available?l0?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"flex-1 bg-surface-2/50 text-muted-foreground/50 cursor-not-allowed"}`,title:cr.available?e(qi==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):cr.reason||e("settings.installTmuxHint"),children:[s.jsx(ui,{size:14,className:l0?"shrink-0":"hidden"}),s.jsx(bc,{size:12}),s.jsx("span",{className:l0?"whitespace-nowrap":"hidden",children:e(qi==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(cr.available||or.length>0)&&s.jsxs("details",{className:"mt-3 group rounded-xl bg-surface-2 [&[open]]:bg-surface-2",children:[s.jsxs("summary",{className:"flex cursor-pointer items-center justify-between rounded-xl px-3 py-2.5 text-[13px] hover:bg-surface-elevated",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-flex h-2 w-2 rounded-full ${cr.available?"bg-primary":"bg-destructive"}`}),s.jsx("span",{className:"font-medium",children:e("settings.tmuxServer")}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:cr.available?e("settings.sessions",{n:or.length}):e("settings.tmuxUnavailable")})]}),s.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),Ko()},disabled:fn,className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":e("settings.refresh"),children:s.jsx(sn,{size:12,className:fn?"animate-spin":""})})]}),s.jsx("div",{className:"px-2 pb-2",children:cr.available?or.length===0?s.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:e("settings.noTmuxSessions")}):s.jsxs("div",{className:"space-y-2",children:[Rd.map(T=>s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1.5 py-1 text-[10px] text-muted-foreground",children:[s.jsx(od,{size:11,className:"shrink-0 text-muted-foreground/70"}),s.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:T.label}),s.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:T.sessions.length})}),T.key&&s.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:T.key})]}),T.sessions.map(D=>{const ie=D.boundFrontendSessionId??null,De=!!(D.connected||ie),dt=ie?gt.find($n=>$n.id===ie)??null:null,Ot=D.friendlyName?.trim()||null,wr=D.label&&D.label!==D.name?D.label:null,Dn=Ot||wr||D.name,bn=Ot||wr?`tmux:${D.name}`:null,ln=D.clientCount&&D.clientCount>0?t==="zh"?`网页连接 ${D.clientCount}`:`Web clients ${D.clientCount}`:null,ii=D.attached>0?t==="zh"?`原生 tmux ${D.attached}`:`Native tmux ${D.attached}`:null,Sn=[bn,De?D.restorable?e("settings.restorable"):e("settings.attached"):null,ln,ii].filter($n=>!!$n),Bi=[e("settings.windows",{n:D.windows}),D.createdAt?new Date(D.createdAt).toLocaleDateString():null].filter($n=>!!$n),Qo=_i===D.name,Xo=Wn===D.name,Kl=ls===D.name;return s.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${Qo?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[s.jsx(bc,{size:13,className:De?"mt-0.5 shrink-0 text-primary":"mt-0.5 shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:Dn}),D.friendlyName&&s.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:t==="zh"?"自定义":"custom"})]}),Sn.length>0&&s.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:Sn.map($n=>s.jsx("span",{className:"max-w-full truncate",children:$n},$n))}),(D.program||D.cwd)&&s.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[D.program&&s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsx(w9,{size:10,className:"shrink-0 text-muted-foreground/70"}),s.jsx("span",{className:"truncate text-foreground/75",children:D.program})]}),D.cwd&&s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsx(od,{size:10,className:"shrink-0 text-muted-foreground/70"}),s.jsx("span",{className:"truncate",children:D.cwd})]})]}),s.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground/80",children:Bi.map($n=>s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(p9,{size:10,className:"shrink-0 text-muted-foreground/60"}),$n]},$n))})]}),Qo?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",disabled:Xo,onClick:()=>{Gf(D.name)},className:"shrink-0 rounded-full bg-destructive/90 px-2.5 py-1 text-[11px] font-medium text-destructive-foreground transition hover:bg-destructive disabled:opacity-50",children:Xo?"…":e("settings.destroy")}),s.jsx("button",{type:"button",disabled:Xo,onClick:()=>{Ps(null),Gn(null)},className:"shrink-0 rounded-full bg-surface-2 px-2.5 py-1 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated",children:e("common.cancel")})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>{dt?kd(dt.id):(qr(D.name),jo({mode:"tmux",tmuxSessionName:D.name}))},disabled:Kl,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${De?"bg-surface text-foreground hover:bg-surface-elevated":Kl?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:Kl?s.jsxs(s.Fragment,{children:[s.jsx(Ti,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(De?"settings.attached":"settings.attach")}),s.jsx("button",{type:"button",disabled:Xo,onClick:()=>{Gn(null),Ps(D.name)},className:"shrink-0 inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-destructive/15 hover:text-destructive","aria-label":`Kill tmux session ${D.name}`,children:s.jsx(Js,{size:12})})]})]},D.name)})]},T.key||"__ungrouped_tmux__")),di&&s.jsx("p",{className:"px-2 text-[11px] text-destructive",children:di})]}):s.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:cr.reason||e("settings.installTmuxHint")})})]}),s.jsxs("button",{type:"button",onClick:()=>no(!0),className:"mt-2 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(e9,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"font-medium text-foreground",children:e("settings.keyboardToolbar")})]}),s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:e("settings.sessions",{n:Re.length})}),s.jsx("span",{children:"›"})]})]}),s.jsxs("button",{type:"button",onClick:()=>Se(!0),className:"mt-2 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Ad,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"font-medium text-foreground",children:e("settings.aiAgentDetection")})]}),s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:"hooks"}),s.jsx("span",{children:"›"})]})]}),s.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.language")}),s.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[{code:"en",label:"English"},{code:"zh",label:"中文"}].map(T=>{const D=t===T.code;return s.jsx("button",{type:"button",onClick:()=>r(T.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:T.label},T.code)})})]}),s.jsxs("button",{type:"button",onClick:async()=>{try{await mw()}catch{}window.dispatchEvent(new CustomEvent("auth:unauthorized"))},className:"mt-3 flex w-full items-center justify-center gap-2 rounded-xl bg-destructive/10 px-3 py-2.5 text-[13px] font-medium text-destructive transition hover:bg-destructive/20 active:scale-[0.98]",children:[s.jsx(t9,{size:14}),e("settings.signOut")]})]})]})})]}),si&&s.jsxs(s.Fragment,{children:[s.jsx(GM,{sessionId:si.id,confirmButton:Nd,onConfirm:Zl,onCancel:Wa,isCurrent:st}),s.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm cursor-default animate-fade-in",onClick:()=>{ft(null),sr(null),Gn(null)},"aria-label":e("common.close")}),s.jsxs("div",{className:`fixed z-menu-panel rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in ${vt&&kt?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:vt&&kt?{...dm(vt),paddingBottom:a}:{paddingBottom:a},children:[s.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),s.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:a0}),s.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),s.jsxs("div",{className:"flex flex-col py-1",children:[s.jsxs("button",{type:"button",ref:Nd,onClick:Zl,className:"flex items-center gap-3 px-4 py-3 text-left text-[13px] text-destructive transition hover:bg-destructive/10",children:[s.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:s.jsx(Js,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.confirmDestroySession")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}),di&&s.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:di})]}),s.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:s.jsx("button",{type:"button",onClick:()=>{ft(null),sr(null),Gn(null)},className:"w-full rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")})})]})]}),Ht&&(()=>{const T=gt.find(ln=>ln.id===Ht);if(!T)return null;const D=Ft.get(T.id),{primary:ie}=cl(T,D?.activeProgram??null,D?.cwd??null,ja),De=kt,dt=De?dm(jr):{paddingBottom:a,maxHeight:"calc(100dvh - 3rem)"},Ot=De?"fixed z-menu-panel overflow-y-auto overflow-x-hidden rounded-lg bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in":"fixed inset-x-3 bottom-6 z-menu-panel mx-auto flex max-w-sm flex-col overflow-hidden rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",wr=De?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",Dn=De?"flex min-h-8 items-center gap-2 px-3 py-1 text-left text-[12px] transition":"flex items-center gap-3 px-4 py-3 text-left text-[13px] transition",bn=De?"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded":"inline-flex h-7 w-7 items-center justify-center rounded-full";return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:`fixed inset-0 z-menu-backdrop cursor-default animate-fade-in ${De?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:$e,"aria-label":e("tab.closeMenu")}),s.jsxs("div",{ref:ge,role:"dialog","aria-modal":"true","aria-label":`${e("tab.session")}: ${ie}`,tabIndex:-1,className:Ot,style:dt,children:[s.jsxs("div",{className:`${wr} shrink-0`,children:[!De&&s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),s.jsx("div",{className:`truncate font-medium text-foreground ${De?"text-[12px]":"mt-0.5 text-[14px]"}`,children:ie}),D?.cwd&&s.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:D.cwd})]}),s.jsxs("div",{className:"flex min-h-0 flex-col overflow-y-auto overscroll-contain py-1",children:[s.jsx(NM,{sessionId:T.id,compact:De,onDone:$e,onInsertTodoPrompt:()=>{Tt(T.id)}}),s.jsxs("button",{type:"button",onClick:()=>{const ln=jr;$e(),Ln(ln),en(T.id)},className:`${Dn} text-foreground hover:bg-surface-2`,children:[s.jsx("span",{className:`${bn} bg-primary/15 text-primary`,children:s.jsx(Ww,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.rename")}),!De&&s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.renameHint")})]})]}),s.jsxs("button",{type:"button",disabled:!D?.cwd,onClick:()=>{r0(T.id),$e()},className:`${Dn} ${D?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[s.jsx("span",{className:`${bn} bg-surface-2 text-muted-foreground`,children:s.jsx(Qw,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.copyCwd")}),!De&&s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.copyCwdHint")})]}),Vn&&Vn===D?.cwd&&s.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),(()=>{const ln=zh(T.id),ii=ln??Jr;return s.jsxs("div",{className:`${Dn} text-foreground`,children:[s.jsx("span",{className:`${bn} bg-surface-2 text-muted-foreground`,children:s.jsx(U9,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.fontSize")}),!De&&s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.fontSizeHint")})]}),s.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[s.jsx("button",{type:"button",onClick:()=>{Th(T.id,ii-1),Dr(Sn=>Sn+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} -1`,children:"−"}),s.jsxs("span",{className:"w-8 text-center text-[11px] tabular-nums text-muted-foreground",children:[ii,"px"]}),s.jsx("button",{type:"button",onClick:()=>{Th(T.id,ii+1),Dr(Sn=>Sn+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} +1`,children:"+"}),ln!==null&&s.jsx("button",{type:"button",onClick:()=>{Th(T.id,null),Dr(Sn=>Sn+1)},className:`ml-1 shrink-0 rounded-md text-[11px] text-primary transition hover:bg-primary/10 ${De?"inline-flex h-7 w-7 items-center justify-center":"px-1.5 py-1"}`,"aria-label":e("tab.fontSizeReset"),title:e("tab.fontSizeReset"),children:De?s.jsx(sn,{size:13}):e("tab.fontSizeReset")})]})]})})(),D?.agentNativeSessionId&&D.agentStatus!=="working"&&D.agentStatus!=="waiting"&&D.terminalSessionId&&s.jsxs("button",{type:"button",onClick:()=>{const ln=D.terminalSessionId;ln&&($e(),ee(T.id,ln))},className:`${Dn} text-foreground hover:bg-surface-2`,children:[s.jsx("span",{className:`${bn} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:s.jsx(j0,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),D.agent?.displayName?` · ${D.agent.displayName}`:""]}),!De&&s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.resumeAgentHint")})]})]}),s.jsx(F3,{sessionId:T.id,backendSessionId:D?.terminalSessionId,itemClassName:Dn,iconClassName:bn,compact:De,onDone:$e,onOpen:ln=>{$e(),Ds.getState().open(ln),pi||Sr.getState().closeLeft()}},T.id),s.jsx("div",{className:"my-1 border-t border-border/15"}),T.mode==="tmux"?s.jsxs("button",{type:"button",onClick:()=>{$e(),Do(T.id)},className:`${Dn} text-destructive hover:bg-destructive/10`,children:[s.jsx("span",{className:`${bn} bg-destructive/15 text-destructive`,children:s.jsx(Js,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.destroySession")}),!De&&s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}):s.jsxs("button",{type:"button",onClick:()=>{$e(),Sc({sessionId:T.id,source:"tab-menu",closeMode:"auto"})},className:`${Dn} text-destructive hover:bg-destructive/10`,children:[s.jsx("span",{className:`${bn} bg-destructive/15 text-destructive`,children:s.jsx(zn,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.close")}),!De&&s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.closeHint")})]})]}),!De&&s.jsx("p",{className:"px-4 py-2 text-[11px] leading-5 text-muted-foreground/80",children:e("tab.longPressTip")})]}),!De&&s.jsx("div",{className:"shrink-0 border-t border-border/15 px-3 py-2",children:s.jsx("button",{type:"button",onClick:$e,className:"w-full rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("tab.closeMenu")})})]})]})})(),qn&&wn&&kt&&(()=>{const T=gt.find(Sn=>Sn.id===qn);if(!T)return null;const D=Ft.get(T.id),{primary:ie}=cl(T,D?.activeProgram??null,D?.cwd??null,ja,D?.shellTitle??null,D?.promptState??null),De=T.customName?T.name:ie,dt=Sn=>{const Bi=Sn.trim();Bi?Bi!==De&&Eo(T.id,Bi):oa(T.id),en(null),Ln(null)},Ot=300,wr=160,Dn=wn.x,bn=wn.y,ln=Math.min(Math.max(Dn-Ot/2,12),window.innerWidth-Ot-12),ii=bn+wr+20>window.innerHeight?Math.max(bn-wr-12,12):bn+12;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-transparent",onClick:()=>{en(null),Ln(null)},"aria-label":e("common.cancel")}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":e("tab.rename"),className:"fixed z-menu-panel w-[300px] rounded-xl bg-surface-elevated border border-border/15 shadow-[0_12px_36px_var(--app-shadow-soft)] animate-fade-in",style:{left:`${ln}px`,top:`${ii}px`},children:[s.jsxs("div",{className:"border-b border-border/15 px-3 py-2.5",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.rename")}),s.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:ie}),D?.cwd&&s.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:D.cwd})]}),s.jsxs("form",{className:"px-3 py-2.5",onSubmit:Sn=>{Sn.preventDefault();const Bi=new FormData(Sn.currentTarget).get("session-name");dt(typeof Bi=="string"?Bi:"")},children:[s.jsx("input",{ref:Sn=>{yt.current=Sn,Sn&&!P.current&&(P.current=!0,Sn.focus({preventScroll:!0}),Sn.select())},type:"text",name:"session-name",defaultValue:De,placeholder:e("tab.renamePlaceholder"),autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,className:"w-full rounded-lg bg-surface-2 px-3 py-2 text-[13px] leading-snug text-foreground outline-none ring-1 ring-primary/40 placeholder:text-muted-foreground/60 focus:ring-primary/70",onKeyDown:Sn=>{Sn.key==="Escape"&&(Sn.stopPropagation(),en(null),Ln(null))}}),s.jsxs("div",{className:"mt-2.5 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{en(null),Ln(null)},className:"flex-1 rounded-full bg-surface-2 px-3 py-1.5 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")}),s.jsx("button",{type:"submit",className:"flex-1 rounded-full bg-primary px-3 py-1.5 text-[12px] font-semibold text-primary-foreground transition hover:bg-primary/90 active:scale-[0.97]",children:e("common.save")})]})]})]})]})})(),qn&&!kt&&(()=>{const T=gt.find(Ot=>Ot.id===qn);if(!T)return null;const D=Ft.get(T.id),{primary:ie}=cl(T,D?.activeProgram??null,D?.cwd??null,ja,D?.shellTitle??null,D?.promptState??null),De=T.customName?T.name:ie,dt=Ot=>{const wr=Ot.trim();wr?wr!==De&&Eo(T.id,wr):oa(T.id),en(null)};return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>en(null),"aria-label":e("common.cancel")}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":e("tab.rename"),className:"fixed inset-x-3 z-menu-panel mx-auto max-w-sm rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",style:{top:`calc(${n} + 3.5rem)`},children:[s.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),s.jsx("div",{className:"mt-0.5 text-[14px] font-medium text-foreground",children:e("tab.rename")})]}),s.jsxs("form",{className:"px-4 py-3",onSubmit:Ot=>{Ot.preventDefault();const wr=new FormData(Ot.currentTarget).get("session-name");dt(typeof wr=="string"?wr:"")},children:[s.jsx("input",{ref:Ot=>{yt.current=Ot,Ot&&!P.current&&(P.current=!0,Ot.focus({preventScroll:!0}),Ot.select())},type:"text",name:"session-name",defaultValue:De,placeholder:e("tab.renamePlaceholder"),autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"done",className:"w-full rounded-lg bg-surface-2 px-3 py-2.5 text-[16px] leading-snug text-foreground outline-none ring-1 ring-primary/40 placeholder:text-muted-foreground/60 focus:ring-primary/70",onKeyDown:Ot=>{Ot.key==="Escape"&&(Ot.stopPropagation(),en(null))}}),s.jsxs("div",{className:"mt-3 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>en(null),className:"flex-1 rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")}),s.jsx("button",{type:"submit",className:"flex-1 rounded-full bg-primary/20 px-3 py-2 text-[12px] font-medium text-primary transition hover:bg-primary/30",children:e("common.save")})]})]})]})]})})(),Yo&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":e("common.close"),className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>so(!1)}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"local-access-title",className:"fixed inset-x-3 top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface sm:top-[10%] sm:bottom-auto sm:max-h-[80vh]",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 p-4",children:[s.jsx("h2",{id:"local-access-title",className:"section-title",children:e("settings.localAccess")}),s.jsx("button",{autoFocus:!0,type:"button","aria-label":e("common.close"),onClick:()=>so(!1),className:"rounded-full bg-surface-2 p-2 text-muted-foreground",children:s.jsx(zn,{size:18})})]}),s.jsxs("div",{className:"overflow-y-auto overscroll-contain p-4",children:[s.jsx(w_,{state:Oe,onCopy:T=>{gn(T,"setup")},copied:he==="setup"}),s.jsxs("div",{className:"mt-3 flex items-center overflow-hidden rounded-lg bg-surface ring-1 ring-border/10 focus-within:ring-primary/40",children:[s.jsx("input",{value:ce,onChange:T=>Ne(T.target.value.toLowerCase()),className:"min-w-0 flex-1 bg-transparent px-2.5 py-2 text-[12px] text-foreground outline-none",placeholder:"jovn",spellCheck:!1}),s.jsx("span",{className:"shrink-0 border-l border-border/10 px-2.5 py-2 text-[11px] text-muted-foreground",children:".termdock.local"})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",disabled:Me,onClick:()=>{Qi()},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary transition hover:bg-primary/25 disabled:opacity-50",children:e(Me?"settings.saving":"common.save")}),s.jsx("button",{type:"button",disabled:Me,onClick:()=>{Fa()},className:"rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-50",children:e("settings.resetAutoName")})]}),s.jsxs("div",{className:"mt-3 space-y-1.5 text-[11px]",children:[Oe.url&&s.jsxs("button",{type:"button",onClick:()=>{gn(Oe.url,"lan")},className:"flex w-full items-center justify-between gap-2 rounded-lg bg-surface px-2.5 py-2 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[s.jsxs("span",{className:"min-w-0 truncate",children:["Branded: ",Oe.url]}),s.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:he==="lan"?"Copied":e("common.copy")})]}),Oe.interfaces.length>0&&s.jsxs("details",{className:"rounded-lg bg-surface px-2.5 py-2 text-muted-foreground",open:!1,children:[s.jsx("summary",{className:"cursor-pointer text-[11px] font-medium text-foreground/80",children:"IP fallback addresses"}),s.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:Oe.interfaces.map(T=>{const D=T.url??`${Oe.httpsEnabled?"https":"http"}://${T.address}:9834`;return s.jsxs("div",{className:"rounded-lg bg-surface-2 p-2",children:[s.jsxs("div",{className:"text-[11px] font-medium text-foreground/85",children:[T.label," (",T.name,")"]}),s.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:T.address}),T.qrDataUrl&&s.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:s.jsx("img",{src:T.qrDataUrl,alt:`QR code for ${D}`,className:"h-28 w-28"})}),s.jsxs("button",{type:"button",onClick:()=>{gn(D,`ip-${T.address}`)},className:"mt-2 flex w-full items-center justify-between gap-2 rounded-md bg-surface px-2 py-1.5 text-left text-[11px] transition hover:bg-surface-elevated",children:[s.jsx("span",{className:"min-w-0 truncate",children:D}),s.jsx("span",{className:"shrink-0 text-[10px]",children:he===`ip-${T.address}`?"Copied":e("common.copy")})]})]},`${T.name}-${T.address}`)})})]}),s.jsxs("div",{className:"text-muted-foreground",children:[Oe.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!Oe.caAvailable&&` · ${e("settings.caMissing")}`]}),Oe.reason&&s.jsx("div",{className:"text-[color:var(--warning)]",children:Oe.reason}),V&&s.jsx("div",{className:"text-destructive",children:V})]})]})]})]}),Mo&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Sa(!1)}),s.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[10%] sm:bottom-auto sm:max-h-[80vh]",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.notifications")}),s.jsx("h2",{className:"section-title mt-1",children:e("settings.notificationsTitle")})]}),s.jsx("button",{type:"button",onClick:()=>Sa(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close notifications settings",children:s.jsx(zn,{size:18})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[s.jsx("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:e("settings.notificationsPageHint")}),s.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsMaster")}),s.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:re==="denied"?e("settings.notificationsDenied"):Vd()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),Vd()&&!gw()&&s.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),s.jsx("button",{type:"button",onClick:()=>{yl()},disabled:!Vd()||re==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":S,children:s.jsx(hl,{checked:S,disabled:!Vd()||re==="denied"})})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[s.jsxs("span",{className:`rounded-full px-2 py-0.5 ${re==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",Nl()?e("settings.notificationsPermissionSystem"):re]}),s.jsx("button",{type:"button",disabled:!S||re!=="granted"||ni==="checking",onClick:()=>{ru()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:e(ni==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),Nl()?.openNotificationSettings&&s.jsx("button",{type:"button",onClick:()=>{Nl()?.openNotificationSettings?.()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:e("settings.notificationsOpenSystemSettings")})]}),ni!=="idle"&&ni!=="checking"&&s.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${ni==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(ni==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),s.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),s.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),s.jsx("div",{className:"mt-3 grid grid-cols-3 gap-1 rounded-xl bg-surface p-1",children:[["normal",e("settings.notificationsStyleNormal"),e("settings.notificationsStyleNormalHint")],["quiet",e("settings.notificationsStyleQuiet"),e("settings.notificationsStyleQuietHint")],["persistent",e("settings.notificationsStylePersistent"),e("settings.notificationsStylePersistentHint")]].map(([T,D,ie])=>{const De=U===T;return s.jsxs("button",{type:"button",disabled:!S,onClick:()=>zf(T),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${De&&S?"bg-primary/15 text-primary":S?"text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"cursor-not-allowed text-muted-foreground/40"}`,title:ie,children:[s.jsx("span",{className:"block truncate text-[11px] font-semibold",children:D}),s.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:ie})]},T)})})]}),s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.notificationsEvents")}),s.jsxs("div",{className:"mt-2 rounded-2xl bg-surface-2 p-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAiFinished")}),s.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAiFinishedHint")})]}),s.jsx("button",{type:"button",disabled:!S,onClick:()=>e0(!N),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":N&&S,children:s.jsx(hl,{checked:N&&S,disabled:!S})})]}),s.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-border/10 pt-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsSessionExited")}),s.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsSessionExitedHint")})]}),s.jsx("button",{type:"button",disabled:!S,onClick:()=>t0(!W),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":W&&S,children:s.jsx(hl,{checked:W&&S,disabled:!S})})]})]}),s.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),fi&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>no(!1)}),s.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-4xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.mobileKeyboard")}),s.jsx("h2",{className:"section-title mt-1",children:e("settings.toolbarPresets")})]}),s.jsx("button",{type:"button",onClick:()=>no(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close toolbar presets",children:s.jsx(zn,{size:18})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:s.jsx(FD,{presets:Re,selectedPresetId:k,onSelectPreset:j,onUpdatePreset:(T,D)=>{et(ie=>N0(ie.map(De=>De.id===T?D(De):De)))},onAddPreset:()=>{const T=`preset-${Date.now()}`;et(D=>N0([...D,{id:T,label:`Preset ${D.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),j(T)},onRemovePreset:T=>{et(D=>N0(D.filter(ie=>ie.id!==T)))},onResetDefaults:()=>{et(bd()),j("default")}})})]})]}),Te&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Se(!1)}),s.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-4xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.aiAgentDetection")}),s.jsx("h2",{className:"section-title mt-1",children:e("settings.detectionRules")})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("button",{type:"button",onClick:()=>Se(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close agent rules",children:s.jsx(zn,{size:18})})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[s.jsx("p",{className:"mb-4 text-[11px] text-muted-foreground",children:e("settings.agentHooksHint")}),s.jsx(UD,{}),s.jsxs("div",{className:"mt-6 border-t border-border/15 pt-4",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.programLabelResolution")}),s.jsx("h3",{className:"mt-1 text-sm font-semibold text-foreground",children:e("settings.rawCommandMapping")}),s.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e("settings.rawCommandMappingHint")}),s.jsx("div",{className:"mt-3 space-y-2 rounded-xl bg-surface-2 p-3",children:gt.map(T=>{const D=Ft.get(T.id),ie=D?.activeProgramRaw??null,De=D?.activeProgram??null;return s.jsxs("div",{className:"rounded-lg bg-surface/60 px-2.5 py-2",children:[s.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:T.name}),s.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[s.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",De||"—"]}),s.jsxs("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:[s.jsx("span",{className:"text-muted-foreground/80",children:"raw:"})," ",ie||"—"]})]},`raw-${T.id}`)})}),s.jsxs("div",{className:"mt-3 space-y-3",children:[[{key:"genericProgramNames",label:e("settings.genericProgramNames"),hint:e("settings.genericProgramNamesHint")},{key:"wrapperScriptNames",label:e("settings.wrapperScriptNames"),hint:e("settings.wrapperScriptNamesHint")},{key:"shellNames",label:e("settings.shellNamesConfig"),hint:e("settings.shellNamesHint")}].map(({key:T,label:D,hint:ie})=>s.jsxs("div",{children:[s.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:D}),s.jsx("div",{className:"text-[10px] text-muted-foreground",children:ie}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[io[T].map(De=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-mono text-foreground",children:[De,s.jsx("button",{type:"button",onClick:()=>{const dt={...io,[T]:io[T].filter(Ot=>Ot!==De)};Es(dt),T==="shellNames"&&(ja=new Set(dt.shellNames),Gd(dt.shellNames)),Mg(dt).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},De)),s.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:De=>{if(De.key!=="Enter")return;const dt=De.target.value.trim().toLowerCase();if(!dt||io[T].includes(dt))return;const Ot={...io,[T]:[...io[T],dt]};Es(Ot),T==="shellNames"&&(ja=new Set(Ot.shellNames),Gd(Ot.shellNames)),De.target.value="",Mg(Ot).catch(()=>{})}})]})]},T)),s.jsx("button",{type:"button",onClick:()=>{xw().then(T=>{Es(T),ja=new Set(T.shellNames),Gd(T.shellNames)}).catch(()=>{})},className:"rounded-full bg-surface-2 px-3 py-1 text-[11px] text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")})]}),s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"mb-1 text-[11px] font-medium text-foreground",children:e("settings.customRules")}),fr.map((T,D)=>s.jsx("div",{className:"mb-2 rounded-lg bg-surface-2 p-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:T.enabled!==!1,onChange:ie=>{const De=fr.map((dt,Ot)=>Ot===D?{...dt,enabled:ie.target.checked}:dt);yr(De),Bn(Ma,De),rr(!0),p0(De).then(dt=>{yr(dt),Bn(Ma,dt)}).catch(()=>{}).finally(()=>rr(!1))}}),s.jsxs("select",{value:T.matchType,onChange:ie=>{const De=fr.map((dt,Ot)=>Ot===D?{...dt,matchType:ie.target.value}:dt);yr(De),Bn(Ma,De),rr(!0),p0(De).then(dt=>{yr(dt),Bn(Ma,dt)}).catch(()=>{}).finally(()=>rr(!1))},className:"rounded bg-surface px-2 py-1 text-[11px]",children:[s.jsx("option",{value:"includes",children:"includes"}),s.jsx("option",{value:"exact",children:"exact"}),s.jsx("option",{value:"prefix",children:"prefix"}),s.jsx("option",{value:"regex",children:"regex"})]}),s.jsx("input",{value:T.pattern,onChange:ie=>{const De=fr.map((dt,Ot)=>Ot===D?{...dt,pattern:ie.target.value}:dt);yr(De),Bn(Ma,De)},onBlur:()=>{rr(!0),p0(fr).then(ie=>{yr(ie),Bn(Ma,ie)}).catch(()=>{}).finally(()=>rr(!1))},placeholder:"pattern",className:"min-w-[180px] flex-1 rounded bg-surface px-2 py-1 text-[11px] font-mono"}),s.jsx("input",{value:T.output,onChange:ie=>{const De=fr.map((dt,Ot)=>Ot===D?{...dt,output:ie.target.value}:dt);yr(De),Bn(Ma,De)},onBlur:()=>{rr(!0),p0(fr).then(ie=>{yr(ie),Bn(Ma,ie)}).catch(()=>{}).finally(()=>rr(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),s.jsx("button",{type:"button",onClick:()=>{const ie=fr.filter((De,dt)=>dt!==D);yr(ie),Bn(Ma,ie),rr(!0),p0(ie).then(De=>{yr(De),Bn(Ma,De)}).catch(()=>{}).finally(()=>rr(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},T.id)),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{const T=[...fr,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];yr(T),Bn(Ma,T),rr(!0),p0(T).then(D=>{yr(D),Bn(Ma,D)}).catch(()=>{}).finally(()=>rr(!1))},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-primary/25",children:e("settings.addRule")}),s.jsx("button",{type:"button",onClick:()=>{rr(!0),bw().then(T=>{yr(T),Bn(Ma,T)}).catch(()=>{}).finally(()=>rr(!1))},className:"rounded-full bg-surface-2 px-3 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:Kn?e("settings.saving"):us?`${fr.length} rules`:"…"})]})]})]})]})]})]}),Le&&s.jsx(jD,{isOpen:Le,onClose:()=>ut(!1)}),!pi&&s.jsx(M5,{isOpen:Er,drawerWidthPx:Pa,onClose:()=>nn("left-sidebar"),onOpen:qs,sessions:gt,activeSessionId:wt,sessionStates:Ft,onNewSession:T=>jo(T),recoverableTmuxSessions:uu,recoverableTmuxSessionsLoading:fn,onRefreshRecoverableTmuxSessions:()=>{Ko()},onCloseRecoverableTmuxSession:i0,onCloseSession:Do,onSplitSession:Ed,onCloseSplit:T=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:T})),onRemoveFromSplit:T=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:T})),splitWorkspaces:Ir,onSetSplitLayout:lu,onReorderSplitWorkspace:Ha,onRenameSplitWorkspace:oo,onCombineSplitSessions:Vl,onReorderSessions:Is,onSessionMenu:wl,onOpenSettings:ia,onJumpToNextAttention:za.length>0?Gl:void 0,onOpenQuota:()=>ut(!0),updateState:ae,updateActionPending:je,onConfirmUpdateRestart:qt,onRetryUpdate:Gt,serverHealthState:Xe,tmuxAvailable:cr.available,defaultSessionMode:_s,onTogglePinned:kt?ro:void 0}),!Lc&&s.jsx(j5,{isOpen:ar,sessionId:wt,drawerWidthPx:ei,onClose:()=>nn("right-sidebar"),onOpen:Ni,rightSidebarFilePreviewOpen:Ei,rightSidebarFilePreviewCloseSignal:Qr,onOpenRightSidebarFilePreview:Io,onCloseRightSidebarFilePreview:Ul,rightSidebarRepoPickerOpen:Dt,rightSidebarRepoPickerCloseSignal:pe,onOpenRightSidebarRepoPicker:zl,onCloseRightSidebarRepoPicker:bl,markdownOutlineOpen:at,markdownOutlineCloseSignal:er,onOpenMarkdownOutline:Di,onCloseMarkdownOutline:ti,markdownImageLightboxOpen:bt,markdownImageLightboxCloseSignal:lr,onOpenMarkdownImageLightbox:na,onCloseMarkdownImageLightbox:sa,onTogglePinned:kt?ko:void 0}),Xt&&!l&&s.jsx("button",{type:"button",onClick:vl,className:"fixed inset-0 z-toast flex cursor-default items-center justify-center bg-[var(--app-backdrop-soft)] px-6 text-left backdrop-blur-[1px]","aria-label":t==="zh"?"继续使用 Termdock":"Continue using Termdock",children:s.jsxs("div",{className:"max-w-[18rem] rounded-2xl border border-border/15 bg-surface/95 px-5 py-4 text-center shadow-[0_18px_50px_var(--app-shadow-strong)] backdrop-blur animate-fade-in",children:[s.jsx("div",{className:"text-[14px] font-semibold text-foreground",children:t==="zh"?"建议使用 Home":"Use Home instead"}),s.jsx("div",{className:"mt-1.5 text-[12px] leading-relaxed text-muted-foreground",children:t==="zh"?"按 Home 退后台,点任意位置继续。":"Use Home to leave. Tap anywhere to continue."}),s.jsx("div",{className:"mt-3 text-[11px] font-medium text-muted-foreground/80",children:t==="zh"?"轻点关闭提示":"Tap to dismiss"})]})}),c&&s.jsxs(s.Fragment,{children:[!kt&&s.jsx(A_,{onClose:()=>h(!1)}),s.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-toast hidden max-h-48 overflow-y-auto border-t border-border/15 bg-surface p-3 animate-fade-in md:block",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("h4",{className:"ui-kicker",children:"Debug Info"}),s.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Close"})]}),s.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(Jt,null,2)})]})]})]}),Qd=ht?s.jsx(Aw,{className:"z-modal-panel",status:"正在恢复会话…"}):null;return kt?s.jsxs("div",{className:"w-screen h-full flex flex-row",children:[pi&&s.jsx(s.Fragment,{children:s.jsxs("div",{ref:Vo,className:"relative",style:{width:Hn,flexShrink:0,height:"100%"},children:[s.jsx(M5,{isOpen:Er,drawerWidthPx:Hn,onClose:gl,onOpen:qs,sessions:gt,activeSessionId:wt,sessionStates:Ft,onNewSession:T=>jo(T),recoverableTmuxSessions:uu,recoverableTmuxSessionsLoading:fn,onRefreshRecoverableTmuxSessions:()=>{Ko()},onCloseRecoverableTmuxSession:i0,onCloseSession:Do,onSplitSession:Ed,onCloseSplit:T=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:T})),onRemoveFromSplit:T=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:T})),splitWorkspaces:Ir,onSetSplitLayout:lu,onReorderSplitWorkspace:Ha,onRenameSplitWorkspace:oo,onCombineSplitSessions:Vl,onReorderSessions:Is,onSessionMenu:wl,onOpenSettings:ia,onJumpToNextAttention:za.length>0?Gl:void 0,onOpenQuota:()=>ut(!0),updateState:ae,updateActionPending:je,onConfirmUpdateRestart:qt,onRetryUpdate:Gt,serverHealthState:Xe,tmuxAvailable:cr.available,defaultSessionMode:_s,pinned:!0,onTogglePinned:ro}),s.jsx("div",{role:"separator",tabIndex:-1,className:"absolute inset-y-0 right-0 z-20 w-[5px] cursor-col-resize hover:bg-border/30 active:bg-border/50 transition-colors",onMouseDown:Aa})]})}),s.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[Dd,Lc&&s.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:_c},children:[s.jsx("div",{role:"separator",tabIndex:-1,className:"h-full w-[5px] shrink-0 cursor-col-resize bg-border/10 transition-colors hover:bg-primary/30 active:bg-primary/50",onMouseDown:ra}),s.jsx("div",{style:{width:du,flexShrink:0,height:"100%"},children:s.jsx(j5,{isOpen:!0,sessionId:wt,drawerWidthPx:du,onClose:Tc,onOpen:Ni,pinned:!0,onTogglePinned:ko,rightSidebarFilePreviewOpen:Ei,rightSidebarFilePreviewCloseSignal:Qr,onOpenRightSidebarFilePreview:Io,onCloseRightSidebarFilePreview:Ul,rightSidebarRepoPickerOpen:Dt,rightSidebarRepoPickerCloseSignal:pe,onOpenRightSidebarRepoPicker:zl,onCloseRightSidebarRepoPicker:bl,markdownOutlineOpen:at,markdownOutlineCloseSignal:er,onOpenMarkdownOutline:Di,onCloseMarkdownOutline:ti,markdownImageLightboxOpen:bt,markdownImageLightboxCloseSignal:lr,onOpenMarkdownImageLightbox:na,onCloseMarkdownImageLightbox:sa})})]})]}),s.jsx(jg,{sessionId:wt}),Qd]}):s.jsxs(s.Fragment,{children:[Dd,s.jsx(jg,{sessionId:wt}),Qd]})}const CB=Object.freeze(Object.defineProperty({__proto__:null,default:xQ,runServiceUpdateConfirmation:uv},Symbol.toStringTag,{value:"Module"}));export{Ij as A,tD as C,N9 as P,lp as W,CB as a,GQ as b,Nf as c,$Q as d,TB as e,lD as f,G6 as g,WQ as h,HQ as i,yc as j,Ds as k,FQ as l,E_ as o,Mj as r,zQ as s,UQ as u};