@hotmeshio/long-tail 0.4.0 → 0.4.1

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 (182) hide show
  1. package/build/api/controlplane.d.ts +1 -0
  2. package/build/api/controlplane.js +1 -0
  3. package/build/routes/controlplane.js +2 -2
  4. package/dashboard/dist/assets/{AdminDashboard-CR0FtTE6.js → AdminDashboard-C0_qN2h3.js} +2 -2
  5. package/dashboard/dist/assets/{AdminDashboard-CR0FtTE6.js.map → AdminDashboard-C0_qN2h3.js.map} +1 -1
  6. package/dashboard/dist/assets/{AgentConfigPage-BVypgq9m.js → AgentConfigPage-DG1zOIiz.js} +5 -5
  7. package/dashboard/dist/assets/{AgentConfigPage-BVypgq9m.js.map → AgentConfigPage-DG1zOIiz.js.map} +1 -1
  8. package/dashboard/dist/assets/{AgentDetailPage-D64ath8c.js → AgentDetailPage-B5kaAJDM.js} +3 -3
  9. package/dashboard/dist/assets/{AgentDetailPage-D64ath8c.js.map → AgentDetailPage-B5kaAJDM.js.map} +1 -1
  10. package/dashboard/dist/assets/{AgentsPage-j-zblMNR.js → AgentsPage-DJWSuoJA.js} +2 -2
  11. package/dashboard/dist/assets/{AgentsPage-j-zblMNR.js.map → AgentsPage-DJWSuoJA.js.map} +1 -1
  12. package/dashboard/dist/assets/{AvailableEscalationsPage-DmUid1h0.js → AvailableEscalationsPage-DrarbHov.js} +2 -2
  13. package/dashboard/dist/assets/{AvailableEscalationsPage-DmUid1h0.js.map → AvailableEscalationsPage-DrarbHov.js.map} +1 -1
  14. package/dashboard/dist/assets/{BotPicker-DCScT8BN.js → BotPicker-CvXQwE5Z.js} +2 -2
  15. package/dashboard/dist/assets/{BotPicker-DCScT8BN.js.map → BotPicker-CvXQwE5Z.js.map} +1 -1
  16. package/dashboard/dist/assets/{CapabilitiesPage-g5iUvHRL.js → CapabilitiesPage-BiL9QUxI.js} +2 -2
  17. package/dashboard/dist/assets/{CapabilitiesPage-g5iUvHRL.js.map → CapabilitiesPage-BiL9QUxI.js.map} +1 -1
  18. package/dashboard/dist/assets/{CollapsibleSection-Dj1YOsVG.js → CollapsibleSection-D9F01Tny.js} +2 -2
  19. package/dashboard/dist/assets/{CollapsibleSection-Dj1YOsVG.js.map → CollapsibleSection-D9F01Tny.js.map} +1 -1
  20. package/dashboard/dist/assets/{CredentialsPage-Dvb4QelY.js → CredentialsPage-C-rjAIK3.js} +2 -2
  21. package/dashboard/dist/assets/{CredentialsPage-Dvb4QelY.js.map → CredentialsPage-C-rjAIK3.js.map} +1 -1
  22. package/dashboard/dist/assets/{CronLabel-sk1BkcJd.js → CronLabel-DnZF8_vw.js} +2 -2
  23. package/dashboard/dist/assets/{CronLabel-sk1BkcJd.js.map → CronLabel-DnZF8_vw.js.map} +1 -1
  24. package/dashboard/dist/assets/{CustomDurationPicker-C0MV2Q06.js → CustomDurationPicker-BYDrcsYT.js} +2 -2
  25. package/dashboard/dist/assets/{CustomDurationPicker-C0MV2Q06.js.map → CustomDurationPicker-BYDrcsYT.js.map} +1 -1
  26. package/dashboard/dist/assets/{DropZone-DN8uwUtf.js → DropZone-BEW3jBzf.js} +2 -2
  27. package/dashboard/dist/assets/{DropZone-DN8uwUtf.js.map → DropZone-BEW3jBzf.js.map} +1 -1
  28. package/dashboard/dist/assets/{ElapsedCell-CFXhhKKc.js → ElapsedCell-BkiVdGaJ.js} +2 -2
  29. package/dashboard/dist/assets/{ElapsedCell-CFXhhKKc.js.map → ElapsedCell-BkiVdGaJ.js.map} +1 -1
  30. package/dashboard/dist/assets/{EscalationsOverview-BEuUFGwC.js → EscalationsOverview-Cg2SN0WK.js} +2 -2
  31. package/dashboard/dist/assets/{EscalationsOverview-BEuUFGwC.js.map → EscalationsOverview-Cg2SN0WK.js.map} +1 -1
  32. package/dashboard/dist/assets/{EventTable-DcwVWOKb.js → EventTable-B9wYf13g.js} +2 -2
  33. package/dashboard/dist/assets/{EventTable-DcwVWOKb.js.map → EventTable-B9wYf13g.js.map} +1 -1
  34. package/dashboard/dist/assets/{EventTopicPill-CWCP1v1O.js → EventTopicPill-By-6sXDp.js} +2 -2
  35. package/dashboard/dist/assets/{EventTopicPill-CWCP1v1O.js.map → EventTopicPill-By-6sXDp.js.map} +1 -1
  36. package/dashboard/dist/assets/{HomePage-BH-F5ws9.js → HomePage-74mCQ5nB.js} +2 -2
  37. package/dashboard/dist/assets/{HomePage-BH-F5ws9.js.map → HomePage-74mCQ5nB.js.map} +1 -1
  38. package/dashboard/dist/assets/ListToolbar-DL1wEuvL.js +2 -0
  39. package/dashboard/dist/assets/{ListToolbar-CUxJlz__.js.map → ListToolbar-DL1wEuvL.js.map} +1 -1
  40. package/dashboard/dist/assets/{McpOverview-O8XrOzy0.js → McpOverview-D34bLMuP.js} +2 -2
  41. package/dashboard/dist/assets/{McpOverview-O8XrOzy0.js.map → McpOverview-D34bLMuP.js.map} +1 -1
  42. package/dashboard/dist/assets/{McpQueryDetailPage-DhiR0Xrx.js → McpQueryDetailPage-gLGTGX6g.js} +2 -2
  43. package/dashboard/dist/assets/{McpQueryDetailPage-DhiR0Xrx.js.map → McpQueryDetailPage-gLGTGX6g.js.map} +1 -1
  44. package/dashboard/dist/assets/{McpQueryPage-Czot0nfl.js → McpQueryPage-wPHJkhEp.js} +2 -2
  45. package/dashboard/dist/assets/{McpQueryPage-Czot0nfl.js.map → McpQueryPage-wPHJkhEp.js.map} +1 -1
  46. package/dashboard/dist/assets/{McpRunDetailPage-B1kNnD_t.js → McpRunDetailPage-SoXudCbq.js} +2 -2
  47. package/dashboard/dist/assets/{McpRunDetailPage-B1kNnD_t.js.map → McpRunDetailPage-SoXudCbq.js.map} +1 -1
  48. package/dashboard/dist/assets/{McpRunsPage-QUY3pWp9.js → McpRunsPage-BUSxdydO.js} +2 -2
  49. package/dashboard/dist/assets/{McpRunsPage-QUY3pWp9.js.map → McpRunsPage-BUSxdydO.js.map} +1 -1
  50. package/dashboard/dist/assets/{OperatorDashboard-BG1Q9qZk.js → OperatorDashboard-CYCl2our.js} +2 -2
  51. package/dashboard/dist/assets/{OperatorDashboard-BG1Q9qZk.js.map → OperatorDashboard-CYCl2our.js.map} +1 -1
  52. package/dashboard/dist/assets/{PageHeader-DlzOOM4Y.js → PageHeader-Bo0SpcCK.js} +2 -2
  53. package/dashboard/dist/assets/{PageHeader-DlzOOM4Y.js.map → PageHeader-Bo0SpcCK.js.map} +1 -1
  54. package/dashboard/dist/assets/{PageHeaderWithStats-C5cZ3IOO.js → PageHeaderWithStats-7K5BdhOj.js} +2 -2
  55. package/dashboard/dist/assets/{PageHeaderWithStats-C5cZ3IOO.js.map → PageHeaderWithStats-7K5BdhOj.js.map} +1 -1
  56. package/dashboard/dist/assets/{ProcessDetailPage-DS1AwTso.js → ProcessDetailPage-DzGacZpO.js} +2 -2
  57. package/dashboard/dist/assets/{ProcessDetailPage-DS1AwTso.js.map → ProcessDetailPage-DzGacZpO.js.map} +1 -1
  58. package/dashboard/dist/assets/{ProcessesListPage-CAmVcn1P.js → ProcessesListPage-Bmn33g_l.js} +2 -2
  59. package/dashboard/dist/assets/{ProcessesListPage-CAmVcn1P.js.map → ProcessesListPage-Bmn33g_l.js.map} +1 -1
  60. package/dashboard/dist/assets/{RolePill-BZaUpkHg.js → RolePill-BDzPFQUv.js} +2 -2
  61. package/dashboard/dist/assets/{RolePill-BZaUpkHg.js.map → RolePill-BDzPFQUv.js.map} +1 -1
  62. package/dashboard/dist/assets/{RolesPage-CFdIXfmv.js → RolesPage-BTtaabkS.js} +2 -2
  63. package/dashboard/dist/assets/{RolesPage-CFdIXfmv.js.map → RolesPage-BTtaabkS.js.map} +1 -1
  64. package/dashboard/dist/assets/{RunAsSelector-BGww9lta.js → RunAsSelector-B1R8nJvE.js} +2 -2
  65. package/dashboard/dist/assets/{RunAsSelector-BGww9lta.js.map → RunAsSelector-B1R8nJvE.js.map} +1 -1
  66. package/dashboard/dist/assets/{ServerName-DfS3pfon.js → ServerName-CEOFF7UG.js} +2 -2
  67. package/dashboard/dist/assets/{ServerName-DfS3pfon.js.map → ServerName-CEOFF7UG.js.map} +1 -1
  68. package/dashboard/dist/assets/{SwimlaneTimeline-C2hGjy0V.js → SwimlaneTimeline-CU2ZD9cC.js} +2 -2
  69. package/dashboard/dist/assets/{SwimlaneTimeline-C2hGjy0V.js.map → SwimlaneTimeline-CU2ZD9cC.js.map} +1 -1
  70. package/dashboard/dist/assets/{TagInput-D21mrQx6.js → TagInput-VBY0xIwb.js} +2 -2
  71. package/dashboard/dist/assets/{TagInput-D21mrQx6.js.map → TagInput-VBY0xIwb.js.map} +1 -1
  72. package/dashboard/dist/assets/{TaskDetailPage-B49WQj8W.js → TaskDetailPage-CZw_F8y4.js} +2 -2
  73. package/dashboard/dist/assets/{TaskDetailPage-B49WQj8W.js.map → TaskDetailPage-CZw_F8y4.js.map} +1 -1
  74. package/dashboard/dist/assets/{TaskQueuePill-D8UMH1rd.js → TaskQueuePill-DZykFijh.js} +2 -2
  75. package/dashboard/dist/assets/{TaskQueuePill-D8UMH1rd.js.map → TaskQueuePill-DZykFijh.js.map} +1 -1
  76. package/dashboard/dist/assets/{TasksListPage-CJB-EvKX.js → TasksListPage-D-vHndyV.js} +2 -2
  77. package/dashboard/dist/assets/{TasksListPage-CJB-EvKX.js.map → TasksListPage-D-vHndyV.js.map} +1 -1
  78. package/dashboard/dist/assets/{TimeAgo-CnjY3XDt.js → TimeAgo-B6Gz4RAU.js} +2 -2
  79. package/dashboard/dist/assets/{TimeAgo-CnjY3XDt.js.map → TimeAgo-B6Gz4RAU.js.map} +1 -1
  80. package/dashboard/dist/assets/{TimestampCell-u1YA8eA3.js → TimestampCell-DZu9PtN2.js} +2 -2
  81. package/dashboard/dist/assets/{TimestampCell-u1YA8eA3.js.map → TimestampCell-DZu9PtN2.js.map} +1 -1
  82. package/dashboard/dist/assets/{ToolPill-Dmcwmqh2.js → ToolPill-RP2Tvlrx.js} +2 -2
  83. package/dashboard/dist/assets/{ToolPill-Dmcwmqh2.js.map → ToolPill-RP2Tvlrx.js.map} +1 -1
  84. package/dashboard/dist/assets/{ToolTestPanel-B1T4Hk0t.js → ToolTestPanel-D4cgYW2p.js} +2 -2
  85. package/dashboard/dist/assets/{ToolTestPanel-B1T4Hk0t.js.map → ToolTestPanel-D4cgYW2p.js.map} +1 -1
  86. package/dashboard/dist/assets/{TopicDetailPage-ClibbST4.js → TopicDetailPage-C5ZUZpU5.js} +3 -3
  87. package/dashboard/dist/assets/{TopicDetailPage-ClibbST4.js.map → TopicDetailPage-C5ZUZpU5.js.map} +1 -1
  88. package/dashboard/dist/assets/{TopicsPage-KjODhitc.js → TopicsPage-Cbc0nVj9.js} +2 -2
  89. package/dashboard/dist/assets/{TopicsPage-KjODhitc.js.map → TopicsPage-Cbc0nVj9.js.map} +1 -1
  90. package/dashboard/dist/assets/{UserName-DVqimwsO.js → UserName-YUoNrFAq.js} +2 -2
  91. package/dashboard/dist/assets/{UserName-DVqimwsO.js.map → UserName-YUoNrFAq.js.map} +1 -1
  92. package/dashboard/dist/assets/{WorkflowExecutionPage-DYNPy7Gk.js → WorkflowExecutionPage-CVGztAdK.js} +2 -2
  93. package/dashboard/dist/assets/{WorkflowExecutionPage-DYNPy7Gk.js.map → WorkflowExecutionPage-CVGztAdK.js.map} +1 -1
  94. package/dashboard/dist/assets/{WorkflowPill-h43nlUmM.js → WorkflowPill-pPuGH8v9.js} +2 -2
  95. package/dashboard/dist/assets/{WorkflowPill-h43nlUmM.js.map → WorkflowPill-pPuGH8v9.js.map} +1 -1
  96. package/dashboard/dist/assets/{WorkflowsDashboard-DdJm6X7x.js → WorkflowsDashboard-BFzCyvgv.js} +2 -2
  97. package/dashboard/dist/assets/{WorkflowsDashboard-DdJm6X7x.js.map → WorkflowsDashboard-BFzCyvgv.js.map} +1 -1
  98. package/dashboard/dist/assets/{WorkflowsOverview-CBOYkfpD.js → WorkflowsOverview-C_y7JCg2.js} +2 -2
  99. package/dashboard/dist/assets/{WorkflowsOverview-CBOYkfpD.js.map → WorkflowsOverview-C_y7JCg2.js.map} +1 -1
  100. package/dashboard/dist/assets/{YamlWorkflowsPage-BZnD_hMw.js → YamlWorkflowsPage-CYQjp3JI.js} +2 -2
  101. package/dashboard/dist/assets/{YamlWorkflowsPage-BZnD_hMw.js.map → YamlWorkflowsPage-CYQjp3JI.js.map} +1 -1
  102. package/dashboard/dist/assets/{agents-oHMkS1GD.js → agents-2pDPv2Ww.js} +2 -2
  103. package/dashboard/dist/assets/{agents-oHMkS1GD.js.map → agents-2pDPv2Ww.js.map} +1 -1
  104. package/dashboard/dist/assets/{bots-BispbsY3.js → bots-2uGZ2l7A.js} +2 -2
  105. package/dashboard/dist/assets/{bots-BispbsY3.js.map → bots-2uGZ2l7A.js.map} +1 -1
  106. package/dashboard/dist/assets/{controlplane-CIbrx5rX.js → controlplane-CQ29M7lK.js} +2 -2
  107. package/dashboard/dist/assets/controlplane-CQ29M7lK.js.map +1 -0
  108. package/dashboard/dist/assets/{escalation-qhj4TxA3.js → escalation-DWOUjrgL.js} +2 -2
  109. package/dashboard/dist/assets/{escalation-qhj4TxA3.js.map → escalation-DWOUjrgL.js.map} +1 -1
  110. package/dashboard/dist/assets/{escalation-columns-Dh_0iVTH.js → escalation-columns-WrgLIl-W.js} +2 -2
  111. package/dashboard/dist/assets/{escalation-columns-Dh_0iVTH.js.map → escalation-columns-WrgLIl-W.js.map} +1 -1
  112. package/dashboard/dist/assets/{helpers-BYw1qqKV.js → helpers-LN5b1KBx.js} +2 -2
  113. package/dashboard/dist/assets/{helpers-BYw1qqKV.js.map → helpers-LN5b1KBx.js.map} +1 -1
  114. package/dashboard/dist/assets/{index-CVRVw3g_.js → index-BMo7wCw8.js} +2 -2
  115. package/dashboard/dist/assets/{index-CVRVw3g_.js.map → index-BMo7wCw8.js.map} +1 -1
  116. package/dashboard/dist/assets/{index-BhhWCADo.js → index-CBS8FBcp.js} +18 -18
  117. package/dashboard/dist/assets/index-CBS8FBcp.js.map +1 -0
  118. package/dashboard/dist/assets/{index-ht5r_7jQ.js → index-CFJc47B8.js} +2 -2
  119. package/dashboard/dist/assets/{index-ht5r_7jQ.js.map → index-CFJc47B8.js.map} +1 -1
  120. package/dashboard/dist/assets/{index-zHicKKh9.js → index-C_A76Dl1.js} +2 -2
  121. package/dashboard/dist/assets/{index-zHicKKh9.js.map → index-C_A76Dl1.js.map} +1 -1
  122. package/dashboard/dist/assets/{index-B9t_vpam.js → index-CdNXBj7w.js} +2 -2
  123. package/dashboard/dist/assets/{index-B9t_vpam.js.map → index-CdNXBj7w.js.map} +1 -1
  124. package/dashboard/dist/assets/index-ChGBlYKj.css +1 -0
  125. package/dashboard/dist/assets/index-CovZsMow.js +15 -0
  126. package/dashboard/dist/assets/{index-D6YjH5uG.js.map → index-CovZsMow.js.map} +1 -1
  127. package/dashboard/dist/assets/index-CryoNbg0.js +2 -0
  128. package/dashboard/dist/assets/index-CryoNbg0.js.map +1 -0
  129. package/dashboard/dist/assets/{index-Bh9g-EOF.js → index-CvzfRxnj.js} +2 -2
  130. package/dashboard/dist/assets/{index-Bh9g-EOF.js.map → index-CvzfRxnj.js.map} +1 -1
  131. package/dashboard/dist/assets/{index-C4W1_Rfk.js → index-DDxZOINn.js} +2 -2
  132. package/dashboard/dist/assets/{index-C4W1_Rfk.js.map → index-DDxZOINn.js.map} +1 -1
  133. package/dashboard/dist/assets/{index-C2yJWps6.js → index-DqFfgd-7.js} +2 -2
  134. package/dashboard/dist/assets/{index-C2yJWps6.js.map → index-DqFfgd-7.js.map} +1 -1
  135. package/dashboard/dist/assets/index-J0dMfAmE.js +2 -0
  136. package/dashboard/dist/assets/index-J0dMfAmE.js.map +1 -0
  137. package/dashboard/dist/assets/{index-CY3EhrEA.js → index-dzxsXeMO.js} +2 -2
  138. package/dashboard/dist/assets/{index-CY3EhrEA.js.map → index-dzxsXeMO.js.map} +1 -1
  139. package/dashboard/dist/assets/{index-CEF3Idec.js → index-ugekH3E2.js} +2 -2
  140. package/dashboard/dist/assets/{index-CEF3Idec.js.map → index-ugekH3E2.js.map} +1 -1
  141. package/dashboard/dist/assets/{knowledge-B23TU6JN.js → knowledge-BhZk3Wy9.js} +2 -2
  142. package/dashboard/dist/assets/{knowledge-B23TU6JN.js.map → knowledge-BhZk3Wy9.js.map} +1 -1
  143. package/dashboard/dist/assets/{mcp-Cew_Sb-Q.js → mcp-FOHNY7Zj.js} +2 -2
  144. package/dashboard/dist/assets/{mcp-Cew_Sb-Q.js.map → mcp-FOHNY7Zj.js.map} +1 -1
  145. package/dashboard/dist/assets/{mcp-query-So0Oz5Lx.js → mcp-query-BoNH5uCn.js} +2 -2
  146. package/dashboard/dist/assets/{mcp-query-So0Oz5Lx.js.map → mcp-query-BoNH5uCn.js.map} +1 -1
  147. package/dashboard/dist/assets/{mcp-runs-4176y3SA.js → mcp-runs-BhkGaw2y.js} +2 -2
  148. package/dashboard/dist/assets/{mcp-runs-4176y3SA.js.map → mcp-runs-BhkGaw2y.js.map} +1 -1
  149. package/dashboard/dist/assets/{namespaces-CqBbWsJx.js → namespaces-duQCQRHq.js} +2 -2
  150. package/dashboard/dist/assets/{namespaces-CqBbWsJx.js.map → namespaces-duQCQRHq.js.map} +1 -1
  151. package/dashboard/dist/assets/{roles-BTxMgLE6.js → roles-DW6lI_g5.js} +2 -2
  152. package/dashboard/dist/assets/{roles-BTxMgLE6.js.map → roles-DW6lI_g5.js.map} +1 -1
  153. package/dashboard/dist/assets/{settings-CtQNxacL.js → settings-wTRbazzw.js} +2 -2
  154. package/dashboard/dist/assets/{settings-CtQNxacL.js.map → settings-wTRbazzw.js.map} +1 -1
  155. package/dashboard/dist/assets/{tasks-CIRlUTbo.js → tasks-C-QX245z.js} +2 -2
  156. package/dashboard/dist/assets/{tasks-CIRlUTbo.js.map → tasks-C-QX245z.js.map} +1 -1
  157. package/dashboard/dist/assets/{topics-C8YmK_j2.js → topics-CAnsyo3w.js} +2 -2
  158. package/dashboard/dist/assets/{topics-C8YmK_j2.js.map → topics-CAnsyo3w.js.map} +1 -1
  159. package/dashboard/dist/assets/{useEventHooks-BvMUy36X.js → useEventHooks-C689a4F7.js} +2 -2
  160. package/dashboard/dist/assets/{useEventHooks-BvMUy36X.js.map → useEventHooks-C689a4F7.js.map} +1 -1
  161. package/dashboard/dist/assets/{useYamlActivityEvents-DLEzqv-z.js → useYamlActivityEvents-BTHFGIsD.js} +2 -2
  162. package/dashboard/dist/assets/{useYamlActivityEvents-DLEzqv-z.js.map → useYamlActivityEvents-BTHFGIsD.js.map} +1 -1
  163. package/dashboard/dist/assets/{users-C_bD6mzW.js → users--D3LoFOD.js} +2 -2
  164. package/dashboard/dist/assets/{users-C_bD6mzW.js.map → users--D3LoFOD.js.map} +1 -1
  165. package/dashboard/dist/assets/{vendor-icons-DY1ctJgc.js → vendor-icons-BNtvBbnj.js} +107 -102
  166. package/dashboard/dist/assets/vendor-icons-BNtvBbnj.js.map +1 -0
  167. package/dashboard/dist/assets/{workflows-DFR0-hI3.js → workflows-MpNdzreD.js} +2 -2
  168. package/dashboard/dist/assets/{workflows-DFR0-hI3.js.map → workflows-MpNdzreD.js.map} +1 -1
  169. package/dashboard/dist/assets/{yaml-workflows-wXURdyjP.js → yaml-workflows-CFhnJzQy.js} +2 -2
  170. package/dashboard/dist/assets/{yaml-workflows-wXURdyjP.js.map → yaml-workflows-CFhnJzQy.js.map} +1 -1
  171. package/dashboard/dist/index.html +3 -3
  172. package/package.json +2 -2
  173. package/dashboard/dist/assets/ListToolbar-CUxJlz__.js +0 -2
  174. package/dashboard/dist/assets/controlplane-CIbrx5rX.js.map +0 -1
  175. package/dashboard/dist/assets/index-BhhWCADo.js.map +0 -1
  176. package/dashboard/dist/assets/index-Bn-VSH41.js +0 -2
  177. package/dashboard/dist/assets/index-Bn-VSH41.js.map +0 -1
  178. package/dashboard/dist/assets/index-CHxvfc97.css +0 -1
  179. package/dashboard/dist/assets/index-D-q2lzup.js +0 -2
  180. package/dashboard/dist/assets/index-D-q2lzup.js.map +0 -1
  181. package/dashboard/dist/assets/index-D6YjH5uG.js +0 -15
  182. package/dashboard/dist/assets/vendor-icons-DY1ctJgc.js.map +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProcessesListPage-CAmVcn1P.js","assets/vendor-query-B2UbickB.js","assets/tasks-CIRlUTbo.js","assets/workflows-DFR0-hI3.js","assets/useEventHooks-BvMUy36X.js","assets/useFilterParams-DZCAaBC7.js","assets/vendor-react-CX88sFS5.js","assets/DataTable-D9yuBv0w.js","assets/EmptyState-BcsfPq9T.js","assets/TimestampCell-u1YA8eA3.js","assets/StickyPagination-F9FZsRy9.js","assets/FilterBar-Ck4K4rzu.js","assets/PageHeader-DlzOOM4Y.js","assets/vendor-icons-DY1ctJgc.js","assets/ListToolbar-CUxJlz__.js","assets/WorkflowPill-h43nlUmM.js","assets/ProcessDetailPage-DS1AwTso.js","assets/settings-CtQNxacL.js","assets/PageHeaderWithStats-C5cZ3IOO.js","assets/StatusBadge-XQlNFwmH.js","assets/RolePill-BZaUpkHg.js","assets/UserName-DVqimwsO.js","assets/users-C_bD6mzW.js","assets/McpOverview-O8XrOzy0.js","assets/mcp-Cew_Sb-Q.js","assets/mcp-runs-4176y3SA.js","assets/yaml-workflows-wXURdyjP.js","assets/namespaces-CqBbWsJx.js","assets/StatCard-DlgF0CJC.js","assets/McpRunsPage-QUY3pWp9.js","assets/ElapsedCell-CFXhhKKc.js","assets/RowActions-Dg-Fsm5O.js","assets/McpRunDetailPage-B1kNnD_t.js","assets/CopyableId-DmLF-RqZ.js","assets/CollapsibleSection-Dj1YOsVG.js","assets/EventTable-DcwVWOKb.js","assets/SwimlaneTimeline-C2hGjy0V.js","assets/McpQueryPage-Czot0nfl.js","assets/mcp-query-So0Oz5Lx.js","assets/McpQueryDetailPage-DhiR0Xrx.js","assets/useYamlActivityEvents-DLEzqv-z.js","assets/TagInput-D21mrQx6.js","assets/ToolPill-Dmcwmqh2.js","assets/RunAsSelector-BGww9lta.js","assets/BotPicker-DCScT8BN.js","assets/bots-BispbsY3.js","assets/TimeAgo-CnjY3XDt.js","assets/EscalationsOverview-BEuUFGwC.js","assets/AvailableEscalationsPage-DmUid1h0.js","assets/roles-BTxMgLE6.js","assets/constants-BHkpVaqx.js","assets/CustomDurationPicker-C0MV2Q06.js","assets/Modal-DEODGeqx.js","assets/escalation-columns-Dh_0iVTH.js","assets/PriorityBadge-DfQY9St9.js","assets/escalation-qhj4TxA3.js","assets/OperatorDashboard-BG1Q9qZk.js","assets/index-C4W1_Rfk.js","assets/WorkflowsOverview-CBOYkfpD.js","assets/index-C2yJWps6.js","assets/helpers-BYw1qqKV.js","assets/WorkflowsDashboard-DdJm6X7x.js","assets/YamlWorkflowsPage-BZnD_hMw.js","assets/useExpandedRows-CkcEntB-.js","assets/ServerName-DfS3pfon.js","assets/TasksListPage-CJB-EvKX.js","assets/TaskDetailPage-B49WQj8W.js","assets/WorkflowExecutionPage-DYNPy7Gk.js","assets/AdminDashboard-CR0FtTE6.js","assets/index-Bh9g-EOF.js","assets/TaskQueuePill-D8UMH1rd.js","assets/index-D6YjH5uG.js","assets/ConfirmDeleteModal-dOxidrSR.js","assets/StepIndicator-CuUIGxKk.js","assets/index-CY3EhrEA.js","assets/ToolTestPanel-B1T4Hk0t.js","assets/index-zHicKKh9.js","assets/index-CVRVw3g_.js","assets/RolesPage-CFdIXfmv.js","assets/index-D-q2lzup.js","assets/index-Bn-VSH41.js","assets/controlplane-CIbrx5rX.js","assets/index-ht5r_7jQ.js","assets/CredentialsPage-Dvb4QelY.js","assets/index-B9t_vpam.js","assets/DropZone-DN8uwUtf.js","assets/index-CEF3Idec.js","assets/knowledge-B23TU6JN.js","assets/HomePage-BH-F5ws9.js","assets/EventTopicPill-CWCP1v1O.js","assets/AgentsPage-j-zblMNR.js","assets/agents-oHMkS1GD.js","assets/AgentDetailPage-D64ath8c.js","assets/CronLabel-sk1BkcJd.js","assets/AgentConfigPage-BVypgq9m.js","assets/topics-C8YmK_j2.js","assets/CapabilitiesPage-g5iUvHRL.js","assets/TopicsPage-KjODhitc.js","assets/TopicDetailPage-ClibbST4.js"])))=>i.map(i=>d[i]);
2
- var mx=Object.defineProperty;var px=(r,n,s)=>n in r?mx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>px(r,typeof n!="symbol"?n+"":n,s);import{r as gx,a as N,j as p,u as fs,b as Nn,c as Ln,Q as yx,d as bx}from"./vendor-query-B2UbickB.js";import{r as xx,L as pr,u as Ei,N as Ac,a as tg,b as Vs,O as bc,c as ng,d as vx,R as _x}from"./vendor-react-CX88sFS5.js";import{C as wx,I as Sx,R as sg,B as ig,U as Ex,A as Ax,Z as Ox,a as jx,S as Qp,P as Tx,L as Xp,W as Nx,b as rg,c as Oc,F as Cx,d as kx,e as Mx,f as Rx,T as Dx,g as zx,h as qx,D as Ux,M as ag,i as lg,j as Bx,k as Lx,E as Hx,l as Px,m as Yx,n as Ip,X as Gf,G as $x,o as Gx,p as Vx,q as Fx,r as Jx}from"./vendor-icons-DY1ctJgc.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))a(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function s(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(c){if(c.ep)return;c.ep=!0;const f=s(c);fetch(c.href,f)}})();var sf={exports:{}},_a={},rf={exports:{}},af={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProcessesListPage-Bmn33g_l.js","assets/vendor-query-B2UbickB.js","assets/tasks-C-QX245z.js","assets/workflows-MpNdzreD.js","assets/useEventHooks-C689a4F7.js","assets/useFilterParams-DZCAaBC7.js","assets/vendor-react-CX88sFS5.js","assets/DataTable-D9yuBv0w.js","assets/EmptyState-BcsfPq9T.js","assets/TimestampCell-DZu9PtN2.js","assets/StickyPagination-F9FZsRy9.js","assets/FilterBar-Ck4K4rzu.js","assets/PageHeader-Bo0SpcCK.js","assets/vendor-icons-BNtvBbnj.js","assets/ListToolbar-DL1wEuvL.js","assets/WorkflowPill-pPuGH8v9.js","assets/ProcessDetailPage-DzGacZpO.js","assets/settings-wTRbazzw.js","assets/PageHeaderWithStats-7K5BdhOj.js","assets/StatusBadge-XQlNFwmH.js","assets/RolePill-BDzPFQUv.js","assets/UserName-YUoNrFAq.js","assets/users--D3LoFOD.js","assets/McpOverview-D34bLMuP.js","assets/mcp-FOHNY7Zj.js","assets/mcp-runs-BhkGaw2y.js","assets/yaml-workflows-CFhnJzQy.js","assets/namespaces-duQCQRHq.js","assets/StatCard-DlgF0CJC.js","assets/McpRunsPage-BUSxdydO.js","assets/ElapsedCell-BkiVdGaJ.js","assets/RowActions-Dg-Fsm5O.js","assets/McpRunDetailPage-SoXudCbq.js","assets/CopyableId-DmLF-RqZ.js","assets/CollapsibleSection-D9F01Tny.js","assets/EventTable-B9wYf13g.js","assets/SwimlaneTimeline-CU2ZD9cC.js","assets/McpQueryPage-wPHJkhEp.js","assets/mcp-query-BoNH5uCn.js","assets/McpQueryDetailPage-gLGTGX6g.js","assets/useYamlActivityEvents-BTHFGIsD.js","assets/TagInput-VBY0xIwb.js","assets/ToolPill-RP2Tvlrx.js","assets/RunAsSelector-B1R8nJvE.js","assets/BotPicker-CvXQwE5Z.js","assets/bots-2uGZ2l7A.js","assets/TimeAgo-B6Gz4RAU.js","assets/EscalationsOverview-Cg2SN0WK.js","assets/AvailableEscalationsPage-DrarbHov.js","assets/roles-DW6lI_g5.js","assets/constants-BHkpVaqx.js","assets/CustomDurationPicker-BYDrcsYT.js","assets/Modal-DEODGeqx.js","assets/escalation-columns-WrgLIl-W.js","assets/PriorityBadge-DfQY9St9.js","assets/escalation-DWOUjrgL.js","assets/OperatorDashboard-CYCl2our.js","assets/index-DDxZOINn.js","assets/WorkflowsOverview-C_y7JCg2.js","assets/index-DqFfgd-7.js","assets/helpers-LN5b1KBx.js","assets/WorkflowsDashboard-BFzCyvgv.js","assets/YamlWorkflowsPage-CYQjp3JI.js","assets/useExpandedRows-CkcEntB-.js","assets/ServerName-CEOFF7UG.js","assets/TasksListPage-D-vHndyV.js","assets/TaskDetailPage-CZw_F8y4.js","assets/WorkflowExecutionPage-CVGztAdK.js","assets/AdminDashboard-C0_qN2h3.js","assets/index-CvzfRxnj.js","assets/TaskQueuePill-DZykFijh.js","assets/index-CovZsMow.js","assets/ConfirmDeleteModal-dOxidrSR.js","assets/StepIndicator-CuUIGxKk.js","assets/index-dzxsXeMO.js","assets/ToolTestPanel-D4cgYW2p.js","assets/index-C_A76Dl1.js","assets/index-BMo7wCw8.js","assets/RolesPage-BTtaabkS.js","assets/index-J0dMfAmE.js","assets/index-CryoNbg0.js","assets/controlplane-CQ29M7lK.js","assets/index-CFJc47B8.js","assets/CredentialsPage-C-rjAIK3.js","assets/index-CdNXBj7w.js","assets/DropZone-BEW3jBzf.js","assets/index-ugekH3E2.js","assets/knowledge-BhZk3Wy9.js","assets/HomePage-74mCQ5nB.js","assets/EventTopicPill-By-6sXDp.js","assets/AgentsPage-DJWSuoJA.js","assets/agents-2pDPv2Ww.js","assets/AgentDetailPage-B5kaAJDM.js","assets/CronLabel-DnZF8_vw.js","assets/AgentConfigPage-DG1zOIiz.js","assets/topics-CAnsyo3w.js","assets/CapabilitiesPage-BiL9QUxI.js","assets/TopicsPage-Cbc0nVj9.js","assets/TopicDetailPage-C5ZUZpU5.js"])))=>i.map(i=>d[i]);
2
+ var dx=Object.defineProperty;var mx=(r,n,s)=>n in r?dx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>mx(r,typeof n!="symbol"?n+"":n,s);import{r as px,a as C,j as p,u as fs,b as Nn,c as Ln,Q as gx,d as yx}from"./vendor-query-B2UbickB.js";import{r as bx,L as pr,u as Ei,N as Ac,a as tg,b as Vs,O as bc,c as ng,d as xx,R as vx}from"./vendor-react-CX88sFS5.js";import{C as _x,I as wx,R as sg,B as ig,U as Sx,A as Ex,Z as Ax,a as Ox,S as Qp,P as jx,L as Xp,W as Tx,b as rg,c as Oc,F as Nx,d as Cx,e as kx,T as Mx,f as Rx,N as Dx,g as zx,D as qx,M as ag,h as lg,i as Ux,j as Bx,E as Lx,k as Hx,l as Px,m as Ip,X as Gf,G as Yx,n as $x,o as Gx,p as Vx,q as Fx}from"./vendor-icons-BNtvBbnj.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))a(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function s(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(c){if(c.ep)return;c.ep=!0;const f=s(c);fetch(c.href,f)}})();var sf={exports:{}},_a={},rf={exports:{}},af={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -7,7 +7,7 @@ var mx=Object.defineProperty;var px=(r,n,s)=>n in r?mx(r,n,{enumerable:!0,config
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var Kp;function Qx(){return Kp||(Kp=1,(function(r){function n(Y,te){var he=Y.length;Y.push(te);e:for(;0<he;){var ve=he-1>>>1,ye=Y[ve];if(0<c(ye,te))Y[ve]=te,Y[he]=ye,he=ve;else break e}}function s(Y){return Y.length===0?null:Y[0]}function a(Y){if(Y.length===0)return null;var te=Y[0],he=Y.pop();if(he!==te){Y[0]=he;e:for(var ve=0,ye=Y.length,je=ye>>>1;ve<je;){var _e=2*(ve+1)-1,Te=Y[_e],lt=_e+1,Pt=Y[lt];if(0>c(Te,he))lt<ye&&0>c(Pt,Te)?(Y[ve]=Pt,Y[lt]=he,ve=lt):(Y[ve]=Te,Y[_e]=he,ve=_e);else if(lt<ye&&0>c(Pt,he))Y[ve]=Pt,Y[lt]=he,ve=lt;else break e}}return te}function c(Y,te){var he=Y.sortIndex-te.sortIndex;return he!==0?he:Y.id-te.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,d=h.now();r.unstable_now=function(){return h.now()-d}}var g=[],y=[],A=1,w=null,j=3,z=!1,R=!1,H=!1,ee=!1,ne=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;function be(Y){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=Y)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function k(Y){if(H=!1,be(Y),!R)if(s(g)!==null)R=!0,I||(I=!0,re());else{var te=s(y);te!==null&&Le(k,te.startTime-Y)}}var I=!1,ie=-1,Z=5,Q=-1;function K(){return ee?!0:!(r.unstable_now()-Q<Z)}function ae(){if(ee=!1,I){var Y=r.unstable_now();Q=Y;var te=!0;try{e:{R=!1,H&&(H=!1,W(ie),ie=-1),z=!0;var he=j;try{t:{for(be(Y),w=s(g);w!==null&&!(w.expirationTime>Y&&K());){var ve=w.callback;if(typeof ve=="function"){w.callback=null,j=w.priorityLevel;var ye=ve(w.expirationTime<=Y);if(Y=r.unstable_now(),typeof ye=="function"){w.callback=ye,be(Y),te=!0;break t}w===s(g)&&a(g),be(Y)}else a(g);w=s(g)}if(w!==null)te=!0;else{var je=s(y);je!==null&&Le(k,je.startTime-Y),te=!1}}break e}finally{w=null,j=he,z=!1}te=void 0}}finally{te?re():I=!1}}}var re;if(typeof me=="function")re=function(){me(ae)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,Ge=qe.port2;qe.port1.onmessage=ae,re=function(){Ge.postMessage(null)}}else re=function(){ne(ae,0)};function Le(Y,te){ie=ne(function(){Y(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(Y){Y.callback=null},r.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<Y?Math.floor(1e3/Y):5},r.unstable_getCurrentPriorityLevel=function(){return j},r.unstable_next=function(Y){switch(j){case 1:case 2:case 3:var te=3;break;default:te=j}var he=j;j=te;try{return Y()}finally{j=he}},r.unstable_requestPaint=function(){ee=!0},r.unstable_runWithPriority=function(Y,te){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var he=j;j=Y;try{return te()}finally{j=he}},r.unstable_scheduleCallback=function(Y,te,he){var ve=r.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?ve+he:ve):he=ve,Y){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=he+ye,Y={id:A++,callback:te,priorityLevel:Y,startTime:he,expirationTime:ye,sortIndex:-1},he>ve?(Y.sortIndex=he,n(y,Y),s(g)===null&&Y===s(y)&&(H?(W(ie),ie=-1):H=!0,Le(k,he-ve))):(Y.sortIndex=ye,n(g,Y),R||z||(R=!0,I||(I=!0,re()))),Y},r.unstable_shouldYield=K,r.unstable_wrapCallback=function(Y){var te=j;return function(){var he=j;j=te;try{return Y.apply(this,arguments)}finally{j=he}}}})(af)),af}var Zp;function Xx(){return Zp||(Zp=1,rf.exports=Qx()),rf.exports}/**
10
+ */var Kp;function Jx(){return Kp||(Kp=1,(function(r){function n(Y,te){var he=Y.length;Y.push(te);e:for(;0<he;){var ve=he-1>>>1,ye=Y[ve];if(0<c(ye,te))Y[ve]=te,Y[he]=ye,he=ve;else break e}}function s(Y){return Y.length===0?null:Y[0]}function a(Y){if(Y.length===0)return null;var te=Y[0],he=Y.pop();if(he!==te){Y[0]=he;e:for(var ve=0,ye=Y.length,je=ye>>>1;ve<je;){var _e=2*(ve+1)-1,Te=Y[_e],lt=_e+1,Pt=Y[lt];if(0>c(Te,he))lt<ye&&0>c(Pt,Te)?(Y[ve]=Pt,Y[lt]=he,ve=lt):(Y[ve]=Te,Y[_e]=he,ve=_e);else if(lt<ye&&0>c(Pt,he))Y[ve]=Pt,Y[lt]=he,ve=lt;else break e}}return te}function c(Y,te){var he=Y.sortIndex-te.sortIndex;return he!==0?he:Y.id-te.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,d=h.now();r.unstable_now=function(){return h.now()-d}}var g=[],y=[],A=1,w=null,j=3,z=!1,R=!1,H=!1,ee=!1,ne=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;function be(Y){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=Y)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function k(Y){if(H=!1,be(Y),!R)if(s(g)!==null)R=!0,I||(I=!0,re());else{var te=s(y);te!==null&&Le(k,te.startTime-Y)}}var I=!1,ie=-1,Z=5,Q=-1;function K(){return ee?!0:!(r.unstable_now()-Q<Z)}function ae(){if(ee=!1,I){var Y=r.unstable_now();Q=Y;var te=!0;try{e:{R=!1,H&&(H=!1,W(ie),ie=-1),z=!0;var he=j;try{t:{for(be(Y),w=s(g);w!==null&&!(w.expirationTime>Y&&K());){var ve=w.callback;if(typeof ve=="function"){w.callback=null,j=w.priorityLevel;var ye=ve(w.expirationTime<=Y);if(Y=r.unstable_now(),typeof ye=="function"){w.callback=ye,be(Y),te=!0;break t}w===s(g)&&a(g),be(Y)}else a(g);w=s(g)}if(w!==null)te=!0;else{var je=s(y);je!==null&&Le(k,je.startTime-Y),te=!1}}break e}finally{w=null,j=he,z=!1}te=void 0}}finally{te?re():I=!1}}}var re;if(typeof me=="function")re=function(){me(ae)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,Ge=qe.port2;qe.port1.onmessage=ae,re=function(){Ge.postMessage(null)}}else re=function(){ne(ae,0)};function Le(Y,te){ie=ne(function(){Y(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(Y){Y.callback=null},r.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<Y?Math.floor(1e3/Y):5},r.unstable_getCurrentPriorityLevel=function(){return j},r.unstable_next=function(Y){switch(j){case 1:case 2:case 3:var te=3;break;default:te=j}var he=j;j=te;try{return Y()}finally{j=he}},r.unstable_requestPaint=function(){ee=!0},r.unstable_runWithPriority=function(Y,te){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var he=j;j=Y;try{return te()}finally{j=he}},r.unstable_scheduleCallback=function(Y,te,he){var ve=r.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?ve+he:ve):he=ve,Y){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=he+ye,Y={id:A++,callback:te,priorityLevel:Y,startTime:he,expirationTime:ye,sortIndex:-1},he>ve?(Y.sortIndex=he,n(y,Y),s(g)===null&&Y===s(y)&&(H?(W(ie),ie=-1):H=!0,Le(k,he-ve))):(Y.sortIndex=ye,n(g,Y),R||z||(R=!0,I||(I=!0,re()))),Y},r.unstable_shouldYield=K,r.unstable_wrapCallback=function(Y){var te=j;return function(){var he=j;j=te;try{return Y.apply(this,arguments)}finally{j=he}}}})(af)),af}var Zp;function Qx(){return Zp||(Zp=1,rf.exports=Jx()),rf.exports}/**
11
11
  * @license React
12
12
  * react-dom-client.production.js
13
13
  *
@@ -15,28 +15,28 @@ var mx=Object.defineProperty;var px=(r,n,s)=>n in r?mx(r,n,{enumerable:!0,config
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var Wp;function Ix(){if(Wp)return _a;Wp=1;var r=Xx(),n=gx(),s=xx();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var i=e,l=t;;){var o=i.return;if(o===null)break;var u=o.alternate;if(u===null){if(l=o.return,l!==null){i=l;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===i)return g(o),e;if(u===l)return g(o),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=o,l=u;else{for(var m=!1,b=o.child;b;){if(b===i){m=!0,i=o,l=u;break}if(b===l){m=!0,l=o,i=u;break}b=b.sibling}if(!m){for(b=u.child;b;){if(b===i){m=!0,i=u,l=o;break}if(b===l){m=!0,l=u,i=o;break}b=b.sibling}if(!m)throw Error(a(189))}}if(i.alternate!==l)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?e:t}function A(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=A(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,j=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),ee=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),me=Symbol.for("react.context"),be=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var qe=Symbol.for("react.client.reference");function Ge(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===qe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case H:return"Fragment";case ne:return"Profiler";case ee:return"StrictMode";case k:return"Suspense";case I:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case R:return"Portal";case me:return e.displayName||"Context";case W:return(e._context.displayName||"Context")+".Consumer";case be:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return t=e.displayName||null,t!==null?t:Ge(e.type)||"Memo";case Z:t=e._payload,e=e._init;try{return Ge(e(t))}catch{}}return null}var Le=Array.isArray,Y=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ve=[],ye=-1;function je(e){return{current:e}}function _e(e){0>ye||(e.current=ve[ye],ve[ye]=null,ye--)}function Te(e,t){ye++,ve[ye]=e.current,e.current=t}var lt=je(null),Pt=je(null),sn=je(null),Ot=je(null);function jt(e,t){switch(Te(sn,t),Te(Pt,e),Te(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yp(t),e=bp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_e(lt),Te(lt,e)}function we(){_e(lt),_e(Pt),_e(sn)}function Tt(e){e.memoizedState!==null&&Te(Ot,e);var t=lt.current,i=bp(t,e.type);t!==i&&(Te(Pt,e),Te(lt,i))}function Zs(e){Pt.current===e&&(_e(lt),_e(Pt)),Ot.current===e&&(_e(Ot),ya._currentValue=he)}var ji,Ws;function rn(e){if(ji===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);ji=t&&t[1]||"",Ws=-1<i.stack.indexOf(`
18
+ */var Wp;function Xx(){if(Wp)return _a;Wp=1;var r=Qx(),n=px(),s=bx();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var i=e,l=t;;){var o=i.return;if(o===null)break;var u=o.alternate;if(u===null){if(l=o.return,l!==null){i=l;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===i)return g(o),e;if(u===l)return g(o),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=o,l=u;else{for(var m=!1,b=o.child;b;){if(b===i){m=!0,i=o,l=u;break}if(b===l){m=!0,l=o,i=u;break}b=b.sibling}if(!m){for(b=u.child;b;){if(b===i){m=!0,i=u,l=o;break}if(b===l){m=!0,l=u,i=o;break}b=b.sibling}if(!m)throw Error(a(189))}}if(i.alternate!==l)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?e:t}function A(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=A(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,j=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),ee=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),me=Symbol.for("react.context"),be=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var qe=Symbol.for("react.client.reference");function Ge(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===qe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case H:return"Fragment";case ne:return"Profiler";case ee:return"StrictMode";case k:return"Suspense";case I:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case R:return"Portal";case me:return e.displayName||"Context";case W:return(e._context.displayName||"Context")+".Consumer";case be:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return t=e.displayName||null,t!==null?t:Ge(e.type)||"Memo";case Z:t=e._payload,e=e._init;try{return Ge(e(t))}catch{}}return null}var Le=Array.isArray,Y=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ve=[],ye=-1;function je(e){return{current:e}}function _e(e){0>ye||(e.current=ve[ye],ve[ye]=null,ye--)}function Te(e,t){ye++,ve[ye]=e.current,e.current=t}var lt=je(null),Pt=je(null),sn=je(null),Ot=je(null);function jt(e,t){switch(Te(sn,t),Te(Pt,e),Te(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yp(t),e=bp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_e(lt),Te(lt,e)}function we(){_e(lt),_e(Pt),_e(sn)}function Tt(e){e.memoizedState!==null&&Te(Ot,e);var t=lt.current,i=bp(t,e.type);t!==i&&(Te(Pt,e),Te(lt,i))}function Zs(e){Pt.current===e&&(_e(lt),_e(Pt)),Ot.current===e&&(_e(Ot),ya._currentValue=he)}var ji,Ws;function rn(e){if(ji===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);ji=t&&t[1]||"",Ws=-1<i.stack.indexOf(`
19
19
  at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
20
20
  `+ji+e+Ws}var Ti=!1;function hs(e,t){if(!e||Ti)return"";Ti=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(P){var B=P}Reflect.construct(e,[],J)}else{try{J.call()}catch(P){B=P}e.call(J.prototype)}}else{try{throw Error()}catch(P){B=P}(J=e())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(P){if(P&&B&&typeof P.stack=="string")return[P.stack,B.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),m=u[0],b=u[1];if(m&&b){var O=m.split(`
21
21
  `),U=b.split(`
22
22
  `);for(o=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;o<U.length&&!U[o].includes("DetermineComponentFrameRoot");)o++;if(l===O.length||o===U.length)for(l=O.length-1,o=U.length-1;1<=l&&0<=o&&O[l]!==U[o];)o--;for(;1<=l&&0<=o;l--,o--)if(O[l]!==U[o]){if(l!==1||o!==1)do if(l--,o--,0>o||O[l]!==U[o]){var $=`
23
23
  `+O[l].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=l&&0<=o);break}}}finally{Ti=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?rn(i):""}function $a(e,t){switch(e.tag){case 26:case 27:case 5:return rn(e.type);case 16:return rn("Lazy");case 13:return e.child!==t&&t!==null?rn("Suspense Fallback"):rn("Suspense");case 19:return rn("SuspenseList");case 0:case 15:return hs(e.type,!1);case 11:return hs(e.type.render,!1);case 1:return hs(e.type,!0);case 31:return rn("Activity");default:return""}}function Ga(e){try{var t="",i=null;do t+=$a(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
24
24
  Error generating stack: `+l.message+`
25
- `+l.stack}}var jr=Object.prototype.hasOwnProperty,Tr=r.unstable_scheduleCallback,Hn=r.unstable_cancelCallback,Va=r.unstable_shouldYield,Ni=r.unstable_requestPaint,et=r.unstable_now,Fc=r.unstable_getCurrentPriorityLevel,Fa=r.unstable_ImmediatePriority,Ja=r.unstable_UserBlockingPriority,Ci=r.unstable_NormalPriority,Jc=r.unstable_LowPriority,Qa=r.unstable_IdlePriority,Qc=r.log,Xa=r.unstable_setDisableYieldValue,ei=null,ct=null;function Yt(e){if(typeof Qc=="function"&&Xa(e),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(ei,e)}catch{}}var Nt=Math.clz32?Math.clz32:ki,Nr=Math.log,Cr=Math.LN2;function ki(e){return e>>>=0,e===0?32:31-(Nr(e)/Cr|0)|0}var ds=256,Pn=262144,ms=4194304;function xn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ti(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var o=0,u=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?o=xn(l):(m&=b,m!==0?o=xn(m):i||(i=b&~e,i!==0&&(o=xn(i))))):(b=l&~u,b!==0?o=xn(b):m!==0?o=xn(m):i||(i=l&~e,i!==0&&(o=xn(i)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:o}function ni(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function kr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mi(){var e=ms;return ms<<=1,(ms&62914560)===0&&(ms=4194304),e}function ps(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function vn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gs(e,t,i,l,o,u){var m=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,U=e.hiddenUpdates;for(i=m&~i;0<i;){var $=31-Nt(i),J=1<<$;b[$]=0,O[$]=-1;var B=U[$];if(B!==null)for(U[$]=null,$=0;$<B.length;$++){var P=B[$];P!==null&&(P.lane&=-536870913)}i&=~J}l!==0&&ys(e,l,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(m&~t))}function ys(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function si(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),o=1<<l;o&t|e[l]&t&&(e[l]|=t),i&=~o}}function bs(e,t){var i=t&-t;return i=(i&42)!==0?1:Yn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Yn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ii(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Mr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Pp(e.type))}function Ia(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Cn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Cn,it="__reactProps$"+Cn,$t="__reactContainer$"+Cn,ri="__reactEvents$"+Cn,Rr="__reactListeners$"+Cn,Ka="__reactHandles$"+Cn,Za="__reactResources$"+Cn,yt="__reactMarker$"+Cn;function Ri(e){delete e[Qe],delete e[it],delete e[ri],delete e[Rr],delete e[Ka]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[$t]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Ap(e);e!==null;){if(i=e[Qe])return i;e=Ap(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Qe]||e[$t]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function E(e){var t=e[Za];return t||(t=e[Za]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function T(e){e[yt]=!0}var D=new Set,F={};function X(e,t){L(e,t),L(e+"Capture",t)}function L(e,t){for(F[e]=t,e=0;e<t.length;e++)D.add(t[e])}var V=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ue={},Oe={};function Ke(e){return jr.call(Oe,e)?!0:jr.call(ue,e)?!1:V.test(e)?Oe[e]=!0:(ue[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function _n(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function $n(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function an(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function oh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ly(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var o=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(m){i=""+m,u.call(this,m)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(m){i=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xc(e){if(!e._valueTracker){var t=oh(e)?"checked":"value";e._valueTracker=ly(e,t,""+e[t])}}function uh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=oh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function Wa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var cy=/[\n"\\]/g;function ln(e){return e.replace(cy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ic(e,t,i,l,o,u,m,b){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+an(t)):e.value!==""+an(t)&&(e.value=""+an(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?Kc(e,m,an(t)):i!=null?Kc(e,m,an(i)):l!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+an(b):e.removeAttribute("name")}function fh(e,t,i,l,o,u,m,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Xc(e);return}i=i!=null?""+an(i):"",t=t!=null?""+an(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??o,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),Xc(e)}function Kc(e,t,i){t==="number"&&Wa(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Di(e,t,i,l){if(e=e.options,t){t={};for(var o=0;o<i.length;o++)t["$"+i[o]]=!0;for(i=0;i<e.length;i++)o=t.hasOwnProperty("$"+e[i].value),e[i].selected!==o&&(e[i].selected=o),o&&l&&(e[i].defaultSelected=!0)}else{for(i=""+an(i),t=null,o=0;o<e.length;o++){if(e[o].value===i){e[o].selected=!0,l&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function hh(e,t,i){if(t!=null&&(t=""+an(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+an(i):""}function dh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Le(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=an(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Xc(e)}function zi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var oy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function mh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||oy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function ph(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var o in t)l=t[o],t.hasOwnProperty(o)&&i[o]!==l&&mh(e,o,l)}else for(var u in t)t.hasOwnProperty(u)&&mh(e,u,t[u])}function Zc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var uy=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),fy=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function el(e){return fy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Gn(){}var Wc=null;function eo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qi=null,Ui=null;function gh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ic(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+ln(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var o=l[it]||null;if(!o)throw Error(a(90));Ic(l,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&uh(l)}break e;case"textarea":hh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&Di(e,!!i.multiple,t,!1)}}}var to=!1;function yh(e,t,i){if(to)return e(t,i);to=!0;try{var l=e(t);return l}finally{if(to=!1,(qi!==null||Ui!==null)&&(Pl(),qi&&(t=qi,e=Ui,Ui=qi=null,gh(t),e)))for(t=0;t<e.length;t++)gh(e[t])}}function Dr(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Vn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),no=!1;if(Vn)try{var zr={};Object.defineProperty(zr,"passive",{get:function(){no=!0}}),window.addEventListener("test",zr,zr),window.removeEventListener("test",zr,zr)}catch{no=!1}var xs=null,so=null,tl=null;function bh(){if(tl)return tl;var e,t=so,i=t.length,l,o="value"in xs?xs.value:xs.textContent,u=o.length;for(e=0;e<i&&t[e]===o[e];e++);var m=i-e;for(l=1;l<=m&&t[i-l]===o[u-l];l++);return tl=o.slice(e,1<l?1-l:void 0)}function nl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function sl(){return!0}function xh(){return!1}function zt(e){function t(i,l,o,u,m){this._reactName=i,this._targetInst=o,this.type=l,this.nativeEvent=u,this.target=m,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?sl:xh,this.isPropagationStopped=xh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=sl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=sl)},persist:function(){},isPersistent:sl}),t}var ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},il=zt(ai),qr=w({},ai,{view:0,detail:0}),hy=zt(qr),io,ro,Ur,rl=w({},qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ur&&(Ur&&e.type==="mousemove"?(io=e.screenX-Ur.screenX,ro=e.screenY-Ur.screenY):ro=io=0,Ur=e),io)},movementY:function(e){return"movementY"in e?e.movementY:ro}}),vh=zt(rl),dy=w({},rl,{dataTransfer:0}),my=zt(dy),py=w({},qr,{relatedTarget:0}),ao=zt(py),gy=w({},ai,{animationName:0,elapsedTime:0,pseudoElement:0}),yy=zt(gy),by=w({},ai,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),xy=zt(by),vy=w({},ai,{data:0}),_h=zt(vy),_y={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wy={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Sy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ey(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sy[e])?!!t[e]:!1}function lo(){return Ey}var Ay=w({},qr,{key:function(e){if(e.key){var t=_y[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=nl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lo,charCode:function(e){return e.type==="keypress"?nl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Oy=zt(Ay),jy=w({},rl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wh=zt(jy),Ty=w({},qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lo}),Ny=zt(Ty),Cy=w({},ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),ky=zt(Cy),My=w({},rl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ry=zt(My),Dy=w({},ai,{newState:0,oldState:0}),zy=zt(Dy),qy=[9,13,27,32],co=Vn&&"CompositionEvent"in window,Br=null;Vn&&"documentMode"in document&&(Br=document.documentMode);var Uy=Vn&&"TextEvent"in window&&!Br,Sh=Vn&&(!co||Br&&8<Br&&11>=Br),Eh=" ",Ah=!1;function Oh(e,t){switch(e){case"keyup":return qy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bi=!1;function By(e,t){switch(e){case"compositionend":return jh(t);case"keypress":return t.which!==32?null:(Ah=!0,Eh);case"textInput":return e=t.data,e===Eh&&Ah?null:e;default:return null}}function Ly(e,t){if(Bi)return e==="compositionend"||!co&&Oh(e,t)?(e=bh(),tl=so=xs=null,Bi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Sh&&t.locale!=="ko"?null:t.data;default:return null}}var Hy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Th(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hy[e.type]:t==="textarea"}function Nh(e,t,i,l){qi?Ui?Ui.push(l):Ui=[l]:qi=l,t=Ql(t,"onChange"),0<t.length&&(i=new il("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Lr=null,Hr=null;function Py(e){fp(e,0)}function al(e){var t=_(e);if(uh(t))return e}function Ch(e,t){if(e==="change")return t}var kh=!1;if(Vn){var oo;if(Vn){var uo="oninput"in document;if(!uo){var Mh=document.createElement("div");Mh.setAttribute("oninput","return;"),uo=typeof Mh.oninput=="function"}oo=uo}else oo=!1;kh=oo&&(!document.documentMode||9<document.documentMode)}function Rh(){Lr&&(Lr.detachEvent("onpropertychange",Dh),Hr=Lr=null)}function Dh(e){if(e.propertyName==="value"&&al(Hr)){var t=[];Nh(t,Hr,e,eo(e)),yh(Py,t)}}function Yy(e,t,i){e==="focusin"?(Rh(),Lr=t,Hr=i,Lr.attachEvent("onpropertychange",Dh)):e==="focusout"&&Rh()}function $y(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return al(Hr)}function Gy(e,t){if(e==="click")return al(t)}function Vy(e,t){if(e==="input"||e==="change")return al(t)}function Fy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Fy;function Pr(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var o=i[l];if(!jr.call(t,o)||!Gt(e[o],t[o]))return!1}return!0}function zh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function qh(e,t){var i=zh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=zh(i)}}function Uh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Uh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Bh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Wa(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Wa(e.document)}return t}function fo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Jy=Vn&&"documentMode"in document&&11>=document.documentMode,Li=null,ho=null,Yr=null,mo=!1;function Lh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;mo||Li==null||Li!==Wa(l)||(l=Li,"selectionStart"in l&&fo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Yr&&Pr(Yr,l)||(Yr=l,l=Ql(ho,"onSelect"),0<l.length&&(t=new il("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Li)))}function li(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Hi={animationend:li("Animation","AnimationEnd"),animationiteration:li("Animation","AnimationIteration"),animationstart:li("Animation","AnimationStart"),transitionrun:li("Transition","TransitionRun"),transitionstart:li("Transition","TransitionStart"),transitioncancel:li("Transition","TransitionCancel"),transitionend:li("Transition","TransitionEnd")},po={},Hh={};Vn&&(Hh=document.createElement("div").style,"AnimationEvent"in window||(delete Hi.animationend.animation,delete Hi.animationiteration.animation,delete Hi.animationstart.animation),"TransitionEvent"in window||delete Hi.transitionend.transition);function ci(e){if(po[e])return po[e];if(!Hi[e])return e;var t=Hi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Hh)return po[e]=t[i];return e}var Ph=ci("animationend"),Yh=ci("animationiteration"),$h=ci("animationstart"),Qy=ci("transitionrun"),Xy=ci("transitionstart"),Iy=ci("transitioncancel"),Gh=ci("transitionend"),Vh=new Map,go="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");go.push("scrollEnd");function wn(e,t){Vh.set(e,t),X(t,[e])}var ll=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},cn=[],Pi=0,yo=0;function cl(){for(var e=Pi,t=yo=Pi=0;t<e;){var i=cn[t];cn[t++]=null;var l=cn[t];cn[t++]=null;var o=cn[t];cn[t++]=null;var u=cn[t];if(cn[t++]=null,l!==null&&o!==null){var m=l.pending;m===null?o.next=o:(o.next=m.next,m.next=o),l.pending=o}u!==0&&Fh(i,o,u)}}function ol(e,t,i,l){cn[Pi++]=e,cn[Pi++]=t,cn[Pi++]=i,cn[Pi++]=l,yo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function bo(e,t,i,l){return ol(e,t,i,l),ul(e)}function oi(e,t){return ol(e,null,null,t),ul(e)}function Fh(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var o=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(o=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,o&&t!==null&&(o=31-Nt(i),e=u.hiddenUpdates,l=e[o],l===null?e[o]=[t]:l.push(t),t.lane=i|536870912),u):null}function ul(e){if(50<ua)throw ua=0,ju=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function Ky(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new Ky(e,t,i,l)}function xo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Jh(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function fl(e,t,i,l,o,u){var m=0;if(l=e,typeof e=="function")xo(e)&&(m=1);else if(typeof e=="string")m=nx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Q:return e=Vt(31,i,t,o),e.elementType=Q,e.lanes=u,e;case H:return ui(i.children,o,u,t);case ee:m=8,o|=24;break;case ne:return e=Vt(12,i,t,o|2),e.elementType=ne,e.lanes=u,e;case k:return e=Vt(13,i,t,o),e.elementType=k,e.lanes=u,e;case I:return e=Vt(19,i,t,o),e.elementType=I,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:m=10;break e;case W:m=9;break e;case be:m=11;break e;case ie:m=14;break e;case Z:m=16,l=null;break e}m=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(m,i,t,o),t.elementType=e,t.type=l,t.lanes=u,t}function ui(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function vo(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function Qh(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function _o(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Xh=new WeakMap;function on(e,t){if(typeof e=="object"&&e!==null){var i=Xh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ga(t)},Xh.set(e,t),t)}return{value:e,source:t,stack:Ga(t)}}var $i=[],Gi=0,hl=null,$r=0,un=[],fn=0,vs=null,kn=1,Mn="";function Jn(e,t){$i[Gi++]=$r,$i[Gi++]=hl,hl=e,$r=t}function Ih(e,t,i){un[fn++]=kn,un[fn++]=Mn,un[fn++]=vs,vs=e;var l=kn;e=Mn;var o=32-Nt(l)-1;l&=~(1<<o),i+=1;var u=32-Nt(t)+o;if(30<u){var m=o-o%5;u=(l&(1<<m)-1).toString(32),l>>=m,o-=m,kn=1<<32-Nt(t)+o|i<<o|l,Mn=u+e}else kn=1<<u|i<<o|l,Mn=e}function wo(e){e.return!==null&&(Jn(e,1),Ih(e,1,0))}function So(e){for(;e===hl;)hl=$i[--Gi],$i[Gi]=null,$r=$i[--Gi],$i[Gi]=null;for(;e===vs;)vs=un[--fn],un[fn]=null,Mn=un[--fn],un[fn]=null,kn=un[--fn],un[fn]=null}function Kh(e,t){un[fn++]=kn,un[fn++]=Mn,un[fn++]=vs,kn=t.id,Mn=t.overflow,vs=e}var wt=null,Ze=null,Re=!1,_s=null,hn=!1,Eo=Error(a(519));function ws(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gr(on(t,e)),Eo}function Zh(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<ha.length;i++)Ce(ha[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),fh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),dh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||pp(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Gn),t=!0):t=!1,t||ws(e,!0)}function Wh(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:hn=!1;return;case 27:case 3:hn=!0;return;default:wt=wt.return}}function Vi(e){if(e!==wt)return!1;if(!Re)return Wh(e),Re=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Yu(e.type,e.memoizedProps)),i=!i),i&&Ze&&ws(e),Wh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Ep(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Ep(e)}else t===27?(t=Ze,qs(e.type)?(e=Ju,Ju=null,Ze=e):Ze=t):Ze=wt?mn(e.stateNode.nextSibling):null;return!0}function fi(){Ze=wt=null,Re=!1}function Ao(){var e=_s;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),_s=null),e}function Gr(e){_s===null?_s=[e]:_s.push(e)}var Oo=je(null),hi=null,Qn=null;function Ss(e,t,i){Te(Oo,t._currentValue),t._currentValue=i}function Xn(e){e._currentValue=Oo.current,_e(Oo)}function jo(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function To(e,t,i,l){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){var m=o.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=o;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),jo(u.return,i,e),l||(m=null);break e}u=b.next}}else if(o.tag===18){if(m=o.return,m===null)throw Error(a(341));m.lanes|=i,u=m.alternate,u!==null&&(u.lanes|=i),jo(m,i,e),m=null}else m=o.child;if(m!==null)m.return=o;else for(m=o;m!==null;){if(m===e){m=null;break}if(o=m.sibling,o!==null){o.return=m.return,m=o;break}m=m.return}o=m}}function Fi(e,t,i,l){e=null;for(var o=t,u=!1;o!==null;){if(!u){if((o.flags&524288)!==0)u=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var m=o.alternate;if(m===null)throw Error(a(387));if(m=m.memoizedProps,m!==null){var b=o.type;Gt(o.pendingProps.value,m.value)||(e!==null?e.push(b):e=[b])}}else if(o===Ot.current){if(m=o.alternate,m===null)throw Error(a(387));m.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(ya):e=[ya])}o=o.return}e!==null&&To(t,e,i,l),t.flags|=262144}function dl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function di(e){hi=e,Qn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ed(hi,e)}function ml(e,t){return hi===null&&di(e),ed(e,t)}function ed(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Qn===null){if(e===null)throw Error(a(308));Qn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Qn=Qn.next=t;return i}var Zy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},Wy=r.unstable_scheduleCallback,eb=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function No(){return{controller:new Zy,data:new Map,refCount:0}}function Vr(e){e.refCount--,e.refCount===0&&Wy(eb,function(){e.controller.abort()})}var Fr=null,Co=0,Ji=0,Qi=null;function tb(e,t){if(Fr===null){var i=Fr=[];Co=0,Ji=Ru(),Qi={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Co++,t.then(td,td),t}function td(){if(--Co===0&&Fr!==null){Qi!==null&&(Qi.status="fulfilled");var e=Fr;Fr=null,Ji=0,Qi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function nb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(o){i.push(o)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var o=0;o<i.length;o++)(0,i[o])(t)},function(o){for(l.status="rejected",l.reason=o,o=0;o<i.length;o++)(0,i[o])(void 0)}),l}var nd=Y.S;Y.S=function(e,t){Lm=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&tb(e,t),nd!==null&&nd(e,t)};var mi=je(null);function ko(){var e=mi.current;return e!==null?e:Xe.pooledCache}function pl(e,t){t===null?Te(mi,mi.current):Te(mi,t.pool)}function sd(){var e=ko();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Mo=Error(a(474)),gl=Error(a(542)),yl={then:function(){}};function id(e){return e=e.status,e==="fulfilled"||e==="rejected"}function rd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Gn,Gn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ld(e),e;default:if(typeof t.status=="string")t.then(Gn,Gn);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=l}},function(l){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ld(e),e}throw gi=t,Xi}}function pi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(gi=i,Xi):i}}var gi=null;function ad(){if(gi===null)throw Error(a(459));var e=gi;return gi=null,e}function ld(e){if(e===Xi||e===gl)throw Error(a(483))}var Ii=null,Jr=0;function bl(e){var t=Jr;return Jr+=1,Ii===null&&(Ii=[]),rd(Ii,e,t)}function Qr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xl(e,t){throw t.$$typeof===j?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function cd(e){function t(M,C){if(e){var q=M.deletions;q===null?(M.deletions=[C],M.flags|=16):q.push(C)}}function i(M,C){if(!e)return null;for(;C!==null;)t(M,C),C=C.sibling;return null}function l(M){for(var C=new Map;M!==null;)M.key!==null?C.set(M.key,M):C.set(M.index,M),M=M.sibling;return C}function o(M,C){return M=Fn(M,C),M.index=0,M.sibling=null,M}function u(M,C,q){return M.index=q,e?(q=M.alternate,q!==null?(q=q.index,q<C?(M.flags|=67108866,C):q):(M.flags|=67108866,C)):(M.flags|=1048576,C)}function m(M){return e&&M.alternate===null&&(M.flags|=67108866),M}function b(M,C,q,G){return C===null||C.tag!==6?(C=vo(q,M.mode,G),C.return=M,C):(C=o(C,q),C.return=M,C)}function O(M,C,q,G){var pe=q.type;return pe===H?$(M,C,q.props.children,G,q.key):C!==null&&(C.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Z&&pi(pe)===C.type)?(C=o(C,q.props),Qr(C,q),C.return=M,C):(C=fl(q.type,q.key,q.props,null,M.mode,G),Qr(C,q),C.return=M,C)}function U(M,C,q,G){return C===null||C.tag!==4||C.stateNode.containerInfo!==q.containerInfo||C.stateNode.implementation!==q.implementation?(C=_o(q,M.mode,G),C.return=M,C):(C=o(C,q.children||[]),C.return=M,C)}function $(M,C,q,G,pe){return C===null||C.tag!==7?(C=ui(q,M.mode,G,pe),C.return=M,C):(C=o(C,q),C.return=M,C)}function J(M,C,q){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=vo(""+C,M.mode,q),C.return=M,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case z:return q=fl(C.type,C.key,C.props,null,M.mode,q),Qr(q,C),q.return=M,q;case R:return C=_o(C,M.mode,q),C.return=M,C;case Z:return C=pi(C),J(M,C,q)}if(Le(C)||re(C))return C=ui(C,M.mode,q,null),C.return=M,C;if(typeof C.then=="function")return J(M,bl(C),q);if(C.$$typeof===me)return J(M,ml(M,C),q);xl(M,C)}return null}function B(M,C,q,G){var pe=C!==null?C.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return pe!==null?null:b(M,C,""+q,G);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case z:return q.key===pe?O(M,C,q,G):null;case R:return q.key===pe?U(M,C,q,G):null;case Z:return q=pi(q),B(M,C,q,G)}if(Le(q)||re(q))return pe!==null?null:$(M,C,q,G,null);if(typeof q.then=="function")return B(M,C,bl(q),G);if(q.$$typeof===me)return B(M,C,ml(M,q),G);xl(M,q)}return null}function P(M,C,q,G,pe){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return M=M.get(q)||null,b(C,M,""+G,pe);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case z:return M=M.get(G.key===null?q:G.key)||null,O(C,M,G,pe);case R:return M=M.get(G.key===null?q:G.key)||null,U(C,M,G,pe);case Z:return G=pi(G),P(M,C,q,G,pe)}if(Le(G)||re(G))return M=M.get(q)||null,$(C,M,G,pe,null);if(typeof G.then=="function")return P(M,C,q,bl(G),pe);if(G.$$typeof===me)return P(M,C,q,ml(C,G),pe);xl(C,G)}return null}function fe(M,C,q,G){for(var pe=null,Ue=null,de=C,Ee=C=0,Me=null;de!==null&&Ee<q.length;Ee++){de.index>Ee?(Me=de,de=null):Me=de.sibling;var Be=B(M,de,q[Ee],G);if(Be===null){de===null&&(de=Me);break}e&&de&&Be.alternate===null&&t(M,de),C=u(Be,C,Ee),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be,de=Me}if(Ee===q.length)return i(M,de),Re&&Jn(M,Ee),pe;if(de===null){for(;Ee<q.length;Ee++)de=J(M,q[Ee],G),de!==null&&(C=u(de,C,Ee),Ue===null?pe=de:Ue.sibling=de,Ue=de);return Re&&Jn(M,Ee),pe}for(de=l(de);Ee<q.length;Ee++)Me=P(de,M,Ee,q[Ee],G),Me!==null&&(e&&Me.alternate!==null&&de.delete(Me.key===null?Ee:Me.key),C=u(Me,C,Ee),Ue===null?pe=Me:Ue.sibling=Me,Ue=Me);return e&&de.forEach(function(Ps){return t(M,Ps)}),Re&&Jn(M,Ee),pe}function ge(M,C,q,G){if(q==null)throw Error(a(151));for(var pe=null,Ue=null,de=C,Ee=C=0,Me=null,Be=q.next();de!==null&&!Be.done;Ee++,Be=q.next()){de.index>Ee?(Me=de,de=null):Me=de.sibling;var Ps=B(M,de,Be.value,G);if(Ps===null){de===null&&(de=Me);break}e&&de&&Ps.alternate===null&&t(M,de),C=u(Ps,C,Ee),Ue===null?pe=Ps:Ue.sibling=Ps,Ue=Ps,de=Me}if(Be.done)return i(M,de),Re&&Jn(M,Ee),pe;if(de===null){for(;!Be.done;Ee++,Be=q.next())Be=J(M,Be.value,G),Be!==null&&(C=u(Be,C,Ee),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be);return Re&&Jn(M,Ee),pe}for(de=l(de);!Be.done;Ee++,Be=q.next())Be=P(de,M,Ee,Be.value,G),Be!==null&&(e&&Be.alternate!==null&&de.delete(Be.key===null?Ee:Be.key),C=u(Be,C,Ee),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be);return e&&de.forEach(function(dx){return t(M,dx)}),Re&&Jn(M,Ee),pe}function Je(M,C,q,G){if(typeof q=="object"&&q!==null&&q.type===H&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case z:e:{for(var pe=q.key;C!==null;){if(C.key===pe){if(pe=q.type,pe===H){if(C.tag===7){i(M,C.sibling),G=o(C,q.props.children),G.return=M,M=G;break e}}else if(C.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Z&&pi(pe)===C.type){i(M,C.sibling),G=o(C,q.props),Qr(G,q),G.return=M,M=G;break e}i(M,C);break}else t(M,C);C=C.sibling}q.type===H?(G=ui(q.props.children,M.mode,G,q.key),G.return=M,M=G):(G=fl(q.type,q.key,q.props,null,M.mode,G),Qr(G,q),G.return=M,M=G)}return m(M);case R:e:{for(pe=q.key;C!==null;){if(C.key===pe)if(C.tag===4&&C.stateNode.containerInfo===q.containerInfo&&C.stateNode.implementation===q.implementation){i(M,C.sibling),G=o(C,q.children||[]),G.return=M,M=G;break e}else{i(M,C);break}else t(M,C);C=C.sibling}G=_o(q,M.mode,G),G.return=M,M=G}return m(M);case Z:return q=pi(q),Je(M,C,q,G)}if(Le(q))return fe(M,C,q,G);if(re(q)){if(pe=re(q),typeof pe!="function")throw Error(a(150));return q=pe.call(q),ge(M,C,q,G)}if(typeof q.then=="function")return Je(M,C,bl(q),G);if(q.$$typeof===me)return Je(M,C,ml(M,q),G);xl(M,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,C!==null&&C.tag===6?(i(M,C.sibling),G=o(C,q),G.return=M,M=G):(i(M,C),G=vo(q,M.mode,G),G.return=M,M=G),m(M)):i(M,C)}return function(M,C,q,G){try{Jr=0;var pe=Je(M,C,q,G);return Ii=null,pe}catch(de){if(de===Xi||de===gl)throw de;var Ue=Vt(29,de,null,M.mode);return Ue.lanes=G,Ue.return=M,Ue}finally{}}}var yi=cd(!0),od=cd(!1),Es=!1;function Ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Do(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function As(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Os(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(He&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,t=ul(e),Fh(e,null,i),t}return ol(e,l,t,i),ul(e)}function Xr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,si(e,i)}}function zo(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var o=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var m={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?o=u=m:u=u.next=m,i=i.next}while(i!==null);u===null?o=u=t:u=u.next=t}else o=u=t;i={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var qo=!1;function Ir(){if(qo){var e=Qi;if(e!==null)throw e}}function Kr(e,t,i,l){qo=!1;var o=e.updateQueue;Es=!1;var u=o.firstBaseUpdate,m=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var O=b,U=O.next;O.next=null,m===null?u=U:m.next=U,m=O;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==m&&(b===null?$.firstBaseUpdate=U:b.next=U,$.lastBaseUpdate=O))}if(u!==null){var J=o.baseState;m=0,$=U=O=null,b=u;do{var B=b.lane&-536870913,P=B!==b.lane;if(P?(ke&B)===B:(l&B)===B){B!==0&&B===Ji&&(qo=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var fe=e,ge=b;B=t;var Je=i;switch(ge.tag){case 1:if(fe=ge.payload,typeof fe=="function"){J=fe.call(Je,J,B);break e}J=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ge.payload,B=typeof fe=="function"?fe.call(Je,J,B):fe,B==null)break e;J=w({},J,B);break e;case 2:Es=!0}}B=b.callback,B!==null&&(e.flags|=64,P&&(e.flags|=8192),P=o.callbacks,P===null?o.callbacks=[B]:P.push(B))}else P={lane:B,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(U=$=P,O=J):$=$.next=P,m|=B;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;P=b,b=P.next,P.next=null,o.lastBaseUpdate=P,o.shared.pending=null}}while(!0);$===null&&(O=J),o.baseState=O,o.firstBaseUpdate=U,o.lastBaseUpdate=$,u===null&&(o.shared.lanes=0),ks|=m,e.lanes=m,e.memoizedState=J}}function ud(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function fd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)ud(i[e],t)}var Ki=je(null),vl=je(0);function hd(e,t){e=is,Te(vl,e),Te(Ki,t),is=e|t.baseLanes}function Uo(){Te(vl,is),Te(Ki,Ki.current)}function Bo(){is=vl.current,_e(Ki),_e(vl)}var Ft=je(null),dn=null;function js(e){var t=e.alternate;Te(ot,ot.current&1),Te(Ft,e),dn===null&&(t===null||Ki.current!==null||t.memoizedState!==null)&&(dn=e)}function Lo(e){Te(ot,ot.current),Te(Ft,e),dn===null&&(dn=e)}function dd(e){e.tag===22?(Te(ot,ot.current),Te(Ft,e),dn===null&&(dn=e)):Ts()}function Ts(){Te(ot,ot.current),Te(Ft,Ft.current)}function Jt(e){_e(Ft),dn===e&&(dn=null),_e(ot)}var ot=je(0);function _l(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Vu(i)||Fu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var In=0,Se=null,Ve=null,dt=null,wl=!1,Zi=!1,bi=!1,Sl=0,Zr=0,Wi=null,sb=0;function rt(){throw Error(a(321))}function Ho(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Po(e,t,i,l,o,u){return In=u,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Y.H=e===null||e.memoizedState===null?Id:nu,bi=!1,u=i(l,o),bi=!1,Zi&&(u=pd(t,i,l,o)),md(e),u}function md(e){Y.H=ta;var t=Ve!==null&&Ve.next!==null;if(In=0,dt=Ve=Se=null,wl=!1,Zr=0,Wi=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&dl(e)&&(mt=!0))}function pd(e,t,i,l){Se=e;var o=0;do{if(Zi&&(Wi=null),Zr=0,Zi=!1,25<=o)throw Error(a(301));if(o+=1,dt=Ve=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}Y.H=Kd,u=t(i,l)}while(Zi);return u}function ib(){var e=Y.H,t=e.useState()[0];return t=typeof t.then=="function"?Wr(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(Se.flags|=1024),t}function Yo(){var e=Sl!==0;return Sl=0,e}function $o(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Go(e){if(wl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}wl=!1}In=0,dt=Ve=Se=null,Zi=!1,Zr=Sl=0,Wi=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Se.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Ve===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=dt===null?Se.memoizedState:dt.next;if(t!==null)dt=t,Ve=e;else{if(e===null)throw Se.alternate===null?Error(a(467)):Error(a(310));Ve=e,e={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},dt===null?Se.memoizedState=dt=e:dt=dt.next=e}return dt}function El(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wr(e){var t=Zr;return Zr+=1,Wi===null&&(Wi=[]),e=rd(Wi,e,t),t=Se,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,Y.H=t===null||t.memoizedState===null?Id:nu),e}function Al(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Wr(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Vo(e){var t=null,i=Se.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Se.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=El(),Se.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=K;return t.index++,i}function Kn(e,t){return typeof t=="function"?t(e):t}function Ol(e){var t=ut();return Fo(t,Ve,e)}function Fo(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var o=e.baseQueue,u=l.pending;if(u!==null){if(o!==null){var m=o.next;o.next=u.next,u.next=m}t.baseQueue=o=u,l.pending=null}if(u=e.baseState,o===null)e.memoizedState=u;else{t=o.next;var b=m=null,O=null,U=t,$=!1;do{var J=U.lane&-536870913;if(J!==U.lane?(ke&J)===J:(In&J)===J){var B=U.revertLane;if(B===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),J===Ji&&($=!0);else if((In&B)===B){U=U.next,B===Ji&&($=!0);continue}else J={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=J,m=u):O=O.next=J,Se.lanes|=B,ks|=B;J=U.action,bi&&i(u,J),u=U.hasEagerState?U.eagerState:i(u,J)}else B={lane:J,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=B,m=u):O=O.next=B,Se.lanes|=J,ks|=J;U=U.next}while(U!==null&&U!==t);if(O===null?m=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,$&&(i=Qi,i!==null)))throw i;e.memoizedState=u,e.baseState=m,e.baseQueue=O,l.lastRenderedState=u}return o===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Jo(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,o=i.pending,u=t.memoizedState;if(o!==null){i.pending=null;var m=o=o.next;do u=e(u,m.action),m=m.next;while(m!==o);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function gd(e,t,i){var l=Se,o=ut(),u=Re;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var m=!Gt((Ve||o).memoizedState,i);if(m&&(o.memoizedState=i,mt=!0),o=o.queue,Io(xd.bind(null,l,o,e),[e]),o.getSnapshot!==t||m||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,er(9,{destroy:void 0},bd.bind(null,l,o,i,t),null),Xe===null)throw Error(a(349));u||(In&127)!==0||yd(l,t,i)}return i}function yd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Se.updateQueue,t===null?(t=El(),Se.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function bd(e,t,i,l){t.value=i,t.getSnapshot=l,vd(t)&&_d(e)}function xd(e,t,i){return i(function(){vd(t)&&_d(e)})}function vd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function _d(e){var t=oi(e,2);t!==null&&Ht(t,e,2)}function Qo(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),bi){Yt(!0);try{i()}finally{Yt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:e},t}function wd(e,t,i,l){return e.baseState=i,Fo(e,Ve,typeof l=="function"?l:Kn)}function rb(e,t,i,l,o){if(Nl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){u.listeners.push(m)}};Y.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Sd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Sd(e,t){var i=t.action,l=t.payload,o=e.state;if(t.isTransition){var u=Y.T,m={};Y.T=m;try{var b=i(o,l),O=Y.S;O!==null&&O(m,b),Ed(e,t,b)}catch(U){Xo(e,t,U)}finally{u!==null&&m.types!==null&&(u.types=m.types),Y.T=u}}else try{u=i(o,l),Ed(e,t,u)}catch(U){Xo(e,t,U)}}function Ed(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Ad(e,t,l)},function(l){return Xo(e,t,l)}):Ad(e,t,i)}function Ad(e,t,i){t.status="fulfilled",t.value=i,Od(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Sd(e,i)))}function Xo(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Od(t),t=t.next;while(t!==l)}e.action=null}function Od(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jd(e,t){return t}function Td(e,t){if(Re){var i=Xe.formState;if(i!==null){e:{var l=Se;if(Re){if(Ze){t:{for(var o=Ze,u=hn;o.nodeType!==8;){if(!u){o=null;break t}if(o=mn(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){Ze=mn(o.nextSibling),l=o.data==="F!";break e}}ws(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jd,lastRenderedState:t},i.queue=l,i=Jd.bind(null,Se,l),l.dispatch=i,l=Qo(!1),u=tu.bind(null,Se,!1,l.queue),l=kt(),o={state:t,dispatch:null,action:e,pending:null},l.queue=o,i=rb.bind(null,Se,o,u,i),o.dispatch=i,l.memoizedState=e,[t,i,!1]}function Nd(e){var t=ut();return Cd(t,Ve,e)}function Cd(e,t,i){if(t=Fo(e,t,jd)[0],e=Ol(Kn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Wr(t)}catch(m){throw m===Xi?gl:m}else l=t;t=ut();var o=t.queue,u=o.dispatch;return i!==t.memoizedState&&(Se.flags|=2048,er(9,{destroy:void 0},ab.bind(null,o,i),null)),[l,u,e]}function ab(e,t){e.action=t}function kd(e){var t=ut(),i=Ve;if(i!==null)return Cd(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function er(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Se.updateQueue,t===null&&(t=El(),Se.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function Md(){return ut().memoizedState}function jl(e,t,i,l){var o=kt();Se.flags|=e,o.memoizedState=er(1|t,{destroy:void 0},i,l===void 0?null:l)}function Tl(e,t,i,l){var o=ut();l=l===void 0?null:l;var u=o.memoizedState.inst;Ve!==null&&l!==null&&Ho(l,Ve.memoizedState.deps)?o.memoizedState=er(t,u,i,l):(Se.flags|=e,o.memoizedState=er(1|t,u,i,l))}function Rd(e,t){jl(8390656,8,e,t)}function Io(e,t){Tl(2048,8,e,t)}function lb(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=El(),Se.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Dd(e){var t=ut().memoizedState;return lb({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function zd(e,t){return Tl(4,2,e,t)}function qd(e,t){return Tl(4,4,e,t)}function Ud(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Bd(e,t,i){i=i!=null?i.concat([e]):null,Tl(4,4,Ud.bind(null,t,e),i)}function Ko(){}function Ld(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&Ho(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Hd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&Ho(t,l[1]))return l[0];if(l=e(),bi){Yt(!0);try{e()}finally{Yt(!1)}}return i.memoizedState=[l,t],l}function Zo(e,t,i){return i===void 0||(In&1073741824)!==0&&(ke&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Pm(),Se.lanes|=e,ks|=e,i)}function Pd(e,t,i,l){return Gt(i,t)?i:Ki.current!==null?(e=Zo(e,i,l),Gt(e,t)||(mt=!0),e):(In&42)===0||(In&1073741824)!==0&&(ke&261930)===0?(mt=!0,e.memoizedState=i):(e=Pm(),Se.lanes|=e,ks|=e,t)}function Yd(e,t,i,l,o){var u=te.p;te.p=u!==0&&8>u?u:8;var m=Y.T,b={};Y.T=b,tu(e,!1,t,i);try{var O=o(),U=Y.S;if(U!==null&&U(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var $=nb(O,l);ea(e,t,$,It(e))}else ea(e,t,l,It(e))}catch(J){ea(e,t,{then:function(){},status:"rejected",reason:J},It())}finally{te.p=u,m!==null&&b.types!==null&&(m.types=b.types),Y.T=m}}function cb(){}function Wo(e,t,i,l){if(e.tag!==5)throw Error(a(476));var o=$d(e).queue;Yd(e,o,t,he,i===null?cb:function(){return Gd(e),i(l)})}function $d(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:he},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Gd(e){var t=$d(e);t.next===null&&(t=e.alternate.memoizedState),ea(e,t.next.queue,{},It())}function eu(){return St(ya)}function Vd(){return ut().memoizedState}function Fd(){return ut().memoizedState}function ob(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=It();e=As(i);var l=Os(t,e,i);l!==null&&(Ht(l,t,i),Xr(l,t,i)),t={cache:No()},e.payload=t;return}t=t.return}}function ub(e,t,i){var l=It();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Nl(e)?Qd(t,i):(i=bo(e,t,i,l),i!==null&&(Ht(i,e,l),Xd(i,t,l)))}function Jd(e,t,i){var l=It();ea(e,t,i,l)}function ea(e,t,i,l){var o={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Nl(e))Qd(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var m=t.lastRenderedState,b=u(m,i);if(o.hasEagerState=!0,o.eagerState=b,Gt(b,m))return ol(e,t,o,0),Xe===null&&cl(),!1}catch{}finally{}if(i=bo(e,t,o,l),i!==null)return Ht(i,e,l),Xd(i,t,l),!0}return!1}function tu(e,t,i,l){if(l={lane:2,revertLane:Ru(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Nl(e)){if(t)throw Error(a(479))}else t=bo(e,i,l,2),t!==null&&Ht(t,e,2)}function Nl(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Qd(e,t){Zi=wl=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Xd(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,si(e,i)}}var ta={readContext:St,use:Al,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};ta.useEffectEvent=rt;var Id={readContext:St,use:Al,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Rd,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,jl(4194308,4,Ud.bind(null,t,e),i)},useLayoutEffect:function(e,t){return jl(4194308,4,e,t)},useInsertionEffect:function(e,t){jl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(bi){Yt(!0);try{e()}finally{Yt(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var o=i(t);if(bi){Yt(!0);try{i(t)}finally{Yt(!1)}}}else o=t;return l.memoizedState=l.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},l.queue=e,e=e.dispatch=ub.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Qo(e);var t=e.queue,i=Jd.bind(null,Se,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Ko,useDeferredValue:function(e,t){var i=kt();return Zo(i,e,t)},useTransition:function(){var e=Qo(!1);return e=Yd.bind(null,Se,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Se,o=kt();if(Re){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Xe===null)throw Error(a(349));(ke&127)!==0||yd(l,t,i)}o.memoizedState=i;var u={value:i,getSnapshot:t};return o.queue=u,Rd(xd.bind(null,l,u,e),[e]),l.flags|=2048,er(9,{destroy:void 0},bd.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Xe.identifierPrefix;if(Re){var i=Mn,l=kn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Sl++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=sb++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:eu,useFormState:Td,useActionState:Td,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=tu.bind(null,Se,!0,i),i.dispatch=t,[e,t]},useMemoCache:Vo,useCacheRefresh:function(){return kt().memoizedState=ob.bind(null,Se)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((He&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},nu={readContext:St,use:Al,useCallback:Ld,useContext:St,useEffect:Io,useImperativeHandle:Bd,useInsertionEffect:zd,useLayoutEffect:qd,useMemo:Hd,useReducer:Ol,useRef:Md,useState:function(){return Ol(Kn)},useDebugValue:Ko,useDeferredValue:function(e,t){var i=ut();return Pd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Ol(Kn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Wr(e),t]},useSyncExternalStore:gd,useId:Vd,useHostTransitionStatus:eu,useFormState:Nd,useActionState:Nd,useOptimistic:function(e,t){var i=ut();return wd(i,Ve,e,t)},useMemoCache:Vo,useCacheRefresh:Fd};nu.useEffectEvent=Dd;var Kd={readContext:St,use:Al,useCallback:Ld,useContext:St,useEffect:Io,useImperativeHandle:Bd,useInsertionEffect:zd,useLayoutEffect:qd,useMemo:Hd,useReducer:Jo,useRef:Md,useState:function(){return Jo(Kn)},useDebugValue:Ko,useDeferredValue:function(e,t){var i=ut();return Ve===null?Zo(i,e,t):Pd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Jo(Kn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Wr(e),t]},useSyncExternalStore:gd,useId:Vd,useHostTransitionStatus:eu,useFormState:kd,useActionState:kd,useOptimistic:function(e,t){var i=ut();return Ve!==null?wd(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Vo,useCacheRefresh:Fd};Kd.useEffectEvent=Dd;function su(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var iu={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=It(),o=As(l);o.payload=t,i!=null&&(o.callback=i),t=Os(e,o,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=It(),o=As(l);o.tag=1,o.payload=t,i!=null&&(o.callback=i),t=Os(e,o,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=It(),l=As(i);l.tag=2,t!=null&&(l.callback=t),t=Os(e,l,i),t!==null&&(Ht(t,e,i),Xr(t,e,i))}};function Zd(e,t,i,l,o,u,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,m):t.prototype&&t.prototype.isPureReactComponent?!Pr(i,l)||!Pr(o,u):!0}function Wd(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&iu.enqueueReplaceState(t,t.state,null)}function xi(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var o in e)i[o]===void 0&&(i[o]=e[o])}return i}function em(e){ll(e)}function tm(e){console.error(e)}function nm(e){ll(e)}function Cl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function sm(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function ru(e,t,i){return i=As(i),i.tag=3,i.payload={element:null},i.callback=function(){Cl(e,t)},i}function im(e){return e=As(e),e.tag=3,e}function rm(e,t,i,l){var o=i.type.getDerivedStateFromError;if(typeof o=="function"){var u=l.value;e.payload=function(){return o(u)},e.callback=function(){sm(t,i,l)}}var m=i.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){sm(t,i,l),typeof o!="function"&&(Ms===null?Ms=new Set([this]):Ms.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function fb(e,t,i,l,o){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Fi(t,i,o,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return dn===null?Yl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=o,l===yl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Cu(e,l,o)),!1;case 22:return i.flags|=65536,l===yl?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Cu(e,l,o)),!1}throw Error(a(435,i.tag))}return Cu(e,l,o),Yl(),!1}if(Re)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,l!==Eo&&(e=Error(a(422),{cause:l}),Gr(on(e,i)))):(l!==Eo&&(t=Error(a(423),{cause:l}),Gr(on(t,i))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,l=on(l,i),o=ru(e.stateNode,l,o),zo(e,o),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=on(u,i),oa===null?oa=[u]:oa.push(u),at!==4&&(at=2),t===null)return!0;l=on(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=o&-o,i.lanes|=e,e=ru(i.stateNode,l,e),zo(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ms===null||!Ms.has(u))))return i.flags|=65536,o&=-o,i.lanes|=o,o=im(o),rm(o,e,i,l),zo(i,o),!1}i=i.return}while(i!==null);return!1}var au=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?od(t,null,i,l):yi(t,e.child,i,l)}function am(e,t,i,l,o){i=i.render;var u=t.ref;if("ref"in l){var m={};for(var b in l)b!=="ref"&&(m[b]=l[b])}else m=l;return di(t),l=Po(e,t,i,m,u,o),b=Yo(),e!==null&&!mt?($o(e,t,o),Zn(e,t,o)):(Re&&b&&wo(t),t.flags|=1,Et(e,t,l,o),t.child)}function lm(e,t,i,l,o){if(e===null){var u=i.type;return typeof u=="function"&&!xo(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,cm(e,t,u,l,o)):(e=fl(i.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!mu(e,o)){var m=u.memoizedProps;if(i=i.compare,i=i!==null?i:Pr,i(m,l)&&e.ref===t.ref)return Zn(e,t,o)}return t.flags|=1,e=Fn(u,l),e.ref=t.ref,e.return=t,t.child=e}function cm(e,t,i,l,o){if(e!==null){var u=e.memoizedProps;if(Pr(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,mu(e,o))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,Zn(e,t,o)}return lu(e,t,i,l,o)}function om(e,t,i,l){var o=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,o=0;l!==null;)o=o|l.lanes|l.childLanes,l=l.sibling;l=o&~u}else l=0,t.child=null;return um(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pl(t,u!==null?u.cachePool:null),u!==null?hd(t,u):Uo(),dd(t);else return l=t.lanes=536870912,um(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(pl(t,u.cachePool),hd(t,u),Ts(),t.memoizedState=null):(e!==null&&pl(t,null),Uo(),Ts());return Et(e,t,o,i),t.child}function na(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function um(e,t,i,l,o){var u=ko();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&pl(t,null),Uo(),dd(t),e!==null&&Fi(e,t,l,!0),t.childLanes=o,null}function kl(e,t){return t=Rl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function fm(e,t,i){return yi(t,e.child,null,i),e=kl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function hb(e,t,i){var l=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(l.mode==="hidden")return e=kl(t,l),t.lanes=536870912,na(null,e);if(Lo(t),(e=Ze)?(e=Sp(e,hn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vs!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Qh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw ws(t);return t.lanes=536870912,null}return kl(t,l)}var u=e.memoizedState;if(u!==null){var m=u.dehydrated;if(Lo(t),o)if(t.flags&256)t.flags&=-257,t=fm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Fi(e,t,i,!1),o=(i&e.childLanes)!==0,mt||o){if(l=Xe,l!==null&&(m=bs(l,i),m!==0&&m!==u.retryLane))throw u.retryLane=m,oi(e,m),Ht(l,e,m),au;Yl(),t=fm(e,t,i)}else e=u.treeContext,Ze=mn(m.nextSibling),wt=t,Re=!0,_s=null,hn=!1,e!==null&&Kh(t,e),t=kl(t,l),t.flags|=4096;return t}return e=Fn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ml(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function lu(e,t,i,l,o){return di(t),i=Po(e,t,i,l,void 0,o),l=Yo(),e!==null&&!mt?($o(e,t,o),Zn(e,t,o)):(Re&&l&&wo(t),t.flags|=1,Et(e,t,i,o),t.child)}function hm(e,t,i,l,o,u){return di(t),t.updateQueue=null,i=pd(t,l,i,o),md(e),l=Yo(),e!==null&&!mt?($o(e,t,u),Zn(e,t,u)):(Re&&l&&wo(t),t.flags|=1,Et(e,t,i,u),t.child)}function dm(e,t,i,l,o){if(di(t),t.stateNode===null){var u=Yi,m=i.contextType;typeof m=="object"&&m!==null&&(u=St(m)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=iu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Ro(t),m=i.contextType,u.context=typeof m=="object"&&m!==null?St(m):Yi,u.state=t.memoizedState,m=i.getDerivedStateFromProps,typeof m=="function"&&(su(t,i,m,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(m=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),m!==u.state&&iu.enqueueReplaceState(u,u.state,null),Kr(t,l,u,o),Ir(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=xi(i,b);u.props=O;var U=u.context,$=i.contextType;m=Yi,typeof $=="object"&&$!==null&&(m=St($));var J=i.getDerivedStateFromProps;$=typeof J=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||U!==m)&&Wd(t,u,l,m),Es=!1;var B=t.memoizedState;u.state=B,Kr(t,l,u,o),Ir(),U=t.memoizedState,b||B!==U||Es?(typeof J=="function"&&(su(t,i,J,l),U=t.memoizedState),(O=Es||Zd(t,i,O,l,B,U,m))?($||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=U),u.props=l,u.state=U,u.context=m,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Do(e,t),m=t.memoizedProps,$=xi(i,m),u.props=$,J=t.pendingProps,B=u.context,U=i.contextType,O=Yi,typeof U=="object"&&U!==null&&(O=St(U)),b=i.getDerivedStateFromProps,(U=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==J||B!==O)&&Wd(t,u,l,O),Es=!1,B=t.memoizedState,u.state=B,Kr(t,l,u,o),Ir();var P=t.memoizedState;m!==J||B!==P||Es||e!==null&&e.dependencies!==null&&dl(e.dependencies)?(typeof b=="function"&&(su(t,i,b,l),P=t.memoizedState),($=Es||Zd(t,i,$,l,B,P,O)||e!==null&&e.dependencies!==null&&dl(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=$):(typeof u.componentDidUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Ml(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=yi(t,e.child,null,o),t.child=yi(t,null,i,o)):Et(e,t,i,o),t.memoizedState=u.state,e=t.child):e=Zn(e,t,o),e}function mm(e,t,i,l){return fi(),t.flags|=256,Et(e,t,i,l),t.child}var cu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ou(e){return{baseLanes:e,cachePool:sd()}}function uu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=Xt),e}function pm(e,t,i){var l=t.pendingProps,o=!1,u=(t.flags&128)!==0,m;if((m=u)||(m=e!==null&&e.memoizedState===null?!1:(ot.current&2)!==0),m&&(o=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(o?js(t):Ts(),(e=Ze)?(e=Sp(e,hn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vs!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Qh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw ws(t);return Fu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,o?(Ts(),o=t.mode,b=Rl({mode:"hidden",children:b},o),l=ui(l,o,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=ou(i),l.childLanes=uu(e,m,i),t.memoizedState=cu,na(null,l)):(js(t),fu(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(js(t),t.flags&=-257,t=hu(e,t,i)):t.memoizedState!==null?(Ts(),t.child=e.child,t.flags|=128,t=null):(Ts(),b=l.fallback,o=t.mode,l=Rl({mode:"visible",children:l.children},o),b=ui(b,o,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,yi(t,e.child,null,i),l=t.child,l.memoizedState=ou(i),l.childLanes=uu(e,m,i),t.memoizedState=cu,t=na(null,l));else if(js(t),Fu(b)){if(m=b.nextSibling&&b.nextSibling.dataset,m)var U=m.dgst;m=U,l=Error(a(419)),l.stack="",l.digest=m,Gr({value:l,source:null,stack:null}),t=hu(e,t,i)}else if(mt||Fi(e,t,i,!1),m=(i&e.childLanes)!==0,mt||m){if(m=Xe,m!==null&&(l=bs(m,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,oi(e,l),Ht(m,e,l),au;Vu(b)||Yl(),t=hu(e,t,i)}else Vu(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=mn(b.nextSibling),wt=t,Re=!0,_s=null,hn=!1,e!==null&&Kh(t,e),t=fu(t,l.children),t.flags|=4096);return t}return o?(Ts(),b=l.fallback,o=t.mode,O=e.child,U=O.sibling,l=Fn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,U!==null?b=Fn(U,b):(b=ui(b,o,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,na(null,l),l=t.child,b=e.child.memoizedState,b===null?b=ou(i):(o=b.cachePool,o!==null?(O=ht._currentValue,o=o.parent!==O?{parent:O,pool:O}:o):o=sd(),b={baseLanes:b.baseLanes|i,cachePool:o}),l.memoizedState=b,l.childLanes=uu(e,m,i),t.memoizedState=cu,na(e.child,l)):(js(t),i=e.child,e=i.sibling,i=Fn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=i,t.memoizedState=null,i)}function fu(e,t){return t=Rl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Rl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function hu(e,t,i){return yi(t,e.child,null,i),e=fu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function gm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),jo(e.return,t,i)}function du(e,t,i,l,o,u){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:o,treeForkCount:u}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=l,m.tail=i,m.tailMode=o,m.treeForkCount=u)}function ym(e,t,i){var l=t.pendingProps,o=l.revealOrder,u=l.tail;l=l.children;var m=ot.current,b=(m&2)!==0;if(b?(m=m&1|2,t.flags|=128):m&=1,Te(ot,m),Et(e,t,l,i),l=Re?$r:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gm(e,i,t);else if(e.tag===19)gm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"forwards":for(i=t.child,o=null;i!==null;)e=i.alternate,e!==null&&_l(e)===null&&(o=i),i=i.sibling;i=o,i===null?(o=t.child,t.child=null):(o=i.sibling,i.sibling=null),du(t,!1,o,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&_l(e)===null){t.child=o;break}e=o.sibling,o.sibling=i,i=o,o=e}du(t,!0,i,null,u,l);break;case"together":du(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Zn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),ks|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Fi(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Fn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Fn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function mu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&dl(e)))}function db(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),Ss(t,ht,e.memoizedState.cache),fi();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:Ss(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lo(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(js(t),t.flags|=128,null):(i&t.child.childLanes)!==0?pm(e,t,i):(js(t),e=Zn(e,t,i),e!==null?e.sibling:null);js(t);break;case 19:var o=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Fi(e,t,i,!1),l=(i&t.childLanes)!==0),o){if(l)return ym(e,t,i);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Te(ot,ot.current),l)break;return null;case 22:return t.lanes=0,om(e,t,i,t.pendingProps);case 24:Ss(t,ht,e.memoizedState.cache)}return Zn(e,t,i)}function bm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!mu(e,i)&&(t.flags&128)===0)return mt=!1,db(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,Re&&(t.flags&1048576)!==0&&Ih(t,$r,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=pi(t.elementType),t.type=e,typeof e=="function")xo(e)?(l=xi(e,l),t.tag=1,t=dm(null,t,e,l,i)):(t.tag=0,t=lu(null,t,e,l,i));else{if(e!=null){var o=e.$$typeof;if(o===be){t.tag=11,t=am(null,t,e,l,i);break e}else if(o===ie){t.tag=14,t=lm(null,t,e,l,i);break e}}throw t=Ge(e)||e,Error(a(306,t,""))}}return t;case 0:return lu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,o=xi(l,t.pendingProps),dm(e,t,l,o,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;o=u.element,Do(e,t),Kr(t,l,null,i);var m=t.memoizedState;if(l=m.cache,Ss(t,ht,l),l!==u.cache&&To(t,[ht],i,!0),Ir(),l=m.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=mm(e,t,l,i);break e}else if(l!==o){o=on(Error(a(424)),t),Gr(o),t=mm(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=mn(e.firstChild),wt=t,Re=!0,_s=null,hn=!0,i=od(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(fi(),l===o){t=Zn(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return Ml(e,t),e===null?(i=Np(t.type,null,t.pendingProps,null))?t.memoizedState=i:Re||(i=t.type,e=t.pendingProps,l=Xl(sn.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),T(l),t.stateNode=l):t.memoizedState=Np(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Re&&(l=t.stateNode=Op(t.type,t.pendingProps,sn.current),wt=t,hn=!0,o=Ze,qs(t.type)?(Ju=o,Ze=mn(l.firstChild)):Ze=o),Et(e,t,t.pendingProps.children,i),Ml(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((o=l=Ze)&&(l=$b(l,t.type,t.pendingProps,hn),l!==null?(t.stateNode=l,wt=t,Ze=mn(l.firstChild),hn=!1,o=!0):o=!1),o||ws(t)),Tt(t),o=t.type,u=t.pendingProps,m=e!==null?e.memoizedProps:null,l=u.children,Yu(o,u)?l=null:m!==null&&Yu(o,m)&&(t.flags|=32),t.memoizedState!==null&&(o=Po(e,t,ib,null,null,i),ya._currentValue=o),Ml(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&Re&&((e=i=Ze)&&(i=Gb(i,t.pendingProps,hn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||ws(t)),null;case 13:return pm(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=yi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return am(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,Ss(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return o=t.type._context,l=t.pendingProps.children,di(t),o=St(o),l=l(o),t.flags|=1,Et(e,t,l,i),t.child;case 14:return lm(e,t,t.type,t.pendingProps,i);case 15:return cm(e,t,t.type,t.pendingProps,i);case 19:return ym(e,t,i);case 31:return hb(e,t,i);case 22:return om(e,t,i,t.pendingProps);case 24:return di(t),l=St(ht),e===null?(o=ko(),o===null&&(o=Xe,u=No(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=i),o=u),t.memoizedState={parent:l,cache:o},Ro(t),Ss(t,ht,o)):((e.lanes&i)!==0&&(Do(e,t),Kr(t,null,null,i),Ir()),o=e.memoizedState,u=t.memoizedState,o.parent!==l?(o={parent:l,cache:l},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),Ss(t,ht,l)):(l=u.cache,Ss(t,ht,l),l!==o.cache&&To(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Wn(e){e.flags|=4}function pu(e,t,i,l,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(Vm())e.flags|=8192;else throw gi=yl,Mo}else e.flags&=-16777217}function xm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Dp(t))if(Vm())e.flags|=8192;else throw gi=yl,Mo}function Dl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Mi():536870912,e.lanes|=t,ir|=t)}function sa(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var o=e.child;o!==null;)i|=o.lanes|o.childLanes,l|=o.subtreeFlags&65011712,l|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)i|=o.lanes|o.childLanes,l|=o.subtreeFlags,l|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function mb(e,t,i){var l=t.pendingProps;switch(So(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Xn(ht),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?Wn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ao())),We(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(Wn(t),u!==null?(We(t),xm(t,u)):(We(t),pu(t,o,null,l,i))):u?u!==e.memoizedState?(Wn(t),We(t),xm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Wn(t),We(t),pu(t,o,e,l,i)),null;case 27:if(Zs(t),i=sn.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Vi(t)?Zh(t):(e=Op(o,l,i),t.stateNode=e,Wn(t))}return We(t),null;case 5:if(Zs(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Vi(t))Zh(t);else{var m=Xl(sn.current);switch(u){case 1:u=m.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:u=m.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":u=m.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":u=m.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":u=m.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?m.createElement("select",{is:l.is}):m.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?m.createElement(o,{is:l.is}):m.createElement(o)}}u[Qe]=t,u[it]=l;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)u.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=u;e:switch(At(u,o,l),o){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Wn(t)}}return We(t),pu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=sn.current,Vi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,o=wt,o!==null)switch(o.tag){case 27:case 5:l=o.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||pp(e.nodeValue,i)),e||ws(t,!0)}else e=Xl(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Vi(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Vi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!o)throw Error(a(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));o[Qe]=t}else fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),o=!1}else o=Ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,o=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(o=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==o&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Dl(t,t.updateQueue),We(t),null);case 4:return we(),e===null&&Uu(t.stateNode.containerInfo),We(t),null;case 10:return Xn(t.type),We(t),null;case 19:if(_e(ot),l=t.memoizedState,l===null)return We(t),null;if(o=(t.flags&128)!==0,u=l.rendering,u===null)if(o)sa(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=_l(e),u!==null){for(t.flags|=128,sa(l,!1),e=u.updateQueue,t.updateQueue=e,Dl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Jh(i,e),i=i.sibling;return Te(ot,ot.current&1|2),Re&&Jn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Ll&&(t.flags|=128,o=!0,sa(l,!1),t.lanes=4194304)}else{if(!o)if(e=_l(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Dl(t,e),sa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Re)return We(t),null}else 2*et()-l.renderingStartTime>Ll&&i!==536870912&&(t.flags|=128,o=!0,sa(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ot.current,Te(ot,o?i&1|2:i&1),Re&&Jn(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Bo(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Dl(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&_e(mi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Xn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function pb(e,t){switch(So(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xn(ht),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Zs(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(ot),null;case 4:return we(),null;case 10:return Xn(t.type),null;case 22:case 23:return Jt(t),Bo(),e!==null&&_e(mi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xn(ht),null;case 25:return null;default:return null}}function vm(e,t){switch(So(t),t.tag){case 3:Xn(ht),we();break;case 26:case 27:case 5:Zs(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:_e(ot);break;case 10:Xn(t.type);break;case 22:case 23:Jt(t),Bo(),e!==null&&_e(mi);break;case 24:Xn(ht)}}function ia(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var o=l.next;i=o;do{if((i.tag&e)===e){l=void 0;var u=i.create,m=i.inst;l=u(),m.destroy=l}i=i.next}while(i!==o)}}catch(b){Ye(t,t.return,b)}}function Ns(e,t,i){try{var l=t.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var u=o.next;l=u;do{if((l.tag&e)===e){var m=l.inst,b=m.destroy;if(b!==void 0){m.destroy=void 0,o=t;var O=i,U=b;try{U()}catch($){Ye(o,O,$)}}}l=l.next}while(l!==u)}}catch($){Ye(t,t.return,$)}}function _m(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{fd(t,i)}catch(l){Ye(e,e.return,l)}}}function wm(e,t,i){i.props=xi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ye(e,t,l)}}function ra(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(o){Ye(e,t,o)}}function Rn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(o){Ye(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(o){Ye(e,t,o)}else i.current=null}function Sm(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(o){Ye(e,e.return,o)}}function gu(e,t,i){try{var l=e.stateNode;Ub(l,e.type,i,t),l[it]=t}catch(o){Ye(e,e.return,o)}}function Em(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qs(e.type)||e.tag===4}function yu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Em(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&qs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Gn));else if(l!==4&&(l===27&&qs(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(bu(e,t,i),e=e.sibling;e!==null;)bu(e,t,i),e=e.sibling}function zl(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&qs(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(zl(e,t,i),e=e.sibling;e!==null;)zl(e,t,i),e=e.sibling}function Am(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){Ye(e,e.return,u)}}var es=!1,pt=!1,xu=!1,Om=typeof WeakSet=="function"?WeakSet:Set,xt=null;function gb(e,t){if(e=e.containerInfo,Hu=nc,e=Bh(e),fo(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var o=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var m=0,b=-1,O=-1,U=0,$=0,J=e,B=null;t:for(;;){for(var P;J!==i||o!==0&&J.nodeType!==3||(b=m+o),J!==u||l!==0&&J.nodeType!==3||(O=m+l),J.nodeType===3&&(m+=J.nodeValue.length),(P=J.firstChild)!==null;)B=J,J=P;for(;;){if(J===e)break t;if(B===i&&++U===o&&(b=m),B===u&&++$===l&&(O=m),(P=J.nextSibling)!==null)break;J=B,B=J.parentNode}J=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Pu={focusedElem:e,selectionRange:i},nc=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)o=e[i],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,o=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var fe=xi(i.type,o);e=l.getSnapshotBeforeUpdate(fe,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ge){Ye(i,i.return,ge)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Gu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Gu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function jm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:ns(e,i),l&4&&ia(5,i);break;case 1:if(ns(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(m){Ye(i,i.return,m)}else{var o=xi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){Ye(i,i.return,m)}}l&64&&_m(i),l&512&&ra(i,i.return);break;case 3:if(ns(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{fd(e,t)}catch(m){Ye(i,i.return,m)}}break;case 27:t===null&&l&4&&Am(i);case 26:case 5:ns(e,i),t===null&&l&4&&Sm(i),l&512&&ra(i,i.return);break;case 12:ns(e,i);break;case 31:ns(e,i),l&4&&Cm(e,i);break;case 13:ns(e,i),l&4&&km(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Ab.bind(null,i),Vb(e,i))));break;case 22:if(l=i.memoizedState!==null||es,!l){t=t!==null&&t.memoizedState!==null||pt,o=es;var u=pt;es=l,(pt=t)&&!u?ss(e,i,(i.subtreeFlags&8772)!==0):ns(e,i),es=o,pt=u}break;case 30:break;default:ns(e,i)}}function Tm(e){var t=e.alternate;t!==null&&(e.alternate=null,Tm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ri(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function ts(e,t,i){for(i=i.child;i!==null;)Nm(e,t,i),i=i.sibling}function Nm(e,t,i){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(ei,i)}catch{}switch(i.tag){case 26:pt||Rn(i,t),ts(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Rn(i,t);var l=tt,o=qt;qs(i.type)&&(tt=i.stateNode,qt=!1),ts(e,t,i),ma(i.stateNode),tt=l,qt=o;break;case 5:pt||Rn(i,t);case 6:if(l=tt,o=qt,tt=null,ts(e,t,i),tt=l,qt=o,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){Ye(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){Ye(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,_p(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),hr(e)):_p(tt,i.stateNode));break;case 4:l=tt,o=qt,tt=i.stateNode.containerInfo,qt=!0,ts(e,t,i),tt=l,qt=o;break;case 0:case 11:case 14:case 15:Ns(2,i,t),pt||Ns(4,i,t),ts(e,t,i);break;case 1:pt||(Rn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&wm(i,t,l)),ts(e,t,i);break;case 21:ts(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ts(e,t,i),pt=l;break;default:ts(e,t,i)}}function Cm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hr(e)}catch(i){Ye(t,t.return,i)}}}function km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hr(e)}catch(i){Ye(t,t.return,i)}}function yb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Om),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Om),t;default:throw Error(a(435,e.tag))}}function ql(e,t){var i=yb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var o=Ob.bind(null,e,l);l.then(o,o)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var o=i[l],u=e,m=t,b=m;e:for(;b!==null;){switch(b.tag){case 27:if(qs(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Nm(u,m,o),tt=null,qt=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mm(t,e),t=t.sibling}var Sn=null;function Mm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(Ns(3,e,e.return),ia(3,e),Ns(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&64&&es&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var o=Sn;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,o=o.ownerDocument||o;t:switch(l){case"title":u=o.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(l),o.head.insertBefore(u,o.querySelector("head > title"))),At(u,l,i),u[Qe]=e,T(u),l=u;break e;case"link":var m=Mp("link","href",o).get(l+(i.href||""));if(m){for(var b=0;b<m.length;b++)if(u=m[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){m.splice(b,1);break t}}u=o.createElement(l),At(u,l,i),o.head.appendChild(u);break;case"meta":if(m=Mp("meta","content",o).get(l+(i.content||""))){for(b=0;b<m.length;b++)if(u=m[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){m.splice(b,1);break t}}u=o.createElement(l),At(u,l,i),o.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,T(u),l=u}e.stateNode=l}else Rp(o,e.type,e.stateNode);else e.stateNode=kp(o,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Rp(o,e.type,e.stateNode):kp(o,l,e.memoizedProps)):l===null&&e.stateNode!==null&&gu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),i!==null&&l&4&&gu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),e.flags&32){o=e.stateNode;try{zi(o,"")}catch(fe){Ye(e,e.return,fe)}}l&4&&e.stateNode!=null&&(o=e.memoizedProps,gu(e,o,i!==null?i.memoizedProps:o)),l&1024&&(xu=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(fe){Ye(e,e.return,fe)}}break;case 3:if(Zl=null,o=Sn,Sn=Il(t.containerInfo),Ut(t,e),Sn=o,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{hr(t.containerInfo)}catch(fe){Ye(e,e.return,fe)}xu&&(xu=!1,Rm(e));break;case 4:l=Sn,Sn=Il(e.stateNode.containerInfo),Ut(t,e),Bt(e),Sn=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Bl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 22:o=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,U=es,$=pt;if(es=U||o,pt=$||O,Ut(t,e),pt=$,es=U,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(i===null||O||es||pt||vi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,o)m=u.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{b=O.stateNode;var J=O.memoizedProps.style,B=J!=null&&J.hasOwnProperty("display")?J.display:null;b.style.display=B==null||typeof B=="boolean"?"":(""+B).trim()}}catch(fe){Ye(O,O.return,fe)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=o?"":O.memoizedProps}catch(fe){Ye(O,O.return,fe)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;o?wp(P,!0):wp(O.stateNode,!1)}catch(fe){Ye(O,O.return,fe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,ql(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(Em(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var o=i.stateNode,u=yu(e);zl(e,u,o);break;case 5:var m=i.stateNode;i.flags&32&&(zi(m,""),i.flags&=-33);var b=yu(e);zl(e,b,m);break;case 3:case 4:var O=i.stateNode.containerInfo,U=yu(e);bu(e,U,O);break;default:throw Error(a(161))}}catch($){Ye(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Rm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ns(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)jm(e,t.alternate,t),t=t.sibling}function vi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ns(4,t,t.return),vi(t);break;case 1:Rn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&wm(t,t.return,i),vi(t);break;case 27:ma(t.stateNode);case 26:case 5:Rn(t,t.return),vi(t);break;case 22:t.memoizedState===null&&vi(t);break;case 30:vi(t);break;default:vi(t)}e=e.sibling}}function ss(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,o=e,u=t,m=u.flags;switch(u.tag){case 0:case 11:case 15:ss(o,u,i),ia(4,u);break;case 1:if(ss(o,u,i),l=u,o=l.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(U){Ye(l,l.return,U)}if(l=u,o=l.updateQueue,o!==null){var b=l.stateNode;try{var O=o.shared.hiddenCallbacks;if(O!==null)for(o.shared.hiddenCallbacks=null,o=0;o<O.length;o++)ud(O[o],b)}catch(U){Ye(l,l.return,U)}}i&&m&64&&_m(u),ra(u,u.return);break;case 27:Am(u);case 26:case 5:ss(o,u,i),i&&l===null&&m&4&&Sm(u),ra(u,u.return);break;case 12:ss(o,u,i);break;case 31:ss(o,u,i),i&&m&4&&Cm(o,u);break;case 13:ss(o,u,i),i&&m&4&&km(o,u);break;case 22:u.memoizedState===null&&ss(o,u,i),ra(u,u.return);break;case 30:break;default:ss(o,u,i)}t=t.sibling}}function vu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Vr(i))}function _u(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vr(e))}function En(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dm(e,t,i,l),t=t.sibling}function Dm(e,t,i,l){var o=t.flags;switch(t.tag){case 0:case 11:case 15:En(e,t,i,l),o&2048&&ia(9,t);break;case 1:En(e,t,i,l);break;case 3:En(e,t,i,l),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vr(e)));break;case 12:if(o&2048){En(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,m=u.id,b=u.onPostCommit;typeof b=="function"&&b(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Ye(t,t.return,O)}}else En(e,t,i,l);break;case 31:En(e,t,i,l);break;case 13:En(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,m=t.alternate,t.memoizedState!==null?u._visibility&2?En(e,t,i,l):aa(e,t):u._visibility&2?En(e,t,i,l):(u._visibility|=2,tr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),o&2048&&vu(m,t);break;case 24:En(e,t,i,l),o&2048&&_u(t.alternate,t);break;default:En(e,t,i,l)}}function tr(e,t,i,l,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,m=t,b=i,O=l,U=m.flags;switch(m.tag){case 0:case 11:case 15:tr(u,m,b,O,o),ia(8,m);break;case 23:break;case 22:var $=m.stateNode;m.memoizedState!==null?$._visibility&2?tr(u,m,b,O,o):aa(u,m):($._visibility|=2,tr(u,m,b,O,o)),o&&U&2048&&vu(m.alternate,m);break;case 24:tr(u,m,b,O,o),o&&U&2048&&_u(m.alternate,m);break;default:tr(u,m,b,O,o)}t=t.sibling}}function aa(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,o=l.flags;switch(l.tag){case 22:aa(i,l),o&2048&&vu(l.alternate,l);break;case 24:aa(i,l),o&2048&&_u(l.alternate,l);break;default:aa(i,l)}t=t.sibling}}var la=8192;function nr(e,t,i){if(e.subtreeFlags&la)for(e=e.child;e!==null;)zm(e,t,i),e=e.sibling}function zm(e,t,i){switch(e.tag){case 26:nr(e,t,i),e.flags&la&&e.memoizedState!==null&&sx(i,Sn,e.memoizedState,e.memoizedProps);break;case 5:nr(e,t,i);break;case 3:case 4:var l=Sn;Sn=Il(e.stateNode.containerInfo),nr(e,t,i),Sn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=la,la=16777216,nr(e,t,i),la=l):nr(e,t,i));break;default:nr(e,t,i)}}function qm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ca(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Bm(l,e)}qm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Um(e),e=e.sibling}function Um(e){switch(e.tag){case 0:case 11:case 15:ca(e),e.flags&2048&&Ns(9,e,e.return);break;case 3:ca(e);break;case 12:ca(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ul(e)):ca(e);break;default:ca(e)}}function Ul(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Bm(l,e)}qm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ns(8,t,t.return),Ul(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Ul(t));break;default:Ul(t)}e=e.sibling}}function Bm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:Ns(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Vr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var o=l.sibling,u=l.return;if(Tm(l),l===i){xt=null;break e}if(o!==null){o.return=u,xt=o;break e}xt=u}}}var bb={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},xb=typeof WeakMap=="function"?WeakMap:Map,He=0,Xe=null,Ne=null,ke=0,Pe=0,Qt=null,Cs=!1,sr=!1,wu=!1,is=0,at=0,ks=0,_i=0,Su=0,Xt=0,ir=0,oa=null,Lt=null,Eu=!1,Bl=0,Lm=0,Ll=1/0,Hl=null,Ms=null,bt=0,Rs=null,rr=null,rs=0,Au=0,Ou=null,Hm=null,ua=0,ju=null;function It(){return(He&2)!==0&&ke!==0?ke&-ke:Y.T!==null?Ru():Mr()}function Pm(){if(Xt===0)if((ke&536870912)===0||Re){var e=Pn;Pn<<=1,(Pn&3932160)===0&&(Pn=262144),Xt=e}else Xt=536870912;return e=Ft.current,e!==null&&(e.flags|=32),Xt}function Ht(e,t,i){(e===Xe&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(ar(e,0),Ds(e,ke,Xt,!1)),vn(e,i),((He&2)===0||e!==Xe)&&(e===Xe&&((He&2)===0&&(_i|=i),at===4&&Ds(e,ke,Xt,!1)),Dn(e))}function Ym(e,t,i){if((He&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ni(e,t),o=l?wb(e,t):Nu(e,t,!0),u=l;do{if(o===0){sr&&!l&&Ds(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!vb(i)){o=Nu(e,t,!1),u=!1;continue}if(o===2){if(u=t,e.errorRecoveryDisabledLanes&u)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var b=e;o=oa;var O=b.current.memoizedState.isDehydrated;if(O&&(ar(b,m).flags|=256),m=Nu(b,m,!1),m!==2){if(wu&&!O){b.errorRecoveryDisabledLanes|=u,_i|=u,o=4;break e}u=Lt,Lt=o,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}o=m}if(u=!1,o!==2)continue}}if(o===1){ar(e,0),Ds(e,t,0,!0);break}e:{switch(l=e,u=o,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:Ds(l,t,Xt,!Cs);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(o=Bl+300-et(),10<o)){if(Ds(l,t,Xt,!Cs),ti(l,0,!0)!==0)break e;rs=t,l.timeoutHandle=xp($m.bind(null,l,i,Lt,Hl,Eu,t,Xt,_i,ir,Cs,u,"Throttled",-0,0),o);break e}$m(l,i,Lt,Hl,Eu,t,Xt,_i,ir,Cs,u,null,-0,0)}}break}while(!0);Dn(e)}function $m(e,t,i,l,o,u,m,b,O,U,$,J,B,P){if(e.timeoutHandle=-1,J=t.subtreeFlags,J&8192||(J&16785408)===16785408){J={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gn},zm(t,u,J);var fe=(u&62914560)===u?Bl-et():(u&4194048)===u?Lm-et():0;if(fe=ix(J,fe),fe!==null){rs=u,e.cancelPendingCommit=fe(Km.bind(null,e,t,u,i,l,o,m,b,O,$,J,null,B,P)),Ds(e,u,m,!U);return}}Km(e,t,u,i,l,o,m,b,O)}function vb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var o=i[l],u=o.getSnapshot;o=o.value;try{if(!Gt(u(),o))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ds(e,t,i,l){t&=~Su,t&=~_i,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var o=t;0<o;){var u=31-Nt(o),m=1<<u;l[u]=-1,o&=~m}i!==0&&ys(e,i,t)}function Pl(){return(He&6)===0?(fa(0),!1):!0}function Tu(){if(Ne!==null){if(Pe===0)var e=Ne.return;else e=Ne,Qn=hi=null,Go(e),Ii=null,Jr=0,e=Ne;for(;e!==null;)vm(e.alternate,e),e=e.return;Ne=null}}function ar(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Hb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),rs=0,Tu(),Xe=e,Ne=i=Fn(e.current,null),ke=t,Pe=0,Qt=null,Cs=!1,sr=ni(e,t),wu=!1,ir=Xt=Su=_i=ks=at=0,Lt=oa=null,Eu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var o=31-Nt(l),u=1<<o;t|=e[o],l&=~u}return is=t,cl(),i}function Gm(e,t){Se=null,Y.H=ta,t===Xi||t===gl?(t=ad(),Pe=3):t===Mo?(t=ad(),Pe=4):Pe=t===au?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Cl(e,on(t,e.current)))}function Vm(){var e=Ft.current;return e===null?!0:(ke&4194048)===ke?dn===null:(ke&62914560)===ke||(ke&536870912)!==0?e===dn:!1}function Fm(){var e=Y.H;return Y.H=ta,e===null?ta:e}function Jm(){var e=Y.A;return Y.A=bb,e}function Yl(){at=4,Cs||(ke&4194048)!==ke&&Ft.current!==null||(sr=!0),(ks&134217727)===0&&(_i&134217727)===0||Xe===null||Ds(Xe,ke,Xt,!1)}function Nu(e,t,i){var l=He;He|=2;var o=Fm(),u=Jm();(Xe!==e||ke!==t)&&(Hl=null,ar(e,t)),t=!1;var m=at;e:do try{if(Pe!==0&&Ne!==null){var b=Ne,O=Qt;switch(Pe){case 8:Tu(),m=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var U=Pe;if(Pe=0,Qt=null,lr(e,b,O,U),i&&sr){m=0;break e}break;default:U=Pe,Pe=0,Qt=null,lr(e,b,O,U)}}_b(),m=at;break}catch($){Gm(e,$)}while(!0);return t&&e.shellSuspendCounter++,Qn=hi=null,He=l,Y.H=o,Y.A=u,Ne===null&&(Xe=null,ke=0,cl()),m}function _b(){for(;Ne!==null;)Qm(Ne)}function wb(e,t){var i=He;He|=2;var l=Fm(),o=Jm();Xe!==e||ke!==t?(Hl=null,Ll=et()+500,ar(e,t)):sr=ni(e,t);e:do try{if(Pe!==0&&Ne!==null){t=Ne;var u=Qt;t:switch(Pe){case 1:Pe=0,Qt=null,lr(e,t,u,1);break;case 2:case 9:if(id(u)){Pe=0,Qt=null,Xm(t);break}t=function(){Pe!==2&&Pe!==9||Xe!==e||(Pe=7),Dn(e)},u.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:id(u)?(Pe=0,Qt=null,Xm(t)):(Pe=0,Qt=null,lr(e,t,u,7));break;case 5:var m=null;switch(Ne.tag){case 26:m=Ne.memoizedState;case 5:case 27:var b=Ne;if(m?Dp(m):b.stateNode.complete){Pe=0,Qt=null;var O=b.sibling;if(O!==null)Ne=O;else{var U=b.return;U!==null?(Ne=U,$l(U)):Ne=null}break t}}Pe=0,Qt=null,lr(e,t,u,5);break;case 6:Pe=0,Qt=null,lr(e,t,u,6);break;case 8:Tu(),at=6;break e;default:throw Error(a(462))}}Sb();break}catch($){Gm(e,$)}while(!0);return Qn=hi=null,Y.H=l,Y.A=o,He=i,Ne!==null?0:(Xe=null,ke=0,cl(),at)}function Sb(){for(;Ne!==null&&!Va();)Qm(Ne)}function Qm(e){var t=bm(e.alternate,e,is);e.memoizedProps=e.pendingProps,t===null?$l(e):Ne=t}function Xm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=hm(i,t,t.pendingProps,t.type,void 0,ke);break;case 11:t=hm(i,t,t.pendingProps,t.type.render,t.ref,ke);break;case 5:Go(t);default:vm(i,t),t=Ne=Jh(t,is),t=bm(i,t,is)}e.memoizedProps=e.pendingProps,t===null?$l(e):Ne=t}function lr(e,t,i,l){Qn=hi=null,Go(t),Ii=null,Jr=0;var o=t.return;try{if(fb(e,o,t,i,ke)){at=1,Cl(e,on(i,e.current)),Ne=null;return}}catch(u){if(o!==null)throw Ne=o,u;at=1,Cl(e,on(i,e.current)),Ne=null;return}t.flags&32768?(Re||l===1?e=!0:sr||(ke&536870912)!==0?e=!1:(Cs=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),Im(t,e)):$l(t)}function $l(e){var t=e;do{if((t.flags&32768)!==0){Im(t,Cs);return}e=t.return;var i=mb(t.alternate,t,is);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function Im(e,t){do{var i=pb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function Km(e,t,i,l,o,u,m,b,O){e.cancelPendingCommit=null;do Gl();while(bt!==0);if((He&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=yo,gs(e,i,u,m,b,O),e===Xe&&(Ne=Xe=null,ke=0),rr=t,Rs=e,rs=i,Au=u,Ou=o,Hm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,jb(Ci,function(){return np(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=Y.T,Y.T=null,o=te.p,te.p=2,m=He,He|=4;try{gb(e,t,i)}finally{He=m,te.p=o,Y.T=l}}bt=1,Zm(),Wm(),ep()}}function Zm(){if(bt===1){bt=0;var e=Rs,t=rr,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=Y.T,Y.T=null;var l=te.p;te.p=2;var o=He;He|=4;try{Mm(t,e);var u=Pu,m=Bh(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(m!==b&&b&&b.ownerDocument&&Uh(b.ownerDocument.documentElement,b)){if(O!==null&&fo(b)){var U=O.start,$=O.end;if($===void 0&&($=U),"selectionStart"in b)b.selectionStart=U,b.selectionEnd=Math.min($,b.value.length);else{var J=b.ownerDocument||document,B=J&&J.defaultView||window;if(B.getSelection){var P=B.getSelection(),fe=b.textContent.length,ge=Math.min(O.start,fe),Je=O.end===void 0?ge:Math.min(O.end,fe);!P.extend&&ge>Je&&(m=Je,Je=ge,ge=m);var M=qh(b,ge),C=qh(b,Je);if(M&&C&&(P.rangeCount!==1||P.anchorNode!==M.node||P.anchorOffset!==M.offset||P.focusNode!==C.node||P.focusOffset!==C.offset)){var q=J.createRange();q.setStart(M.node,M.offset),P.removeAllRanges(),ge>Je?(P.addRange(q),P.extend(C.node,C.offset)):(q.setEnd(C.node,C.offset),P.addRange(q))}}}}for(J=[],P=b;P=P.parentNode;)P.nodeType===1&&J.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<J.length;b++){var G=J[b];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}nc=!!Hu,Pu=Hu=null}finally{He=o,te.p=l,Y.T=i}}e.current=t,bt=2}}function Wm(){if(bt===2){bt=0;var e=Rs,t=rr,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=Y.T,Y.T=null;var l=te.p;te.p=2;var o=He;He|=4;try{jm(e,t.alternate,t)}finally{He=o,te.p=l,Y.T=i}}bt=3}}function ep(){if(bt===4||bt===3){bt=0,Ni();var e=Rs,t=rr,i=rs,l=Hm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,rr=Rs=null,tp(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Ms=null),ii(i),t=t.stateNode,ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(ei,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=Y.T,o=te.p,te.p=2,Y.T=null;try{for(var u=e.onRecoverableError,m=0;m<l.length;m++){var b=l[m];u(b.value,{componentStack:b.stack})}}finally{Y.T=t,te.p=o}}(rs&3)!==0&&Gl(),Dn(e),o=e.pendingLanes,(i&261930)!==0&&(o&42)!==0?e===ju?ua++:(ua=0,ju=e):ua=0,fa(0)}}function tp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vr(t)))}function Gl(){return Zm(),Wm(),ep(),np()}function np(){if(bt!==5)return!1;var e=Rs,t=Au;Au=0;var i=ii(rs),l=Y.T,o=te.p;try{te.p=32>i?32:i,Y.T=null,i=Ou,Ou=null;var u=Rs,m=rs;if(bt=0,rr=Rs=null,rs=0,(He&6)!==0)throw Error(a(331));var b=He;if(He|=4,Um(u.current),Dm(u,u.current,m,i),He=b,fa(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(ei,u)}catch{}return!0}finally{te.p=o,Y.T=l,tp(e,t)}}function sp(e,t,i){t=on(i,t),t=ru(e.stateNode,t,2),e=Os(e,t,2),e!==null&&(vn(e,2),Dn(e))}function Ye(e,t,i){if(e.tag===3)sp(e,e,i);else for(;t!==null;){if(t.tag===3){sp(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ms===null||!Ms.has(l))){e=on(i,e),i=im(2),l=Os(t,i,2),l!==null&&(rm(i,l,t,e),vn(l,2),Dn(l));break}}t=t.return}}function Cu(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new xb;var o=new Set;l.set(t,o)}else o=l.get(t),o===void 0&&(o=new Set,l.set(t,o));o.has(i)||(wu=!0,o.add(i),e=Eb.bind(null,e,t,i),t.then(e,e))}function Eb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Xe===e&&(ke&i)===i&&(at===4||at===3&&(ke&62914560)===ke&&300>et()-Bl?(He&2)===0&&ar(e,0):Su|=i,ir===ke&&(ir=0)),Dn(e)}function ip(e,t){t===0&&(t=Mi()),e=oi(e,t),e!==null&&(vn(e,t),Dn(e))}function Ab(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),ip(e,i)}function Ob(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,o=e.memoizedState;o!==null&&(i=o.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),ip(e,i)}function jb(e,t){return Tr(e,t)}var Vl=null,cr=null,ku=!1,Fl=!1,Mu=!1,zs=0;function Dn(e){e!==cr&&e.next===null&&(cr===null?Vl=cr=e:cr=cr.next=e),Fl=!0,ku||(ku=!0,Nb())}function fa(e,t){if(!Mu&&Fl){Mu=!0;do for(var i=!1,l=Vl;l!==null;){if(e!==0){var o=l.pendingLanes;if(o===0)var u=0;else{var m=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=o&~(m&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,cp(l,u))}else u=ke,u=ti(l,l===Xe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ni(l,u)||(i=!0,cp(l,u));l=l.next}while(i);Mu=!1}}function Tb(){rp()}function rp(){Fl=ku=!1;var e=0;zs!==0&&Lb()&&(e=zs);for(var t=et(),i=null,l=Vl;l!==null;){var o=l.next,u=ap(l,t);u===0?(l.next=null,i===null?Vl=o:i.next=o,o===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Fl=!0)),l=o}bt!==0&&bt!==5||fa(e),zs!==0&&(zs=0)}function ap(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var m=31-Nt(u),b=1<<m,O=o[m];O===-1?((b&i)===0||(b&l)!==0)&&(o[m]=kr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Xe,i=ke,i=ti(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Hn(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ni(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&Hn(l),ii(i)){case 2:case 8:i=Ja;break;case 32:i=Ci;break;case 268435456:i=Qa;break;default:i=Ci}return l=lp.bind(null,e),i=Tr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&Hn(l),e.callbackPriority=2,e.callbackNode=null,2}function lp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Gl()&&e.callbackNode!==i)return null;var l=ke;return l=ti(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Ym(e,l,t),ap(e,et()),e.callbackNode!=null&&e.callbackNode===i?lp.bind(null,e):null)}function cp(e,t){if(Gl())return null;Ym(e,t,!0)}function Nb(){Pb(function(){(He&6)!==0?Tr(Fa,Tb):rp()})}function Ru(){if(zs===0){var e=Ji;e===0&&(e=ds,ds<<=1,(ds&261888)===0&&(ds=256)),zs=e}return zs}function op(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:el(""+e)}function up(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Cb(e,t,i,l,o){if(t==="submit"&&i&&i.stateNode===o){var u=op((o[it]||null).action),m=l.submitter;m&&(t=(t=m[it]||null)?op(t.formAction):m.getAttribute("formAction"),t!==null&&(u=t,m=null));var b=new il("action","action",null,l,o);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(zs!==0){var O=m?up(o,m):new FormData(o);Wo(i,{pending:!0,data:O,method:o.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=m?up(o,m):new FormData(o),Wo(i,{pending:!0,data:O,method:o.method,action:u},u,O))},currentTarget:o}]})}}for(var Du=0;Du<go.length;Du++){var zu=go[Du],kb=zu.toLowerCase(),Mb=zu[0].toUpperCase()+zu.slice(1);wn(kb,"on"+Mb)}wn(Ph,"onAnimationEnd"),wn(Yh,"onAnimationIteration"),wn($h,"onAnimationStart"),wn("dblclick","onDoubleClick"),wn("focusin","onFocus"),wn("focusout","onBlur"),wn(Qy,"onTransitionRun"),wn(Xy,"onTransitionStart"),wn(Iy,"onTransitionCancel"),wn(Gh,"onTransitionEnd"),L("onMouseEnter",["mouseout","mouseover"]),L("onMouseLeave",["mouseout","mouseover"]),L("onPointerEnter",["pointerout","pointerover"]),L("onPointerLeave",["pointerout","pointerover"]),X("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),X("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),X("onBeforeInput",["compositionend","keypress","textInput","paste"]),X("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ha="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Rb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ha));function fp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],o=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var m=l.length-1;0<=m;m--){var b=l[m],O=b.instance,U=b.currentTarget;if(b=b.listener,O!==u&&o.isPropagationStopped())break e;u=b,o.currentTarget=U;try{u(o)}catch($){ll($)}o.currentTarget=null,u=O}else for(m=0;m<l.length;m++){if(b=l[m],O=b.instance,U=b.currentTarget,b=b.listener,O!==u&&o.isPropagationStopped())break e;u=b,o.currentTarget=U;try{u(o)}catch($){ll($)}o.currentTarget=null,u=O}}}}function Ce(e,t){var i=t[ri];i===void 0&&(i=t[ri]=new Set);var l=e+"__bubble";i.has(l)||(hp(t,e,2,!1),i.add(l))}function qu(e,t,i){var l=0;t&&(l|=4),hp(i,e,l,t)}var Jl="_reactListening"+Math.random().toString(36).slice(2);function Uu(e){if(!e[Jl]){e[Jl]=!0,D.forEach(function(i){i!=="selectionchange"&&(Rb.has(i)||qu(i,!1,e),qu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Jl]||(t[Jl]=!0,qu("selectionchange",!1,t))}}function hp(e,t,i,l){switch(Pp(t)){case 2:var o=lx;break;case 8:o=cx;break;default:o=Zu}i=o.bind(null,t,i,e),o=void 0,!no||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),l?o!==void 0?e.addEventListener(t,i,{capture:!0,passive:o}):e.addEventListener(t,i,!0):o!==void 0?e.addEventListener(t,i,{passive:o}):e.addEventListener(t,i,!1)}function Bu(e,t,i,l,o){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var m=l.tag;if(m===3||m===4){var b=l.stateNode.containerInfo;if(b===o)break;if(m===4)for(m=l.return;m!==null;){var O=m.tag;if((O===3||O===4)&&m.stateNode.containerInfo===o)return;m=m.return}for(;b!==null;){if(m=x(b),m===null)return;if(O=m.tag,O===5||O===6||O===26||O===27){l=u=m;continue e}b=b.parentNode}}l=l.return}yh(function(){var U=u,$=eo(i),J=[];e:{var B=Vh.get(e);if(B!==void 0){var P=il,fe=e;switch(e){case"keypress":if(nl(i)===0)break e;case"keydown":case"keyup":P=Oy;break;case"focusin":fe="focus",P=ao;break;case"focusout":fe="blur",P=ao;break;case"beforeblur":case"afterblur":P=ao;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=vh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=my;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=Ny;break;case Ph:case Yh:case $h:P=yy;break;case Gh:P=ky;break;case"scroll":case"scrollend":P=hy;break;case"wheel":P=Ry;break;case"copy":case"cut":case"paste":P=xy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=wh;break;case"toggle":case"beforetoggle":P=zy}var ge=(t&4)!==0,Je=!ge&&(e==="scroll"||e==="scrollend"),M=ge?B!==null?B+"Capture":null:B;ge=[];for(var C=U,q;C!==null;){var G=C;if(q=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||q===null||M===null||(G=Dr(C,M),G!=null&&ge.push(da(C,G,q))),Je)break;C=C.return}0<ge.length&&(B=new P(B,fe,null,i,$),J.push({event:B,listeners:ge}))}}if((t&7)===0){e:{if(B=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",B&&i!==Wc&&(fe=i.relatedTarget||i.fromElement)&&(x(fe)||fe[$t]))break e;if((P||B)&&(B=$.window===$?$:(B=$.ownerDocument)?B.defaultView||B.parentWindow:window,P?(fe=i.relatedTarget||i.toElement,P=U,fe=fe?x(fe):null,fe!==null&&(Je=f(fe),ge=fe.tag,fe!==Je||ge!==5&&ge!==27&&ge!==6)&&(fe=null)):(P=null,fe=U),P!==fe)){if(ge=vh,G="onMouseLeave",M="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ge=wh,G="onPointerLeave",M="onPointerEnter",C="pointer"),Je=P==null?B:_(P),q=fe==null?B:_(fe),B=new ge(G,C+"leave",P,i,$),B.target=Je,B.relatedTarget=q,G=null,x($)===U&&(ge=new ge(M,C+"enter",fe,i,$),ge.target=q,ge.relatedTarget=Je,G=ge),Je=G,P&&fe)t:{for(ge=Db,M=P,C=fe,q=0,G=M;G;G=ge(G))q++;G=0;for(var pe=C;pe;pe=ge(pe))G++;for(;0<q-G;)M=ge(M),q--;for(;0<G-q;)C=ge(C),G--;for(;q--;){if(M===C||C!==null&&M===C.alternate){ge=M;break t}M=ge(M),C=ge(C)}ge=null}else ge=null;P!==null&&dp(J,B,P,ge,!1),fe!==null&&Je!==null&&dp(J,Je,fe,ge,!0)}}e:{if(B=U?_(U):window,P=B.nodeName&&B.nodeName.toLowerCase(),P==="select"||P==="input"&&B.type==="file")var Ue=Ch;else if(Th(B))if(kh)Ue=Vy;else{Ue=$y;var de=Yy}else P=B.nodeName,!P||P.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?U&&Zc(U.elementType)&&(Ue=Ch):Ue=Gy;if(Ue&&(Ue=Ue(e,U))){Nh(J,Ue,i,$);break e}de&&de(e,B,U),e==="focusout"&&U&&B.type==="number"&&U.memoizedProps.value!=null&&Kc(B,"number",B.value)}switch(de=U?_(U):window,e){case"focusin":(Th(de)||de.contentEditable==="true")&&(Li=de,ho=U,Yr=null);break;case"focusout":Yr=ho=Li=null;break;case"mousedown":mo=!0;break;case"contextmenu":case"mouseup":case"dragend":mo=!1,Lh(J,i,$);break;case"selectionchange":if(Jy)break;case"keydown":case"keyup":Lh(J,i,$)}var Ee;if(co)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Bi?Oh(e,i)&&(Me="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Me="onCompositionStart");Me&&(Sh&&i.locale!=="ko"&&(Bi||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Bi&&(Ee=bh()):(xs=$,so="value"in xs?xs.value:xs.textContent,Bi=!0)),de=Ql(U,Me),0<de.length&&(Me=new _h(Me,e,null,i,$),J.push({event:Me,listeners:de}),Ee?Me.data=Ee:(Ee=jh(i),Ee!==null&&(Me.data=Ee)))),(Ee=Uy?By(e,i):Ly(e,i))&&(Me=Ql(U,"onBeforeInput"),0<Me.length&&(de=new _h("onBeforeInput","beforeinput",null,i,$),J.push({event:de,listeners:Me}),de.data=Ee)),Cb(J,e,U,i,$)}fp(J,t)})}function da(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Ql(e,t){for(var i=t+"Capture",l=[];e!==null;){var o=e,u=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||u===null||(o=Dr(e,i),o!=null&&l.unshift(da(e,o,u)),o=Dr(e,t),o!=null&&l.push(da(e,o,u))),e.tag===3)return l;e=e.return}return[]}function Db(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function dp(e,t,i,l,o){for(var u=t._reactName,m=[];i!==null&&i!==l;){var b=i,O=b.alternate,U=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||U===null||(O=U,o?(U=Dr(i,u),U!=null&&m.unshift(da(i,U,O))):o||(U=Dr(i,u),U!=null&&m.push(da(i,U,O)))),i=i.return}m.length!==0&&e.push({event:t,listeners:m})}var zb=/\r\n?/g,qb=/\u0000|\uFFFD/g;function mp(e){return(typeof e=="string"?e:""+e).replace(zb,`
26
- `).replace(qb,"")}function pp(e,t){return t=mp(t),mp(e)===t}function Fe(e,t,i,l,o,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||zi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&zi(e,""+l);break;case"className":_n(e,"class",l);break;case"tabIndex":_n(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":_n(e,i,l);break;case"style":ph(e,l,u);break;case"data":if(t!=="object"){_n(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=el(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&Fe(e,t,"name",o.name,o,null),Fe(e,t,"formEncType",o.formEncType,o,null),Fe(e,t,"formMethod",o.formMethod,o,null),Fe(e,t,"formTarget",o.formTarget,o,null)):(Fe(e,t,"encType",o.encType,o,null),Fe(e,t,"method",o.method,o,null),Fe(e,t,"target",o.target,o,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=el(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Gn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(o.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=el(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":$n(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":$n(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":$n(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":$n(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":$n(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":$n(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":$n(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":$n(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":$n(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=uy.get(i)||i,Ct(e,i,l))}}function Lu(e,t,i,l,o,u){switch(i){case"style":ph(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(o.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?zi(e,l):(typeof l=="number"||typeof l=="bigint")&&zi(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Gn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!F.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(o=i.endsWith("Capture"),t=i.slice(2,o?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,o),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,o);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,o=!1,u;for(u in i)if(i.hasOwnProperty(u)){var m=i[u];if(m!=null)switch(u){case"src":l=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,m,i,null)}}o&&Fe(e,t,"srcSet",i.srcSet,i,null),l&&Fe(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=m=o=null,O=null,U=null;for(l in i)if(i.hasOwnProperty(l)){var $=i[l];if($!=null)switch(l){case"name":o=$;break;case"type":m=$;break;case"checked":O=$;break;case"defaultChecked":U=$;break;case"value":u=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(a(137,t));break;default:Fe(e,t,l,$,i,null)}}fh(e,u,b,O,U,m,o,!1);return;case"select":Ce("invalid",e),l=m=u=null;for(o in i)if(i.hasOwnProperty(o)&&(b=i[o],b!=null))switch(o){case"value":u=b;break;case"defaultValue":m=b;break;case"multiple":l=b;default:Fe(e,t,o,b,i,null)}t=u,i=m,e.multiple=!!l,t!=null?Di(e,!!l,t,!1):i!=null&&Di(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=o=l=null;for(m in i)if(i.hasOwnProperty(m)&&(b=i[m],b!=null))switch(m){case"value":l=b;break;case"defaultValue":o=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,m,b,i,null)}dh(e,l,o,u);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(l=i[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Fe(e,t,O,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<ha.length;l++)Ce(ha[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in i)if(i.hasOwnProperty(U)&&(l=i[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,U,l,i,null)}return;default:if(Zc(t)){for($ in i)i.hasOwnProperty($)&&(l=i[$],l!==void 0&&Lu(e,t,$,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Fe(e,t,b,l,i,null))}function Ub(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,u=null,m=null,b=null,O=null,U=null,$=null;for(P in i){var J=i[P];if(i.hasOwnProperty(P)&&J!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=J;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,J)}}for(var B in l){var P=l[B];if(J=i[B],l.hasOwnProperty(B)&&(P!=null||J!=null))switch(B){case"type":u=P;break;case"name":o=P;break;case"checked":U=P;break;case"defaultChecked":$=P;break;case"value":m=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==J&&Fe(e,t,B,P,l,J)}}Ic(e,m,b,O,U,$,u,o);return;case"select":P=m=b=B=null;for(u in i)if(O=i[u],i.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":P=O;default:l.hasOwnProperty(u)||Fe(e,t,u,null,l,O)}for(o in l)if(u=l[o],O=i[o],l.hasOwnProperty(o)&&(u!=null||O!=null))switch(o){case"value":B=u;break;case"defaultValue":b=u;break;case"multiple":m=u;default:u!==O&&Fe(e,t,o,u,l,O)}t=b,i=m,l=P,B!=null?Di(e,!!i,B,!1):!!l!=!!i&&(t!=null?Di(e,!!i,t,!0):Di(e,!!i,i?[]:"",!1));return;case"textarea":P=B=null;for(b in i)if(o=i[b],i.hasOwnProperty(b)&&o!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,o)}for(m in l)if(o=l[m],u=i[m],l.hasOwnProperty(m)&&(o!=null||u!=null))switch(m){case"value":B=o;break;case"defaultValue":P=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(a(91));break;default:o!==u&&Fe(e,t,m,o,l,u)}hh(e,B,P);return;case"option":for(var fe in i)if(B=i[fe],i.hasOwnProperty(fe)&&B!=null&&!l.hasOwnProperty(fe))switch(fe){case"selected":e.selected=!1;break;default:Fe(e,t,fe,null,l,B)}for(O in l)if(B=l[O],P=i[O],l.hasOwnProperty(O)&&B!==P&&(B!=null||P!=null))switch(O){case"selected":e.selected=B&&typeof B!="function"&&typeof B!="symbol";break;default:Fe(e,t,O,B,l,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ge in i)B=i[ge],i.hasOwnProperty(ge)&&B!=null&&!l.hasOwnProperty(ge)&&Fe(e,t,ge,null,l,B);for(U in l)if(B=l[U],P=i[U],l.hasOwnProperty(U)&&B!==P&&(B!=null||P!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(a(137,t));break;default:Fe(e,t,U,B,l,P)}return;default:if(Zc(t)){for(var Je in i)B=i[Je],i.hasOwnProperty(Je)&&B!==void 0&&!l.hasOwnProperty(Je)&&Lu(e,t,Je,void 0,l,B);for($ in l)B=l[$],P=i[$],!l.hasOwnProperty($)||B===P||B===void 0&&P===void 0||Lu(e,t,$,B,l,P);return}}for(var M in i)B=i[M],i.hasOwnProperty(M)&&B!=null&&!l.hasOwnProperty(M)&&Fe(e,t,M,null,l,B);for(J in l)B=l[J],P=i[J],!l.hasOwnProperty(J)||B===P||B==null&&P==null||Fe(e,t,J,B,l,P)}function gp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var o=i[l],u=o.transferSize,m=o.initiatorType,b=o.duration;if(u&&b&&gp(m)){for(m=0,b=o.responseEnd,l+=1;l<i.length;l++){var O=i[l],U=O.startTime;if(U>b)break;var $=O.transferSize,J=O.initiatorType;$&&gp(J)&&(O=O.responseEnd,m+=$*(O<b?1:(b-U)/(O-U)))}if(--l,t+=8*(u+m)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Hu=null,Pu=null;function Xl(e){return e.nodeType===9?e:e.ownerDocument}function yp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function bp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Yu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var $u=null;function Lb(){var e=window.event;return e&&e.type==="popstate"?e===$u?!1:($u=e,!0):($u=null,!1)}var xp=typeof setTimeout=="function"?setTimeout:void 0,Hb=typeof clearTimeout=="function"?clearTimeout:void 0,vp=typeof Promise=="function"?Promise:void 0,Pb=typeof queueMicrotask=="function"?queueMicrotask:typeof vp<"u"?function(e){return vp.resolve(null).then(e).catch(Yb)}:xp;function Yb(e){setTimeout(function(){throw e})}function qs(e){return e==="head"}function _p(e,t){var i=t,l=0;do{var o=i.nextSibling;if(e.removeChild(i),o&&o.nodeType===8)if(i=o.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(o),hr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")ma(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ma(i);for(var u=i.firstChild;u;){var m=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=m}}else i==="body"&&ma(e.ownerDocument.body);i=o}while(i);hr(t)}function wp(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Gu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Gu(i),Ri(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function $b(e,t,i,l){for(;e.nodeType===1;){var o=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=mn(e.nextSibling),e===null)break}return null}function Gb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=mn(e.nextSibling),e===null))return null;return e}function Sp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=mn(e.nextSibling),e===null))return null;return e}function Vu(e){return e.data==="$?"||e.data==="$~"}function Fu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Vb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function mn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Ju=null;function Ep(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return mn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Ap(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Op(e,t,i){switch(t=Xl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ma(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ri(e)}var pn=new Map,jp=new Set;function Il(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var as=te.d;te.d={f:Fb,r:Jb,D:Qb,C:Xb,L:Ib,m:Kb,X:Wb,S:Zb,M:ex};function Fb(){var e=as.f(),t=Pl();return e||t}function Jb(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Gd(t):as.r(e)}var or=typeof document>"u"?null:document;function Tp(e,t,i){var l=or;if(l&&typeof t=="string"&&t){var o=ln(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof i=="string"&&(o+='[crossorigin="'+i+'"]'),jp.has(o)||(jp.add(o),e={rel:e,crossOrigin:i,href:t},l.querySelector(o)===null&&(t=l.createElement("link"),At(t,"link",e),T(t),l.head.appendChild(t)))}}function Qb(e){as.D(e),Tp("dns-prefetch",e,null)}function Xb(e,t){as.C(e,t),Tp("preconnect",e,t)}function Ib(e,t,i){as.L(e,t,i);var l=or;if(l&&e&&t){var o='link[rel="preload"][as="'+ln(t)+'"]';t==="image"&&i&&i.imageSrcSet?(o+='[imagesrcset="'+ln(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(o+='[imagesizes="'+ln(i.imageSizes)+'"]')):o+='[href="'+ln(e)+'"]';var u=o;switch(t){case"style":u=ur(e);break;case"script":u=fr(e)}pn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),pn.set(u,e),l.querySelector(o)!==null||t==="style"&&l.querySelector(pa(u))||t==="script"&&l.querySelector(ga(u))||(t=l.createElement("link"),At(t,"link",e),T(t),l.head.appendChild(t)))}}function Kb(e,t){as.m(e,t);var i=or;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+ln(l)+'"][href="'+ln(e)+'"]',u=o;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=fr(e)}if(!pn.has(u)&&(e=w({rel:"modulepreload",href:e},t),pn.set(u,e),i.querySelector(o)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ga(u)))return}l=i.createElement("link"),At(l,"link",e),T(l),i.head.appendChild(l)}}}function Zb(e,t,i){as.S(e,t,i);var l=or;if(l&&e){var o=E(l).hoistableStyles,u=ur(e);t=t||"default";var m=o.get(u);if(!m){var b={loading:0,preload:null};if(m=l.querySelector(pa(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=pn.get(u))&&Qu(e,i);var O=m=l.createElement("link");T(O),At(O,"link",e),O._p=new Promise(function(U,$){O.onload=U,O.onerror=$}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Kl(m,t,l)}m={type:"stylesheet",instance:m,count:1,state:b},o.set(u,m)}}}function Wb(e,t){as.X(e,t);var i=or;if(i&&e){var l=E(i).hoistableScripts,o=fr(e),u=l.get(o);u||(u=i.querySelector(ga(o)),u||(e=w({src:e,async:!0},t),(t=pn.get(o))&&Xu(e,t),u=i.createElement("script"),T(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(o,u))}}function ex(e,t){as.M(e,t);var i=or;if(i&&e){var l=E(i).hoistableScripts,o=fr(e),u=l.get(o);u||(u=i.querySelector(ga(o)),u||(e=w({src:e,async:!0,type:"module"},t),(t=pn.get(o))&&Xu(e,t),u=i.createElement("script"),T(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(o,u))}}function Np(e,t,i,l){var o=(o=sn.current)?Il(o):null;if(!o)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=ur(i.href),i=E(o).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=ur(i.href);var u=E(o).hoistableStyles,m=u.get(e);if(m||(o=o.ownerDocument||o,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,m),(u=o.querySelector(pa(e)))&&!u._p&&(m.instance=u,m.state.loading=5),pn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},pn.set(e,i),u||tx(o,e,i,m.state))),t&&l===null)throw Error(a(528,""));return m}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=fr(i),i=E(o).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function ur(e){return'href="'+ln(e)+'"'}function pa(e){return'link[rel="stylesheet"]['+e+"]"}function Cp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function tx(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),T(t),e.head.appendChild(t))}function fr(e){return'[src="'+ln(e)+'"]'}function ga(e){return"script[async]"+e}function kp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+ln(i.href)+'"]');if(l)return t.instance=l,T(l),l;var o=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),T(l),At(l,"style",o),Kl(l,i.precedence,e),t.instance=l;case"stylesheet":o=ur(i.href);var u=e.querySelector(pa(o));if(u)return t.state.loading|=4,t.instance=u,T(u),u;l=Cp(i),(o=pn.get(o))&&Qu(l,o),u=(e.ownerDocument||e).createElement("link"),T(u);var m=u;return m._p=new Promise(function(b,O){m.onload=b,m.onerror=O}),At(u,"link",l),t.state.loading|=4,Kl(u,i.precedence,e),t.instance=u;case"script":return u=fr(i.src),(o=e.querySelector(ga(u)))?(t.instance=o,T(o),o):(l=i,(o=pn.get(u))&&(l=w({},i),Xu(l,o)),e=e.ownerDocument||e,o=e.createElement("script"),T(o),At(o,"link",l),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Kl(l,i.precedence,e));return t.instance}function Kl(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=l.length?l[l.length-1]:null,u=o,m=0;m<l.length;m++){var b=l[m];if(b.dataset.precedence===t)u=b;else if(u!==o)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Qu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Zl=null;function Mp(e,t,i){if(Zl===null){var l=new Map,o=Zl=new Map;o.set(i,l)}else o=Zl,l=o.get(i),l||(l=new Map,o.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),o=0;o<i.length;o++){var u=i[o];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var m=u.getAttribute(t)||"";m=e+m;var b=l.get(m);b?b.push(u):l.set(m,[u])}}return l}function Rp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function nx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Dp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function sx(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var o=ur(l.href),u=t.querySelector(pa(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wl.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,T(u);return}u=t.ownerDocument||t,l=Cp(l),(o=pn.get(o))&&Qu(l,o),u=u.createElement("link"),T(u);var m=u;m._p=new Promise(function(b,O){m.onload=b,m.onerror=O}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Wl.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Iu=0;function ix(e,t){return e.stylesheets&&e.count===0&&tc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&tc(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Iu===0&&(Iu=62500*Bb());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&tc(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Iu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(o)}}:null}function Wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ec=null;function tc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ec=new Map,t.forEach(rx,e),ec=null,Wl.call(e))}function rx(e,t){if(!(t.state.loading&4)){var i=ec.get(e);if(i)var l=i.get(null);else{i=new Map,ec.set(e,i);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<o.length;u++){var m=o[u];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(i.set(m.dataset.precedence,m),l=m)}l&&i.set(null,l)}o=t.instance,m=o.getAttribute("data-precedence"),u=i.get(m)||l,u===l&&i.set(null,o),i.set(m,o),this.count++,l=Wl.bind(this),o.addEventListener("load",l),o.addEventListener("error",l),u?u.parentNode.insertBefore(o,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var ya={$$typeof:me,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function ax(e,t,i,l,o,u,m,b,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ps(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ps(0),this.hiddenUpdates=ps(null),this.identifierPrefix=l,this.onUncaughtError=o,this.onCaughtError=u,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function zp(e,t,i,l,o,u,m,b,O,U,$,J){return e=new ax(e,t,i,m,O,U,$,J,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=No(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},Ro(u),e}function qp(e){return e?(e=Yi,e):Yi}function Up(e,t,i,l,o,u){o=qp(o),l.context===null?l.context=o:l.pendingContext=o,l=As(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=Os(e,l,t),i!==null&&(Ht(i,e,t),Xr(i,e,t))}function Bp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Ku(e,t){Bp(e,t),(e=e.alternate)&&Bp(e,t)}function Lp(e){if(e.tag===13||e.tag===31){var t=oi(e,67108864);t!==null&&Ht(t,e,67108864),Ku(e,67108864)}}function Hp(e){if(e.tag===13||e.tag===31){var t=It();t=Yn(t);var i=oi(e,t);i!==null&&Ht(i,e,t),Ku(e,t)}}var nc=!0;function lx(e,t,i,l){var o=Y.T;Y.T=null;var u=te.p;try{te.p=2,Zu(e,t,i,l)}finally{te.p=u,Y.T=o}}function cx(e,t,i,l){var o=Y.T;Y.T=null;var u=te.p;try{te.p=8,Zu(e,t,i,l)}finally{te.p=u,Y.T=o}}function Zu(e,t,i,l){if(nc){var o=Wu(l);if(o===null)Bu(e,t,l,sc,i),Yp(e,l);else if(ux(o,e,t,i,l))l.stopPropagation();else if(Yp(e,l),t&4&&-1<ox.indexOf(e)){for(;o!==null;){var u=S(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var m=xn(u.pendingLanes);if(m!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;m;){var O=1<<31-Nt(m);b.entanglements[1]|=O,m&=~O}Dn(u),(He&6)===0&&(Ll=et()+500,fa(0))}}break;case 31:case 13:b=oi(u,2),b!==null&&Ht(b,u,2),Pl(),Ku(u,2)}if(u=Wu(l),u===null&&Bu(e,t,l,sc,i),u===o)break;o=u}o!==null&&l.stopPropagation()}else Bu(e,t,l,null,i)}}function Wu(e){return e=eo(e),ef(e)}var sc=null;function ef(e){if(sc=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=d(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return sc=e,null}function Pp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Fc()){case Fa:return 2;case Ja:return 8;case Ci:case Jc:return 32;case Qa:return 268435456;default:return 32}default:return 32}}var tf=!1,Us=null,Bs=null,Ls=null,ba=new Map,xa=new Map,Hs=[],ox="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Yp(e,t){switch(e){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":Bs=null;break;case"mouseover":case"mouseout":Ls=null;break;case"pointerover":case"pointerout":ba.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":xa.delete(t.pointerId)}}function va(e,t,i,l,o,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[o]},t!==null&&(t=S(t),t!==null&&Lp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function ux(e,t,i,l,o){switch(t){case"focusin":return Us=va(Us,e,t,i,l,o),!0;case"dragenter":return Bs=va(Bs,e,t,i,l,o),!0;case"mouseover":return Ls=va(Ls,e,t,i,l,o),!0;case"pointerover":var u=o.pointerId;return ba.set(u,va(ba.get(u)||null,e,t,i,l,o)),!0;case"gotpointercapture":return u=o.pointerId,xa.set(u,va(xa.get(u)||null,e,t,i,l,o)),!0}return!1}function $p(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Ia(e.priority,function(){Hp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Ia(e.priority,function(){Hp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ic(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Wu(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);Wc=l,i.target.dispatchEvent(l),Wc=null}else return t=S(i),t!==null&&Lp(t),e.blockedOn=i,!1;t.shift()}return!0}function Gp(e,t,i){ic(e)&&i.delete(t)}function fx(){tf=!1,Us!==null&&ic(Us)&&(Us=null),Bs!==null&&ic(Bs)&&(Bs=null),Ls!==null&&ic(Ls)&&(Ls=null),ba.forEach(Gp),xa.forEach(Gp)}function rc(e,t){e.blockedOn===t&&(e.blockedOn=null,tf||(tf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,fx)))}var ac=null;function Vp(e){ac!==e&&(ac=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){ac===e&&(ac=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],o=e[t+2];if(typeof l!="function"){if(ef(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,Wo(u,{pending:!0,data:o,method:i.method,action:l},l,o))}}))}function hr(e){function t(O){return rc(O,e)}Us!==null&&rc(Us,e),Bs!==null&&rc(Bs,e),Ls!==null&&rc(Ls,e),ba.forEach(t),xa.forEach(t);for(var i=0;i<Hs.length;i++){var l=Hs[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Hs.length&&(i=Hs[0],i.blockedOn===null);)$p(i),i.blockedOn===null&&Hs.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var o=i[l],u=i[l+1],m=o[it]||null;if(typeof u=="function")m||Vp(i);else if(m){var b=null;if(u&&u.hasAttribute("formAction")){if(o=u,m=u[it]||null)b=m.formAction;else if(ef(o)!==null)continue}else b=m.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Vp(i)}}}function Fp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(m){return o=m})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function nf(e){this._internalRoot=e}lc.prototype.render=nf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=It();Up(i,l,e,t,null,null)},lc.prototype.unmount=nf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Up(e.current,2,null,e,null,null),Pl(),t[$t]=null}};function lc(e){this._internalRoot=e}lc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Hs.length&&t!==0&&t<Hs[i].priority;i++);Hs.splice(i,0,e),i===0&&$p(e)}};var Jp=n.version;if(Jp!=="19.2.4")throw Error(a(527,Jp,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?A(e):null,e=e===null?null:e.stateNode,e};var hx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cc.isDisabled&&cc.supportsFiber)try{ei=cc.inject(hx),ct=cc}catch{}}return _a.createRoot=function(e,t){if(!c(e))throw Error(a(299));var i=!1,l="",o=em,u=tm,m=nm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=zp(e,1,!1,null,null,i,l,null,o,u,m,Fp),e[$t]=t.current,Uu(e),new nf(t)},_a.hydrateRoot=function(e,t,i){if(!c(e))throw Error(a(299));var l=!1,o="",u=em,m=tm,b=nm,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(m=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),t=zp(e,1,!0,t,i??null,l,o,O,u,m,b,Fp),t.context=qp(null),i=t.current,l=It(),l=Yn(l),o=As(l),o.callback=null,Os(i,o,l),i=l,t.current.lanes=i,vn(t,i),Dn(t),e[$t]=t.current,Uu(e),new lc(t)},_a.version="19.2.4",_a}var e0;function Kx(){if(e0)return sf.exports;e0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),sf.exports=Ix(),sf.exports}var Zx=Kx();const Wx="modulepreload",ev=function(r){return"/"+r},t0={},Ae=function(n,s,a){let c=Promise.resolve();if(s&&s.length>0){let h=function(y){return Promise.all(y.map(A=>Promise.resolve(A).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),g=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));c=h(s.map(y=>{if(y=ev(y),y in t0)return;t0[y]=!0;const A=y.endsWith(".css"),w=A?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${w}`))return;const j=document.createElement("link");if(j.rel=A?"stylesheet":Wx,A||(j.as="script"),j.crossOrigin="",j.href=y,g&&j.setAttribute("nonce",g),document.head.appendChild(j),A)return new Promise((z,R)=>{j.addEventListener("load",z),j.addEventListener("error",()=>R(new Error(`Unable to preload CSS for ${y}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return c.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function cg(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function og(r){const n=cg(r);return!n||typeof n.exp!="number"?null:n.exp}function Vf(r,n=0){const s=og(r);return s===null?!0:Date.now()/1e3>=s-n}const _f="/api";let Gs=null;function oc(r){Gs=r}function ug(){return Gs}async function n0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${_f}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const c=await a.json();return c.token&&c.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:c.user.display_name,username:c.user.external_id})),c.token??null}catch{return null}}let Ys=null;async function Ie(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Gs){if(Vf(Gs)){Ys||(Ys=n0().finally(()=>{Ys=null}));const c=await Ys;if(c)Gs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Gs}`}let a=await fetch(`${_f}${r}`,{...n,headers:s});if(a.status===401&&Gs){Ys||(Ys=n0().finally(()=>{Ys=null}));const c=await Ys;if(c&&(Gs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),s.Authorization=`Bearer ${c}`,a=await fetch(`${_f}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const c=await a.json().catch(()=>({error:a.statusText}));throw new Error(c.message||c.error||a.statusText)}return a.json()}const fg=N.createContext(null),tv=300;function lf(r,n){if(Vf(r))return null;const s=cg(r);if(!s)return null;const a=n??(()=>{try{const c=sessionStorage.getItem("lt_user_info");return c?JSON.parse(c):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function nv({children:r}){const[n,s]=N.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Vf(w)?(sessionStorage.removeItem("lt_token"),null):(oc(w),lf(w)):null}),a=N.useRef(void 0),c=N.useCallback(w=>{clearTimeout(a.current);const j=og(w);if(!j)return;const z=(j-tv)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{const R=sessionStorage.getItem("lt_credentials");if(R)try{const{username:H,password:ee}=JSON.parse(R),ne=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:H,password:ee})});if(!ne.ok)return;const W=await ne.json();W.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:W.token}}))}catch{}},z))},[]),f=N.useCallback((w,j,z)=>{const R={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(j==null?void 0:j.username)??null},H=lf(w,R);H&&(oc(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(R)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(H),c(w))},[c]),h=N.useCallback(()=>{clearTimeout(a.current),oc(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),s(null)},[]);N.useEffect(()=>{const w=()=>h(),j=z=>{var ee;const R=(ee=z.detail)==null?void 0:ee.token;if(!R)return;const H=lf(R);H&&(oc(R),sessionStorage.setItem("lt_token",R),s(H),c(R))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",j)}},[h,c]),N.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&c(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=N.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.role===w))??!1,[n]),y=N.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.type===w))??!1,[n]),A=(n==null?void 0:n.roles.map(w=>w.role))??[];return p.jsx(fg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:A},children:r})}function Ai(){const r=N.useContext(fg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const tn=new Uint8Array(0),Oi=new TextEncoder,Wt=new TextDecoder;function sv(...r){let n=0;for(let c=0;c<r.length;c++)n+=r[c].length;const s=new Uint8Array(n);let a=0;for(let c=0;c<r.length;c++)s.set(r[c],a),a+=r[c].length;return s}function Ca(...r){const n=[];for(let s=0;s<r.length;s++)n.push(Oi.encode(r[s]));return n.length===0?tn:n.length===1?n[0]:sv(...n)}function s0(r){return!r||r.length===0?"":Wt.decode(r)}const i0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",r0=36,iv=0xcfd41b9100000,a0=33,rv=333,l0=22;function av(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function lv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):av(r)}class cv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(l0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*iv),this.inc=Math.floor(Math.random()*(rv-a0)+a0)}setPre(){const n=new Uint8Array(12);lv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=i0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=l0-1;s>=12;s--)this.buf[s]=i0.charCodeAt(n%r0),n=Math.floor(n/r0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Is=new cv;var ls;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(ls||(ls={}));var yr;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(yr||(yr={}));var se;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(se||(se={}));function ov(r){return typeof r.code=="string"}class hg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(se.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(se.BadJson,"Bad JSON"),this.messages.set(se.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return uv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const uv=new hg;class oe extends Error{constructor(s,a,c){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=c}static errorForCode(s,a){const c=hg.getMessage(s);return new oe(c,s,a)}isAuthError(){return this.code===se.AuthenticationExpired||this.code===se.AuthorizationViolation||this.code===se.AccountExpired}isAuthTimeout(){return this.code===se.AuthenticationTimeout}isPermissionError(){return this.code===se.PermissionsViolation}isProtocolError(){return this.code===se.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var jn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(jn||(jn={}));var ka;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(ka||(ka={}));const jc="Nats-Service-Error",Tc="Nats-Service-Error-Code";class Nc extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Nc.toServiceError(s)!==null}static toServiceError(s){var c,f;const a=((c=s==null?void 0:s.headers)==null?void 0:c.get(Tc))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(jc))||"";return new Nc(h,d.length?d:a)}return null}}function cs(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Is.next()}`}const wf="127.0.0.1";var Fs;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Fs||(Fs={}));function Bc(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(c){r[c]=a[c]})}return r}function uc(r){return Wt.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function wr(r,n=!0){const s=n?oe.errorForCode(se.Timeout):null;let a,c;const f=new Promise((h,d)=>{a={cancel:()=>{c&&clearTimeout(c)}},c=setTimeout(()=>{d(s===null?oe.errorForCode(se.Timeout):s)},r)});return Object.assign(f,a)}function Ar(r=0){let n;const s=new Promise(a=>{const c=setTimeout(()=>{a()},r);n={cancel:()=>{c&&clearTimeout(c)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function dg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function fv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Ff(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return fv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Jf(r){return Math.floor(r/1e6)}function c0(r){let a=!0;const c=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new oe(`'${r[f]}' is not a valid character for a header key`,se.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),c[f]=h,a=h==45}return String.fromCharCode(...c)}function os(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Js(r,n)}const cf="NATS/1.0";class Js{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const c=n.values(s);if(a.length!==c.length)return!1;const f=[...a].sort(),h=[...c].sort();for(let d=0;d<f.length;d++)if(f[d]!==h[d])return!1}return!0}return!1}static decode(n){const s=new Js,c=Wt.decode(n).split(`\r
25
+ `+l.stack}}var jr=Object.prototype.hasOwnProperty,Tr=r.unstable_scheduleCallback,Hn=r.unstable_cancelCallback,Va=r.unstable_shouldYield,Ni=r.unstable_requestPaint,et=r.unstable_now,Fc=r.unstable_getCurrentPriorityLevel,Fa=r.unstable_ImmediatePriority,Ja=r.unstable_UserBlockingPriority,Ci=r.unstable_NormalPriority,Jc=r.unstable_LowPriority,Qa=r.unstable_IdlePriority,Qc=r.log,Xa=r.unstable_setDisableYieldValue,ei=null,ct=null;function Yt(e){if(typeof Qc=="function"&&Xa(e),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(ei,e)}catch{}}var Nt=Math.clz32?Math.clz32:ki,Nr=Math.log,Cr=Math.LN2;function ki(e){return e>>>=0,e===0?32:31-(Nr(e)/Cr|0)|0}var ds=256,Pn=262144,ms=4194304;function xn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ti(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var o=0,u=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?o=xn(l):(m&=b,m!==0?o=xn(m):i||(i=b&~e,i!==0&&(o=xn(i))))):(b=l&~u,b!==0?o=xn(b):m!==0?o=xn(m):i||(i=l&~e,i!==0&&(o=xn(i)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:o}function ni(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function kr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mi(){var e=ms;return ms<<=1,(ms&62914560)===0&&(ms=4194304),e}function ps(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function vn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gs(e,t,i,l,o,u){var m=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,U=e.hiddenUpdates;for(i=m&~i;0<i;){var $=31-Nt(i),J=1<<$;b[$]=0,O[$]=-1;var B=U[$];if(B!==null)for(U[$]=null,$=0;$<B.length;$++){var P=B[$];P!==null&&(P.lane&=-536870913)}i&=~J}l!==0&&ys(e,l,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(m&~t))}function ys(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function si(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),o=1<<l;o&t|e[l]&t&&(e[l]|=t),i&=~o}}function bs(e,t){var i=t&-t;return i=(i&42)!==0?1:Yn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Yn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ii(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Mr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Pp(e.type))}function Ia(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Cn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Cn,it="__reactProps$"+Cn,$t="__reactContainer$"+Cn,ri="__reactEvents$"+Cn,Rr="__reactListeners$"+Cn,Ka="__reactHandles$"+Cn,Za="__reactResources$"+Cn,yt="__reactMarker$"+Cn;function Ri(e){delete e[Qe],delete e[it],delete e[ri],delete e[Rr],delete e[Ka]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[$t]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Ap(e);e!==null;){if(i=e[Qe])return i;e=Ap(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Qe]||e[$t]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function E(e){var t=e[Za];return t||(t=e[Za]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function T(e){e[yt]=!0}var D=new Set,F={};function X(e,t){L(e,t),L(e+"Capture",t)}function L(e,t){for(F[e]=t,e=0;e<t.length;e++)D.add(t[e])}var V=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ue={},Oe={};function Ke(e){return jr.call(Oe,e)?!0:jr.call(ue,e)?!1:V.test(e)?Oe[e]=!0:(ue[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function _n(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function $n(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function an(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function oh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ay(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var o=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(m){i=""+m,u.call(this,m)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(m){i=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xc(e){if(!e._valueTracker){var t=oh(e)?"checked":"value";e._valueTracker=ay(e,t,""+e[t])}}function uh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=oh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function Wa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ly=/[\n"\\]/g;function ln(e){return e.replace(ly,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ic(e,t,i,l,o,u,m,b){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+an(t)):e.value!==""+an(t)&&(e.value=""+an(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?Kc(e,m,an(t)):i!=null?Kc(e,m,an(i)):l!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+an(b):e.removeAttribute("name")}function fh(e,t,i,l,o,u,m,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Xc(e);return}i=i!=null?""+an(i):"",t=t!=null?""+an(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??o,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),Xc(e)}function Kc(e,t,i){t==="number"&&Wa(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Di(e,t,i,l){if(e=e.options,t){t={};for(var o=0;o<i.length;o++)t["$"+i[o]]=!0;for(i=0;i<e.length;i++)o=t.hasOwnProperty("$"+e[i].value),e[i].selected!==o&&(e[i].selected=o),o&&l&&(e[i].defaultSelected=!0)}else{for(i=""+an(i),t=null,o=0;o<e.length;o++){if(e[o].value===i){e[o].selected=!0,l&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function hh(e,t,i){if(t!=null&&(t=""+an(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+an(i):""}function dh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Le(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=an(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Xc(e)}function zi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var cy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function mh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||cy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function ph(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var o in t)l=t[o],t.hasOwnProperty(o)&&i[o]!==l&&mh(e,o,l)}else for(var u in t)t.hasOwnProperty(u)&&mh(e,u,t[u])}function Zc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var oy=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),uy=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function el(e){return uy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Gn(){}var Wc=null;function eo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qi=null,Ui=null;function gh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ic(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+ln(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var o=l[it]||null;if(!o)throw Error(a(90));Ic(l,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&uh(l)}break e;case"textarea":hh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&Di(e,!!i.multiple,t,!1)}}}var to=!1;function yh(e,t,i){if(to)return e(t,i);to=!0;try{var l=e(t);return l}finally{if(to=!1,(qi!==null||Ui!==null)&&(Pl(),qi&&(t=qi,e=Ui,Ui=qi=null,gh(t),e)))for(t=0;t<e.length;t++)gh(e[t])}}function Dr(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Vn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),no=!1;if(Vn)try{var zr={};Object.defineProperty(zr,"passive",{get:function(){no=!0}}),window.addEventListener("test",zr,zr),window.removeEventListener("test",zr,zr)}catch{no=!1}var xs=null,so=null,tl=null;function bh(){if(tl)return tl;var e,t=so,i=t.length,l,o="value"in xs?xs.value:xs.textContent,u=o.length;for(e=0;e<i&&t[e]===o[e];e++);var m=i-e;for(l=1;l<=m&&t[i-l]===o[u-l];l++);return tl=o.slice(e,1<l?1-l:void 0)}function nl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function sl(){return!0}function xh(){return!1}function zt(e){function t(i,l,o,u,m){this._reactName=i,this._targetInst=o,this.type=l,this.nativeEvent=u,this.target=m,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?sl:xh,this.isPropagationStopped=xh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=sl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=sl)},persist:function(){},isPersistent:sl}),t}var ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},il=zt(ai),qr=w({},ai,{view:0,detail:0}),fy=zt(qr),io,ro,Ur,rl=w({},qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ur&&(Ur&&e.type==="mousemove"?(io=e.screenX-Ur.screenX,ro=e.screenY-Ur.screenY):ro=io=0,Ur=e),io)},movementY:function(e){return"movementY"in e?e.movementY:ro}}),vh=zt(rl),hy=w({},rl,{dataTransfer:0}),dy=zt(hy),my=w({},qr,{relatedTarget:0}),ao=zt(my),py=w({},ai,{animationName:0,elapsedTime:0,pseudoElement:0}),gy=zt(py),yy=w({},ai,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),by=zt(yy),xy=w({},ai,{data:0}),_h=zt(xy),vy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_y={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},wy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=wy[e])?!!t[e]:!1}function lo(){return Sy}var Ey=w({},qr,{key:function(e){if(e.key){var t=vy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=nl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?_y[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lo,charCode:function(e){return e.type==="keypress"?nl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ay=zt(Ey),Oy=w({},rl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wh=zt(Oy),jy=w({},qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lo}),Ty=zt(jy),Ny=w({},ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),Cy=zt(Ny),ky=w({},rl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),My=zt(ky),Ry=w({},ai,{newState:0,oldState:0}),Dy=zt(Ry),zy=[9,13,27,32],co=Vn&&"CompositionEvent"in window,Br=null;Vn&&"documentMode"in document&&(Br=document.documentMode);var qy=Vn&&"TextEvent"in window&&!Br,Sh=Vn&&(!co||Br&&8<Br&&11>=Br),Eh=" ",Ah=!1;function Oh(e,t){switch(e){case"keyup":return zy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bi=!1;function Uy(e,t){switch(e){case"compositionend":return jh(t);case"keypress":return t.which!==32?null:(Ah=!0,Eh);case"textInput":return e=t.data,e===Eh&&Ah?null:e;default:return null}}function By(e,t){if(Bi)return e==="compositionend"||!co&&Oh(e,t)?(e=bh(),tl=so=xs=null,Bi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Sh&&t.locale!=="ko"?null:t.data;default:return null}}var Ly={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Th(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ly[e.type]:t==="textarea"}function Nh(e,t,i,l){qi?Ui?Ui.push(l):Ui=[l]:qi=l,t=Ql(t,"onChange"),0<t.length&&(i=new il("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Lr=null,Hr=null;function Hy(e){fp(e,0)}function al(e){var t=_(e);if(uh(t))return e}function Ch(e,t){if(e==="change")return t}var kh=!1;if(Vn){var oo;if(Vn){var uo="oninput"in document;if(!uo){var Mh=document.createElement("div");Mh.setAttribute("oninput","return;"),uo=typeof Mh.oninput=="function"}oo=uo}else oo=!1;kh=oo&&(!document.documentMode||9<document.documentMode)}function Rh(){Lr&&(Lr.detachEvent("onpropertychange",Dh),Hr=Lr=null)}function Dh(e){if(e.propertyName==="value"&&al(Hr)){var t=[];Nh(t,Hr,e,eo(e)),yh(Hy,t)}}function Py(e,t,i){e==="focusin"?(Rh(),Lr=t,Hr=i,Lr.attachEvent("onpropertychange",Dh)):e==="focusout"&&Rh()}function Yy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return al(Hr)}function $y(e,t){if(e==="click")return al(t)}function Gy(e,t){if(e==="input"||e==="change")return al(t)}function Vy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Vy;function Pr(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var o=i[l];if(!jr.call(t,o)||!Gt(e[o],t[o]))return!1}return!0}function zh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function qh(e,t){var i=zh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=zh(i)}}function Uh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Uh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Bh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Wa(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Wa(e.document)}return t}function fo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Fy=Vn&&"documentMode"in document&&11>=document.documentMode,Li=null,ho=null,Yr=null,mo=!1;function Lh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;mo||Li==null||Li!==Wa(l)||(l=Li,"selectionStart"in l&&fo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Yr&&Pr(Yr,l)||(Yr=l,l=Ql(ho,"onSelect"),0<l.length&&(t=new il("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Li)))}function li(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Hi={animationend:li("Animation","AnimationEnd"),animationiteration:li("Animation","AnimationIteration"),animationstart:li("Animation","AnimationStart"),transitionrun:li("Transition","TransitionRun"),transitionstart:li("Transition","TransitionStart"),transitioncancel:li("Transition","TransitionCancel"),transitionend:li("Transition","TransitionEnd")},po={},Hh={};Vn&&(Hh=document.createElement("div").style,"AnimationEvent"in window||(delete Hi.animationend.animation,delete Hi.animationiteration.animation,delete Hi.animationstart.animation),"TransitionEvent"in window||delete Hi.transitionend.transition);function ci(e){if(po[e])return po[e];if(!Hi[e])return e;var t=Hi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Hh)return po[e]=t[i];return e}var Ph=ci("animationend"),Yh=ci("animationiteration"),$h=ci("animationstart"),Jy=ci("transitionrun"),Qy=ci("transitionstart"),Xy=ci("transitioncancel"),Gh=ci("transitionend"),Vh=new Map,go="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");go.push("scrollEnd");function wn(e,t){Vh.set(e,t),X(t,[e])}var ll=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},cn=[],Pi=0,yo=0;function cl(){for(var e=Pi,t=yo=Pi=0;t<e;){var i=cn[t];cn[t++]=null;var l=cn[t];cn[t++]=null;var o=cn[t];cn[t++]=null;var u=cn[t];if(cn[t++]=null,l!==null&&o!==null){var m=l.pending;m===null?o.next=o:(o.next=m.next,m.next=o),l.pending=o}u!==0&&Fh(i,o,u)}}function ol(e,t,i,l){cn[Pi++]=e,cn[Pi++]=t,cn[Pi++]=i,cn[Pi++]=l,yo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function bo(e,t,i,l){return ol(e,t,i,l),ul(e)}function oi(e,t){return ol(e,null,null,t),ul(e)}function Fh(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var o=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(o=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,o&&t!==null&&(o=31-Nt(i),e=u.hiddenUpdates,l=e[o],l===null?e[o]=[t]:l.push(t),t.lane=i|536870912),u):null}function ul(e){if(50<ua)throw ua=0,ju=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function Iy(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new Iy(e,t,i,l)}function xo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Jh(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function fl(e,t,i,l,o,u){var m=0;if(l=e,typeof e=="function")xo(e)&&(m=1);else if(typeof e=="string")m=tx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Q:return e=Vt(31,i,t,o),e.elementType=Q,e.lanes=u,e;case H:return ui(i.children,o,u,t);case ee:m=8,o|=24;break;case ne:return e=Vt(12,i,t,o|2),e.elementType=ne,e.lanes=u,e;case k:return e=Vt(13,i,t,o),e.elementType=k,e.lanes=u,e;case I:return e=Vt(19,i,t,o),e.elementType=I,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:m=10;break e;case W:m=9;break e;case be:m=11;break e;case ie:m=14;break e;case Z:m=16,l=null;break e}m=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(m,i,t,o),t.elementType=e,t.type=l,t.lanes=u,t}function ui(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function vo(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function Qh(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function _o(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Xh=new WeakMap;function on(e,t){if(typeof e=="object"&&e!==null){var i=Xh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ga(t)},Xh.set(e,t),t)}return{value:e,source:t,stack:Ga(t)}}var $i=[],Gi=0,hl=null,$r=0,un=[],fn=0,vs=null,kn=1,Mn="";function Jn(e,t){$i[Gi++]=$r,$i[Gi++]=hl,hl=e,$r=t}function Ih(e,t,i){un[fn++]=kn,un[fn++]=Mn,un[fn++]=vs,vs=e;var l=kn;e=Mn;var o=32-Nt(l)-1;l&=~(1<<o),i+=1;var u=32-Nt(t)+o;if(30<u){var m=o-o%5;u=(l&(1<<m)-1).toString(32),l>>=m,o-=m,kn=1<<32-Nt(t)+o|i<<o|l,Mn=u+e}else kn=1<<u|i<<o|l,Mn=e}function wo(e){e.return!==null&&(Jn(e,1),Ih(e,1,0))}function So(e){for(;e===hl;)hl=$i[--Gi],$i[Gi]=null,$r=$i[--Gi],$i[Gi]=null;for(;e===vs;)vs=un[--fn],un[fn]=null,Mn=un[--fn],un[fn]=null,kn=un[--fn],un[fn]=null}function Kh(e,t){un[fn++]=kn,un[fn++]=Mn,un[fn++]=vs,kn=t.id,Mn=t.overflow,vs=e}var wt=null,Ze=null,Re=!1,_s=null,hn=!1,Eo=Error(a(519));function ws(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gr(on(t,e)),Eo}function Zh(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<ha.length;i++)Ce(ha[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),fh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),dh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||pp(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Gn),t=!0):t=!1,t||ws(e,!0)}function Wh(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:hn=!1;return;case 27:case 3:hn=!0;return;default:wt=wt.return}}function Vi(e){if(e!==wt)return!1;if(!Re)return Wh(e),Re=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Yu(e.type,e.memoizedProps)),i=!i),i&&Ze&&ws(e),Wh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Ep(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Ep(e)}else t===27?(t=Ze,qs(e.type)?(e=Ju,Ju=null,Ze=e):Ze=t):Ze=wt?mn(e.stateNode.nextSibling):null;return!0}function fi(){Ze=wt=null,Re=!1}function Ao(){var e=_s;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),_s=null),e}function Gr(e){_s===null?_s=[e]:_s.push(e)}var Oo=je(null),hi=null,Qn=null;function Ss(e,t,i){Te(Oo,t._currentValue),t._currentValue=i}function Xn(e){e._currentValue=Oo.current,_e(Oo)}function jo(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function To(e,t,i,l){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){var m=o.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=o;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),jo(u.return,i,e),l||(m=null);break e}u=b.next}}else if(o.tag===18){if(m=o.return,m===null)throw Error(a(341));m.lanes|=i,u=m.alternate,u!==null&&(u.lanes|=i),jo(m,i,e),m=null}else m=o.child;if(m!==null)m.return=o;else for(m=o;m!==null;){if(m===e){m=null;break}if(o=m.sibling,o!==null){o.return=m.return,m=o;break}m=m.return}o=m}}function Fi(e,t,i,l){e=null;for(var o=t,u=!1;o!==null;){if(!u){if((o.flags&524288)!==0)u=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var m=o.alternate;if(m===null)throw Error(a(387));if(m=m.memoizedProps,m!==null){var b=o.type;Gt(o.pendingProps.value,m.value)||(e!==null?e.push(b):e=[b])}}else if(o===Ot.current){if(m=o.alternate,m===null)throw Error(a(387));m.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(ya):e=[ya])}o=o.return}e!==null&&To(t,e,i,l),t.flags|=262144}function dl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function di(e){hi=e,Qn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ed(hi,e)}function ml(e,t){return hi===null&&di(e),ed(e,t)}function ed(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Qn===null){if(e===null)throw Error(a(308));Qn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Qn=Qn.next=t;return i}var Ky=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},Zy=r.unstable_scheduleCallback,Wy=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function No(){return{controller:new Ky,data:new Map,refCount:0}}function Vr(e){e.refCount--,e.refCount===0&&Zy(Wy,function(){e.controller.abort()})}var Fr=null,Co=0,Ji=0,Qi=null;function eb(e,t){if(Fr===null){var i=Fr=[];Co=0,Ji=Ru(),Qi={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Co++,t.then(td,td),t}function td(){if(--Co===0&&Fr!==null){Qi!==null&&(Qi.status="fulfilled");var e=Fr;Fr=null,Ji=0,Qi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function tb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(o){i.push(o)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var o=0;o<i.length;o++)(0,i[o])(t)},function(o){for(l.status="rejected",l.reason=o,o=0;o<i.length;o++)(0,i[o])(void 0)}),l}var nd=Y.S;Y.S=function(e,t){Lm=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&eb(e,t),nd!==null&&nd(e,t)};var mi=je(null);function ko(){var e=mi.current;return e!==null?e:Xe.pooledCache}function pl(e,t){t===null?Te(mi,mi.current):Te(mi,t.pool)}function sd(){var e=ko();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Mo=Error(a(474)),gl=Error(a(542)),yl={then:function(){}};function id(e){return e=e.status,e==="fulfilled"||e==="rejected"}function rd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Gn,Gn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ld(e),e;default:if(typeof t.status=="string")t.then(Gn,Gn);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=l}},function(l){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ld(e),e}throw gi=t,Xi}}function pi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(gi=i,Xi):i}}var gi=null;function ad(){if(gi===null)throw Error(a(459));var e=gi;return gi=null,e}function ld(e){if(e===Xi||e===gl)throw Error(a(483))}var Ii=null,Jr=0;function bl(e){var t=Jr;return Jr+=1,Ii===null&&(Ii=[]),rd(Ii,e,t)}function Qr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xl(e,t){throw t.$$typeof===j?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function cd(e){function t(M,N){if(e){var q=M.deletions;q===null?(M.deletions=[N],M.flags|=16):q.push(N)}}function i(M,N){if(!e)return null;for(;N!==null;)t(M,N),N=N.sibling;return null}function l(M){for(var N=new Map;M!==null;)M.key!==null?N.set(M.key,M):N.set(M.index,M),M=M.sibling;return N}function o(M,N){return M=Fn(M,N),M.index=0,M.sibling=null,M}function u(M,N,q){return M.index=q,e?(q=M.alternate,q!==null?(q=q.index,q<N?(M.flags|=67108866,N):q):(M.flags|=67108866,N)):(M.flags|=1048576,N)}function m(M){return e&&M.alternate===null&&(M.flags|=67108866),M}function b(M,N,q,G){return N===null||N.tag!==6?(N=vo(q,M.mode,G),N.return=M,N):(N=o(N,q),N.return=M,N)}function O(M,N,q,G){var pe=q.type;return pe===H?$(M,N,q.props.children,G,q.key):N!==null&&(N.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Z&&pi(pe)===N.type)?(N=o(N,q.props),Qr(N,q),N.return=M,N):(N=fl(q.type,q.key,q.props,null,M.mode,G),Qr(N,q),N.return=M,N)}function U(M,N,q,G){return N===null||N.tag!==4||N.stateNode.containerInfo!==q.containerInfo||N.stateNode.implementation!==q.implementation?(N=_o(q,M.mode,G),N.return=M,N):(N=o(N,q.children||[]),N.return=M,N)}function $(M,N,q,G,pe){return N===null||N.tag!==7?(N=ui(q,M.mode,G,pe),N.return=M,N):(N=o(N,q),N.return=M,N)}function J(M,N,q){if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return N=vo(""+N,M.mode,q),N.return=M,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case z:return q=fl(N.type,N.key,N.props,null,M.mode,q),Qr(q,N),q.return=M,q;case R:return N=_o(N,M.mode,q),N.return=M,N;case Z:return N=pi(N),J(M,N,q)}if(Le(N)||re(N))return N=ui(N,M.mode,q,null),N.return=M,N;if(typeof N.then=="function")return J(M,bl(N),q);if(N.$$typeof===me)return J(M,ml(M,N),q);xl(M,N)}return null}function B(M,N,q,G){var pe=N!==null?N.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return pe!==null?null:b(M,N,""+q,G);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case z:return q.key===pe?O(M,N,q,G):null;case R:return q.key===pe?U(M,N,q,G):null;case Z:return q=pi(q),B(M,N,q,G)}if(Le(q)||re(q))return pe!==null?null:$(M,N,q,G,null);if(typeof q.then=="function")return B(M,N,bl(q),G);if(q.$$typeof===me)return B(M,N,ml(M,q),G);xl(M,q)}return null}function P(M,N,q,G,pe){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return M=M.get(q)||null,b(N,M,""+G,pe);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case z:return M=M.get(G.key===null?q:G.key)||null,O(N,M,G,pe);case R:return M=M.get(G.key===null?q:G.key)||null,U(N,M,G,pe);case Z:return G=pi(G),P(M,N,q,G,pe)}if(Le(G)||re(G))return M=M.get(q)||null,$(N,M,G,pe,null);if(typeof G.then=="function")return P(M,N,q,bl(G),pe);if(G.$$typeof===me)return P(M,N,q,ml(N,G),pe);xl(N,G)}return null}function fe(M,N,q,G){for(var pe=null,Ue=null,de=N,Ee=N=0,Me=null;de!==null&&Ee<q.length;Ee++){de.index>Ee?(Me=de,de=null):Me=de.sibling;var Be=B(M,de,q[Ee],G);if(Be===null){de===null&&(de=Me);break}e&&de&&Be.alternate===null&&t(M,de),N=u(Be,N,Ee),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be,de=Me}if(Ee===q.length)return i(M,de),Re&&Jn(M,Ee),pe;if(de===null){for(;Ee<q.length;Ee++)de=J(M,q[Ee],G),de!==null&&(N=u(de,N,Ee),Ue===null?pe=de:Ue.sibling=de,Ue=de);return Re&&Jn(M,Ee),pe}for(de=l(de);Ee<q.length;Ee++)Me=P(de,M,Ee,q[Ee],G),Me!==null&&(e&&Me.alternate!==null&&de.delete(Me.key===null?Ee:Me.key),N=u(Me,N,Ee),Ue===null?pe=Me:Ue.sibling=Me,Ue=Me);return e&&de.forEach(function(Ps){return t(M,Ps)}),Re&&Jn(M,Ee),pe}function ge(M,N,q,G){if(q==null)throw Error(a(151));for(var pe=null,Ue=null,de=N,Ee=N=0,Me=null,Be=q.next();de!==null&&!Be.done;Ee++,Be=q.next()){de.index>Ee?(Me=de,de=null):Me=de.sibling;var Ps=B(M,de,Be.value,G);if(Ps===null){de===null&&(de=Me);break}e&&de&&Ps.alternate===null&&t(M,de),N=u(Ps,N,Ee),Ue===null?pe=Ps:Ue.sibling=Ps,Ue=Ps,de=Me}if(Be.done)return i(M,de),Re&&Jn(M,Ee),pe;if(de===null){for(;!Be.done;Ee++,Be=q.next())Be=J(M,Be.value,G),Be!==null&&(N=u(Be,N,Ee),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be);return Re&&Jn(M,Ee),pe}for(de=l(de);!Be.done;Ee++,Be=q.next())Be=P(de,M,Ee,Be.value,G),Be!==null&&(e&&Be.alternate!==null&&de.delete(Be.key===null?Ee:Be.key),N=u(Be,N,Ee),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be);return e&&de.forEach(function(hx){return t(M,hx)}),Re&&Jn(M,Ee),pe}function Je(M,N,q,G){if(typeof q=="object"&&q!==null&&q.type===H&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case z:e:{for(var pe=q.key;N!==null;){if(N.key===pe){if(pe=q.type,pe===H){if(N.tag===7){i(M,N.sibling),G=o(N,q.props.children),G.return=M,M=G;break e}}else if(N.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Z&&pi(pe)===N.type){i(M,N.sibling),G=o(N,q.props),Qr(G,q),G.return=M,M=G;break e}i(M,N);break}else t(M,N);N=N.sibling}q.type===H?(G=ui(q.props.children,M.mode,G,q.key),G.return=M,M=G):(G=fl(q.type,q.key,q.props,null,M.mode,G),Qr(G,q),G.return=M,M=G)}return m(M);case R:e:{for(pe=q.key;N!==null;){if(N.key===pe)if(N.tag===4&&N.stateNode.containerInfo===q.containerInfo&&N.stateNode.implementation===q.implementation){i(M,N.sibling),G=o(N,q.children||[]),G.return=M,M=G;break e}else{i(M,N);break}else t(M,N);N=N.sibling}G=_o(q,M.mode,G),G.return=M,M=G}return m(M);case Z:return q=pi(q),Je(M,N,q,G)}if(Le(q))return fe(M,N,q,G);if(re(q)){if(pe=re(q),typeof pe!="function")throw Error(a(150));return q=pe.call(q),ge(M,N,q,G)}if(typeof q.then=="function")return Je(M,N,bl(q),G);if(q.$$typeof===me)return Je(M,N,ml(M,q),G);xl(M,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,N!==null&&N.tag===6?(i(M,N.sibling),G=o(N,q),G.return=M,M=G):(i(M,N),G=vo(q,M.mode,G),G.return=M,M=G),m(M)):i(M,N)}return function(M,N,q,G){try{Jr=0;var pe=Je(M,N,q,G);return Ii=null,pe}catch(de){if(de===Xi||de===gl)throw de;var Ue=Vt(29,de,null,M.mode);return Ue.lanes=G,Ue.return=M,Ue}finally{}}}var yi=cd(!0),od=cd(!1),Es=!1;function Ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Do(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function As(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Os(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(He&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,t=ul(e),Fh(e,null,i),t}return ol(e,l,t,i),ul(e)}function Xr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,si(e,i)}}function zo(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var o=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var m={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?o=u=m:u=u.next=m,i=i.next}while(i!==null);u===null?o=u=t:u=u.next=t}else o=u=t;i={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var qo=!1;function Ir(){if(qo){var e=Qi;if(e!==null)throw e}}function Kr(e,t,i,l){qo=!1;var o=e.updateQueue;Es=!1;var u=o.firstBaseUpdate,m=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var O=b,U=O.next;O.next=null,m===null?u=U:m.next=U,m=O;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==m&&(b===null?$.firstBaseUpdate=U:b.next=U,$.lastBaseUpdate=O))}if(u!==null){var J=o.baseState;m=0,$=U=O=null,b=u;do{var B=b.lane&-536870913,P=B!==b.lane;if(P?(ke&B)===B:(l&B)===B){B!==0&&B===Ji&&(qo=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var fe=e,ge=b;B=t;var Je=i;switch(ge.tag){case 1:if(fe=ge.payload,typeof fe=="function"){J=fe.call(Je,J,B);break e}J=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ge.payload,B=typeof fe=="function"?fe.call(Je,J,B):fe,B==null)break e;J=w({},J,B);break e;case 2:Es=!0}}B=b.callback,B!==null&&(e.flags|=64,P&&(e.flags|=8192),P=o.callbacks,P===null?o.callbacks=[B]:P.push(B))}else P={lane:B,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(U=$=P,O=J):$=$.next=P,m|=B;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;P=b,b=P.next,P.next=null,o.lastBaseUpdate=P,o.shared.pending=null}}while(!0);$===null&&(O=J),o.baseState=O,o.firstBaseUpdate=U,o.lastBaseUpdate=$,u===null&&(o.shared.lanes=0),ks|=m,e.lanes=m,e.memoizedState=J}}function ud(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function fd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)ud(i[e],t)}var Ki=je(null),vl=je(0);function hd(e,t){e=is,Te(vl,e),Te(Ki,t),is=e|t.baseLanes}function Uo(){Te(vl,is),Te(Ki,Ki.current)}function Bo(){is=vl.current,_e(Ki),_e(vl)}var Ft=je(null),dn=null;function js(e){var t=e.alternate;Te(ot,ot.current&1),Te(Ft,e),dn===null&&(t===null||Ki.current!==null||t.memoizedState!==null)&&(dn=e)}function Lo(e){Te(ot,ot.current),Te(Ft,e),dn===null&&(dn=e)}function dd(e){e.tag===22?(Te(ot,ot.current),Te(Ft,e),dn===null&&(dn=e)):Ts()}function Ts(){Te(ot,ot.current),Te(Ft,Ft.current)}function Jt(e){_e(Ft),dn===e&&(dn=null),_e(ot)}var ot=je(0);function _l(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Vu(i)||Fu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var In=0,Se=null,Ve=null,dt=null,wl=!1,Zi=!1,bi=!1,Sl=0,Zr=0,Wi=null,nb=0;function rt(){throw Error(a(321))}function Ho(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Po(e,t,i,l,o,u){return In=u,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Y.H=e===null||e.memoizedState===null?Id:nu,bi=!1,u=i(l,o),bi=!1,Zi&&(u=pd(t,i,l,o)),md(e),u}function md(e){Y.H=ta;var t=Ve!==null&&Ve.next!==null;if(In=0,dt=Ve=Se=null,wl=!1,Zr=0,Wi=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&dl(e)&&(mt=!0))}function pd(e,t,i,l){Se=e;var o=0;do{if(Zi&&(Wi=null),Zr=0,Zi=!1,25<=o)throw Error(a(301));if(o+=1,dt=Ve=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}Y.H=Kd,u=t(i,l)}while(Zi);return u}function sb(){var e=Y.H,t=e.useState()[0];return t=typeof t.then=="function"?Wr(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(Se.flags|=1024),t}function Yo(){var e=Sl!==0;return Sl=0,e}function $o(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Go(e){if(wl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}wl=!1}In=0,dt=Ve=Se=null,Zi=!1,Zr=Sl=0,Wi=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Se.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Ve===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=dt===null?Se.memoizedState:dt.next;if(t!==null)dt=t,Ve=e;else{if(e===null)throw Se.alternate===null?Error(a(467)):Error(a(310));Ve=e,e={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},dt===null?Se.memoizedState=dt=e:dt=dt.next=e}return dt}function El(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wr(e){var t=Zr;return Zr+=1,Wi===null&&(Wi=[]),e=rd(Wi,e,t),t=Se,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,Y.H=t===null||t.memoizedState===null?Id:nu),e}function Al(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Wr(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Vo(e){var t=null,i=Se.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Se.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=El(),Se.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=K;return t.index++,i}function Kn(e,t){return typeof t=="function"?t(e):t}function Ol(e){var t=ut();return Fo(t,Ve,e)}function Fo(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var o=e.baseQueue,u=l.pending;if(u!==null){if(o!==null){var m=o.next;o.next=u.next,u.next=m}t.baseQueue=o=u,l.pending=null}if(u=e.baseState,o===null)e.memoizedState=u;else{t=o.next;var b=m=null,O=null,U=t,$=!1;do{var J=U.lane&-536870913;if(J!==U.lane?(ke&J)===J:(In&J)===J){var B=U.revertLane;if(B===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),J===Ji&&($=!0);else if((In&B)===B){U=U.next,B===Ji&&($=!0);continue}else J={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=J,m=u):O=O.next=J,Se.lanes|=B,ks|=B;J=U.action,bi&&i(u,J),u=U.hasEagerState?U.eagerState:i(u,J)}else B={lane:J,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=B,m=u):O=O.next=B,Se.lanes|=J,ks|=J;U=U.next}while(U!==null&&U!==t);if(O===null?m=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,$&&(i=Qi,i!==null)))throw i;e.memoizedState=u,e.baseState=m,e.baseQueue=O,l.lastRenderedState=u}return o===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Jo(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,o=i.pending,u=t.memoizedState;if(o!==null){i.pending=null;var m=o=o.next;do u=e(u,m.action),m=m.next;while(m!==o);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function gd(e,t,i){var l=Se,o=ut(),u=Re;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var m=!Gt((Ve||o).memoizedState,i);if(m&&(o.memoizedState=i,mt=!0),o=o.queue,Io(xd.bind(null,l,o,e),[e]),o.getSnapshot!==t||m||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,er(9,{destroy:void 0},bd.bind(null,l,o,i,t),null),Xe===null)throw Error(a(349));u||(In&127)!==0||yd(l,t,i)}return i}function yd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Se.updateQueue,t===null?(t=El(),Se.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function bd(e,t,i,l){t.value=i,t.getSnapshot=l,vd(t)&&_d(e)}function xd(e,t,i){return i(function(){vd(t)&&_d(e)})}function vd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function _d(e){var t=oi(e,2);t!==null&&Ht(t,e,2)}function Qo(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),bi){Yt(!0);try{i()}finally{Yt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:e},t}function wd(e,t,i,l){return e.baseState=i,Fo(e,Ve,typeof l=="function"?l:Kn)}function ib(e,t,i,l,o){if(Nl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){u.listeners.push(m)}};Y.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Sd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Sd(e,t){var i=t.action,l=t.payload,o=e.state;if(t.isTransition){var u=Y.T,m={};Y.T=m;try{var b=i(o,l),O=Y.S;O!==null&&O(m,b),Ed(e,t,b)}catch(U){Xo(e,t,U)}finally{u!==null&&m.types!==null&&(u.types=m.types),Y.T=u}}else try{u=i(o,l),Ed(e,t,u)}catch(U){Xo(e,t,U)}}function Ed(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Ad(e,t,l)},function(l){return Xo(e,t,l)}):Ad(e,t,i)}function Ad(e,t,i){t.status="fulfilled",t.value=i,Od(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Sd(e,i)))}function Xo(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Od(t),t=t.next;while(t!==l)}e.action=null}function Od(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jd(e,t){return t}function Td(e,t){if(Re){var i=Xe.formState;if(i!==null){e:{var l=Se;if(Re){if(Ze){t:{for(var o=Ze,u=hn;o.nodeType!==8;){if(!u){o=null;break t}if(o=mn(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){Ze=mn(o.nextSibling),l=o.data==="F!";break e}}ws(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jd,lastRenderedState:t},i.queue=l,i=Jd.bind(null,Se,l),l.dispatch=i,l=Qo(!1),u=tu.bind(null,Se,!1,l.queue),l=kt(),o={state:t,dispatch:null,action:e,pending:null},l.queue=o,i=ib.bind(null,Se,o,u,i),o.dispatch=i,l.memoizedState=e,[t,i,!1]}function Nd(e){var t=ut();return Cd(t,Ve,e)}function Cd(e,t,i){if(t=Fo(e,t,jd)[0],e=Ol(Kn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Wr(t)}catch(m){throw m===Xi?gl:m}else l=t;t=ut();var o=t.queue,u=o.dispatch;return i!==t.memoizedState&&(Se.flags|=2048,er(9,{destroy:void 0},rb.bind(null,o,i),null)),[l,u,e]}function rb(e,t){e.action=t}function kd(e){var t=ut(),i=Ve;if(i!==null)return Cd(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function er(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Se.updateQueue,t===null&&(t=El(),Se.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function Md(){return ut().memoizedState}function jl(e,t,i,l){var o=kt();Se.flags|=e,o.memoizedState=er(1|t,{destroy:void 0},i,l===void 0?null:l)}function Tl(e,t,i,l){var o=ut();l=l===void 0?null:l;var u=o.memoizedState.inst;Ve!==null&&l!==null&&Ho(l,Ve.memoizedState.deps)?o.memoizedState=er(t,u,i,l):(Se.flags|=e,o.memoizedState=er(1|t,u,i,l))}function Rd(e,t){jl(8390656,8,e,t)}function Io(e,t){Tl(2048,8,e,t)}function ab(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=El(),Se.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Dd(e){var t=ut().memoizedState;return ab({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function zd(e,t){return Tl(4,2,e,t)}function qd(e,t){return Tl(4,4,e,t)}function Ud(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Bd(e,t,i){i=i!=null?i.concat([e]):null,Tl(4,4,Ud.bind(null,t,e),i)}function Ko(){}function Ld(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&Ho(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Hd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&Ho(t,l[1]))return l[0];if(l=e(),bi){Yt(!0);try{e()}finally{Yt(!1)}}return i.memoizedState=[l,t],l}function Zo(e,t,i){return i===void 0||(In&1073741824)!==0&&(ke&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Pm(),Se.lanes|=e,ks|=e,i)}function Pd(e,t,i,l){return Gt(i,t)?i:Ki.current!==null?(e=Zo(e,i,l),Gt(e,t)||(mt=!0),e):(In&42)===0||(In&1073741824)!==0&&(ke&261930)===0?(mt=!0,e.memoizedState=i):(e=Pm(),Se.lanes|=e,ks|=e,t)}function Yd(e,t,i,l,o){var u=te.p;te.p=u!==0&&8>u?u:8;var m=Y.T,b={};Y.T=b,tu(e,!1,t,i);try{var O=o(),U=Y.S;if(U!==null&&U(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var $=tb(O,l);ea(e,t,$,It(e))}else ea(e,t,l,It(e))}catch(J){ea(e,t,{then:function(){},status:"rejected",reason:J},It())}finally{te.p=u,m!==null&&b.types!==null&&(m.types=b.types),Y.T=m}}function lb(){}function Wo(e,t,i,l){if(e.tag!==5)throw Error(a(476));var o=$d(e).queue;Yd(e,o,t,he,i===null?lb:function(){return Gd(e),i(l)})}function $d(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:he},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Gd(e){var t=$d(e);t.next===null&&(t=e.alternate.memoizedState),ea(e,t.next.queue,{},It())}function eu(){return St(ya)}function Vd(){return ut().memoizedState}function Fd(){return ut().memoizedState}function cb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=It();e=As(i);var l=Os(t,e,i);l!==null&&(Ht(l,t,i),Xr(l,t,i)),t={cache:No()},e.payload=t;return}t=t.return}}function ob(e,t,i){var l=It();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Nl(e)?Qd(t,i):(i=bo(e,t,i,l),i!==null&&(Ht(i,e,l),Xd(i,t,l)))}function Jd(e,t,i){var l=It();ea(e,t,i,l)}function ea(e,t,i,l){var o={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Nl(e))Qd(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var m=t.lastRenderedState,b=u(m,i);if(o.hasEagerState=!0,o.eagerState=b,Gt(b,m))return ol(e,t,o,0),Xe===null&&cl(),!1}catch{}finally{}if(i=bo(e,t,o,l),i!==null)return Ht(i,e,l),Xd(i,t,l),!0}return!1}function tu(e,t,i,l){if(l={lane:2,revertLane:Ru(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Nl(e)){if(t)throw Error(a(479))}else t=bo(e,i,l,2),t!==null&&Ht(t,e,2)}function Nl(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Qd(e,t){Zi=wl=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Xd(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,si(e,i)}}var ta={readContext:St,use:Al,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};ta.useEffectEvent=rt;var Id={readContext:St,use:Al,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Rd,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,jl(4194308,4,Ud.bind(null,t,e),i)},useLayoutEffect:function(e,t){return jl(4194308,4,e,t)},useInsertionEffect:function(e,t){jl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(bi){Yt(!0);try{e()}finally{Yt(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var o=i(t);if(bi){Yt(!0);try{i(t)}finally{Yt(!1)}}}else o=t;return l.memoizedState=l.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},l.queue=e,e=e.dispatch=ob.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Qo(e);var t=e.queue,i=Jd.bind(null,Se,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Ko,useDeferredValue:function(e,t){var i=kt();return Zo(i,e,t)},useTransition:function(){var e=Qo(!1);return e=Yd.bind(null,Se,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Se,o=kt();if(Re){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Xe===null)throw Error(a(349));(ke&127)!==0||yd(l,t,i)}o.memoizedState=i;var u={value:i,getSnapshot:t};return o.queue=u,Rd(xd.bind(null,l,u,e),[e]),l.flags|=2048,er(9,{destroy:void 0},bd.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Xe.identifierPrefix;if(Re){var i=Mn,l=kn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Sl++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=nb++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:eu,useFormState:Td,useActionState:Td,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=tu.bind(null,Se,!0,i),i.dispatch=t,[e,t]},useMemoCache:Vo,useCacheRefresh:function(){return kt().memoizedState=cb.bind(null,Se)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((He&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},nu={readContext:St,use:Al,useCallback:Ld,useContext:St,useEffect:Io,useImperativeHandle:Bd,useInsertionEffect:zd,useLayoutEffect:qd,useMemo:Hd,useReducer:Ol,useRef:Md,useState:function(){return Ol(Kn)},useDebugValue:Ko,useDeferredValue:function(e,t){var i=ut();return Pd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Ol(Kn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Wr(e),t]},useSyncExternalStore:gd,useId:Vd,useHostTransitionStatus:eu,useFormState:Nd,useActionState:Nd,useOptimistic:function(e,t){var i=ut();return wd(i,Ve,e,t)},useMemoCache:Vo,useCacheRefresh:Fd};nu.useEffectEvent=Dd;var Kd={readContext:St,use:Al,useCallback:Ld,useContext:St,useEffect:Io,useImperativeHandle:Bd,useInsertionEffect:zd,useLayoutEffect:qd,useMemo:Hd,useReducer:Jo,useRef:Md,useState:function(){return Jo(Kn)},useDebugValue:Ko,useDeferredValue:function(e,t){var i=ut();return Ve===null?Zo(i,e,t):Pd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Jo(Kn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Wr(e),t]},useSyncExternalStore:gd,useId:Vd,useHostTransitionStatus:eu,useFormState:kd,useActionState:kd,useOptimistic:function(e,t){var i=ut();return Ve!==null?wd(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Vo,useCacheRefresh:Fd};Kd.useEffectEvent=Dd;function su(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var iu={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=It(),o=As(l);o.payload=t,i!=null&&(o.callback=i),t=Os(e,o,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=It(),o=As(l);o.tag=1,o.payload=t,i!=null&&(o.callback=i),t=Os(e,o,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=It(),l=As(i);l.tag=2,t!=null&&(l.callback=t),t=Os(e,l,i),t!==null&&(Ht(t,e,i),Xr(t,e,i))}};function Zd(e,t,i,l,o,u,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,m):t.prototype&&t.prototype.isPureReactComponent?!Pr(i,l)||!Pr(o,u):!0}function Wd(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&iu.enqueueReplaceState(t,t.state,null)}function xi(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var o in e)i[o]===void 0&&(i[o]=e[o])}return i}function em(e){ll(e)}function tm(e){console.error(e)}function nm(e){ll(e)}function Cl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function sm(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function ru(e,t,i){return i=As(i),i.tag=3,i.payload={element:null},i.callback=function(){Cl(e,t)},i}function im(e){return e=As(e),e.tag=3,e}function rm(e,t,i,l){var o=i.type.getDerivedStateFromError;if(typeof o=="function"){var u=l.value;e.payload=function(){return o(u)},e.callback=function(){sm(t,i,l)}}var m=i.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){sm(t,i,l),typeof o!="function"&&(Ms===null?Ms=new Set([this]):Ms.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function ub(e,t,i,l,o){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Fi(t,i,o,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return dn===null?Yl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=o,l===yl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Cu(e,l,o)),!1;case 22:return i.flags|=65536,l===yl?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Cu(e,l,o)),!1}throw Error(a(435,i.tag))}return Cu(e,l,o),Yl(),!1}if(Re)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,l!==Eo&&(e=Error(a(422),{cause:l}),Gr(on(e,i)))):(l!==Eo&&(t=Error(a(423),{cause:l}),Gr(on(t,i))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,l=on(l,i),o=ru(e.stateNode,l,o),zo(e,o),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=on(u,i),oa===null?oa=[u]:oa.push(u),at!==4&&(at=2),t===null)return!0;l=on(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=o&-o,i.lanes|=e,e=ru(i.stateNode,l,e),zo(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ms===null||!Ms.has(u))))return i.flags|=65536,o&=-o,i.lanes|=o,o=im(o),rm(o,e,i,l),zo(i,o),!1}i=i.return}while(i!==null);return!1}var au=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?od(t,null,i,l):yi(t,e.child,i,l)}function am(e,t,i,l,o){i=i.render;var u=t.ref;if("ref"in l){var m={};for(var b in l)b!=="ref"&&(m[b]=l[b])}else m=l;return di(t),l=Po(e,t,i,m,u,o),b=Yo(),e!==null&&!mt?($o(e,t,o),Zn(e,t,o)):(Re&&b&&wo(t),t.flags|=1,Et(e,t,l,o),t.child)}function lm(e,t,i,l,o){if(e===null){var u=i.type;return typeof u=="function"&&!xo(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,cm(e,t,u,l,o)):(e=fl(i.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!mu(e,o)){var m=u.memoizedProps;if(i=i.compare,i=i!==null?i:Pr,i(m,l)&&e.ref===t.ref)return Zn(e,t,o)}return t.flags|=1,e=Fn(u,l),e.ref=t.ref,e.return=t,t.child=e}function cm(e,t,i,l,o){if(e!==null){var u=e.memoizedProps;if(Pr(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,mu(e,o))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,Zn(e,t,o)}return lu(e,t,i,l,o)}function om(e,t,i,l){var o=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,o=0;l!==null;)o=o|l.lanes|l.childLanes,l=l.sibling;l=o&~u}else l=0,t.child=null;return um(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pl(t,u!==null?u.cachePool:null),u!==null?hd(t,u):Uo(),dd(t);else return l=t.lanes=536870912,um(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(pl(t,u.cachePool),hd(t,u),Ts(),t.memoizedState=null):(e!==null&&pl(t,null),Uo(),Ts());return Et(e,t,o,i),t.child}function na(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function um(e,t,i,l,o){var u=ko();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&pl(t,null),Uo(),dd(t),e!==null&&Fi(e,t,l,!0),t.childLanes=o,null}function kl(e,t){return t=Rl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function fm(e,t,i){return yi(t,e.child,null,i),e=kl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function fb(e,t,i){var l=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(l.mode==="hidden")return e=kl(t,l),t.lanes=536870912,na(null,e);if(Lo(t),(e=Ze)?(e=Sp(e,hn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vs!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Qh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw ws(t);return t.lanes=536870912,null}return kl(t,l)}var u=e.memoizedState;if(u!==null){var m=u.dehydrated;if(Lo(t),o)if(t.flags&256)t.flags&=-257,t=fm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Fi(e,t,i,!1),o=(i&e.childLanes)!==0,mt||o){if(l=Xe,l!==null&&(m=bs(l,i),m!==0&&m!==u.retryLane))throw u.retryLane=m,oi(e,m),Ht(l,e,m),au;Yl(),t=fm(e,t,i)}else e=u.treeContext,Ze=mn(m.nextSibling),wt=t,Re=!0,_s=null,hn=!1,e!==null&&Kh(t,e),t=kl(t,l),t.flags|=4096;return t}return e=Fn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ml(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function lu(e,t,i,l,o){return di(t),i=Po(e,t,i,l,void 0,o),l=Yo(),e!==null&&!mt?($o(e,t,o),Zn(e,t,o)):(Re&&l&&wo(t),t.flags|=1,Et(e,t,i,o),t.child)}function hm(e,t,i,l,o,u){return di(t),t.updateQueue=null,i=pd(t,l,i,o),md(e),l=Yo(),e!==null&&!mt?($o(e,t,u),Zn(e,t,u)):(Re&&l&&wo(t),t.flags|=1,Et(e,t,i,u),t.child)}function dm(e,t,i,l,o){if(di(t),t.stateNode===null){var u=Yi,m=i.contextType;typeof m=="object"&&m!==null&&(u=St(m)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=iu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Ro(t),m=i.contextType,u.context=typeof m=="object"&&m!==null?St(m):Yi,u.state=t.memoizedState,m=i.getDerivedStateFromProps,typeof m=="function"&&(su(t,i,m,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(m=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),m!==u.state&&iu.enqueueReplaceState(u,u.state,null),Kr(t,l,u,o),Ir(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=xi(i,b);u.props=O;var U=u.context,$=i.contextType;m=Yi,typeof $=="object"&&$!==null&&(m=St($));var J=i.getDerivedStateFromProps;$=typeof J=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||U!==m)&&Wd(t,u,l,m),Es=!1;var B=t.memoizedState;u.state=B,Kr(t,l,u,o),Ir(),U=t.memoizedState,b||B!==U||Es?(typeof J=="function"&&(su(t,i,J,l),U=t.memoizedState),(O=Es||Zd(t,i,O,l,B,U,m))?($||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=U),u.props=l,u.state=U,u.context=m,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Do(e,t),m=t.memoizedProps,$=xi(i,m),u.props=$,J=t.pendingProps,B=u.context,U=i.contextType,O=Yi,typeof U=="object"&&U!==null&&(O=St(U)),b=i.getDerivedStateFromProps,(U=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==J||B!==O)&&Wd(t,u,l,O),Es=!1,B=t.memoizedState,u.state=B,Kr(t,l,u,o),Ir();var P=t.memoizedState;m!==J||B!==P||Es||e!==null&&e.dependencies!==null&&dl(e.dependencies)?(typeof b=="function"&&(su(t,i,b,l),P=t.memoizedState),($=Es||Zd(t,i,$,l,B,P,O)||e!==null&&e.dependencies!==null&&dl(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=$):(typeof u.componentDidUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Ml(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=yi(t,e.child,null,o),t.child=yi(t,null,i,o)):Et(e,t,i,o),t.memoizedState=u.state,e=t.child):e=Zn(e,t,o),e}function mm(e,t,i,l){return fi(),t.flags|=256,Et(e,t,i,l),t.child}var cu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ou(e){return{baseLanes:e,cachePool:sd()}}function uu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=Xt),e}function pm(e,t,i){var l=t.pendingProps,o=!1,u=(t.flags&128)!==0,m;if((m=u)||(m=e!==null&&e.memoizedState===null?!1:(ot.current&2)!==0),m&&(o=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(o?js(t):Ts(),(e=Ze)?(e=Sp(e,hn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vs!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Qh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw ws(t);return Fu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,o?(Ts(),o=t.mode,b=Rl({mode:"hidden",children:b},o),l=ui(l,o,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=ou(i),l.childLanes=uu(e,m,i),t.memoizedState=cu,na(null,l)):(js(t),fu(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(js(t),t.flags&=-257,t=hu(e,t,i)):t.memoizedState!==null?(Ts(),t.child=e.child,t.flags|=128,t=null):(Ts(),b=l.fallback,o=t.mode,l=Rl({mode:"visible",children:l.children},o),b=ui(b,o,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,yi(t,e.child,null,i),l=t.child,l.memoizedState=ou(i),l.childLanes=uu(e,m,i),t.memoizedState=cu,t=na(null,l));else if(js(t),Fu(b)){if(m=b.nextSibling&&b.nextSibling.dataset,m)var U=m.dgst;m=U,l=Error(a(419)),l.stack="",l.digest=m,Gr({value:l,source:null,stack:null}),t=hu(e,t,i)}else if(mt||Fi(e,t,i,!1),m=(i&e.childLanes)!==0,mt||m){if(m=Xe,m!==null&&(l=bs(m,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,oi(e,l),Ht(m,e,l),au;Vu(b)||Yl(),t=hu(e,t,i)}else Vu(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=mn(b.nextSibling),wt=t,Re=!0,_s=null,hn=!1,e!==null&&Kh(t,e),t=fu(t,l.children),t.flags|=4096);return t}return o?(Ts(),b=l.fallback,o=t.mode,O=e.child,U=O.sibling,l=Fn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,U!==null?b=Fn(U,b):(b=ui(b,o,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,na(null,l),l=t.child,b=e.child.memoizedState,b===null?b=ou(i):(o=b.cachePool,o!==null?(O=ht._currentValue,o=o.parent!==O?{parent:O,pool:O}:o):o=sd(),b={baseLanes:b.baseLanes|i,cachePool:o}),l.memoizedState=b,l.childLanes=uu(e,m,i),t.memoizedState=cu,na(e.child,l)):(js(t),i=e.child,e=i.sibling,i=Fn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=i,t.memoizedState=null,i)}function fu(e,t){return t=Rl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Rl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function hu(e,t,i){return yi(t,e.child,null,i),e=fu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function gm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),jo(e.return,t,i)}function du(e,t,i,l,o,u){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:o,treeForkCount:u}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=l,m.tail=i,m.tailMode=o,m.treeForkCount=u)}function ym(e,t,i){var l=t.pendingProps,o=l.revealOrder,u=l.tail;l=l.children;var m=ot.current,b=(m&2)!==0;if(b?(m=m&1|2,t.flags|=128):m&=1,Te(ot,m),Et(e,t,l,i),l=Re?$r:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gm(e,i,t);else if(e.tag===19)gm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"forwards":for(i=t.child,o=null;i!==null;)e=i.alternate,e!==null&&_l(e)===null&&(o=i),i=i.sibling;i=o,i===null?(o=t.child,t.child=null):(o=i.sibling,i.sibling=null),du(t,!1,o,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&_l(e)===null){t.child=o;break}e=o.sibling,o.sibling=i,i=o,o=e}du(t,!0,i,null,u,l);break;case"together":du(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Zn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),ks|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Fi(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Fn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Fn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function mu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&dl(e)))}function hb(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),Ss(t,ht,e.memoizedState.cache),fi();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:Ss(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lo(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(js(t),t.flags|=128,null):(i&t.child.childLanes)!==0?pm(e,t,i):(js(t),e=Zn(e,t,i),e!==null?e.sibling:null);js(t);break;case 19:var o=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Fi(e,t,i,!1),l=(i&t.childLanes)!==0),o){if(l)return ym(e,t,i);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Te(ot,ot.current),l)break;return null;case 22:return t.lanes=0,om(e,t,i,t.pendingProps);case 24:Ss(t,ht,e.memoizedState.cache)}return Zn(e,t,i)}function bm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!mu(e,i)&&(t.flags&128)===0)return mt=!1,hb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,Re&&(t.flags&1048576)!==0&&Ih(t,$r,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=pi(t.elementType),t.type=e,typeof e=="function")xo(e)?(l=xi(e,l),t.tag=1,t=dm(null,t,e,l,i)):(t.tag=0,t=lu(null,t,e,l,i));else{if(e!=null){var o=e.$$typeof;if(o===be){t.tag=11,t=am(null,t,e,l,i);break e}else if(o===ie){t.tag=14,t=lm(null,t,e,l,i);break e}}throw t=Ge(e)||e,Error(a(306,t,""))}}return t;case 0:return lu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,o=xi(l,t.pendingProps),dm(e,t,l,o,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;o=u.element,Do(e,t),Kr(t,l,null,i);var m=t.memoizedState;if(l=m.cache,Ss(t,ht,l),l!==u.cache&&To(t,[ht],i,!0),Ir(),l=m.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=mm(e,t,l,i);break e}else if(l!==o){o=on(Error(a(424)),t),Gr(o),t=mm(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=mn(e.firstChild),wt=t,Re=!0,_s=null,hn=!0,i=od(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(fi(),l===o){t=Zn(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return Ml(e,t),e===null?(i=Np(t.type,null,t.pendingProps,null))?t.memoizedState=i:Re||(i=t.type,e=t.pendingProps,l=Xl(sn.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),T(l),t.stateNode=l):t.memoizedState=Np(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Re&&(l=t.stateNode=Op(t.type,t.pendingProps,sn.current),wt=t,hn=!0,o=Ze,qs(t.type)?(Ju=o,Ze=mn(l.firstChild)):Ze=o),Et(e,t,t.pendingProps.children,i),Ml(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((o=l=Ze)&&(l=Yb(l,t.type,t.pendingProps,hn),l!==null?(t.stateNode=l,wt=t,Ze=mn(l.firstChild),hn=!1,o=!0):o=!1),o||ws(t)),Tt(t),o=t.type,u=t.pendingProps,m=e!==null?e.memoizedProps:null,l=u.children,Yu(o,u)?l=null:m!==null&&Yu(o,m)&&(t.flags|=32),t.memoizedState!==null&&(o=Po(e,t,sb,null,null,i),ya._currentValue=o),Ml(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&Re&&((e=i=Ze)&&(i=$b(i,t.pendingProps,hn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||ws(t)),null;case 13:return pm(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=yi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return am(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,Ss(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return o=t.type._context,l=t.pendingProps.children,di(t),o=St(o),l=l(o),t.flags|=1,Et(e,t,l,i),t.child;case 14:return lm(e,t,t.type,t.pendingProps,i);case 15:return cm(e,t,t.type,t.pendingProps,i);case 19:return ym(e,t,i);case 31:return fb(e,t,i);case 22:return om(e,t,i,t.pendingProps);case 24:return di(t),l=St(ht),e===null?(o=ko(),o===null&&(o=Xe,u=No(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=i),o=u),t.memoizedState={parent:l,cache:o},Ro(t),Ss(t,ht,o)):((e.lanes&i)!==0&&(Do(e,t),Kr(t,null,null,i),Ir()),o=e.memoizedState,u=t.memoizedState,o.parent!==l?(o={parent:l,cache:l},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),Ss(t,ht,l)):(l=u.cache,Ss(t,ht,l),l!==o.cache&&To(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Wn(e){e.flags|=4}function pu(e,t,i,l,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(Vm())e.flags|=8192;else throw gi=yl,Mo}else e.flags&=-16777217}function xm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Dp(t))if(Vm())e.flags|=8192;else throw gi=yl,Mo}function Dl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Mi():536870912,e.lanes|=t,ir|=t)}function sa(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var o=e.child;o!==null;)i|=o.lanes|o.childLanes,l|=o.subtreeFlags&65011712,l|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)i|=o.lanes|o.childLanes,l|=o.subtreeFlags,l|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function db(e,t,i){var l=t.pendingProps;switch(So(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Xn(ht),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?Wn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ao())),We(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(Wn(t),u!==null?(We(t),xm(t,u)):(We(t),pu(t,o,null,l,i))):u?u!==e.memoizedState?(Wn(t),We(t),xm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Wn(t),We(t),pu(t,o,e,l,i)),null;case 27:if(Zs(t),i=sn.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Vi(t)?Zh(t):(e=Op(o,l,i),t.stateNode=e,Wn(t))}return We(t),null;case 5:if(Zs(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Vi(t))Zh(t);else{var m=Xl(sn.current);switch(u){case 1:u=m.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:u=m.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":u=m.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":u=m.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":u=m.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?m.createElement("select",{is:l.is}):m.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?m.createElement(o,{is:l.is}):m.createElement(o)}}u[Qe]=t,u[it]=l;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)u.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=u;e:switch(At(u,o,l),o){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Wn(t)}}return We(t),pu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=sn.current,Vi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,o=wt,o!==null)switch(o.tag){case 27:case 5:l=o.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||pp(e.nodeValue,i)),e||ws(t,!0)}else e=Xl(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Vi(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Vi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!o)throw Error(a(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));o[Qe]=t}else fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),o=!1}else o=Ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,o=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(o=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==o&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Dl(t,t.updateQueue),We(t),null);case 4:return we(),e===null&&Uu(t.stateNode.containerInfo),We(t),null;case 10:return Xn(t.type),We(t),null;case 19:if(_e(ot),l=t.memoizedState,l===null)return We(t),null;if(o=(t.flags&128)!==0,u=l.rendering,u===null)if(o)sa(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=_l(e),u!==null){for(t.flags|=128,sa(l,!1),e=u.updateQueue,t.updateQueue=e,Dl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Jh(i,e),i=i.sibling;return Te(ot,ot.current&1|2),Re&&Jn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Ll&&(t.flags|=128,o=!0,sa(l,!1),t.lanes=4194304)}else{if(!o)if(e=_l(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Dl(t,e),sa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Re)return We(t),null}else 2*et()-l.renderingStartTime>Ll&&i!==536870912&&(t.flags|=128,o=!0,sa(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ot.current,Te(ot,o?i&1|2:i&1),Re&&Jn(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Bo(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Dl(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&_e(mi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Xn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function mb(e,t){switch(So(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xn(ht),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Zs(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(ot),null;case 4:return we(),null;case 10:return Xn(t.type),null;case 22:case 23:return Jt(t),Bo(),e!==null&&_e(mi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xn(ht),null;case 25:return null;default:return null}}function vm(e,t){switch(So(t),t.tag){case 3:Xn(ht),we();break;case 26:case 27:case 5:Zs(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:_e(ot);break;case 10:Xn(t.type);break;case 22:case 23:Jt(t),Bo(),e!==null&&_e(mi);break;case 24:Xn(ht)}}function ia(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var o=l.next;i=o;do{if((i.tag&e)===e){l=void 0;var u=i.create,m=i.inst;l=u(),m.destroy=l}i=i.next}while(i!==o)}}catch(b){Ye(t,t.return,b)}}function Ns(e,t,i){try{var l=t.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var u=o.next;l=u;do{if((l.tag&e)===e){var m=l.inst,b=m.destroy;if(b!==void 0){m.destroy=void 0,o=t;var O=i,U=b;try{U()}catch($){Ye(o,O,$)}}}l=l.next}while(l!==u)}}catch($){Ye(t,t.return,$)}}function _m(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{fd(t,i)}catch(l){Ye(e,e.return,l)}}}function wm(e,t,i){i.props=xi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ye(e,t,l)}}function ra(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(o){Ye(e,t,o)}}function Rn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(o){Ye(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(o){Ye(e,t,o)}else i.current=null}function Sm(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(o){Ye(e,e.return,o)}}function gu(e,t,i){try{var l=e.stateNode;qb(l,e.type,i,t),l[it]=t}catch(o){Ye(e,e.return,o)}}function Em(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qs(e.type)||e.tag===4}function yu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Em(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&qs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Gn));else if(l!==4&&(l===27&&qs(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(bu(e,t,i),e=e.sibling;e!==null;)bu(e,t,i),e=e.sibling}function zl(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&qs(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(zl(e,t,i),e=e.sibling;e!==null;)zl(e,t,i),e=e.sibling}function Am(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){Ye(e,e.return,u)}}var es=!1,pt=!1,xu=!1,Om=typeof WeakSet=="function"?WeakSet:Set,xt=null;function pb(e,t){if(e=e.containerInfo,Hu=nc,e=Bh(e),fo(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var o=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var m=0,b=-1,O=-1,U=0,$=0,J=e,B=null;t:for(;;){for(var P;J!==i||o!==0&&J.nodeType!==3||(b=m+o),J!==u||l!==0&&J.nodeType!==3||(O=m+l),J.nodeType===3&&(m+=J.nodeValue.length),(P=J.firstChild)!==null;)B=J,J=P;for(;;){if(J===e)break t;if(B===i&&++U===o&&(b=m),B===u&&++$===l&&(O=m),(P=J.nextSibling)!==null)break;J=B,B=J.parentNode}J=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Pu={focusedElem:e,selectionRange:i},nc=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)o=e[i],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,o=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var fe=xi(i.type,o);e=l.getSnapshotBeforeUpdate(fe,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ge){Ye(i,i.return,ge)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Gu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Gu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function jm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:ns(e,i),l&4&&ia(5,i);break;case 1:if(ns(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(m){Ye(i,i.return,m)}else{var o=xi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){Ye(i,i.return,m)}}l&64&&_m(i),l&512&&ra(i,i.return);break;case 3:if(ns(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{fd(e,t)}catch(m){Ye(i,i.return,m)}}break;case 27:t===null&&l&4&&Am(i);case 26:case 5:ns(e,i),t===null&&l&4&&Sm(i),l&512&&ra(i,i.return);break;case 12:ns(e,i);break;case 31:ns(e,i),l&4&&Cm(e,i);break;case 13:ns(e,i),l&4&&km(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Eb.bind(null,i),Gb(e,i))));break;case 22:if(l=i.memoizedState!==null||es,!l){t=t!==null&&t.memoizedState!==null||pt,o=es;var u=pt;es=l,(pt=t)&&!u?ss(e,i,(i.subtreeFlags&8772)!==0):ns(e,i),es=o,pt=u}break;case 30:break;default:ns(e,i)}}function Tm(e){var t=e.alternate;t!==null&&(e.alternate=null,Tm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ri(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function ts(e,t,i){for(i=i.child;i!==null;)Nm(e,t,i),i=i.sibling}function Nm(e,t,i){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(ei,i)}catch{}switch(i.tag){case 26:pt||Rn(i,t),ts(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Rn(i,t);var l=tt,o=qt;qs(i.type)&&(tt=i.stateNode,qt=!1),ts(e,t,i),ma(i.stateNode),tt=l,qt=o;break;case 5:pt||Rn(i,t);case 6:if(l=tt,o=qt,tt=null,ts(e,t,i),tt=l,qt=o,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){Ye(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){Ye(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,_p(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),hr(e)):_p(tt,i.stateNode));break;case 4:l=tt,o=qt,tt=i.stateNode.containerInfo,qt=!0,ts(e,t,i),tt=l,qt=o;break;case 0:case 11:case 14:case 15:Ns(2,i,t),pt||Ns(4,i,t),ts(e,t,i);break;case 1:pt||(Rn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&wm(i,t,l)),ts(e,t,i);break;case 21:ts(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ts(e,t,i),pt=l;break;default:ts(e,t,i)}}function Cm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hr(e)}catch(i){Ye(t,t.return,i)}}}function km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hr(e)}catch(i){Ye(t,t.return,i)}}function gb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Om),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Om),t;default:throw Error(a(435,e.tag))}}function ql(e,t){var i=gb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var o=Ab.bind(null,e,l);l.then(o,o)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var o=i[l],u=e,m=t,b=m;e:for(;b!==null;){switch(b.tag){case 27:if(qs(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Nm(u,m,o),tt=null,qt=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mm(t,e),t=t.sibling}var Sn=null;function Mm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(Ns(3,e,e.return),ia(3,e),Ns(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&64&&es&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var o=Sn;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,o=o.ownerDocument||o;t:switch(l){case"title":u=o.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(l),o.head.insertBefore(u,o.querySelector("head > title"))),At(u,l,i),u[Qe]=e,T(u),l=u;break e;case"link":var m=Mp("link","href",o).get(l+(i.href||""));if(m){for(var b=0;b<m.length;b++)if(u=m[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){m.splice(b,1);break t}}u=o.createElement(l),At(u,l,i),o.head.appendChild(u);break;case"meta":if(m=Mp("meta","content",o).get(l+(i.content||""))){for(b=0;b<m.length;b++)if(u=m[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){m.splice(b,1);break t}}u=o.createElement(l),At(u,l,i),o.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,T(u),l=u}e.stateNode=l}else Rp(o,e.type,e.stateNode);else e.stateNode=kp(o,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Rp(o,e.type,e.stateNode):kp(o,l,e.memoizedProps)):l===null&&e.stateNode!==null&&gu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),i!==null&&l&4&&gu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),e.flags&32){o=e.stateNode;try{zi(o,"")}catch(fe){Ye(e,e.return,fe)}}l&4&&e.stateNode!=null&&(o=e.memoizedProps,gu(e,o,i!==null?i.memoizedProps:o)),l&1024&&(xu=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(fe){Ye(e,e.return,fe)}}break;case 3:if(Zl=null,o=Sn,Sn=Il(t.containerInfo),Ut(t,e),Sn=o,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{hr(t.containerInfo)}catch(fe){Ye(e,e.return,fe)}xu&&(xu=!1,Rm(e));break;case 4:l=Sn,Sn=Il(e.stateNode.containerInfo),Ut(t,e),Bt(e),Sn=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Bl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 22:o=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,U=es,$=pt;if(es=U||o,pt=$||O,Ut(t,e),pt=$,es=U,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(i===null||O||es||pt||vi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,o)m=u.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{b=O.stateNode;var J=O.memoizedProps.style,B=J!=null&&J.hasOwnProperty("display")?J.display:null;b.style.display=B==null||typeof B=="boolean"?"":(""+B).trim()}}catch(fe){Ye(O,O.return,fe)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=o?"":O.memoizedProps}catch(fe){Ye(O,O.return,fe)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;o?wp(P,!0):wp(O.stateNode,!1)}catch(fe){Ye(O,O.return,fe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,ql(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(Em(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var o=i.stateNode,u=yu(e);zl(e,u,o);break;case 5:var m=i.stateNode;i.flags&32&&(zi(m,""),i.flags&=-33);var b=yu(e);zl(e,b,m);break;case 3:case 4:var O=i.stateNode.containerInfo,U=yu(e);bu(e,U,O);break;default:throw Error(a(161))}}catch($){Ye(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Rm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ns(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)jm(e,t.alternate,t),t=t.sibling}function vi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ns(4,t,t.return),vi(t);break;case 1:Rn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&wm(t,t.return,i),vi(t);break;case 27:ma(t.stateNode);case 26:case 5:Rn(t,t.return),vi(t);break;case 22:t.memoizedState===null&&vi(t);break;case 30:vi(t);break;default:vi(t)}e=e.sibling}}function ss(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,o=e,u=t,m=u.flags;switch(u.tag){case 0:case 11:case 15:ss(o,u,i),ia(4,u);break;case 1:if(ss(o,u,i),l=u,o=l.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(U){Ye(l,l.return,U)}if(l=u,o=l.updateQueue,o!==null){var b=l.stateNode;try{var O=o.shared.hiddenCallbacks;if(O!==null)for(o.shared.hiddenCallbacks=null,o=0;o<O.length;o++)ud(O[o],b)}catch(U){Ye(l,l.return,U)}}i&&m&64&&_m(u),ra(u,u.return);break;case 27:Am(u);case 26:case 5:ss(o,u,i),i&&l===null&&m&4&&Sm(u),ra(u,u.return);break;case 12:ss(o,u,i);break;case 31:ss(o,u,i),i&&m&4&&Cm(o,u);break;case 13:ss(o,u,i),i&&m&4&&km(o,u);break;case 22:u.memoizedState===null&&ss(o,u,i),ra(u,u.return);break;case 30:break;default:ss(o,u,i)}t=t.sibling}}function vu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Vr(i))}function _u(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vr(e))}function En(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dm(e,t,i,l),t=t.sibling}function Dm(e,t,i,l){var o=t.flags;switch(t.tag){case 0:case 11:case 15:En(e,t,i,l),o&2048&&ia(9,t);break;case 1:En(e,t,i,l);break;case 3:En(e,t,i,l),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vr(e)));break;case 12:if(o&2048){En(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,m=u.id,b=u.onPostCommit;typeof b=="function"&&b(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Ye(t,t.return,O)}}else En(e,t,i,l);break;case 31:En(e,t,i,l);break;case 13:En(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,m=t.alternate,t.memoizedState!==null?u._visibility&2?En(e,t,i,l):aa(e,t):u._visibility&2?En(e,t,i,l):(u._visibility|=2,tr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),o&2048&&vu(m,t);break;case 24:En(e,t,i,l),o&2048&&_u(t.alternate,t);break;default:En(e,t,i,l)}}function tr(e,t,i,l,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,m=t,b=i,O=l,U=m.flags;switch(m.tag){case 0:case 11:case 15:tr(u,m,b,O,o),ia(8,m);break;case 23:break;case 22:var $=m.stateNode;m.memoizedState!==null?$._visibility&2?tr(u,m,b,O,o):aa(u,m):($._visibility|=2,tr(u,m,b,O,o)),o&&U&2048&&vu(m.alternate,m);break;case 24:tr(u,m,b,O,o),o&&U&2048&&_u(m.alternate,m);break;default:tr(u,m,b,O,o)}t=t.sibling}}function aa(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,o=l.flags;switch(l.tag){case 22:aa(i,l),o&2048&&vu(l.alternate,l);break;case 24:aa(i,l),o&2048&&_u(l.alternate,l);break;default:aa(i,l)}t=t.sibling}}var la=8192;function nr(e,t,i){if(e.subtreeFlags&la)for(e=e.child;e!==null;)zm(e,t,i),e=e.sibling}function zm(e,t,i){switch(e.tag){case 26:nr(e,t,i),e.flags&la&&e.memoizedState!==null&&nx(i,Sn,e.memoizedState,e.memoizedProps);break;case 5:nr(e,t,i);break;case 3:case 4:var l=Sn;Sn=Il(e.stateNode.containerInfo),nr(e,t,i),Sn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=la,la=16777216,nr(e,t,i),la=l):nr(e,t,i));break;default:nr(e,t,i)}}function qm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ca(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Bm(l,e)}qm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Um(e),e=e.sibling}function Um(e){switch(e.tag){case 0:case 11:case 15:ca(e),e.flags&2048&&Ns(9,e,e.return);break;case 3:ca(e);break;case 12:ca(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ul(e)):ca(e);break;default:ca(e)}}function Ul(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Bm(l,e)}qm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ns(8,t,t.return),Ul(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Ul(t));break;default:Ul(t)}e=e.sibling}}function Bm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:Ns(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Vr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var o=l.sibling,u=l.return;if(Tm(l),l===i){xt=null;break e}if(o!==null){o.return=u,xt=o;break e}xt=u}}}var yb={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},bb=typeof WeakMap=="function"?WeakMap:Map,He=0,Xe=null,Ne=null,ke=0,Pe=0,Qt=null,Cs=!1,sr=!1,wu=!1,is=0,at=0,ks=0,_i=0,Su=0,Xt=0,ir=0,oa=null,Lt=null,Eu=!1,Bl=0,Lm=0,Ll=1/0,Hl=null,Ms=null,bt=0,Rs=null,rr=null,rs=0,Au=0,Ou=null,Hm=null,ua=0,ju=null;function It(){return(He&2)!==0&&ke!==0?ke&-ke:Y.T!==null?Ru():Mr()}function Pm(){if(Xt===0)if((ke&536870912)===0||Re){var e=Pn;Pn<<=1,(Pn&3932160)===0&&(Pn=262144),Xt=e}else Xt=536870912;return e=Ft.current,e!==null&&(e.flags|=32),Xt}function Ht(e,t,i){(e===Xe&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(ar(e,0),Ds(e,ke,Xt,!1)),vn(e,i),((He&2)===0||e!==Xe)&&(e===Xe&&((He&2)===0&&(_i|=i),at===4&&Ds(e,ke,Xt,!1)),Dn(e))}function Ym(e,t,i){if((He&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ni(e,t),o=l?_b(e,t):Nu(e,t,!0),u=l;do{if(o===0){sr&&!l&&Ds(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!xb(i)){o=Nu(e,t,!1),u=!1;continue}if(o===2){if(u=t,e.errorRecoveryDisabledLanes&u)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var b=e;o=oa;var O=b.current.memoizedState.isDehydrated;if(O&&(ar(b,m).flags|=256),m=Nu(b,m,!1),m!==2){if(wu&&!O){b.errorRecoveryDisabledLanes|=u,_i|=u,o=4;break e}u=Lt,Lt=o,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}o=m}if(u=!1,o!==2)continue}}if(o===1){ar(e,0),Ds(e,t,0,!0);break}e:{switch(l=e,u=o,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:Ds(l,t,Xt,!Cs);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(o=Bl+300-et(),10<o)){if(Ds(l,t,Xt,!Cs),ti(l,0,!0)!==0)break e;rs=t,l.timeoutHandle=xp($m.bind(null,l,i,Lt,Hl,Eu,t,Xt,_i,ir,Cs,u,"Throttled",-0,0),o);break e}$m(l,i,Lt,Hl,Eu,t,Xt,_i,ir,Cs,u,null,-0,0)}}break}while(!0);Dn(e)}function $m(e,t,i,l,o,u,m,b,O,U,$,J,B,P){if(e.timeoutHandle=-1,J=t.subtreeFlags,J&8192||(J&16785408)===16785408){J={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gn},zm(t,u,J);var fe=(u&62914560)===u?Bl-et():(u&4194048)===u?Lm-et():0;if(fe=sx(J,fe),fe!==null){rs=u,e.cancelPendingCommit=fe(Km.bind(null,e,t,u,i,l,o,m,b,O,$,J,null,B,P)),Ds(e,u,m,!U);return}}Km(e,t,u,i,l,o,m,b,O)}function xb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var o=i[l],u=o.getSnapshot;o=o.value;try{if(!Gt(u(),o))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ds(e,t,i,l){t&=~Su,t&=~_i,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var o=t;0<o;){var u=31-Nt(o),m=1<<u;l[u]=-1,o&=~m}i!==0&&ys(e,i,t)}function Pl(){return(He&6)===0?(fa(0),!1):!0}function Tu(){if(Ne!==null){if(Pe===0)var e=Ne.return;else e=Ne,Qn=hi=null,Go(e),Ii=null,Jr=0,e=Ne;for(;e!==null;)vm(e.alternate,e),e=e.return;Ne=null}}function ar(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Lb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),rs=0,Tu(),Xe=e,Ne=i=Fn(e.current,null),ke=t,Pe=0,Qt=null,Cs=!1,sr=ni(e,t),wu=!1,ir=Xt=Su=_i=ks=at=0,Lt=oa=null,Eu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var o=31-Nt(l),u=1<<o;t|=e[o],l&=~u}return is=t,cl(),i}function Gm(e,t){Se=null,Y.H=ta,t===Xi||t===gl?(t=ad(),Pe=3):t===Mo?(t=ad(),Pe=4):Pe=t===au?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Cl(e,on(t,e.current)))}function Vm(){var e=Ft.current;return e===null?!0:(ke&4194048)===ke?dn===null:(ke&62914560)===ke||(ke&536870912)!==0?e===dn:!1}function Fm(){var e=Y.H;return Y.H=ta,e===null?ta:e}function Jm(){var e=Y.A;return Y.A=yb,e}function Yl(){at=4,Cs||(ke&4194048)!==ke&&Ft.current!==null||(sr=!0),(ks&134217727)===0&&(_i&134217727)===0||Xe===null||Ds(Xe,ke,Xt,!1)}function Nu(e,t,i){var l=He;He|=2;var o=Fm(),u=Jm();(Xe!==e||ke!==t)&&(Hl=null,ar(e,t)),t=!1;var m=at;e:do try{if(Pe!==0&&Ne!==null){var b=Ne,O=Qt;switch(Pe){case 8:Tu(),m=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var U=Pe;if(Pe=0,Qt=null,lr(e,b,O,U),i&&sr){m=0;break e}break;default:U=Pe,Pe=0,Qt=null,lr(e,b,O,U)}}vb(),m=at;break}catch($){Gm(e,$)}while(!0);return t&&e.shellSuspendCounter++,Qn=hi=null,He=l,Y.H=o,Y.A=u,Ne===null&&(Xe=null,ke=0,cl()),m}function vb(){for(;Ne!==null;)Qm(Ne)}function _b(e,t){var i=He;He|=2;var l=Fm(),o=Jm();Xe!==e||ke!==t?(Hl=null,Ll=et()+500,ar(e,t)):sr=ni(e,t);e:do try{if(Pe!==0&&Ne!==null){t=Ne;var u=Qt;t:switch(Pe){case 1:Pe=0,Qt=null,lr(e,t,u,1);break;case 2:case 9:if(id(u)){Pe=0,Qt=null,Xm(t);break}t=function(){Pe!==2&&Pe!==9||Xe!==e||(Pe=7),Dn(e)},u.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:id(u)?(Pe=0,Qt=null,Xm(t)):(Pe=0,Qt=null,lr(e,t,u,7));break;case 5:var m=null;switch(Ne.tag){case 26:m=Ne.memoizedState;case 5:case 27:var b=Ne;if(m?Dp(m):b.stateNode.complete){Pe=0,Qt=null;var O=b.sibling;if(O!==null)Ne=O;else{var U=b.return;U!==null?(Ne=U,$l(U)):Ne=null}break t}}Pe=0,Qt=null,lr(e,t,u,5);break;case 6:Pe=0,Qt=null,lr(e,t,u,6);break;case 8:Tu(),at=6;break e;default:throw Error(a(462))}}wb();break}catch($){Gm(e,$)}while(!0);return Qn=hi=null,Y.H=l,Y.A=o,He=i,Ne!==null?0:(Xe=null,ke=0,cl(),at)}function wb(){for(;Ne!==null&&!Va();)Qm(Ne)}function Qm(e){var t=bm(e.alternate,e,is);e.memoizedProps=e.pendingProps,t===null?$l(e):Ne=t}function Xm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=hm(i,t,t.pendingProps,t.type,void 0,ke);break;case 11:t=hm(i,t,t.pendingProps,t.type.render,t.ref,ke);break;case 5:Go(t);default:vm(i,t),t=Ne=Jh(t,is),t=bm(i,t,is)}e.memoizedProps=e.pendingProps,t===null?$l(e):Ne=t}function lr(e,t,i,l){Qn=hi=null,Go(t),Ii=null,Jr=0;var o=t.return;try{if(ub(e,o,t,i,ke)){at=1,Cl(e,on(i,e.current)),Ne=null;return}}catch(u){if(o!==null)throw Ne=o,u;at=1,Cl(e,on(i,e.current)),Ne=null;return}t.flags&32768?(Re||l===1?e=!0:sr||(ke&536870912)!==0?e=!1:(Cs=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),Im(t,e)):$l(t)}function $l(e){var t=e;do{if((t.flags&32768)!==0){Im(t,Cs);return}e=t.return;var i=db(t.alternate,t,is);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function Im(e,t){do{var i=mb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function Km(e,t,i,l,o,u,m,b,O){e.cancelPendingCommit=null;do Gl();while(bt!==0);if((He&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=yo,gs(e,i,u,m,b,O),e===Xe&&(Ne=Xe=null,ke=0),rr=t,Rs=e,rs=i,Au=u,Ou=o,Hm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Ob(Ci,function(){return np(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=Y.T,Y.T=null,o=te.p,te.p=2,m=He,He|=4;try{pb(e,t,i)}finally{He=m,te.p=o,Y.T=l}}bt=1,Zm(),Wm(),ep()}}function Zm(){if(bt===1){bt=0;var e=Rs,t=rr,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=Y.T,Y.T=null;var l=te.p;te.p=2;var o=He;He|=4;try{Mm(t,e);var u=Pu,m=Bh(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(m!==b&&b&&b.ownerDocument&&Uh(b.ownerDocument.documentElement,b)){if(O!==null&&fo(b)){var U=O.start,$=O.end;if($===void 0&&($=U),"selectionStart"in b)b.selectionStart=U,b.selectionEnd=Math.min($,b.value.length);else{var J=b.ownerDocument||document,B=J&&J.defaultView||window;if(B.getSelection){var P=B.getSelection(),fe=b.textContent.length,ge=Math.min(O.start,fe),Je=O.end===void 0?ge:Math.min(O.end,fe);!P.extend&&ge>Je&&(m=Je,Je=ge,ge=m);var M=qh(b,ge),N=qh(b,Je);if(M&&N&&(P.rangeCount!==1||P.anchorNode!==M.node||P.anchorOffset!==M.offset||P.focusNode!==N.node||P.focusOffset!==N.offset)){var q=J.createRange();q.setStart(M.node,M.offset),P.removeAllRanges(),ge>Je?(P.addRange(q),P.extend(N.node,N.offset)):(q.setEnd(N.node,N.offset),P.addRange(q))}}}}for(J=[],P=b;P=P.parentNode;)P.nodeType===1&&J.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<J.length;b++){var G=J[b];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}nc=!!Hu,Pu=Hu=null}finally{He=o,te.p=l,Y.T=i}}e.current=t,bt=2}}function Wm(){if(bt===2){bt=0;var e=Rs,t=rr,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=Y.T,Y.T=null;var l=te.p;te.p=2;var o=He;He|=4;try{jm(e,t.alternate,t)}finally{He=o,te.p=l,Y.T=i}}bt=3}}function ep(){if(bt===4||bt===3){bt=0,Ni();var e=Rs,t=rr,i=rs,l=Hm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,rr=Rs=null,tp(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Ms=null),ii(i),t=t.stateNode,ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(ei,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=Y.T,o=te.p,te.p=2,Y.T=null;try{for(var u=e.onRecoverableError,m=0;m<l.length;m++){var b=l[m];u(b.value,{componentStack:b.stack})}}finally{Y.T=t,te.p=o}}(rs&3)!==0&&Gl(),Dn(e),o=e.pendingLanes,(i&261930)!==0&&(o&42)!==0?e===ju?ua++:(ua=0,ju=e):ua=0,fa(0)}}function tp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vr(t)))}function Gl(){return Zm(),Wm(),ep(),np()}function np(){if(bt!==5)return!1;var e=Rs,t=Au;Au=0;var i=ii(rs),l=Y.T,o=te.p;try{te.p=32>i?32:i,Y.T=null,i=Ou,Ou=null;var u=Rs,m=rs;if(bt=0,rr=Rs=null,rs=0,(He&6)!==0)throw Error(a(331));var b=He;if(He|=4,Um(u.current),Dm(u,u.current,m,i),He=b,fa(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(ei,u)}catch{}return!0}finally{te.p=o,Y.T=l,tp(e,t)}}function sp(e,t,i){t=on(i,t),t=ru(e.stateNode,t,2),e=Os(e,t,2),e!==null&&(vn(e,2),Dn(e))}function Ye(e,t,i){if(e.tag===3)sp(e,e,i);else for(;t!==null;){if(t.tag===3){sp(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ms===null||!Ms.has(l))){e=on(i,e),i=im(2),l=Os(t,i,2),l!==null&&(rm(i,l,t,e),vn(l,2),Dn(l));break}}t=t.return}}function Cu(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new bb;var o=new Set;l.set(t,o)}else o=l.get(t),o===void 0&&(o=new Set,l.set(t,o));o.has(i)||(wu=!0,o.add(i),e=Sb.bind(null,e,t,i),t.then(e,e))}function Sb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Xe===e&&(ke&i)===i&&(at===4||at===3&&(ke&62914560)===ke&&300>et()-Bl?(He&2)===0&&ar(e,0):Su|=i,ir===ke&&(ir=0)),Dn(e)}function ip(e,t){t===0&&(t=Mi()),e=oi(e,t),e!==null&&(vn(e,t),Dn(e))}function Eb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),ip(e,i)}function Ab(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,o=e.memoizedState;o!==null&&(i=o.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),ip(e,i)}function Ob(e,t){return Tr(e,t)}var Vl=null,cr=null,ku=!1,Fl=!1,Mu=!1,zs=0;function Dn(e){e!==cr&&e.next===null&&(cr===null?Vl=cr=e:cr=cr.next=e),Fl=!0,ku||(ku=!0,Tb())}function fa(e,t){if(!Mu&&Fl){Mu=!0;do for(var i=!1,l=Vl;l!==null;){if(e!==0){var o=l.pendingLanes;if(o===0)var u=0;else{var m=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=o&~(m&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,cp(l,u))}else u=ke,u=ti(l,l===Xe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ni(l,u)||(i=!0,cp(l,u));l=l.next}while(i);Mu=!1}}function jb(){rp()}function rp(){Fl=ku=!1;var e=0;zs!==0&&Bb()&&(e=zs);for(var t=et(),i=null,l=Vl;l!==null;){var o=l.next,u=ap(l,t);u===0?(l.next=null,i===null?Vl=o:i.next=o,o===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Fl=!0)),l=o}bt!==0&&bt!==5||fa(e),zs!==0&&(zs=0)}function ap(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var m=31-Nt(u),b=1<<m,O=o[m];O===-1?((b&i)===0||(b&l)!==0)&&(o[m]=kr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Xe,i=ke,i=ti(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Hn(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ni(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&Hn(l),ii(i)){case 2:case 8:i=Ja;break;case 32:i=Ci;break;case 268435456:i=Qa;break;default:i=Ci}return l=lp.bind(null,e),i=Tr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&Hn(l),e.callbackPriority=2,e.callbackNode=null,2}function lp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Gl()&&e.callbackNode!==i)return null;var l=ke;return l=ti(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Ym(e,l,t),ap(e,et()),e.callbackNode!=null&&e.callbackNode===i?lp.bind(null,e):null)}function cp(e,t){if(Gl())return null;Ym(e,t,!0)}function Tb(){Hb(function(){(He&6)!==0?Tr(Fa,jb):rp()})}function Ru(){if(zs===0){var e=Ji;e===0&&(e=ds,ds<<=1,(ds&261888)===0&&(ds=256)),zs=e}return zs}function op(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:el(""+e)}function up(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Nb(e,t,i,l,o){if(t==="submit"&&i&&i.stateNode===o){var u=op((o[it]||null).action),m=l.submitter;m&&(t=(t=m[it]||null)?op(t.formAction):m.getAttribute("formAction"),t!==null&&(u=t,m=null));var b=new il("action","action",null,l,o);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(zs!==0){var O=m?up(o,m):new FormData(o);Wo(i,{pending:!0,data:O,method:o.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=m?up(o,m):new FormData(o),Wo(i,{pending:!0,data:O,method:o.method,action:u},u,O))},currentTarget:o}]})}}for(var Du=0;Du<go.length;Du++){var zu=go[Du],Cb=zu.toLowerCase(),kb=zu[0].toUpperCase()+zu.slice(1);wn(Cb,"on"+kb)}wn(Ph,"onAnimationEnd"),wn(Yh,"onAnimationIteration"),wn($h,"onAnimationStart"),wn("dblclick","onDoubleClick"),wn("focusin","onFocus"),wn("focusout","onBlur"),wn(Jy,"onTransitionRun"),wn(Qy,"onTransitionStart"),wn(Xy,"onTransitionCancel"),wn(Gh,"onTransitionEnd"),L("onMouseEnter",["mouseout","mouseover"]),L("onMouseLeave",["mouseout","mouseover"]),L("onPointerEnter",["pointerout","pointerover"]),L("onPointerLeave",["pointerout","pointerover"]),X("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),X("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),X("onBeforeInput",["compositionend","keypress","textInput","paste"]),X("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ha="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Mb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ha));function fp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],o=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var m=l.length-1;0<=m;m--){var b=l[m],O=b.instance,U=b.currentTarget;if(b=b.listener,O!==u&&o.isPropagationStopped())break e;u=b,o.currentTarget=U;try{u(o)}catch($){ll($)}o.currentTarget=null,u=O}else for(m=0;m<l.length;m++){if(b=l[m],O=b.instance,U=b.currentTarget,b=b.listener,O!==u&&o.isPropagationStopped())break e;u=b,o.currentTarget=U;try{u(o)}catch($){ll($)}o.currentTarget=null,u=O}}}}function Ce(e,t){var i=t[ri];i===void 0&&(i=t[ri]=new Set);var l=e+"__bubble";i.has(l)||(hp(t,e,2,!1),i.add(l))}function qu(e,t,i){var l=0;t&&(l|=4),hp(i,e,l,t)}var Jl="_reactListening"+Math.random().toString(36).slice(2);function Uu(e){if(!e[Jl]){e[Jl]=!0,D.forEach(function(i){i!=="selectionchange"&&(Mb.has(i)||qu(i,!1,e),qu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Jl]||(t[Jl]=!0,qu("selectionchange",!1,t))}}function hp(e,t,i,l){switch(Pp(t)){case 2:var o=ax;break;case 8:o=lx;break;default:o=Zu}i=o.bind(null,t,i,e),o=void 0,!no||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),l?o!==void 0?e.addEventListener(t,i,{capture:!0,passive:o}):e.addEventListener(t,i,!0):o!==void 0?e.addEventListener(t,i,{passive:o}):e.addEventListener(t,i,!1)}function Bu(e,t,i,l,o){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var m=l.tag;if(m===3||m===4){var b=l.stateNode.containerInfo;if(b===o)break;if(m===4)for(m=l.return;m!==null;){var O=m.tag;if((O===3||O===4)&&m.stateNode.containerInfo===o)return;m=m.return}for(;b!==null;){if(m=x(b),m===null)return;if(O=m.tag,O===5||O===6||O===26||O===27){l=u=m;continue e}b=b.parentNode}}l=l.return}yh(function(){var U=u,$=eo(i),J=[];e:{var B=Vh.get(e);if(B!==void 0){var P=il,fe=e;switch(e){case"keypress":if(nl(i)===0)break e;case"keydown":case"keyup":P=Ay;break;case"focusin":fe="focus",P=ao;break;case"focusout":fe="blur",P=ao;break;case"beforeblur":case"afterblur":P=ao;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=vh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=dy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=Ty;break;case Ph:case Yh:case $h:P=gy;break;case Gh:P=Cy;break;case"scroll":case"scrollend":P=fy;break;case"wheel":P=My;break;case"copy":case"cut":case"paste":P=by;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=wh;break;case"toggle":case"beforetoggle":P=Dy}var ge=(t&4)!==0,Je=!ge&&(e==="scroll"||e==="scrollend"),M=ge?B!==null?B+"Capture":null:B;ge=[];for(var N=U,q;N!==null;){var G=N;if(q=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||q===null||M===null||(G=Dr(N,M),G!=null&&ge.push(da(N,G,q))),Je)break;N=N.return}0<ge.length&&(B=new P(B,fe,null,i,$),J.push({event:B,listeners:ge}))}}if((t&7)===0){e:{if(B=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",B&&i!==Wc&&(fe=i.relatedTarget||i.fromElement)&&(x(fe)||fe[$t]))break e;if((P||B)&&(B=$.window===$?$:(B=$.ownerDocument)?B.defaultView||B.parentWindow:window,P?(fe=i.relatedTarget||i.toElement,P=U,fe=fe?x(fe):null,fe!==null&&(Je=f(fe),ge=fe.tag,fe!==Je||ge!==5&&ge!==27&&ge!==6)&&(fe=null)):(P=null,fe=U),P!==fe)){if(ge=vh,G="onMouseLeave",M="onMouseEnter",N="mouse",(e==="pointerout"||e==="pointerover")&&(ge=wh,G="onPointerLeave",M="onPointerEnter",N="pointer"),Je=P==null?B:_(P),q=fe==null?B:_(fe),B=new ge(G,N+"leave",P,i,$),B.target=Je,B.relatedTarget=q,G=null,x($)===U&&(ge=new ge(M,N+"enter",fe,i,$),ge.target=q,ge.relatedTarget=Je,G=ge),Je=G,P&&fe)t:{for(ge=Rb,M=P,N=fe,q=0,G=M;G;G=ge(G))q++;G=0;for(var pe=N;pe;pe=ge(pe))G++;for(;0<q-G;)M=ge(M),q--;for(;0<G-q;)N=ge(N),G--;for(;q--;){if(M===N||N!==null&&M===N.alternate){ge=M;break t}M=ge(M),N=ge(N)}ge=null}else ge=null;P!==null&&dp(J,B,P,ge,!1),fe!==null&&Je!==null&&dp(J,Je,fe,ge,!0)}}e:{if(B=U?_(U):window,P=B.nodeName&&B.nodeName.toLowerCase(),P==="select"||P==="input"&&B.type==="file")var Ue=Ch;else if(Th(B))if(kh)Ue=Gy;else{Ue=Yy;var de=Py}else P=B.nodeName,!P||P.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?U&&Zc(U.elementType)&&(Ue=Ch):Ue=$y;if(Ue&&(Ue=Ue(e,U))){Nh(J,Ue,i,$);break e}de&&de(e,B,U),e==="focusout"&&U&&B.type==="number"&&U.memoizedProps.value!=null&&Kc(B,"number",B.value)}switch(de=U?_(U):window,e){case"focusin":(Th(de)||de.contentEditable==="true")&&(Li=de,ho=U,Yr=null);break;case"focusout":Yr=ho=Li=null;break;case"mousedown":mo=!0;break;case"contextmenu":case"mouseup":case"dragend":mo=!1,Lh(J,i,$);break;case"selectionchange":if(Fy)break;case"keydown":case"keyup":Lh(J,i,$)}var Ee;if(co)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Bi?Oh(e,i)&&(Me="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Me="onCompositionStart");Me&&(Sh&&i.locale!=="ko"&&(Bi||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Bi&&(Ee=bh()):(xs=$,so="value"in xs?xs.value:xs.textContent,Bi=!0)),de=Ql(U,Me),0<de.length&&(Me=new _h(Me,e,null,i,$),J.push({event:Me,listeners:de}),Ee?Me.data=Ee:(Ee=jh(i),Ee!==null&&(Me.data=Ee)))),(Ee=qy?Uy(e,i):By(e,i))&&(Me=Ql(U,"onBeforeInput"),0<Me.length&&(de=new _h("onBeforeInput","beforeinput",null,i,$),J.push({event:de,listeners:Me}),de.data=Ee)),Nb(J,e,U,i,$)}fp(J,t)})}function da(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Ql(e,t){for(var i=t+"Capture",l=[];e!==null;){var o=e,u=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||u===null||(o=Dr(e,i),o!=null&&l.unshift(da(e,o,u)),o=Dr(e,t),o!=null&&l.push(da(e,o,u))),e.tag===3)return l;e=e.return}return[]}function Rb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function dp(e,t,i,l,o){for(var u=t._reactName,m=[];i!==null&&i!==l;){var b=i,O=b.alternate,U=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||U===null||(O=U,o?(U=Dr(i,u),U!=null&&m.unshift(da(i,U,O))):o||(U=Dr(i,u),U!=null&&m.push(da(i,U,O)))),i=i.return}m.length!==0&&e.push({event:t,listeners:m})}var Db=/\r\n?/g,zb=/\u0000|\uFFFD/g;function mp(e){return(typeof e=="string"?e:""+e).replace(Db,`
26
+ `).replace(zb,"")}function pp(e,t){return t=mp(t),mp(e)===t}function Fe(e,t,i,l,o,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||zi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&zi(e,""+l);break;case"className":_n(e,"class",l);break;case"tabIndex":_n(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":_n(e,i,l);break;case"style":ph(e,l,u);break;case"data":if(t!=="object"){_n(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=el(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&Fe(e,t,"name",o.name,o,null),Fe(e,t,"formEncType",o.formEncType,o,null),Fe(e,t,"formMethod",o.formMethod,o,null),Fe(e,t,"formTarget",o.formTarget,o,null)):(Fe(e,t,"encType",o.encType,o,null),Fe(e,t,"method",o.method,o,null),Fe(e,t,"target",o.target,o,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=el(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Gn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(o.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=el(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":$n(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":$n(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":$n(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":$n(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":$n(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":$n(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":$n(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":$n(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":$n(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=oy.get(i)||i,Ct(e,i,l))}}function Lu(e,t,i,l,o,u){switch(i){case"style":ph(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(o.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?zi(e,l):(typeof l=="number"||typeof l=="bigint")&&zi(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Gn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!F.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(o=i.endsWith("Capture"),t=i.slice(2,o?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,o),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,o);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,o=!1,u;for(u in i)if(i.hasOwnProperty(u)){var m=i[u];if(m!=null)switch(u){case"src":l=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,m,i,null)}}o&&Fe(e,t,"srcSet",i.srcSet,i,null),l&&Fe(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=m=o=null,O=null,U=null;for(l in i)if(i.hasOwnProperty(l)){var $=i[l];if($!=null)switch(l){case"name":o=$;break;case"type":m=$;break;case"checked":O=$;break;case"defaultChecked":U=$;break;case"value":u=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(a(137,t));break;default:Fe(e,t,l,$,i,null)}}fh(e,u,b,O,U,m,o,!1);return;case"select":Ce("invalid",e),l=m=u=null;for(o in i)if(i.hasOwnProperty(o)&&(b=i[o],b!=null))switch(o){case"value":u=b;break;case"defaultValue":m=b;break;case"multiple":l=b;default:Fe(e,t,o,b,i,null)}t=u,i=m,e.multiple=!!l,t!=null?Di(e,!!l,t,!1):i!=null&&Di(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=o=l=null;for(m in i)if(i.hasOwnProperty(m)&&(b=i[m],b!=null))switch(m){case"value":l=b;break;case"defaultValue":o=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,m,b,i,null)}dh(e,l,o,u);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(l=i[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Fe(e,t,O,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<ha.length;l++)Ce(ha[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in i)if(i.hasOwnProperty(U)&&(l=i[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,U,l,i,null)}return;default:if(Zc(t)){for($ in i)i.hasOwnProperty($)&&(l=i[$],l!==void 0&&Lu(e,t,$,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Fe(e,t,b,l,i,null))}function qb(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,u=null,m=null,b=null,O=null,U=null,$=null;for(P in i){var J=i[P];if(i.hasOwnProperty(P)&&J!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=J;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,J)}}for(var B in l){var P=l[B];if(J=i[B],l.hasOwnProperty(B)&&(P!=null||J!=null))switch(B){case"type":u=P;break;case"name":o=P;break;case"checked":U=P;break;case"defaultChecked":$=P;break;case"value":m=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==J&&Fe(e,t,B,P,l,J)}}Ic(e,m,b,O,U,$,u,o);return;case"select":P=m=b=B=null;for(u in i)if(O=i[u],i.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":P=O;default:l.hasOwnProperty(u)||Fe(e,t,u,null,l,O)}for(o in l)if(u=l[o],O=i[o],l.hasOwnProperty(o)&&(u!=null||O!=null))switch(o){case"value":B=u;break;case"defaultValue":b=u;break;case"multiple":m=u;default:u!==O&&Fe(e,t,o,u,l,O)}t=b,i=m,l=P,B!=null?Di(e,!!i,B,!1):!!l!=!!i&&(t!=null?Di(e,!!i,t,!0):Di(e,!!i,i?[]:"",!1));return;case"textarea":P=B=null;for(b in i)if(o=i[b],i.hasOwnProperty(b)&&o!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,o)}for(m in l)if(o=l[m],u=i[m],l.hasOwnProperty(m)&&(o!=null||u!=null))switch(m){case"value":B=o;break;case"defaultValue":P=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(a(91));break;default:o!==u&&Fe(e,t,m,o,l,u)}hh(e,B,P);return;case"option":for(var fe in i)if(B=i[fe],i.hasOwnProperty(fe)&&B!=null&&!l.hasOwnProperty(fe))switch(fe){case"selected":e.selected=!1;break;default:Fe(e,t,fe,null,l,B)}for(O in l)if(B=l[O],P=i[O],l.hasOwnProperty(O)&&B!==P&&(B!=null||P!=null))switch(O){case"selected":e.selected=B&&typeof B!="function"&&typeof B!="symbol";break;default:Fe(e,t,O,B,l,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ge in i)B=i[ge],i.hasOwnProperty(ge)&&B!=null&&!l.hasOwnProperty(ge)&&Fe(e,t,ge,null,l,B);for(U in l)if(B=l[U],P=i[U],l.hasOwnProperty(U)&&B!==P&&(B!=null||P!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(a(137,t));break;default:Fe(e,t,U,B,l,P)}return;default:if(Zc(t)){for(var Je in i)B=i[Je],i.hasOwnProperty(Je)&&B!==void 0&&!l.hasOwnProperty(Je)&&Lu(e,t,Je,void 0,l,B);for($ in l)B=l[$],P=i[$],!l.hasOwnProperty($)||B===P||B===void 0&&P===void 0||Lu(e,t,$,B,l,P);return}}for(var M in i)B=i[M],i.hasOwnProperty(M)&&B!=null&&!l.hasOwnProperty(M)&&Fe(e,t,M,null,l,B);for(J in l)B=l[J],P=i[J],!l.hasOwnProperty(J)||B===P||B==null&&P==null||Fe(e,t,J,B,l,P)}function gp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ub(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var o=i[l],u=o.transferSize,m=o.initiatorType,b=o.duration;if(u&&b&&gp(m)){for(m=0,b=o.responseEnd,l+=1;l<i.length;l++){var O=i[l],U=O.startTime;if(U>b)break;var $=O.transferSize,J=O.initiatorType;$&&gp(J)&&(O=O.responseEnd,m+=$*(O<b?1:(b-U)/(O-U)))}if(--l,t+=8*(u+m)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Hu=null,Pu=null;function Xl(e){return e.nodeType===9?e:e.ownerDocument}function yp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function bp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Yu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var $u=null;function Bb(){var e=window.event;return e&&e.type==="popstate"?e===$u?!1:($u=e,!0):($u=null,!1)}var xp=typeof setTimeout=="function"?setTimeout:void 0,Lb=typeof clearTimeout=="function"?clearTimeout:void 0,vp=typeof Promise=="function"?Promise:void 0,Hb=typeof queueMicrotask=="function"?queueMicrotask:typeof vp<"u"?function(e){return vp.resolve(null).then(e).catch(Pb)}:xp;function Pb(e){setTimeout(function(){throw e})}function qs(e){return e==="head"}function _p(e,t){var i=t,l=0;do{var o=i.nextSibling;if(e.removeChild(i),o&&o.nodeType===8)if(i=o.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(o),hr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")ma(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ma(i);for(var u=i.firstChild;u;){var m=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=m}}else i==="body"&&ma(e.ownerDocument.body);i=o}while(i);hr(t)}function wp(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Gu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Gu(i),Ri(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Yb(e,t,i,l){for(;e.nodeType===1;){var o=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=mn(e.nextSibling),e===null)break}return null}function $b(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=mn(e.nextSibling),e===null))return null;return e}function Sp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=mn(e.nextSibling),e===null))return null;return e}function Vu(e){return e.data==="$?"||e.data==="$~"}function Fu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Gb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function mn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Ju=null;function Ep(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return mn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Ap(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Op(e,t,i){switch(t=Xl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ma(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ri(e)}var pn=new Map,jp=new Set;function Il(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var as=te.d;te.d={f:Vb,r:Fb,D:Jb,C:Qb,L:Xb,m:Ib,X:Zb,S:Kb,M:Wb};function Vb(){var e=as.f(),t=Pl();return e||t}function Fb(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Gd(t):as.r(e)}var or=typeof document>"u"?null:document;function Tp(e,t,i){var l=or;if(l&&typeof t=="string"&&t){var o=ln(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof i=="string"&&(o+='[crossorigin="'+i+'"]'),jp.has(o)||(jp.add(o),e={rel:e,crossOrigin:i,href:t},l.querySelector(o)===null&&(t=l.createElement("link"),At(t,"link",e),T(t),l.head.appendChild(t)))}}function Jb(e){as.D(e),Tp("dns-prefetch",e,null)}function Qb(e,t){as.C(e,t),Tp("preconnect",e,t)}function Xb(e,t,i){as.L(e,t,i);var l=or;if(l&&e&&t){var o='link[rel="preload"][as="'+ln(t)+'"]';t==="image"&&i&&i.imageSrcSet?(o+='[imagesrcset="'+ln(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(o+='[imagesizes="'+ln(i.imageSizes)+'"]')):o+='[href="'+ln(e)+'"]';var u=o;switch(t){case"style":u=ur(e);break;case"script":u=fr(e)}pn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),pn.set(u,e),l.querySelector(o)!==null||t==="style"&&l.querySelector(pa(u))||t==="script"&&l.querySelector(ga(u))||(t=l.createElement("link"),At(t,"link",e),T(t),l.head.appendChild(t)))}}function Ib(e,t){as.m(e,t);var i=or;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+ln(l)+'"][href="'+ln(e)+'"]',u=o;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=fr(e)}if(!pn.has(u)&&(e=w({rel:"modulepreload",href:e},t),pn.set(u,e),i.querySelector(o)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ga(u)))return}l=i.createElement("link"),At(l,"link",e),T(l),i.head.appendChild(l)}}}function Kb(e,t,i){as.S(e,t,i);var l=or;if(l&&e){var o=E(l).hoistableStyles,u=ur(e);t=t||"default";var m=o.get(u);if(!m){var b={loading:0,preload:null};if(m=l.querySelector(pa(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=pn.get(u))&&Qu(e,i);var O=m=l.createElement("link");T(O),At(O,"link",e),O._p=new Promise(function(U,$){O.onload=U,O.onerror=$}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Kl(m,t,l)}m={type:"stylesheet",instance:m,count:1,state:b},o.set(u,m)}}}function Zb(e,t){as.X(e,t);var i=or;if(i&&e){var l=E(i).hoistableScripts,o=fr(e),u=l.get(o);u||(u=i.querySelector(ga(o)),u||(e=w({src:e,async:!0},t),(t=pn.get(o))&&Xu(e,t),u=i.createElement("script"),T(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(o,u))}}function Wb(e,t){as.M(e,t);var i=or;if(i&&e){var l=E(i).hoistableScripts,o=fr(e),u=l.get(o);u||(u=i.querySelector(ga(o)),u||(e=w({src:e,async:!0,type:"module"},t),(t=pn.get(o))&&Xu(e,t),u=i.createElement("script"),T(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(o,u))}}function Np(e,t,i,l){var o=(o=sn.current)?Il(o):null;if(!o)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=ur(i.href),i=E(o).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=ur(i.href);var u=E(o).hoistableStyles,m=u.get(e);if(m||(o=o.ownerDocument||o,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,m),(u=o.querySelector(pa(e)))&&!u._p&&(m.instance=u,m.state.loading=5),pn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},pn.set(e,i),u||ex(o,e,i,m.state))),t&&l===null)throw Error(a(528,""));return m}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=fr(i),i=E(o).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function ur(e){return'href="'+ln(e)+'"'}function pa(e){return'link[rel="stylesheet"]['+e+"]"}function Cp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function ex(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),T(t),e.head.appendChild(t))}function fr(e){return'[src="'+ln(e)+'"]'}function ga(e){return"script[async]"+e}function kp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+ln(i.href)+'"]');if(l)return t.instance=l,T(l),l;var o=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),T(l),At(l,"style",o),Kl(l,i.precedence,e),t.instance=l;case"stylesheet":o=ur(i.href);var u=e.querySelector(pa(o));if(u)return t.state.loading|=4,t.instance=u,T(u),u;l=Cp(i),(o=pn.get(o))&&Qu(l,o),u=(e.ownerDocument||e).createElement("link"),T(u);var m=u;return m._p=new Promise(function(b,O){m.onload=b,m.onerror=O}),At(u,"link",l),t.state.loading|=4,Kl(u,i.precedence,e),t.instance=u;case"script":return u=fr(i.src),(o=e.querySelector(ga(u)))?(t.instance=o,T(o),o):(l=i,(o=pn.get(u))&&(l=w({},i),Xu(l,o)),e=e.ownerDocument||e,o=e.createElement("script"),T(o),At(o,"link",l),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Kl(l,i.precedence,e));return t.instance}function Kl(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=l.length?l[l.length-1]:null,u=o,m=0;m<l.length;m++){var b=l[m];if(b.dataset.precedence===t)u=b;else if(u!==o)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Qu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Zl=null;function Mp(e,t,i){if(Zl===null){var l=new Map,o=Zl=new Map;o.set(i,l)}else o=Zl,l=o.get(i),l||(l=new Map,o.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),o=0;o<i.length;o++){var u=i[o];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var m=u.getAttribute(t)||"";m=e+m;var b=l.get(m);b?b.push(u):l.set(m,[u])}}return l}function Rp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function tx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Dp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function nx(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var o=ur(l.href),u=t.querySelector(pa(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wl.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,T(u);return}u=t.ownerDocument||t,l=Cp(l),(o=pn.get(o))&&Qu(l,o),u=u.createElement("link"),T(u);var m=u;m._p=new Promise(function(b,O){m.onload=b,m.onerror=O}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Wl.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Iu=0;function sx(e,t){return e.stylesheets&&e.count===0&&tc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&tc(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Iu===0&&(Iu=62500*Ub());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&tc(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Iu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(o)}}:null}function Wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ec=null;function tc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ec=new Map,t.forEach(ix,e),ec=null,Wl.call(e))}function ix(e,t){if(!(t.state.loading&4)){var i=ec.get(e);if(i)var l=i.get(null);else{i=new Map,ec.set(e,i);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<o.length;u++){var m=o[u];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(i.set(m.dataset.precedence,m),l=m)}l&&i.set(null,l)}o=t.instance,m=o.getAttribute("data-precedence"),u=i.get(m)||l,u===l&&i.set(null,o),i.set(m,o),this.count++,l=Wl.bind(this),o.addEventListener("load",l),o.addEventListener("error",l),u?u.parentNode.insertBefore(o,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var ya={$$typeof:me,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function rx(e,t,i,l,o,u,m,b,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ps(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ps(0),this.hiddenUpdates=ps(null),this.identifierPrefix=l,this.onUncaughtError=o,this.onCaughtError=u,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function zp(e,t,i,l,o,u,m,b,O,U,$,J){return e=new rx(e,t,i,m,O,U,$,J,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=No(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},Ro(u),e}function qp(e){return e?(e=Yi,e):Yi}function Up(e,t,i,l,o,u){o=qp(o),l.context===null?l.context=o:l.pendingContext=o,l=As(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=Os(e,l,t),i!==null&&(Ht(i,e,t),Xr(i,e,t))}function Bp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Ku(e,t){Bp(e,t),(e=e.alternate)&&Bp(e,t)}function Lp(e){if(e.tag===13||e.tag===31){var t=oi(e,67108864);t!==null&&Ht(t,e,67108864),Ku(e,67108864)}}function Hp(e){if(e.tag===13||e.tag===31){var t=It();t=Yn(t);var i=oi(e,t);i!==null&&Ht(i,e,t),Ku(e,t)}}var nc=!0;function ax(e,t,i,l){var o=Y.T;Y.T=null;var u=te.p;try{te.p=2,Zu(e,t,i,l)}finally{te.p=u,Y.T=o}}function lx(e,t,i,l){var o=Y.T;Y.T=null;var u=te.p;try{te.p=8,Zu(e,t,i,l)}finally{te.p=u,Y.T=o}}function Zu(e,t,i,l){if(nc){var o=Wu(l);if(o===null)Bu(e,t,l,sc,i),Yp(e,l);else if(ox(o,e,t,i,l))l.stopPropagation();else if(Yp(e,l),t&4&&-1<cx.indexOf(e)){for(;o!==null;){var u=S(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var m=xn(u.pendingLanes);if(m!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;m;){var O=1<<31-Nt(m);b.entanglements[1]|=O,m&=~O}Dn(u),(He&6)===0&&(Ll=et()+500,fa(0))}}break;case 31:case 13:b=oi(u,2),b!==null&&Ht(b,u,2),Pl(),Ku(u,2)}if(u=Wu(l),u===null&&Bu(e,t,l,sc,i),u===o)break;o=u}o!==null&&l.stopPropagation()}else Bu(e,t,l,null,i)}}function Wu(e){return e=eo(e),ef(e)}var sc=null;function ef(e){if(sc=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=d(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return sc=e,null}function Pp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Fc()){case Fa:return 2;case Ja:return 8;case Ci:case Jc:return 32;case Qa:return 268435456;default:return 32}default:return 32}}var tf=!1,Us=null,Bs=null,Ls=null,ba=new Map,xa=new Map,Hs=[],cx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Yp(e,t){switch(e){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":Bs=null;break;case"mouseover":case"mouseout":Ls=null;break;case"pointerover":case"pointerout":ba.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":xa.delete(t.pointerId)}}function va(e,t,i,l,o,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[o]},t!==null&&(t=S(t),t!==null&&Lp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function ox(e,t,i,l,o){switch(t){case"focusin":return Us=va(Us,e,t,i,l,o),!0;case"dragenter":return Bs=va(Bs,e,t,i,l,o),!0;case"mouseover":return Ls=va(Ls,e,t,i,l,o),!0;case"pointerover":var u=o.pointerId;return ba.set(u,va(ba.get(u)||null,e,t,i,l,o)),!0;case"gotpointercapture":return u=o.pointerId,xa.set(u,va(xa.get(u)||null,e,t,i,l,o)),!0}return!1}function $p(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Ia(e.priority,function(){Hp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Ia(e.priority,function(){Hp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ic(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Wu(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);Wc=l,i.target.dispatchEvent(l),Wc=null}else return t=S(i),t!==null&&Lp(t),e.blockedOn=i,!1;t.shift()}return!0}function Gp(e,t,i){ic(e)&&i.delete(t)}function ux(){tf=!1,Us!==null&&ic(Us)&&(Us=null),Bs!==null&&ic(Bs)&&(Bs=null),Ls!==null&&ic(Ls)&&(Ls=null),ba.forEach(Gp),xa.forEach(Gp)}function rc(e,t){e.blockedOn===t&&(e.blockedOn=null,tf||(tf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,ux)))}var ac=null;function Vp(e){ac!==e&&(ac=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){ac===e&&(ac=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],o=e[t+2];if(typeof l!="function"){if(ef(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,Wo(u,{pending:!0,data:o,method:i.method,action:l},l,o))}}))}function hr(e){function t(O){return rc(O,e)}Us!==null&&rc(Us,e),Bs!==null&&rc(Bs,e),Ls!==null&&rc(Ls,e),ba.forEach(t),xa.forEach(t);for(var i=0;i<Hs.length;i++){var l=Hs[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Hs.length&&(i=Hs[0],i.blockedOn===null);)$p(i),i.blockedOn===null&&Hs.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var o=i[l],u=i[l+1],m=o[it]||null;if(typeof u=="function")m||Vp(i);else if(m){var b=null;if(u&&u.hasAttribute("formAction")){if(o=u,m=u[it]||null)b=m.formAction;else if(ef(o)!==null)continue}else b=m.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Vp(i)}}}function Fp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(m){return o=m})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function nf(e){this._internalRoot=e}lc.prototype.render=nf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=It();Up(i,l,e,t,null,null)},lc.prototype.unmount=nf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Up(e.current,2,null,e,null,null),Pl(),t[$t]=null}};function lc(e){this._internalRoot=e}lc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Hs.length&&t!==0&&t<Hs[i].priority;i++);Hs.splice(i,0,e),i===0&&$p(e)}};var Jp=n.version;if(Jp!=="19.2.4")throw Error(a(527,Jp,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?A(e):null,e=e===null?null:e.stateNode,e};var fx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cc.isDisabled&&cc.supportsFiber)try{ei=cc.inject(fx),ct=cc}catch{}}return _a.createRoot=function(e,t){if(!c(e))throw Error(a(299));var i=!1,l="",o=em,u=tm,m=nm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=zp(e,1,!1,null,null,i,l,null,o,u,m,Fp),e[$t]=t.current,Uu(e),new nf(t)},_a.hydrateRoot=function(e,t,i){if(!c(e))throw Error(a(299));var l=!1,o="",u=em,m=tm,b=nm,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(m=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),t=zp(e,1,!0,t,i??null,l,o,O,u,m,b,Fp),t.context=qp(null),i=t.current,l=It(),l=Yn(l),o=As(l),o.callback=null,Os(i,o,l),i=l,t.current.lanes=i,vn(t,i),Dn(t),e[$t]=t.current,Uu(e),new lc(t)},_a.version="19.2.4",_a}var e0;function Ix(){if(e0)return sf.exports;e0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),sf.exports=Xx(),sf.exports}var Kx=Ix();const Zx="modulepreload",Wx=function(r){return"/"+r},t0={},Ae=function(n,s,a){let c=Promise.resolve();if(s&&s.length>0){let h=function(y){return Promise.all(y.map(A=>Promise.resolve(A).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),g=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));c=h(s.map(y=>{if(y=Wx(y),y in t0)return;t0[y]=!0;const A=y.endsWith(".css"),w=A?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${w}`))return;const j=document.createElement("link");if(j.rel=A?"stylesheet":Zx,A||(j.as="script"),j.crossOrigin="",j.href=y,g&&j.setAttribute("nonce",g),document.head.appendChild(j),A)return new Promise((z,R)=>{j.addEventListener("load",z),j.addEventListener("error",()=>R(new Error(`Unable to preload CSS for ${y}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return c.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function cg(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function og(r){const n=cg(r);return!n||typeof n.exp!="number"?null:n.exp}function Vf(r,n=0){const s=og(r);return s===null?!0:Date.now()/1e3>=s-n}const _f="/api";let Gs=null;function oc(r){Gs=r}function ug(){return Gs}async function n0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${_f}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const c=await a.json();return c.token&&c.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:c.user.display_name,username:c.user.external_id})),c.token??null}catch{return null}}let Ys=null;async function Ie(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Gs){if(Vf(Gs)){Ys||(Ys=n0().finally(()=>{Ys=null}));const c=await Ys;if(c)Gs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Gs}`}let a=await fetch(`${_f}${r}`,{...n,headers:s});if(a.status===401&&Gs){Ys||(Ys=n0().finally(()=>{Ys=null}));const c=await Ys;if(c&&(Gs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),s.Authorization=`Bearer ${c}`,a=await fetch(`${_f}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const c=await a.json().catch(()=>({error:a.statusText}));throw new Error(c.message||c.error||a.statusText)}return a.json()}const fg=C.createContext(null),ev=300;function lf(r,n){if(Vf(r))return null;const s=cg(r);if(!s)return null;const a=n??(()=>{try{const c=sessionStorage.getItem("lt_user_info");return c?JSON.parse(c):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function tv({children:r}){const[n,s]=C.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Vf(w)?(sessionStorage.removeItem("lt_token"),null):(oc(w),lf(w)):null}),a=C.useRef(void 0),c=C.useCallback(w=>{clearTimeout(a.current);const j=og(w);if(!j)return;const z=(j-ev)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{const R=sessionStorage.getItem("lt_credentials");if(R)try{const{username:H,password:ee}=JSON.parse(R),ne=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:H,password:ee})});if(!ne.ok)return;const W=await ne.json();W.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:W.token}}))}catch{}},z))},[]),f=C.useCallback((w,j,z)=>{const R={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(j==null?void 0:j.username)??null},H=lf(w,R);H&&(oc(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(R)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(H),c(w))},[c]),h=C.useCallback(()=>{clearTimeout(a.current),oc(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),s(null)},[]);C.useEffect(()=>{const w=()=>h(),j=z=>{var ee;const R=(ee=z.detail)==null?void 0:ee.token;if(!R)return;const H=lf(R);H&&(oc(R),sessionStorage.setItem("lt_token",R),s(H),c(R))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",j)}},[h,c]),C.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&c(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=C.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.role===w))??!1,[n]),y=C.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.type===w))??!1,[n]),A=(n==null?void 0:n.roles.map(w=>w.role))??[];return p.jsx(fg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:A},children:r})}function Ai(){const r=C.useContext(fg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const tn=new Uint8Array(0),Oi=new TextEncoder,Wt=new TextDecoder;function nv(...r){let n=0;for(let c=0;c<r.length;c++)n+=r[c].length;const s=new Uint8Array(n);let a=0;for(let c=0;c<r.length;c++)s.set(r[c],a),a+=r[c].length;return s}function Ca(...r){const n=[];for(let s=0;s<r.length;s++)n.push(Oi.encode(r[s]));return n.length===0?tn:n.length===1?n[0]:nv(...n)}function s0(r){return!r||r.length===0?"":Wt.decode(r)}const i0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",r0=36,sv=0xcfd41b9100000,a0=33,iv=333,l0=22;function rv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function av(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):rv(r)}class lv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(l0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*sv),this.inc=Math.floor(Math.random()*(iv-a0)+a0)}setPre(){const n=new Uint8Array(12);av(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=i0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=l0-1;s>=12;s--)this.buf[s]=i0.charCodeAt(n%r0),n=Math.floor(n/r0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Is=new lv;var ls;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(ls||(ls={}));var yr;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(yr||(yr={}));var se;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(se||(se={}));function cv(r){return typeof r.code=="string"}class hg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(se.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(se.BadJson,"Bad JSON"),this.messages.set(se.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return ov.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const ov=new hg;class oe extends Error{constructor(s,a,c){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=c}static errorForCode(s,a){const c=hg.getMessage(s);return new oe(c,s,a)}isAuthError(){return this.code===se.AuthenticationExpired||this.code===se.AuthorizationViolation||this.code===se.AccountExpired}isAuthTimeout(){return this.code===se.AuthenticationTimeout}isPermissionError(){return this.code===se.PermissionsViolation}isProtocolError(){return this.code===se.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var jn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(jn||(jn={}));var ka;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(ka||(ka={}));const jc="Nats-Service-Error",Tc="Nats-Service-Error-Code";class Nc extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Nc.toServiceError(s)!==null}static toServiceError(s){var c,f;const a=((c=s==null?void 0:s.headers)==null?void 0:c.get(Tc))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(jc))||"";return new Nc(h,d.length?d:a)}return null}}function cs(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Is.next()}`}const wf="127.0.0.1";var Fs;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Fs||(Fs={}));function Bc(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(c){r[c]=a[c]})}return r}function uc(r){return Wt.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function wr(r,n=!0){const s=n?oe.errorForCode(se.Timeout):null;let a,c;const f=new Promise((h,d)=>{a={cancel:()=>{c&&clearTimeout(c)}},c=setTimeout(()=>{d(s===null?oe.errorForCode(se.Timeout):s)},r)});return Object.assign(f,a)}function Ar(r=0){let n;const s=new Promise(a=>{const c=setTimeout(()=>{a()},r);n={cancel:()=>{c&&clearTimeout(c)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function dg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function uv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Ff(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return uv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Jf(r){return Math.floor(r/1e6)}function c0(r){let a=!0;const c=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new oe(`'${r[f]}' is not a valid character for a header key`,se.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),c[f]=h,a=h==45}return String.fromCharCode(...c)}function os(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Js(r,n)}const cf="NATS/1.0";class Js{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const c=n.values(s);if(a.length!==c.length)return!1;const f=[...a].sort(),h=[...c].sort();for(let d=0;d<f.length;d++)if(f[d]!==h[d])return!1}return!0}return!1}static decode(n){const s=new Js,c=Wt.decode(n).split(`\r
27
27
  `),f=c[0];if(f!==cf){let h=f.replace(cf,"").trim();if(h.length>0){s._code=parseInt(h,10),isNaN(s._code)&&(s._code=0);const d=s._code.toString();h=h.replace(d,""),s._description=h.trim()}}return c.length>=1&&c.slice(1).map(h=>{if(h){const d=h.indexOf(":");if(d>-1){const g=h.slice(0,d),y=h.slice(d+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=cf;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let c=0;c<a.length;c++)n=`${n}\r
28
28
  ${s}: ${a[c]}`;return`${n}\r
29
29
  \r
30
30
  `}encode(){return Oi.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new oe("invalid header value - \\r and \\n are not allowed.",se.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(c=>c===n);case Kt.CanonicalMIME:return n=c0(n),a.filter(c=>c===n);default:{const c=n.toLowerCase();return a.filter(f=>c===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const c=this.headers.get(a[0]);if(c)return Array.isArray(c)?c[0]:c}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const c=this.headers.get(a[0]);if(c)return Array.isArray(c)?c[c.length-1]:c}return""}has(n,s=Kt.Exact){return this.findKeys(n,s).length>0}set(n,s,a=Kt.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=Kt.Exact){const c=c0(n);a===Kt.CanonicalMIME&&(n=c);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Js.validHeaderValue(s);let d=this.headers.get(n);d||(d=[],this.headers.set(n,d)),d.push(h)}values(n,s=Kt.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const h=this.headers.get(f);h&&a.push(...h)}),a}delete(n,s=Kt.Exact){this.findKeys(n,s).forEach(c=>{this.headers.delete(c)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new Js;for(const a in n)s.headers.set(a,n[a]);return s}}function Sf(){return{encode(r){return Oi.encode(r)},decode(r){return Wt.decode(r)}}}function Tn(r){return{encode(n){try{return n===void 0&&(n=null),Oi.encode(JSON.stringify(n))}catch(s){throw oe.errorForCode(se.BadJson,s)}},decode(n){try{return JSON.parse(Wt.decode(n),r)}catch(s){throw oe.errorForCode(se.BadJson,s)}}}}function mg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?oe.errorForCode(se.NoResponders):null}class Qf{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=Wt.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Wt.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Js.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=tn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var c;const n=this._msg.subject.length,s=((c=this._msg.reply)==null?void 0:c.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,c){return(a==="start"||a==="stop")&&c!==""?new Date(Date.parse(c)):c}):null}}v(Qf,"jc");function br(r){return Lc("durable",r)}function Mt(r){return Lc("stream",r)}function Lc(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
31
31
  `,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
32
- `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function ja(r,n=""){if(n==="")throw Error(`${r} name required`);const s=hv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function hv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Ef(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Af(r){var n;return Ef(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function dv(r,n,s){const a=os(r,n),c={hdr:1,sid:0,size:0},f=new Qf(c,tn,{});return f._headers=a,f._subject=s,f}function xr(r){if(r.data.length!==0)return null;const n=r.headers;return n?pg(n.code,n.description):null}var yn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(yn||(yn={}));function mv(r){return r.code!==se.JetStream409?!1:[yn.MaxBatchExceeded,yn.MaxExpiresExceeded,yn.MaxBytesExceeded,yn.MaxMessageSizeExceeded,yn.PushConsumer,yn.IdleHeartbeatMissed,yn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function pg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new oe(n,se.JetStream404NoMessages);case 408:return new oe(n,se.JetStream408RequestTimeout);case 409:{const s=n.startsWith(yn.IdleHeartbeatMissed)?se.JetStreamIdleHeartBeat:se.JetStream409;return new oe(n,s)}case 503:return oe.errorForCode(se.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=se.Unknown),new oe(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new oe("unsupported iterator",se.ApiError);if(this.yielding)throw new oe("already yielding",se.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const c=n[s];try{c()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const c=Date.now();yield n[s],this.time=Date.now()-c,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Xf{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Of;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Of||(Of={}));var za;(function(r){r.Old="old",r.New="new"})(za||(za={}));var jf;(function(r){r.File="file",r.Memory="memory"})(jf||(jf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var Sr;(function(r){r.Instant="instant",r.Original="original"})(Sr||(Sr={}));var Ks;(function(r){r.None="none",r.S2="s2"})(Ks||(Ks={}));var Cc;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Cc||(Cc={}));function pv(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Sr.Instant},n)}var o0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(o0||(o0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var An;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(An||(An={}));var gr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(gr||(gr={}));var u0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(u0||(u0={}));const Zt="KV_";class gv{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=pv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return br(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Sr.Instant,this}replayOriginal(){return this.config.replay_policy=Sr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Qs(r){return new gv(r)}function f0(r){return typeof r.getOpts=="function"}class yv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,c=>c.charCodeAt(0)):a}}class vr{static encode(n){return vr.toB64URLEncoding(yv.encode(n))}static decode(n,s=!1){return vr.decode(vr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Er{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let c=0;for(let f=0;f<n.length;f++)a.set(n[f],c),c+=n[f].length;return a}static fromAscii(n){return n||(n=""),Oi.encode(n)}static toAscii(n){return Wt.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const c=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,c}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function bv(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var c=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,c.get?c:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var xv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},wa=xv.performance||{};wa.now||wa.mozNow||wa.msNow||wa.oNow||wa.webkitNow;var h0={versions:{}},vv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _v(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var of,Hc={exports:{}},d0={},m0=_v(bv({__proto__:null,default:d0},[d0]));of=Hc,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",c=!s.JS_SHA256_NO_NODE_JS&&h0.versions&&h0.versions.node;c?s=vv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&of.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],A=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var z=function(k,I){return function(ie){return new W(I,!0).update(ie)[k]()}},R=function(k){var I=z("hex",k);c&&(I=H(I,k)),I.create=function(){return new W(k)},I.update=function(Q){return I.create().update(Q)};for(var ie=0;ie<w.length;++ie){var Z=w[ie];I[Z]=z(Z,k)}return I},H=function(k,I){var ie,Z=m0,Q=m0.Buffer,K=I?"sha224":"sha256";return ie=Q.from&&!s.JS_SHA256_NO_BUFFER_FROM?Q.from:function(ae){return new Q(ae)},function(ae){if(typeof ae=="string")return Z.createHash(K).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===Q?Z.createHash(K).update(ie(ae)).digest("hex"):k(ae)}},ee=function(k,I){return function(ie,Z){return new me(ie,I,!0).update(Z)[k]()}},ne=function(k){var I=ee("hex",k);I.create=function(Q){return new me(Q,k)},I.update=function(Q,K){return I.create(Q).update(K)};for(var ie=0;ie<w.length;++ie){var Z=w[ie];I[Z]=ee(Z,k)}return I};function W(k,I){I?(j[0]=j[16]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=j[9]=j[10]=j[11]=j[12]=j[13]=j[14]=j[15]=0,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=k}function me(k,I,ie){var Z,Q=typeof k;if(Q==="string"){var K,ae=[],re=k.length,qe=0;for(Z=0;Z<re;++Z)(K=k.charCodeAt(Z))<128?ae[qe++]=K:K<2048?(ae[qe++]=192|K>>>6,ae[qe++]=128|63&K):K<55296||K>=57344?(ae[qe++]=224|K>>>12,ae[qe++]=128|K>>>6&63,ae[qe++]=128|63&K):(K=65536+((1023&K)<<10|1023&k.charCodeAt(++Z)),ae[qe++]=240|K>>>18,ae[qe++]=128|K>>>12&63,ae[qe++]=128|K>>>6&63,ae[qe++]=128|63&K);k=ae}else{if(Q!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r)}k.length>64&&(k=new W(I,!0).update(k).array());var Ge=[],Le=[];for(Z=0;Z<64;++Z){var Y=k[Z]||0;Ge[Z]=92^Y,Le[Z]=54^Y}W.call(this,I,ie),this.update(Le),this.oKeyPad=Ge,this.inner=!0,this.sharedMemory=ie}W.prototype.update=function(k){if(!this.finalized){var I,ie=typeof k;if(ie!=="string"){if(ie!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r);I=!0}for(var Z,Q,K=0,ae=k.length,re=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,re[0]=this.block,this.block=re[16]=re[1]=re[2]=re[3]=re[4]=re[5]=re[6]=re[7]=re[8]=re[9]=re[10]=re[11]=re[12]=re[13]=re[14]=re[15]=0),I)for(Q=this.start;K<ae&&Q<64;++K)re[Q>>>2]|=k[K]<<y[3&Q++];else for(Q=this.start;K<ae&&Q<64;++K)(Z=k.charCodeAt(K))<128?re[Q>>>2]|=Z<<y[3&Q++]:Z<2048?(re[Q>>>2]|=(192|Z>>>6)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]):Z<55296||Z>=57344?(re[Q>>>2]|=(224|Z>>>12)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>6&63)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]):(Z=65536+((1023&Z)<<10|1023&k.charCodeAt(++K)),re[Q>>>2]|=(240|Z>>>18)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>12&63)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>6&63)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]);this.lastByteIndex=Q,this.bytes+=Q-this.start,Q>=64?(this.block=re[16],this.start=Q-64,this.hash(),this.hashed=!0):this.start=Q}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},W.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,I=this.lastByteIndex;k[16]=this.block,k[I>>>2]|=g[3&I],this.block=k[16],I>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},W.prototype.hash=function(){var k,I,ie,Z,Q,K,ae,re,qe,Ge=this.h0,Le=this.h1,Y=this.h2,te=this.h3,he=this.h4,ve=this.h5,ye=this.h6,je=this.h7,_e=this.blocks;for(k=16;k<64;++k)I=((Q=_e[k-15])>>>7|Q<<25)^(Q>>>18|Q<<14)^Q>>>3,ie=((Q=_e[k-2])>>>17|Q<<15)^(Q>>>19|Q<<13)^Q>>>10,_e[k]=_e[k-16]+I+_e[k-7]+ie|0;for(qe=Le&Y,k=0;k<64;k+=4)this.first?(this.is224?(K=300032,je=(Q=_e[0]-1413257819)-150054599|0,te=Q+24177077|0):(K=704751109,je=(Q=_e[0]-210244248)-1521486534|0,te=Q+143694565|0),this.first=!1):(I=(Ge>>>2|Ge<<30)^(Ge>>>13|Ge<<19)^(Ge>>>22|Ge<<10),Z=(K=Ge&Le)^Ge&Y^qe,je=te+(Q=je+(ie=(he>>>6|he<<26)^(he>>>11|he<<21)^(he>>>25|he<<7))+(he&ve^~he&ye)+A[k]+_e[k])|0,te=Q+(I+Z)|0),I=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),Z=(ae=te&Ge)^te&Le^K,ye=Y+(Q=ye+(ie=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&he^~je&ve)+A[k+1]+_e[k+1])|0,I=((Y=Q+(I+Z)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),Z=(re=Y&te)^Y&Ge^ae,ve=Le+(Q=ve+(ie=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&je^~ye&he)+A[k+2]+_e[k+2])|0,I=((Le=Q+(I+Z)|0)>>>2|Le<<30)^(Le>>>13|Le<<19)^(Le>>>22|Le<<10),Z=(qe=Le&Y)^Le&te^re,he=Ge+(Q=he+(ie=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&ye^~ve&je)+A[k+3]+_e[k+3])|0,Ge=Q+(I+Z)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Ge|0,this.h1=this.h1+Le|0,this.h2=this.h2+Y|0,this.h3=this.h3+te|0,this.h4=this.h4+he|0,this.h5=this.h5+ve|0,this.h6=this.h6+ye|0,this.h7=this.h7+je|0},W.prototype.hex=function(){this.finalize();var k=this.h0,I=this.h1,ie=this.h2,Z=this.h3,Q=this.h4,K=this.h5,ae=this.h6,re=this.h7,qe=d[k>>>28&15]+d[k>>>24&15]+d[k>>>20&15]+d[k>>>16&15]+d[k>>>12&15]+d[k>>>8&15]+d[k>>>4&15]+d[15&k]+d[I>>>28&15]+d[I>>>24&15]+d[I>>>20&15]+d[I>>>16&15]+d[I>>>12&15]+d[I>>>8&15]+d[I>>>4&15]+d[15&I]+d[ie>>>28&15]+d[ie>>>24&15]+d[ie>>>20&15]+d[ie>>>16&15]+d[ie>>>12&15]+d[ie>>>8&15]+d[ie>>>4&15]+d[15&ie]+d[Z>>>28&15]+d[Z>>>24&15]+d[Z>>>20&15]+d[Z>>>16&15]+d[Z>>>12&15]+d[Z>>>8&15]+d[Z>>>4&15]+d[15&Z]+d[Q>>>28&15]+d[Q>>>24&15]+d[Q>>>20&15]+d[Q>>>16&15]+d[Q>>>12&15]+d[Q>>>8&15]+d[Q>>>4&15]+d[15&Q]+d[K>>>28&15]+d[K>>>24&15]+d[K>>>20&15]+d[K>>>16&15]+d[K>>>12&15]+d[K>>>8&15]+d[K>>>4&15]+d[15&K]+d[ae>>>28&15]+d[ae>>>24&15]+d[ae>>>20&15]+d[ae>>>16&15]+d[ae>>>12&15]+d[ae>>>8&15]+d[ae>>>4&15]+d[15&ae];return this.is224||(qe+=d[re>>>28&15]+d[re>>>24&15]+d[re>>>20&15]+d[re>>>16&15]+d[re>>>12&15]+d[re>>>8&15]+d[re>>>4&15]+d[15&re]),qe},W.prototype.toString=W.prototype.hex,W.prototype.digest=function(){this.finalize();var k=this.h0,I=this.h1,ie=this.h2,Z=this.h3,Q=this.h4,K=this.h5,ae=this.h6,re=this.h7,qe=[k>>>24&255,k>>>16&255,k>>>8&255,255&k,I>>>24&255,I>>>16&255,I>>>8&255,255&I,ie>>>24&255,ie>>>16&255,ie>>>8&255,255&ie,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q,K>>>24&255,K>>>16&255,K>>>8&255,255&K,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||qe.push(re>>>24&255,re>>>16&255,re>>>8&255,255&re),qe},W.prototype.array=W.prototype.digest,W.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),I=new DataView(k);return I.setUint32(0,this.h0),I.setUint32(4,this.h1),I.setUint32(8,this.h2),I.setUint32(12,this.h3),I.setUint32(16,this.h4),I.setUint32(20,this.h5),I.setUint32(24,this.h6),this.is224||I.setUint32(28,this.h7),k},me.prototype=new W,me.prototype.finalize=function(){if(W.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();W.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),W.prototype.finalize.call(this)}};var be=R();be.sha256=be,be.sha224=R(!0),be.sha256.hmac=ne(),be.sha224.hmac=ne(!0),f?of.exports=be:(s.sha256=be.sha256,s.sha224=be.sha224)})();Hc.exports;Hc.exports.sha224;var p0=Hc.exports.sha256;function Tf(r){return jv(r)}function wv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function Sv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Ev(r){return wv(r)?"hex":Sv(r)?"b64":""}function Av(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function Ov(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function jv(r){switch(Ev(r)){case"hex":return Av(r);case"b64":return Ov(r)}return null}function Tv(r,n){const s=typeof r=="string"?Tf(r):r,a=typeof n=="string"?Tf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let c=0;c<s.length;c++)if(s[c]!==a[c])return!1;return!0}class gg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Is.next(),a&&(this.ctx=new Error)}}class Nv extends gg{constructor(s,a,c={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=c,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof c.maxMessages=="number"&&c.maxMessages>0?c.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},c.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
32
+ `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function ja(r,n=""){if(n==="")throw Error(`${r} name required`);const s=fv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function fv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Ef(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Af(r){var n;return Ef(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function hv(r,n,s){const a=os(r,n),c={hdr:1,sid:0,size:0},f=new Qf(c,tn,{});return f._headers=a,f._subject=s,f}function xr(r){if(r.data.length!==0)return null;const n=r.headers;return n?pg(n.code,n.description):null}var yn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(yn||(yn={}));function dv(r){return r.code!==se.JetStream409?!1:[yn.MaxBatchExceeded,yn.MaxExpiresExceeded,yn.MaxBytesExceeded,yn.MaxMessageSizeExceeded,yn.PushConsumer,yn.IdleHeartbeatMissed,yn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function pg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new oe(n,se.JetStream404NoMessages);case 408:return new oe(n,se.JetStream408RequestTimeout);case 409:{const s=n.startsWith(yn.IdleHeartbeatMissed)?se.JetStreamIdleHeartBeat:se.JetStream409;return new oe(n,s)}case 503:return oe.errorForCode(se.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=se.Unknown),new oe(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new oe("unsupported iterator",se.ApiError);if(this.yielding)throw new oe("already yielding",se.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const c=n[s];try{c()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const c=Date.now();yield n[s],this.time=Date.now()-c,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Xf{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Of;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Of||(Of={}));var za;(function(r){r.Old="old",r.New="new"})(za||(za={}));var jf;(function(r){r.File="file",r.Memory="memory"})(jf||(jf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var Sr;(function(r){r.Instant="instant",r.Original="original"})(Sr||(Sr={}));var Ks;(function(r){r.None="none",r.S2="s2"})(Ks||(Ks={}));var Cc;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Cc||(Cc={}));function mv(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Sr.Instant},n)}var o0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(o0||(o0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var An;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(An||(An={}));var gr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(gr||(gr={}));var u0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(u0||(u0={}));const Zt="KV_";class pv{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=mv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return br(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Sr.Instant,this}replayOriginal(){return this.config.replay_policy=Sr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Qs(r){return new pv(r)}function f0(r){return typeof r.getOpts=="function"}class gv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,c=>c.charCodeAt(0)):a}}class vr{static encode(n){return vr.toB64URLEncoding(gv.encode(n))}static decode(n,s=!1){return vr.decode(vr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Er{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let c=0;for(let f=0;f<n.length;f++)a.set(n[f],c),c+=n[f].length;return a}static fromAscii(n){return n||(n=""),Oi.encode(n)}static toAscii(n){return Wt.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const c=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,c}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function yv(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var c=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,c.get?c:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var bv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},wa=bv.performance||{};wa.now||wa.mozNow||wa.msNow||wa.oNow||wa.webkitNow;var h0={versions:{}},xv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vv(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var of,Hc={exports:{}},d0={},m0=vv(yv({__proto__:null,default:d0},[d0]));of=Hc,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",c=!s.JS_SHA256_NO_NODE_JS&&h0.versions&&h0.versions.node;c?s=xv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&of.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],A=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var z=function(k,I){return function(ie){return new W(I,!0).update(ie)[k]()}},R=function(k){var I=z("hex",k);c&&(I=H(I,k)),I.create=function(){return new W(k)},I.update=function(Q){return I.create().update(Q)};for(var ie=0;ie<w.length;++ie){var Z=w[ie];I[Z]=z(Z,k)}return I},H=function(k,I){var ie,Z=m0,Q=m0.Buffer,K=I?"sha224":"sha256";return ie=Q.from&&!s.JS_SHA256_NO_BUFFER_FROM?Q.from:function(ae){return new Q(ae)},function(ae){if(typeof ae=="string")return Z.createHash(K).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===Q?Z.createHash(K).update(ie(ae)).digest("hex"):k(ae)}},ee=function(k,I){return function(ie,Z){return new me(ie,I,!0).update(Z)[k]()}},ne=function(k){var I=ee("hex",k);I.create=function(Q){return new me(Q,k)},I.update=function(Q,K){return I.create(Q).update(K)};for(var ie=0;ie<w.length;++ie){var Z=w[ie];I[Z]=ee(Z,k)}return I};function W(k,I){I?(j[0]=j[16]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=j[9]=j[10]=j[11]=j[12]=j[13]=j[14]=j[15]=0,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=k}function me(k,I,ie){var Z,Q=typeof k;if(Q==="string"){var K,ae=[],re=k.length,qe=0;for(Z=0;Z<re;++Z)(K=k.charCodeAt(Z))<128?ae[qe++]=K:K<2048?(ae[qe++]=192|K>>>6,ae[qe++]=128|63&K):K<55296||K>=57344?(ae[qe++]=224|K>>>12,ae[qe++]=128|K>>>6&63,ae[qe++]=128|63&K):(K=65536+((1023&K)<<10|1023&k.charCodeAt(++Z)),ae[qe++]=240|K>>>18,ae[qe++]=128|K>>>12&63,ae[qe++]=128|K>>>6&63,ae[qe++]=128|63&K);k=ae}else{if(Q!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r)}k.length>64&&(k=new W(I,!0).update(k).array());var Ge=[],Le=[];for(Z=0;Z<64;++Z){var Y=k[Z]||0;Ge[Z]=92^Y,Le[Z]=54^Y}W.call(this,I,ie),this.update(Le),this.oKeyPad=Ge,this.inner=!0,this.sharedMemory=ie}W.prototype.update=function(k){if(!this.finalized){var I,ie=typeof k;if(ie!=="string"){if(ie!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r);I=!0}for(var Z,Q,K=0,ae=k.length,re=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,re[0]=this.block,this.block=re[16]=re[1]=re[2]=re[3]=re[4]=re[5]=re[6]=re[7]=re[8]=re[9]=re[10]=re[11]=re[12]=re[13]=re[14]=re[15]=0),I)for(Q=this.start;K<ae&&Q<64;++K)re[Q>>>2]|=k[K]<<y[3&Q++];else for(Q=this.start;K<ae&&Q<64;++K)(Z=k.charCodeAt(K))<128?re[Q>>>2]|=Z<<y[3&Q++]:Z<2048?(re[Q>>>2]|=(192|Z>>>6)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]):Z<55296||Z>=57344?(re[Q>>>2]|=(224|Z>>>12)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>6&63)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]):(Z=65536+((1023&Z)<<10|1023&k.charCodeAt(++K)),re[Q>>>2]|=(240|Z>>>18)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>12&63)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>6&63)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]);this.lastByteIndex=Q,this.bytes+=Q-this.start,Q>=64?(this.block=re[16],this.start=Q-64,this.hash(),this.hashed=!0):this.start=Q}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},W.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,I=this.lastByteIndex;k[16]=this.block,k[I>>>2]|=g[3&I],this.block=k[16],I>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},W.prototype.hash=function(){var k,I,ie,Z,Q,K,ae,re,qe,Ge=this.h0,Le=this.h1,Y=this.h2,te=this.h3,he=this.h4,ve=this.h5,ye=this.h6,je=this.h7,_e=this.blocks;for(k=16;k<64;++k)I=((Q=_e[k-15])>>>7|Q<<25)^(Q>>>18|Q<<14)^Q>>>3,ie=((Q=_e[k-2])>>>17|Q<<15)^(Q>>>19|Q<<13)^Q>>>10,_e[k]=_e[k-16]+I+_e[k-7]+ie|0;for(qe=Le&Y,k=0;k<64;k+=4)this.first?(this.is224?(K=300032,je=(Q=_e[0]-1413257819)-150054599|0,te=Q+24177077|0):(K=704751109,je=(Q=_e[0]-210244248)-1521486534|0,te=Q+143694565|0),this.first=!1):(I=(Ge>>>2|Ge<<30)^(Ge>>>13|Ge<<19)^(Ge>>>22|Ge<<10),Z=(K=Ge&Le)^Ge&Y^qe,je=te+(Q=je+(ie=(he>>>6|he<<26)^(he>>>11|he<<21)^(he>>>25|he<<7))+(he&ve^~he&ye)+A[k]+_e[k])|0,te=Q+(I+Z)|0),I=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),Z=(ae=te&Ge)^te&Le^K,ye=Y+(Q=ye+(ie=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&he^~je&ve)+A[k+1]+_e[k+1])|0,I=((Y=Q+(I+Z)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),Z=(re=Y&te)^Y&Ge^ae,ve=Le+(Q=ve+(ie=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&je^~ye&he)+A[k+2]+_e[k+2])|0,I=((Le=Q+(I+Z)|0)>>>2|Le<<30)^(Le>>>13|Le<<19)^(Le>>>22|Le<<10),Z=(qe=Le&Y)^Le&te^re,he=Ge+(Q=he+(ie=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&ye^~ve&je)+A[k+3]+_e[k+3])|0,Ge=Q+(I+Z)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Ge|0,this.h1=this.h1+Le|0,this.h2=this.h2+Y|0,this.h3=this.h3+te|0,this.h4=this.h4+he|0,this.h5=this.h5+ve|0,this.h6=this.h6+ye|0,this.h7=this.h7+je|0},W.prototype.hex=function(){this.finalize();var k=this.h0,I=this.h1,ie=this.h2,Z=this.h3,Q=this.h4,K=this.h5,ae=this.h6,re=this.h7,qe=d[k>>>28&15]+d[k>>>24&15]+d[k>>>20&15]+d[k>>>16&15]+d[k>>>12&15]+d[k>>>8&15]+d[k>>>4&15]+d[15&k]+d[I>>>28&15]+d[I>>>24&15]+d[I>>>20&15]+d[I>>>16&15]+d[I>>>12&15]+d[I>>>8&15]+d[I>>>4&15]+d[15&I]+d[ie>>>28&15]+d[ie>>>24&15]+d[ie>>>20&15]+d[ie>>>16&15]+d[ie>>>12&15]+d[ie>>>8&15]+d[ie>>>4&15]+d[15&ie]+d[Z>>>28&15]+d[Z>>>24&15]+d[Z>>>20&15]+d[Z>>>16&15]+d[Z>>>12&15]+d[Z>>>8&15]+d[Z>>>4&15]+d[15&Z]+d[Q>>>28&15]+d[Q>>>24&15]+d[Q>>>20&15]+d[Q>>>16&15]+d[Q>>>12&15]+d[Q>>>8&15]+d[Q>>>4&15]+d[15&Q]+d[K>>>28&15]+d[K>>>24&15]+d[K>>>20&15]+d[K>>>16&15]+d[K>>>12&15]+d[K>>>8&15]+d[K>>>4&15]+d[15&K]+d[ae>>>28&15]+d[ae>>>24&15]+d[ae>>>20&15]+d[ae>>>16&15]+d[ae>>>12&15]+d[ae>>>8&15]+d[ae>>>4&15]+d[15&ae];return this.is224||(qe+=d[re>>>28&15]+d[re>>>24&15]+d[re>>>20&15]+d[re>>>16&15]+d[re>>>12&15]+d[re>>>8&15]+d[re>>>4&15]+d[15&re]),qe},W.prototype.toString=W.prototype.hex,W.prototype.digest=function(){this.finalize();var k=this.h0,I=this.h1,ie=this.h2,Z=this.h3,Q=this.h4,K=this.h5,ae=this.h6,re=this.h7,qe=[k>>>24&255,k>>>16&255,k>>>8&255,255&k,I>>>24&255,I>>>16&255,I>>>8&255,255&I,ie>>>24&255,ie>>>16&255,ie>>>8&255,255&ie,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q,K>>>24&255,K>>>16&255,K>>>8&255,255&K,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||qe.push(re>>>24&255,re>>>16&255,re>>>8&255,255&re),qe},W.prototype.array=W.prototype.digest,W.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),I=new DataView(k);return I.setUint32(0,this.h0),I.setUint32(4,this.h1),I.setUint32(8,this.h2),I.setUint32(12,this.h3),I.setUint32(16,this.h4),I.setUint32(20,this.h5),I.setUint32(24,this.h6),this.is224||I.setUint32(28,this.h7),k},me.prototype=new W,me.prototype.finalize=function(){if(W.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();W.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),W.prototype.finalize.call(this)}};var be=R();be.sha256=be,be.sha224=R(!0),be.sha256.hmac=ne(),be.sha224.hmac=ne(!0),f?of.exports=be:(s.sha256=be.sha256,s.sha224=be.sha224)})();Hc.exports;Hc.exports.sha224;var p0=Hc.exports.sha256;function Tf(r){return Ov(r)}function _v(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function wv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Sv(r){return _v(r)?"hex":wv(r)?"b64":""}function Ev(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function Av(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Ov(r){switch(Sv(r)){case"hex":return Ev(r);case"b64":return Av(r)}return null}function jv(r,n){const s=typeof r=="string"?Tf(r):r,a=typeof n=="string"?Tf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let c=0;c<s.length;c++)if(s[c]!==a[c])return!1;return!0}class gg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Is.next(),a&&(this.ctx=new Error)}}class Tv extends gg{constructor(s,a,c={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=c,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof c.maxMessages=="number"&&c.maxMessages>0?c.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},c.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
33
33
 
34
34
  ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===jn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===jn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===jn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class yg extends gg{constructor(s,a,c={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=wr(c.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
35
 
36
- ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||oe.errorForCode(se.Cancelled))}}const Cv="$JS.API";function kv(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Bc({apiPrefix:Cv,timeout:5e3},r)}class Ha{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=kv(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Tn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let c=tn;s&&(c=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=Ff();for(let d=0;d<f;d++)try{const g=await this.nc.request(n,c,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===se.Timeout)&&d+1<f)await Ar(h.backoff(d));else throw g}}async findStream(n){const s={subject:n},c=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!c.streams||c.streams.length!==1)throw new Error("no stream matches subject");return c.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const c=pg(a.error.code,a.error.description);if(c!==null)throw c.api_error=a.error,c}return s}}class Ta{constructor(n,s,a,c){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=c||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,c;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((c=n.streams)==null?void 0:c.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Si(r=""){const n=r.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${r}' is not a semver value`)}function Nf(r,n){return r.major<n.major?-1:r.major>n.major?1:r.minor<n.minor?-1:r.minor>n.minor?1:r.micro<n.micro?-1:r.micro>n.micro?1:0}var ze;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(ze||(ze={}));class Mv{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Si(n)),this.server=n,this.set(ze.JS_KV,"2.6.2"),this.set(ze.JS_OBJECTSTORE,"2.6.3"),this.set(ze.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ze.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ze.JS_ALLOW_DIRECT,"2.9.0"),this.set(ze.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ze.JS_SIMPLIFICATION,"2.9.4"),this.set(ze.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ze.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ze.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ze.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ze.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ze.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ze.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:Nf(this.server,Si(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Si(n)),Nf(this.server,n)>=0}}class kc extends Ha{constructor(n,s){super(n,s)}async add(n,s,a=Cc.Create){if(Mt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const c={};c.config=s,c.stream_name=n,c.action=a,c.config.durable_name&&br(c.config.durable_name);const f=this.nc;let{min:h,ok:d}=f.features.get(ze.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!d)throw new Error(`consumer 'name' requires server ${h}`);if(g)try{Lc("name",g)}catch(j){const z=j.message,R=z.indexOf("cannot contain");throw R!==-1?new Error(`consumer 'name' ${z.substring(R)}`):j}let y,A="";if(Array.isArray(s.filter_subjects)){const{min:j,ok:z}=f.features.get(ze.JS_MULTIPLE_CONSUMER_FILTER);if(!z)throw new Error(`consumer 'filter_subjects' requires server ${j}`);d=!1}if(s.metadata){const{min:j,ok:z}=f.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!z)throw new Error(`consumer 'metadata' requires server ${j}`)}if(d&&(A=s.name??s.durable_name??""),A!==""){let j=s.filter_subject??void 0;j===">"&&(j=void 0),y=j!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${A}.${j}`:`${this.prefix}.CONSUMER.CREATE.${n}.${A}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,c)}async update(n,s,a){const c=await this.info(n,s),f=a;return this.add(n,Object.assign(c.config,f),Cc.Update)}async info(n,s){return Mt(n),br(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),br(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=c=>c.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Ta(a,s,this)}pause(n,s,a){const c=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(c,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function dr(r,n,s=!1){if(s===!0&&!r)throw oe.errorForCode(se.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw oe.errorForCode(se.ApiError,new Error(`${n} is not a function`))}class Rv extends _t{constructor(s,a,c){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");dr(c.adapter,"adapter",!0),this.adapter=c.adapter,c.callback&&dr(c.callback,"callback"),this.noIterator=typeof c.callback=="function",c.ingestionFilterFn&&(dr(c.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=c.ingestionFilterFn),c.protocolFilterFn&&(dr(c.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=c.protocolFilterFn),c.dispatchedFn&&(dr(c.dispatchedFn,"dispatchedFn"),this.dispatchedFn=c.dispatchedFn),c.cleanupFn&&dr(c.cleanupFn,"cleanupFn");let f=(A,w)=>{this.callback(A,w)};if(c.callback){const A=c.callback;f=(w,j)=>{const[z,R]=this.adapter(w,j);if(z){A(z,null);return}const{ingest:H}=this.ingestionFilterFn?this.ingestionFilterFn(R,this):{ingest:!0};H&&(!this.protocolFilterFn||this.protocolFilterFn(R))&&(A(z,R),this.dispatchedFn&&R&&this.dispatchedFn(R))}}const{max:h,queue:d,timeout:g}=c,y={queue:d,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),c.cleanupFn&&(this.sub.cleanupFn=c.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async A=>{await A.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[c,f]=this.adapter(s,a);c&&this.stop(c),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let en;function Dv(r){en=r}function bg(){return en!==void 0&&en.defaultPort!==void 0?en.defaultPort:4222}function uf(){return en!==void 0&&en.urlParseFn?en.urlParseFn:void 0}function zv(){if(!en||typeof en.factory!="function")throw new Error("transport fn is not set");return en.factory()}function Cf(){return en!==void 0&&en.dnsResolveFn?en.dnsResolveFn:void 0}const xc=`\r
37
- `,Mc=Er.fromAscii(xc),qv=new Uint8Array(Mc)[0],Uv=new Uint8Array(Mc)[1];function Bv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===qv&&r[s]===Uv)return s+1}return 0}function Lv(r){const n=Bv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return Wt.decode(a)}return""}const Hv=4,xg=48,Pv=65,Yv=97;function $v(r,n,s,a){const c=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{c[d]=h}),c[12]=r,c[13]=n,c[14]=s,c[15]=a,c}function kf(r){return Gv(r)!==void 0}function Gv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return vg(r);case":":return Vv(r)}}function vg(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c,ok:f}=Fv(r);if(!f||a>255)return;r=r.substring(c),n[s]=a}return $v(n[0],n[1],n[2],n[3])}function Vv(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:c,c:f,ok:h}=Jv(r);if(!h||c>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=vg(r);if(d===void 0)return;n[a]=d[12],n[a+1]=d[13],n[a+2]=d[14],n[a+3]=d[15],r="",a+=Hv;break}if(n[a]=c>>8,n[a+1]=c,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const c=16-a;for(let f=a-1;f>=s;f--)n[f+c]=n[f];for(let f=s+c-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function Fv(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-xg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function Jv(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-xg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Yv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Pv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function Qv(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Mf(r){return!Qv(r)}function Xv(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function Iv(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=Xv(r),Mf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Mf(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",c=new URL(`${a}://${r}`);c.port=`${s}`;let f=c.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:c.host,hostname:f,port:s}}class Ma{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=Iv(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(kf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const c of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Mf(c)?"["+c+"]":c}`);h.port=`${this.port}`;const d=new Ma(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&dg(s),this.resolves=s,s}}class Kv{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=uf();n&&(n.forEach(c=>{c=a?a(c):c,this.servers.push(new Ma(c))}),this.randomize&&(this.servers=dg(this.servers))),this.servers.length===0&&this.addServer(`${wf}:${bg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();kf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=uf();n=a?a(n):n;const c=new Ma(n,s);kf(c.hostname)&&(c.tlsName=this.tlsName),this.servers.push(c)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let c=[];const f=uf(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Ma(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const A=g.listen;g.gossiped&&this.currentServer.listen!==A&&h.get(A)===void 0&&d.push(y),h.delete(A)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);c=c.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:c}}}class Zv{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${cs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(c=>{c.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const c=this.all().find(f=>f.requestSubject===a.subject);if(c)return c.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const c=this.get(a);c&&(n===null&&s.headers&&(n=mg(s)),c.resolver(n,s))}}}close(){const n=oe.errorForCode(se.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class Wv{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:yr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class e1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function t1(r,n="Assertion failed."){if(!r)throw new e1(n)}const g0=32*1024,ff=2**32-2;function fc(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class hf{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){t1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=fc(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Oi.encode(n))}write(n){const s=this._grow(n.byteLength);return fc(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const c=this.capacity;if(n<=Math.floor(c/2)-s)fc(this._buf.subarray(this._off),this._buf);else{if(c+n>ff)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*c+n,ff));fc(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,ff)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(g0);for(;;){const c=this.capacity-this.length<g0,f=c?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;c?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function y0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const n1=48;class b0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=le.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case le.OP_START:switch(a){case ce.M:case ce.m:this.state=le.OP_M,this.hdr=-1,this.ma=y0();break;case ce.H:case ce.h:this.state=le.OP_H,this.hdr=0,this.ma=y0();break;case ce.P:case ce.p:this.state=le.OP_P;break;case ce.PLUS:this.state=le.OP_PLUS;break;case ce.MINUS:this.state=le.OP_MINUS;break;case ce.I:case ce.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case ce.M:case ce.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case ce.S:case ce.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case ce.G:case ce.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{const c=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(c),this.drop=0,this.as=s+1,this.state=le.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case le.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const c=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:c}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let c=this.ma.size-this.msgBuf.length;const f=n.length-s;f<c&&(c=f),c>0?(this.msgBuf.write(n.subarray(s,s+c)),s=s+c-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END);break;case le.MSG_END:switch(a){case ce.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case ce.O:case ce.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case ce.K:case ce.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case ce.E:case ce.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case ce.R:case ce.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case ce.R:case ce.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let c;this.argBuf?(c=this.argBuf.bytes(),this.argBuf=void 0):c=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:c}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case le.OP_P:switch(a){case ce.I:case ce.i:this.state=le.OP_PI;break;case ce.O:case ce.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case ce.N:case ce.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case ce.G:case ce.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case ce.N:case ce.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case ce.G:case ce.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case ce.N:case ce.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case ce.F:case ce.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case ce.O:case ce.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let c;this.argBuf?(c=this.argBuf.bytes(),this.argBuf=void 0):c=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:c}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===le.MSG_ARG||this.state===le.MINUS_ERR_ARG||this.state===le.INFO_ARG)&&!this.argBuf&&(this.argBuf=new hf(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new hf(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new hf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let c=0;c<n.length;c++)switch(n[c]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,c)),a=-1);break;default:a<0&&(a=c)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${Wt.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let c=0;c<n.length;c++)switch(n[c]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,c)),a=-1);break;default:a<0&&(a=c)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-n1)}return s}}var le;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(le||(le={}));var ce;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(ce||(ce={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},c=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),d=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),A=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),z=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function R(x,S){return x<<S|x>>>32-S}function H(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function ee(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],E=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,E)}function ne(x,S,_){var E;for(E=0;E<4;E++)x[S+E]=_&255,_>>>=8}function W(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,E,T){var D,F=0;for(D=0;D<T;D++)F|=x[S+D]^_[E+D];return(1&F-1>>>8)-1}function be(x,S,_,E){return me(x,S,_,E,16)}function k(x,S,_,E){return me(x,S,_,E,32)}function I(x,S,_,E,T){var D=new Uint32Array(16),F=new Uint32Array(16),X=new Uint32Array(16),L=new Uint32Array(4),V,ue,Oe;for(V=0;V<4;V++)F[5*V]=H(E,4*V),F[1+V]=H(_,4*V),F[6+V]=H(S,4*V),F[11+V]=H(_,16+4*V);for(V=0;V<16;V++)X[V]=F[V];for(V=0;V<20;V++){for(ue=0;ue<4;ue++){for(Oe=0;Oe<4;Oe++)L[Oe]=F[(5*ue+4*Oe)%16];for(L[1]^=R(L[0]+L[3]|0,7),L[2]^=R(L[1]+L[0]|0,9),L[3]^=R(L[2]+L[1]|0,13),L[0]^=R(L[3]+L[2]|0,18),Oe=0;Oe<4;Oe++)D[4*ue+(ue+Oe)%4]=L[Oe]}for(Oe=0;Oe<16;Oe++)F[Oe]=D[Oe]}if(T){for(V=0;V<16;V++)F[V]=F[V]+X[V]|0;for(V=0;V<4;V++)F[5*V]=F[5*V]-H(E,4*V)|0,F[6+V]=F[6+V]-H(S,4*V)|0;for(V=0;V<4;V++)ne(x,4*V,F[5*V]),ne(x,16+4*V,F[6+V])}else for(V=0;V<16;V++)ne(x,4*V,F[V]+X[V]|0)}function ie(x,S,_,E){return I(x,S,_,E,!1),0}function Z(x,S,_,E){return I(x,S,_,E,!0),0}var Q=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,E,T,D,F){var X=new Uint8Array(16),L=new Uint8Array(64),V,ue;if(!T)return 0;for(ue=0;ue<16;ue++)X[ue]=0;for(ue=0;ue<8;ue++)X[ue]=D[ue];for(;T>=64;){for(ie(L,X,F,Q),ue=0;ue<64;ue++)x[S+ue]=(_?_[E+ue]:0)^L[ue];for(V=1,ue=8;ue<16;ue++)V=V+(X[ue]&255)|0,X[ue]=V&255,V>>>=8;T-=64,S+=64,_&&(E+=64)}if(T>0)for(ie(L,X,F,Q),ue=0;ue<T;ue++)x[S+ue]=(_?_[E+ue]:0)^L[ue];return 0}function ae(x,S,_,E,T){return K(x,S,null,0,_,E,T)}function re(x,S,_,E,T){var D=new Uint8Array(32);return Z(D,E,T,Q),ae(x,S,_,E.subarray(16),D)}function qe(x,S,_,E,T,D,F){var X=new Uint8Array(32);return Z(X,D,F,Q),K(x,S,_,E,T,D.subarray(16),X)}function Ge(x,S){var _,E=0;for(_=0;_<17;_++)E=E+(x[_]+S[_]|0)|0,x[_]=E&255,E>>>=8}var Le=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(x,S,_,E,T,D){var F,X,L,V,ue=new Uint32Array(17),Oe=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),_n=new Uint32Array(17);for(L=0;L<17;L++)Oe[L]=Ke[L]=0;for(L=0;L<16;L++)Oe[L]=D[L];for(Oe[3]&=15,Oe[4]&=252,Oe[7]&=15,Oe[8]&=252,Oe[11]&=15,Oe[12]&=252,Oe[15]&=15;T>0;){for(L=0;L<17;L++)Ct[L]=0;for(L=0;L<16&&L<T;++L)Ct[L]=_[E+L];for(Ct[L]=1,E+=L,T-=L,Ge(Ke,Ct),X=0;X<17;X++)for(ue[X]=0,L=0;L<17;L++)ue[X]=ue[X]+Ke[L]*(L<=X?Oe[X-L]:320*Oe[X+17-L]|0)|0|0;for(X=0;X<17;X++)Ke[X]=ue[X];for(V=0,L=0;L<16;L++)V=V+Ke[L]|0,Ke[L]=V&255,V>>>=8;for(V=V+Ke[16]|0,Ke[16]=V&3,V=5*(V>>>2)|0,L=0;L<16;L++)V=V+Ke[L]|0,Ke[L]=V&255,V>>>=8;V=V+Ke[16]|0,Ke[16]=V}for(L=0;L<17;L++)_n[L]=Ke[L];for(Ge(Ke,Le),F=-(Ke[16]>>>7)|0,L=0;L<17;L++)Ke[L]^=F&(_n[L]^Ke[L]);for(L=0;L<16;L++)Ct[L]=D[L+16];for(Ct[16]=0,Ge(Ke,Ct),L=0;L<16;L++)x[S+L]=Ke[L];return 0}function te(x,S,_,E,T,D){var F=new Uint8Array(16);return Y(F,0,_,E,T,D),be(x,S,F,0)}function he(x,S,_,E,T){var D;if(_<32)return-1;for(qe(x,0,S,0,_,E,T),Y(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function ve(x,S,_,E,T){var D,F=new Uint8Array(32);if(_<32||(re(F,0,32,E,T),te(S,16,S,32,_-32,F)!==0))return-1;for(qe(x,0,S,0,_,E,T),D=0;D<32;D++)x[D]=0;return 0}function ye(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function je(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function _e(x,S,_){for(var E,T=~(_-1),D=0;D<16;D++)E=T&(x[D]^S[D]),x[D]^=E,S[D]^=E}function Te(x,S){var _,E,T,D=s(),F=s();for(_=0;_<16;_++)F[_]=S[_];for(je(F),je(F),je(F),E=0;E<2;E++){for(D[0]=F[0]-65517,_=1;_<15;_++)D[_]=F[_]-65535-(D[_-1]>>16&1),D[_-1]&=65535;D[15]=F[15]-32767-(D[14]>>16&1),T=D[15]>>16&1,D[14]&=65535,_e(F,D,1-T)}for(_=0;_<16;_++)x[2*_]=F[_]&255,x[2*_+1]=F[_]>>8}function lt(x,S){var _=new Uint8Array(32),E=new Uint8Array(32);return Te(_,x),Te(E,S),k(_,0,E,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function sn(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function Ot(x,S,_){var E;for(E=0;E<16;E++)x[E]=S[E]+_[E]|0}function jt(x,S,_){var E;for(E=0;E<16;E++)x[E]=S[E]-_[E]|0}function we(x,S,_){var E,T,D=new Float64Array(31);for(E=0;E<31;E++)D[E]=0;for(E=0;E<16;E++)for(T=0;T<16;T++)D[E+T]+=S[E]*_[T];for(E=0;E<15;E++)D[E]+=38*D[E+16];for(E=0;E<16;E++)x[E]=D[E];je(x),je(x)}function Tt(x,S){we(x,S,S)}function Zs(x,S){var _=s(),E;for(E=0;E<16;E++)_[E]=S[E];for(E=253;E>=0;E--)Tt(_,_),E!==2&&E!==4&&we(_,_,S);for(E=0;E<16;E++)x[E]=_[E]}function ji(x,S){var _=s(),E;for(E=0;E<16;E++)_[E]=S[E];for(E=250;E>=0;E--)Tt(_,_),E!==1&&we(_,_,S);for(E=0;E<16;E++)x[E]=_[E]}function Ws(x,S,_){var E=new Uint8Array(32),T=new Float64Array(80),D,F,X=s(),L=s(),V=s(),ue=s(),Oe=s(),Ke=s();for(F=0;F<31;F++)E[F]=S[F];for(E[31]=S[31]&127|64,E[0]&=248,sn(T,_),F=0;F<16;F++)L[F]=T[F],ue[F]=X[F]=V[F]=0;for(X[0]=ue[0]=1,F=254;F>=0;--F)D=E[F>>>3]>>>(F&7)&1,_e(X,L,D),_e(V,ue,D),Ot(Oe,X,V),jt(X,X,V),Ot(V,L,ue),jt(L,L,ue),Tt(ue,Oe),Tt(Ke,X),we(X,V,X),we(V,L,Oe),Ot(Oe,X,V),jt(X,X,V),Tt(L,X),jt(V,ue,Ke),we(X,V,g),Ot(X,X,ue),we(V,V,X),we(X,ue,Ke),we(ue,L,T),Tt(L,Oe),_e(X,L,D),_e(V,ue,D);for(F=0;F<16;F++)T[F+16]=X[F],T[F+32]=V[F],T[F+48]=L[F],T[F+64]=ue[F];var Ct=T.subarray(32),_n=T.subarray(16);return Zs(Ct,Ct),we(_n,_n,Ct),Te(x,_n),0}function rn(x,S){return Ws(x,S,f)}function Ti(x,S){return a(S,32),rn(x,S)}function hs(x,S,_){var E=new Uint8Array(32);return Ws(E,_,S),Z(x,c,E,Q)}var $a=he,Ga=ve;function jr(x,S,_,E,T,D){var F=new Uint8Array(32);return hs(F,T,D),$a(x,S,_,E,F)}function Tr(x,S,_,E,T,D){var F=new Uint8Array(32);return hs(F,T,D),Ga(x,S,_,E,F)}function Hn(){var x=0,S=0,_=0,E=0,T=65535,D,F,X;for(X=0;X<arguments.length;X++)D=arguments[X].lo,F=arguments[X].hi,x+=D&T,S+=D>>>16,_+=F&T,E+=F>>>16;return S+=x>>>16,_+=S>>>16,E+=_>>>16,new n(_&T|E<<16,x&T|S<<16)}function Va(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ni(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,E,T=32-S;return S<32?(_=x.hi>>>S|x.lo<<T,E=x.lo>>>S|x.hi<<T):S<64&&(_=x.lo>>>S|x.hi<<T,E=x.hi>>>S|x.lo<<T),new n(_,E)}function Fc(x,S,_){var E=x.hi&S.hi^~x.hi&_.hi,T=x.lo&S.lo^~x.lo&_.lo;return new n(E,T)}function Fa(x,S,_){var E=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,T=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(E,T)}function Ja(x){return Ni(et(x,28),et(x,34),et(x,39))}function Ci(x){return Ni(et(x,14),et(x,18),et(x,41))}function Jc(x){return Ni(et(x,1),et(x,8),Va(x,7))}function Qa(x){return Ni(et(x,19),et(x,61),Va(x,6))}var Qc=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Xa(x,S,_){var E=[],T=[],D=[],F=[],X,L,V;for(L=0;L<8;L++)E[L]=D[L]=ee(x,8*L);for(var ue=0;_>=128;){for(L=0;L<16;L++)F[L]=ee(S,8*L+ue);for(L=0;L<80;L++){for(V=0;V<8;V++)T[V]=D[V];for(X=Hn(D[7],Ci(D[4]),Fc(D[4],D[5],D[6]),Qc[L],F[L%16]),T[7]=Hn(X,Ja(D[0]),Fa(D[0],D[1],D[2])),T[3]=Hn(T[3],X),V=0;V<8;V++)D[(V+1)%8]=T[V];if(L%16===15)for(V=0;V<16;V++)F[V]=Hn(F[V],F[(V+9)%16],Jc(F[(V+1)%16]),Qa(F[(V+14)%16]))}for(L=0;L<8;L++)D[L]=Hn(D[L],E[L]),E[L]=D[L];ue+=128,_-=128}for(L=0;L<8;L++)W(x,8*L,E[L]);return _}var ei=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ct(x,S,_){var E=new Uint8Array(64),T=new Uint8Array(256),D,F=_;for(D=0;D<64;D++)E[D]=ei[D];for(Xa(E,S,_),_%=128,D=0;D<256;D++)T[D]=0;for(D=0;D<_;D++)T[D]=S[F-_+D];for(T[_]=128,_=256-128*(_<112?1:0),T[_-9]=0,W(T,_-8,new n(F/536870912|0,F<<3)),Xa(E,T,_),D=0;D<64;D++)x[D]=E[D];return 0}function Yt(x,S){var _=s(),E=s(),T=s(),D=s(),F=s(),X=s(),L=s(),V=s(),ue=s();jt(_,x[1],x[0]),jt(ue,S[1],S[0]),we(_,_,ue),Ot(E,x[0],x[1]),Ot(ue,S[0],S[1]),we(E,E,ue),we(T,x[3],S[3]),we(T,T,A),we(D,x[2],S[2]),Ot(D,D,D),jt(F,E,_),jt(X,D,T),Ot(L,D,T),Ot(V,E,_),we(x[0],F,X),we(x[1],V,L),we(x[2],L,X),we(x[3],F,V)}function Nt(x,S,_){var E;for(E=0;E<4;E++)_e(x[E],S[E],_)}function Nr(x,S){var _=s(),E=s(),T=s();Zs(T,S[2]),we(_,S[0],T),we(E,S[1],T),Te(x,E),x[31]^=Pt(_)<<7}function Cr(x,S,_){var E,T;for(ye(x[0],h),ye(x[1],d),ye(x[2],d),ye(x[3],h),T=255;T>=0;--T)E=_[T/8|0]>>(T&7)&1,Nt(x,S,E),Yt(S,x),Yt(x,x),Nt(x,S,E)}function ki(x,S){var _=[s(),s(),s(),s()];ye(_[0],w),ye(_[1],j),ye(_[2],d),we(_[3],w,j),Cr(x,_,S)}function ds(x,S,_){var E=new Uint8Array(64),T=[s(),s(),s(),s()],D;for(_||a(S,32),ct(E,S,32),E[0]&=248,E[31]&=127,E[31]|=64,ki(T,E),Nr(x,T),D=0;D<32;D++)S[D+32]=x[D];return 0}var Pn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ms(x,S){var _,E,T,D;for(E=63;E>=32;--E){for(_=0,T=E-32,D=E-12;T<D;++T)S[T]+=_-16*S[E]*Pn[T-(E-32)],_=Math.floor((S[T]+128)/256),S[T]-=_*256;S[T]+=_,S[E]=0}for(_=0,T=0;T<32;T++)S[T]+=_-(S[31]>>4)*Pn[T],_=S[T]>>8,S[T]&=255;for(T=0;T<32;T++)S[T]-=_*Pn[T];for(E=0;E<32;E++)S[E+1]+=S[E]>>8,x[E]=S[E]&255}function xn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;ms(x,S)}function ti(x,S,_,E){var T=new Uint8Array(64),D=new Uint8Array(64),F=new Uint8Array(64),X,L,V=new Float64Array(64),ue=[s(),s(),s(),s()];ct(T,E,32),T[0]&=248,T[31]&=127,T[31]|=64;var Oe=_+64;for(X=0;X<_;X++)x[64+X]=S[X];for(X=0;X<32;X++)x[32+X]=T[32+X];for(ct(F,x.subarray(32),_+32),xn(F),ki(ue,F),Nr(x,ue),X=32;X<64;X++)x[X]=E[X];for(ct(D,x,_+64),xn(D),X=0;X<64;X++)V[X]=0;for(X=0;X<32;X++)V[X]=F[X];for(X=0;X<32;X++)for(L=0;L<32;L++)V[X+L]+=D[X]*T[L];return ms(x.subarray(32),V),Oe}function ni(x,S){var _=s(),E=s(),T=s(),D=s(),F=s(),X=s(),L=s();return ye(x[2],d),sn(x[1],S),Tt(T,x[1]),we(D,T,y),jt(T,T,x[2]),Ot(D,x[2],D),Tt(F,D),Tt(X,F),we(L,X,F),we(_,L,T),we(_,_,D),ji(_,_),we(_,_,T),we(_,_,D),we(_,_,D),we(x[0],_,D),Tt(E,x[0]),we(E,E,D),lt(E,T)&&we(x[0],x[0],z),Tt(E,x[0]),we(E,E,D),lt(E,T)?-1:(Pt(x[0])===S[31]>>7&&jt(x[0],h,x[0]),we(x[3],x[0],x[1]),0)}function kr(x,S,_,E){var T,D=new Uint8Array(32),F=new Uint8Array(64),X=[s(),s(),s(),s()],L=[s(),s(),s(),s()];if(_<64||ni(L,E))return-1;for(T=0;T<_;T++)x[T]=S[T];for(T=0;T<32;T++)x[T+32]=E[T];if(ct(F,x,_),xn(F),Cr(X,L,F),ki(L,S.subarray(32)),Yt(X,L),Nr(D,X),_-=64,k(S,0,D,0)){for(T=0;T<_;T++)x[T]=0;return-1}for(T=0;T<_;T++)x[T]=S[T+64];return _}var Mi=32,ps=24,vn=32,gs=16,ys=32,si=32,bs=32,Yn=32,ii=32,Mr=ps,Ia=vn,Cn=gs,Qe=64,it=32,$t=64,ri=32,Rr=64;r.lowlevel={crypto_core_hsalsa20:Z,crypto_stream_xor:qe,crypto_stream:re,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:Y,crypto_onetimeauth_verify:te,crypto_verify_16:be,crypto_verify_32:k,crypto_secretbox:he,crypto_secretbox_open:ve,crypto_scalarmult:Ws,crypto_scalarmult_base:rn,crypto_box_beforenm:hs,crypto_box_afternm:$a,crypto_box:jr,crypto_box_open:Tr,crypto_box_keypair:Ti,crypto_hash:ct,crypto_sign:ti,crypto_sign_keypair:ds,crypto_sign_open:kr,crypto_secretbox_KEYBYTES:Mi,crypto_secretbox_NONCEBYTES:ps,crypto_secretbox_ZEROBYTES:vn,crypto_secretbox_BOXZEROBYTES:gs,crypto_scalarmult_BYTES:ys,crypto_scalarmult_SCALARBYTES:si,crypto_box_PUBLICKEYBYTES:bs,crypto_box_SECRETKEYBYTES:Yn,crypto_box_BEFORENMBYTES:ii,crypto_box_NONCEBYTES:Mr,crypto_box_ZEROBYTES:Ia,crypto_box_BOXZEROBYTES:Cn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:$t,crypto_sign_SEEDBYTES:ri,crypto_hash_BYTES:Rr,gf:s,D:y,L:Pn,pack25519:Te,unpack25519:sn,M:we,A:Ot,S:Tt,Z:jt,pow2523:ji,add:Yt,set25519:ye,modL:ms,scalarmult:Cr,scalarbase:ki};function Ka(x,S){if(x.length!==Mi)throw new Error("bad key size");if(S.length!==ps)throw new Error("bad nonce size")}function Za(x,S){if(x.length!==bs)throw new Error("bad public key size");if(S.length!==Yn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ri(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),Ka(_,S);for(var E=new Uint8Array(vn+x.length),T=new Uint8Array(E.length),D=0;D<x.length;D++)E[D+vn]=x[D];return he(T,E,E.length,S,_),T.subarray(gs)},r.secretbox.open=function(x,S,_){yt(x,S,_),Ka(_,S);for(var E=new Uint8Array(gs+x.length),T=new Uint8Array(E.length),D=0;D<x.length;D++)E[D+gs]=x[D];return E.length<32||ve(T,E,E.length,S,_)!==0?null:T.subarray(vn)},r.secretbox.keyLength=Mi,r.secretbox.nonceLength=ps,r.secretbox.overheadLength=gs,r.scalarMult=function(x,S){if(yt(x,S),x.length!==si)throw new Error("bad n size");if(S.length!==ys)throw new Error("bad p size");var _=new Uint8Array(ys);return Ws(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==si)throw new Error("bad n size");var S=new Uint8Array(ys);return rn(S,x),S},r.scalarMult.scalarLength=si,r.scalarMult.groupElementLength=ys,r.box=function(x,S,_,E){var T=r.box.before(_,E);return r.secretbox(x,S,T)},r.box.before=function(x,S){yt(x,S),Za(x,S);var _=new Uint8Array(ii);return hs(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,E){var T=r.box.before(_,E);return r.secretbox.open(x,S,T)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(bs),S=new Uint8Array(Yn);return Ti(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yn)throw new Error("bad secret key size");var S=new Uint8Array(bs);return rn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=bs,r.box.secretKeyLength=Yn,r.box.sharedKeyLength=ii,r.box.nonceLength=Mr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==$t)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return ti(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),E=kr(_,x,x.length,S);if(E<0)return null;for(var T=new Uint8Array(E),D=0;D<T.length;D++)T[D]=_[D];return T},r.sign.detached=function(x,S){for(var _=r.sign(x,S),E=new Uint8Array(Qe),T=0;T<E.length;T++)E[T]=_[T];return E},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var E=new Uint8Array(Qe+x.length),T=new Uint8Array(Qe+x.length),D;for(D=0;D<Qe;D++)E[D]=S[D];for(D=0;D<x.length;D++)E[D+Qe]=x[D];return kr(T,E,E.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array($t);return ds(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==$t)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==ri)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array($t),E=0;E<32;E++)_[E]=x[E];return ds(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=$t,r.sign.seedLength=ri,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(Rr);return ct(S,x,x.length),S},r.hash.hashLength=Rr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,E){var T,D=new Uint8Array(E);for(T=0;T<E;T+=S)x.getRandomValues(D.subarray(T,T+Math.min(E-T,S)));for(T=0;T<E;T++)_[T]=D[T];Ri(D)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,E){var T,D=x.randomBytes(E);for(T=0;T<E;T++)_[T]=D[T];Ri(D)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const hc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;hc.sign.keyPair.fromSeed,hc.sign.detached,hc.sign.detached.verify,hc.randomBytes;var x0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(x0||(x0={}));var v0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(v0||(v0={}));function s1(r){return n=>{let s={};return r.forEach(a=>{const c=a(n)||{};s=Object.assign(s,c)}),s}}function i1(){return()=>{}}function r1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function a1(r){return()=>({auth_token:typeof r=="function"?r():r})}const _g=120*1e3,l1=2,wg=2*1e3;function c1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:_g,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:wg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function o1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(a1(r.token)),r.user&&n.push(r1(r.user,r.pass)),n.length===0?i1():s1(n)}function u1(r){const n=`${wf}:${bg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new oe("port and servers options are mutually exclusive",se.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${wf}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Bc(c1(),r);if(s.authenticator=o1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new oe(`${a} option should be a function`,se.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{cs(s.inboxPrefix)}catch(a){throw new oe(a.message,se.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Cf()=="function"),s.resolve&&typeof Cf()!="function")throw new oe("'resolve' is not supported on this client",se.InvalidOption);return s}function f1(r,n){const{proto:s,tls_required:a,tls_available:c}=r;if((s===void 0||s<1)&&n.noEcho)throw new oe("noEcho",se.ServerOptionNotAvailable);const f=a||c||!1;if(n.tls&&!f)throw new oe("tls",se.ServerOptionNotAvailable)}const h1=1024*32,d1=/^INFO\s+([^\r\n]+)\r\n/i,m1=Ca(`PONG\r
36
+ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||oe.errorForCode(se.Cancelled))}}const Nv="$JS.API";function Cv(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Bc({apiPrefix:Nv,timeout:5e3},r)}class Ha{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=Cv(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Tn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let c=tn;s&&(c=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=Ff();for(let d=0;d<f;d++)try{const g=await this.nc.request(n,c,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===se.Timeout)&&d+1<f)await Ar(h.backoff(d));else throw g}}async findStream(n){const s={subject:n},c=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!c.streams||c.streams.length!==1)throw new Error("no stream matches subject");return c.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const c=pg(a.error.code,a.error.description);if(c!==null)throw c.api_error=a.error,c}return s}}class Ta{constructor(n,s,a,c){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=c||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,c;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((c=n.streams)==null?void 0:c.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Si(r=""){const n=r.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${r}' is not a semver value`)}function Nf(r,n){return r.major<n.major?-1:r.major>n.major?1:r.minor<n.minor?-1:r.minor>n.minor?1:r.micro<n.micro?-1:r.micro>n.micro?1:0}var ze;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(ze||(ze={}));class kv{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Si(n)),this.server=n,this.set(ze.JS_KV,"2.6.2"),this.set(ze.JS_OBJECTSTORE,"2.6.3"),this.set(ze.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ze.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ze.JS_ALLOW_DIRECT,"2.9.0"),this.set(ze.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ze.JS_SIMPLIFICATION,"2.9.4"),this.set(ze.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ze.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ze.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ze.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ze.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ze.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ze.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:Nf(this.server,Si(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Si(n)),Nf(this.server,n)>=0}}class kc extends Ha{constructor(n,s){super(n,s)}async add(n,s,a=Cc.Create){if(Mt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const c={};c.config=s,c.stream_name=n,c.action=a,c.config.durable_name&&br(c.config.durable_name);const f=this.nc;let{min:h,ok:d}=f.features.get(ze.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!d)throw new Error(`consumer 'name' requires server ${h}`);if(g)try{Lc("name",g)}catch(j){const z=j.message,R=z.indexOf("cannot contain");throw R!==-1?new Error(`consumer 'name' ${z.substring(R)}`):j}let y,A="";if(Array.isArray(s.filter_subjects)){const{min:j,ok:z}=f.features.get(ze.JS_MULTIPLE_CONSUMER_FILTER);if(!z)throw new Error(`consumer 'filter_subjects' requires server ${j}`);d=!1}if(s.metadata){const{min:j,ok:z}=f.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!z)throw new Error(`consumer 'metadata' requires server ${j}`)}if(d&&(A=s.name??s.durable_name??""),A!==""){let j=s.filter_subject??void 0;j===">"&&(j=void 0),y=j!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${A}.${j}`:`${this.prefix}.CONSUMER.CREATE.${n}.${A}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,c)}async update(n,s,a){const c=await this.info(n,s),f=a;return this.add(n,Object.assign(c.config,f),Cc.Update)}async info(n,s){return Mt(n),br(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),br(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=c=>c.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Ta(a,s,this)}pause(n,s,a){const c=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(c,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function dr(r,n,s=!1){if(s===!0&&!r)throw oe.errorForCode(se.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw oe.errorForCode(se.ApiError,new Error(`${n} is not a function`))}class Mv extends _t{constructor(s,a,c){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");dr(c.adapter,"adapter",!0),this.adapter=c.adapter,c.callback&&dr(c.callback,"callback"),this.noIterator=typeof c.callback=="function",c.ingestionFilterFn&&(dr(c.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=c.ingestionFilterFn),c.protocolFilterFn&&(dr(c.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=c.protocolFilterFn),c.dispatchedFn&&(dr(c.dispatchedFn,"dispatchedFn"),this.dispatchedFn=c.dispatchedFn),c.cleanupFn&&dr(c.cleanupFn,"cleanupFn");let f=(A,w)=>{this.callback(A,w)};if(c.callback){const A=c.callback;f=(w,j)=>{const[z,R]=this.adapter(w,j);if(z){A(z,null);return}const{ingest:H}=this.ingestionFilterFn?this.ingestionFilterFn(R,this):{ingest:!0};H&&(!this.protocolFilterFn||this.protocolFilterFn(R))&&(A(z,R),this.dispatchedFn&&R&&this.dispatchedFn(R))}}const{max:h,queue:d,timeout:g}=c,y={queue:d,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),c.cleanupFn&&(this.sub.cleanupFn=c.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async A=>{await A.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[c,f]=this.adapter(s,a);c&&this.stop(c),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let en;function Rv(r){en=r}function bg(){return en!==void 0&&en.defaultPort!==void 0?en.defaultPort:4222}function uf(){return en!==void 0&&en.urlParseFn?en.urlParseFn:void 0}function Dv(){if(!en||typeof en.factory!="function")throw new Error("transport fn is not set");return en.factory()}function Cf(){return en!==void 0&&en.dnsResolveFn?en.dnsResolveFn:void 0}const xc=`\r
37
+ `,Mc=Er.fromAscii(xc),zv=new Uint8Array(Mc)[0],qv=new Uint8Array(Mc)[1];function Uv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===zv&&r[s]===qv)return s+1}return 0}function Bv(r){const n=Uv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return Wt.decode(a)}return""}const Lv=4,xg=48,Hv=65,Pv=97;function Yv(r,n,s,a){const c=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{c[d]=h}),c[12]=r,c[13]=n,c[14]=s,c[15]=a,c}function kf(r){return $v(r)!==void 0}function $v(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return vg(r);case":":return Gv(r)}}function vg(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c,ok:f}=Vv(r);if(!f||a>255)return;r=r.substring(c),n[s]=a}return Yv(n[0],n[1],n[2],n[3])}function Gv(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:c,c:f,ok:h}=Fv(r);if(!h||c>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=vg(r);if(d===void 0)return;n[a]=d[12],n[a+1]=d[13],n[a+2]=d[14],n[a+3]=d[15],r="",a+=Lv;break}if(n[a]=c>>8,n[a+1]=c,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const c=16-a;for(let f=a-1;f>=s;f--)n[f+c]=n[f];for(let f=s+c-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function Vv(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-xg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function Fv(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-xg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Pv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Hv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function Jv(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Mf(r){return!Jv(r)}function Qv(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function Xv(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=Qv(r),Mf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Mf(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",c=new URL(`${a}://${r}`);c.port=`${s}`;let f=c.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:c.host,hostname:f,port:s}}class Ma{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=Xv(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(kf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const c of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Mf(c)?"["+c+"]":c}`);h.port=`${this.port}`;const d=new Ma(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&dg(s),this.resolves=s,s}}class Iv{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=uf();n&&(n.forEach(c=>{c=a?a(c):c,this.servers.push(new Ma(c))}),this.randomize&&(this.servers=dg(this.servers))),this.servers.length===0&&this.addServer(`${wf}:${bg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();kf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=uf();n=a?a(n):n;const c=new Ma(n,s);kf(c.hostname)&&(c.tlsName=this.tlsName),this.servers.push(c)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let c=[];const f=uf(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Ma(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const A=g.listen;g.gossiped&&this.currentServer.listen!==A&&h.get(A)===void 0&&d.push(y),h.delete(A)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);c=c.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:c}}}class Kv{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${cs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(c=>{c.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const c=this.all().find(f=>f.requestSubject===a.subject);if(c)return c.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const c=this.get(a);c&&(n===null&&s.headers&&(n=mg(s)),c.resolver(n,s))}}}close(){const n=oe.errorForCode(se.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class Zv{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:yr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class Wv extends Error{constructor(n){super(n),this.name="AssertionError"}}function e1(r,n="Assertion failed."){if(!r)throw new Wv(n)}const g0=32*1024,ff=2**32-2;function fc(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class hf{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){e1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=fc(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Oi.encode(n))}write(n){const s=this._grow(n.byteLength);return fc(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const c=this.capacity;if(n<=Math.floor(c/2)-s)fc(this._buf.subarray(this._off),this._buf);else{if(c+n>ff)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*c+n,ff));fc(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,ff)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(g0);for(;;){const c=this.capacity-this.length<g0,f=c?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;c?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function y0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const t1=48;class b0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=le.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case le.OP_START:switch(a){case ce.M:case ce.m:this.state=le.OP_M,this.hdr=-1,this.ma=y0();break;case ce.H:case ce.h:this.state=le.OP_H,this.hdr=0,this.ma=y0();break;case ce.P:case ce.p:this.state=le.OP_P;break;case ce.PLUS:this.state=le.OP_PLUS;break;case ce.MINUS:this.state=le.OP_MINUS;break;case ce.I:case ce.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case ce.M:case ce.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case ce.S:case ce.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case ce.G:case ce.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{const c=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(c),this.drop=0,this.as=s+1,this.state=le.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case le.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const c=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:c}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let c=this.ma.size-this.msgBuf.length;const f=n.length-s;f<c&&(c=f),c>0?(this.msgBuf.write(n.subarray(s,s+c)),s=s+c-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END);break;case le.MSG_END:switch(a){case ce.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case ce.O:case ce.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case ce.K:case ce.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case ce.E:case ce.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case ce.R:case ce.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case ce.R:case ce.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let c;this.argBuf?(c=this.argBuf.bytes(),this.argBuf=void 0):c=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:c}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case le.OP_P:switch(a){case ce.I:case ce.i:this.state=le.OP_PI;break;case ce.O:case ce.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case ce.N:case ce.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case ce.G:case ce.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case ce.N:case ce.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case ce.G:case ce.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case ce.N:case ce.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case ce.F:case ce.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case ce.O:case ce.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let c;this.argBuf?(c=this.argBuf.bytes(),this.argBuf=void 0):c=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:c}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===le.MSG_ARG||this.state===le.MINUS_ERR_ARG||this.state===le.INFO_ARG)&&!this.argBuf&&(this.argBuf=new hf(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new hf(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new hf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let c=0;c<n.length;c++)switch(n[c]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,c)),a=-1);break;default:a<0&&(a=c)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${Wt.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let c=0;c<n.length;c++)switch(n[c]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,c)),a=-1);break;default:a<0&&(a=c)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-t1)}return s}}var le;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(le||(le={}));var ce;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(ce||(ce={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},c=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),d=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),A=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),z=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function R(x,S){return x<<S|x>>>32-S}function H(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function ee(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],E=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,E)}function ne(x,S,_){var E;for(E=0;E<4;E++)x[S+E]=_&255,_>>>=8}function W(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,E,T){var D,F=0;for(D=0;D<T;D++)F|=x[S+D]^_[E+D];return(1&F-1>>>8)-1}function be(x,S,_,E){return me(x,S,_,E,16)}function k(x,S,_,E){return me(x,S,_,E,32)}function I(x,S,_,E,T){var D=new Uint32Array(16),F=new Uint32Array(16),X=new Uint32Array(16),L=new Uint32Array(4),V,ue,Oe;for(V=0;V<4;V++)F[5*V]=H(E,4*V),F[1+V]=H(_,4*V),F[6+V]=H(S,4*V),F[11+V]=H(_,16+4*V);for(V=0;V<16;V++)X[V]=F[V];for(V=0;V<20;V++){for(ue=0;ue<4;ue++){for(Oe=0;Oe<4;Oe++)L[Oe]=F[(5*ue+4*Oe)%16];for(L[1]^=R(L[0]+L[3]|0,7),L[2]^=R(L[1]+L[0]|0,9),L[3]^=R(L[2]+L[1]|0,13),L[0]^=R(L[3]+L[2]|0,18),Oe=0;Oe<4;Oe++)D[4*ue+(ue+Oe)%4]=L[Oe]}for(Oe=0;Oe<16;Oe++)F[Oe]=D[Oe]}if(T){for(V=0;V<16;V++)F[V]=F[V]+X[V]|0;for(V=0;V<4;V++)F[5*V]=F[5*V]-H(E,4*V)|0,F[6+V]=F[6+V]-H(S,4*V)|0;for(V=0;V<4;V++)ne(x,4*V,F[5*V]),ne(x,16+4*V,F[6+V])}else for(V=0;V<16;V++)ne(x,4*V,F[V]+X[V]|0)}function ie(x,S,_,E){return I(x,S,_,E,!1),0}function Z(x,S,_,E){return I(x,S,_,E,!0),0}var Q=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,E,T,D,F){var X=new Uint8Array(16),L=new Uint8Array(64),V,ue;if(!T)return 0;for(ue=0;ue<16;ue++)X[ue]=0;for(ue=0;ue<8;ue++)X[ue]=D[ue];for(;T>=64;){for(ie(L,X,F,Q),ue=0;ue<64;ue++)x[S+ue]=(_?_[E+ue]:0)^L[ue];for(V=1,ue=8;ue<16;ue++)V=V+(X[ue]&255)|0,X[ue]=V&255,V>>>=8;T-=64,S+=64,_&&(E+=64)}if(T>0)for(ie(L,X,F,Q),ue=0;ue<T;ue++)x[S+ue]=(_?_[E+ue]:0)^L[ue];return 0}function ae(x,S,_,E,T){return K(x,S,null,0,_,E,T)}function re(x,S,_,E,T){var D=new Uint8Array(32);return Z(D,E,T,Q),ae(x,S,_,E.subarray(16),D)}function qe(x,S,_,E,T,D,F){var X=new Uint8Array(32);return Z(X,D,F,Q),K(x,S,_,E,T,D.subarray(16),X)}function Ge(x,S){var _,E=0;for(_=0;_<17;_++)E=E+(x[_]+S[_]|0)|0,x[_]=E&255,E>>>=8}var Le=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(x,S,_,E,T,D){var F,X,L,V,ue=new Uint32Array(17),Oe=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),_n=new Uint32Array(17);for(L=0;L<17;L++)Oe[L]=Ke[L]=0;for(L=0;L<16;L++)Oe[L]=D[L];for(Oe[3]&=15,Oe[4]&=252,Oe[7]&=15,Oe[8]&=252,Oe[11]&=15,Oe[12]&=252,Oe[15]&=15;T>0;){for(L=0;L<17;L++)Ct[L]=0;for(L=0;L<16&&L<T;++L)Ct[L]=_[E+L];for(Ct[L]=1,E+=L,T-=L,Ge(Ke,Ct),X=0;X<17;X++)for(ue[X]=0,L=0;L<17;L++)ue[X]=ue[X]+Ke[L]*(L<=X?Oe[X-L]:320*Oe[X+17-L]|0)|0|0;for(X=0;X<17;X++)Ke[X]=ue[X];for(V=0,L=0;L<16;L++)V=V+Ke[L]|0,Ke[L]=V&255,V>>>=8;for(V=V+Ke[16]|0,Ke[16]=V&3,V=5*(V>>>2)|0,L=0;L<16;L++)V=V+Ke[L]|0,Ke[L]=V&255,V>>>=8;V=V+Ke[16]|0,Ke[16]=V}for(L=0;L<17;L++)_n[L]=Ke[L];for(Ge(Ke,Le),F=-(Ke[16]>>>7)|0,L=0;L<17;L++)Ke[L]^=F&(_n[L]^Ke[L]);for(L=0;L<16;L++)Ct[L]=D[L+16];for(Ct[16]=0,Ge(Ke,Ct),L=0;L<16;L++)x[S+L]=Ke[L];return 0}function te(x,S,_,E,T,D){var F=new Uint8Array(16);return Y(F,0,_,E,T,D),be(x,S,F,0)}function he(x,S,_,E,T){var D;if(_<32)return-1;for(qe(x,0,S,0,_,E,T),Y(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function ve(x,S,_,E,T){var D,F=new Uint8Array(32);if(_<32||(re(F,0,32,E,T),te(S,16,S,32,_-32,F)!==0))return-1;for(qe(x,0,S,0,_,E,T),D=0;D<32;D++)x[D]=0;return 0}function ye(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function je(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function _e(x,S,_){for(var E,T=~(_-1),D=0;D<16;D++)E=T&(x[D]^S[D]),x[D]^=E,S[D]^=E}function Te(x,S){var _,E,T,D=s(),F=s();for(_=0;_<16;_++)F[_]=S[_];for(je(F),je(F),je(F),E=0;E<2;E++){for(D[0]=F[0]-65517,_=1;_<15;_++)D[_]=F[_]-65535-(D[_-1]>>16&1),D[_-1]&=65535;D[15]=F[15]-32767-(D[14]>>16&1),T=D[15]>>16&1,D[14]&=65535,_e(F,D,1-T)}for(_=0;_<16;_++)x[2*_]=F[_]&255,x[2*_+1]=F[_]>>8}function lt(x,S){var _=new Uint8Array(32),E=new Uint8Array(32);return Te(_,x),Te(E,S),k(_,0,E,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function sn(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function Ot(x,S,_){var E;for(E=0;E<16;E++)x[E]=S[E]+_[E]|0}function jt(x,S,_){var E;for(E=0;E<16;E++)x[E]=S[E]-_[E]|0}function we(x,S,_){var E,T,D=new Float64Array(31);for(E=0;E<31;E++)D[E]=0;for(E=0;E<16;E++)for(T=0;T<16;T++)D[E+T]+=S[E]*_[T];for(E=0;E<15;E++)D[E]+=38*D[E+16];for(E=0;E<16;E++)x[E]=D[E];je(x),je(x)}function Tt(x,S){we(x,S,S)}function Zs(x,S){var _=s(),E;for(E=0;E<16;E++)_[E]=S[E];for(E=253;E>=0;E--)Tt(_,_),E!==2&&E!==4&&we(_,_,S);for(E=0;E<16;E++)x[E]=_[E]}function ji(x,S){var _=s(),E;for(E=0;E<16;E++)_[E]=S[E];for(E=250;E>=0;E--)Tt(_,_),E!==1&&we(_,_,S);for(E=0;E<16;E++)x[E]=_[E]}function Ws(x,S,_){var E=new Uint8Array(32),T=new Float64Array(80),D,F,X=s(),L=s(),V=s(),ue=s(),Oe=s(),Ke=s();for(F=0;F<31;F++)E[F]=S[F];for(E[31]=S[31]&127|64,E[0]&=248,sn(T,_),F=0;F<16;F++)L[F]=T[F],ue[F]=X[F]=V[F]=0;for(X[0]=ue[0]=1,F=254;F>=0;--F)D=E[F>>>3]>>>(F&7)&1,_e(X,L,D),_e(V,ue,D),Ot(Oe,X,V),jt(X,X,V),Ot(V,L,ue),jt(L,L,ue),Tt(ue,Oe),Tt(Ke,X),we(X,V,X),we(V,L,Oe),Ot(Oe,X,V),jt(X,X,V),Tt(L,X),jt(V,ue,Ke),we(X,V,g),Ot(X,X,ue),we(V,V,X),we(X,ue,Ke),we(ue,L,T),Tt(L,Oe),_e(X,L,D),_e(V,ue,D);for(F=0;F<16;F++)T[F+16]=X[F],T[F+32]=V[F],T[F+48]=L[F],T[F+64]=ue[F];var Ct=T.subarray(32),_n=T.subarray(16);return Zs(Ct,Ct),we(_n,_n,Ct),Te(x,_n),0}function rn(x,S){return Ws(x,S,f)}function Ti(x,S){return a(S,32),rn(x,S)}function hs(x,S,_){var E=new Uint8Array(32);return Ws(E,_,S),Z(x,c,E,Q)}var $a=he,Ga=ve;function jr(x,S,_,E,T,D){var F=new Uint8Array(32);return hs(F,T,D),$a(x,S,_,E,F)}function Tr(x,S,_,E,T,D){var F=new Uint8Array(32);return hs(F,T,D),Ga(x,S,_,E,F)}function Hn(){var x=0,S=0,_=0,E=0,T=65535,D,F,X;for(X=0;X<arguments.length;X++)D=arguments[X].lo,F=arguments[X].hi,x+=D&T,S+=D>>>16,_+=F&T,E+=F>>>16;return S+=x>>>16,_+=S>>>16,E+=_>>>16,new n(_&T|E<<16,x&T|S<<16)}function Va(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ni(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,E,T=32-S;return S<32?(_=x.hi>>>S|x.lo<<T,E=x.lo>>>S|x.hi<<T):S<64&&(_=x.lo>>>S|x.hi<<T,E=x.hi>>>S|x.lo<<T),new n(_,E)}function Fc(x,S,_){var E=x.hi&S.hi^~x.hi&_.hi,T=x.lo&S.lo^~x.lo&_.lo;return new n(E,T)}function Fa(x,S,_){var E=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,T=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(E,T)}function Ja(x){return Ni(et(x,28),et(x,34),et(x,39))}function Ci(x){return Ni(et(x,14),et(x,18),et(x,41))}function Jc(x){return Ni(et(x,1),et(x,8),Va(x,7))}function Qa(x){return Ni(et(x,19),et(x,61),Va(x,6))}var Qc=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Xa(x,S,_){var E=[],T=[],D=[],F=[],X,L,V;for(L=0;L<8;L++)E[L]=D[L]=ee(x,8*L);for(var ue=0;_>=128;){for(L=0;L<16;L++)F[L]=ee(S,8*L+ue);for(L=0;L<80;L++){for(V=0;V<8;V++)T[V]=D[V];for(X=Hn(D[7],Ci(D[4]),Fc(D[4],D[5],D[6]),Qc[L],F[L%16]),T[7]=Hn(X,Ja(D[0]),Fa(D[0],D[1],D[2])),T[3]=Hn(T[3],X),V=0;V<8;V++)D[(V+1)%8]=T[V];if(L%16===15)for(V=0;V<16;V++)F[V]=Hn(F[V],F[(V+9)%16],Jc(F[(V+1)%16]),Qa(F[(V+14)%16]))}for(L=0;L<8;L++)D[L]=Hn(D[L],E[L]),E[L]=D[L];ue+=128,_-=128}for(L=0;L<8;L++)W(x,8*L,E[L]);return _}var ei=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ct(x,S,_){var E=new Uint8Array(64),T=new Uint8Array(256),D,F=_;for(D=0;D<64;D++)E[D]=ei[D];for(Xa(E,S,_),_%=128,D=0;D<256;D++)T[D]=0;for(D=0;D<_;D++)T[D]=S[F-_+D];for(T[_]=128,_=256-128*(_<112?1:0),T[_-9]=0,W(T,_-8,new n(F/536870912|0,F<<3)),Xa(E,T,_),D=0;D<64;D++)x[D]=E[D];return 0}function Yt(x,S){var _=s(),E=s(),T=s(),D=s(),F=s(),X=s(),L=s(),V=s(),ue=s();jt(_,x[1],x[0]),jt(ue,S[1],S[0]),we(_,_,ue),Ot(E,x[0],x[1]),Ot(ue,S[0],S[1]),we(E,E,ue),we(T,x[3],S[3]),we(T,T,A),we(D,x[2],S[2]),Ot(D,D,D),jt(F,E,_),jt(X,D,T),Ot(L,D,T),Ot(V,E,_),we(x[0],F,X),we(x[1],V,L),we(x[2],L,X),we(x[3],F,V)}function Nt(x,S,_){var E;for(E=0;E<4;E++)_e(x[E],S[E],_)}function Nr(x,S){var _=s(),E=s(),T=s();Zs(T,S[2]),we(_,S[0],T),we(E,S[1],T),Te(x,E),x[31]^=Pt(_)<<7}function Cr(x,S,_){var E,T;for(ye(x[0],h),ye(x[1],d),ye(x[2],d),ye(x[3],h),T=255;T>=0;--T)E=_[T/8|0]>>(T&7)&1,Nt(x,S,E),Yt(S,x),Yt(x,x),Nt(x,S,E)}function ki(x,S){var _=[s(),s(),s(),s()];ye(_[0],w),ye(_[1],j),ye(_[2],d),we(_[3],w,j),Cr(x,_,S)}function ds(x,S,_){var E=new Uint8Array(64),T=[s(),s(),s(),s()],D;for(_||a(S,32),ct(E,S,32),E[0]&=248,E[31]&=127,E[31]|=64,ki(T,E),Nr(x,T),D=0;D<32;D++)S[D+32]=x[D];return 0}var Pn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ms(x,S){var _,E,T,D;for(E=63;E>=32;--E){for(_=0,T=E-32,D=E-12;T<D;++T)S[T]+=_-16*S[E]*Pn[T-(E-32)],_=Math.floor((S[T]+128)/256),S[T]-=_*256;S[T]+=_,S[E]=0}for(_=0,T=0;T<32;T++)S[T]+=_-(S[31]>>4)*Pn[T],_=S[T]>>8,S[T]&=255;for(T=0;T<32;T++)S[T]-=_*Pn[T];for(E=0;E<32;E++)S[E+1]+=S[E]>>8,x[E]=S[E]&255}function xn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;ms(x,S)}function ti(x,S,_,E){var T=new Uint8Array(64),D=new Uint8Array(64),F=new Uint8Array(64),X,L,V=new Float64Array(64),ue=[s(),s(),s(),s()];ct(T,E,32),T[0]&=248,T[31]&=127,T[31]|=64;var Oe=_+64;for(X=0;X<_;X++)x[64+X]=S[X];for(X=0;X<32;X++)x[32+X]=T[32+X];for(ct(F,x.subarray(32),_+32),xn(F),ki(ue,F),Nr(x,ue),X=32;X<64;X++)x[X]=E[X];for(ct(D,x,_+64),xn(D),X=0;X<64;X++)V[X]=0;for(X=0;X<32;X++)V[X]=F[X];for(X=0;X<32;X++)for(L=0;L<32;L++)V[X+L]+=D[X]*T[L];return ms(x.subarray(32),V),Oe}function ni(x,S){var _=s(),E=s(),T=s(),D=s(),F=s(),X=s(),L=s();return ye(x[2],d),sn(x[1],S),Tt(T,x[1]),we(D,T,y),jt(T,T,x[2]),Ot(D,x[2],D),Tt(F,D),Tt(X,F),we(L,X,F),we(_,L,T),we(_,_,D),ji(_,_),we(_,_,T),we(_,_,D),we(_,_,D),we(x[0],_,D),Tt(E,x[0]),we(E,E,D),lt(E,T)&&we(x[0],x[0],z),Tt(E,x[0]),we(E,E,D),lt(E,T)?-1:(Pt(x[0])===S[31]>>7&&jt(x[0],h,x[0]),we(x[3],x[0],x[1]),0)}function kr(x,S,_,E){var T,D=new Uint8Array(32),F=new Uint8Array(64),X=[s(),s(),s(),s()],L=[s(),s(),s(),s()];if(_<64||ni(L,E))return-1;for(T=0;T<_;T++)x[T]=S[T];for(T=0;T<32;T++)x[T+32]=E[T];if(ct(F,x,_),xn(F),Cr(X,L,F),ki(L,S.subarray(32)),Yt(X,L),Nr(D,X),_-=64,k(S,0,D,0)){for(T=0;T<_;T++)x[T]=0;return-1}for(T=0;T<_;T++)x[T]=S[T+64];return _}var Mi=32,ps=24,vn=32,gs=16,ys=32,si=32,bs=32,Yn=32,ii=32,Mr=ps,Ia=vn,Cn=gs,Qe=64,it=32,$t=64,ri=32,Rr=64;r.lowlevel={crypto_core_hsalsa20:Z,crypto_stream_xor:qe,crypto_stream:re,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:Y,crypto_onetimeauth_verify:te,crypto_verify_16:be,crypto_verify_32:k,crypto_secretbox:he,crypto_secretbox_open:ve,crypto_scalarmult:Ws,crypto_scalarmult_base:rn,crypto_box_beforenm:hs,crypto_box_afternm:$a,crypto_box:jr,crypto_box_open:Tr,crypto_box_keypair:Ti,crypto_hash:ct,crypto_sign:ti,crypto_sign_keypair:ds,crypto_sign_open:kr,crypto_secretbox_KEYBYTES:Mi,crypto_secretbox_NONCEBYTES:ps,crypto_secretbox_ZEROBYTES:vn,crypto_secretbox_BOXZEROBYTES:gs,crypto_scalarmult_BYTES:ys,crypto_scalarmult_SCALARBYTES:si,crypto_box_PUBLICKEYBYTES:bs,crypto_box_SECRETKEYBYTES:Yn,crypto_box_BEFORENMBYTES:ii,crypto_box_NONCEBYTES:Mr,crypto_box_ZEROBYTES:Ia,crypto_box_BOXZEROBYTES:Cn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:$t,crypto_sign_SEEDBYTES:ri,crypto_hash_BYTES:Rr,gf:s,D:y,L:Pn,pack25519:Te,unpack25519:sn,M:we,A:Ot,S:Tt,Z:jt,pow2523:ji,add:Yt,set25519:ye,modL:ms,scalarmult:Cr,scalarbase:ki};function Ka(x,S){if(x.length!==Mi)throw new Error("bad key size");if(S.length!==ps)throw new Error("bad nonce size")}function Za(x,S){if(x.length!==bs)throw new Error("bad public key size");if(S.length!==Yn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ri(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),Ka(_,S);for(var E=new Uint8Array(vn+x.length),T=new Uint8Array(E.length),D=0;D<x.length;D++)E[D+vn]=x[D];return he(T,E,E.length,S,_),T.subarray(gs)},r.secretbox.open=function(x,S,_){yt(x,S,_),Ka(_,S);for(var E=new Uint8Array(gs+x.length),T=new Uint8Array(E.length),D=0;D<x.length;D++)E[D+gs]=x[D];return E.length<32||ve(T,E,E.length,S,_)!==0?null:T.subarray(vn)},r.secretbox.keyLength=Mi,r.secretbox.nonceLength=ps,r.secretbox.overheadLength=gs,r.scalarMult=function(x,S){if(yt(x,S),x.length!==si)throw new Error("bad n size");if(S.length!==ys)throw new Error("bad p size");var _=new Uint8Array(ys);return Ws(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==si)throw new Error("bad n size");var S=new Uint8Array(ys);return rn(S,x),S},r.scalarMult.scalarLength=si,r.scalarMult.groupElementLength=ys,r.box=function(x,S,_,E){var T=r.box.before(_,E);return r.secretbox(x,S,T)},r.box.before=function(x,S){yt(x,S),Za(x,S);var _=new Uint8Array(ii);return hs(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,E){var T=r.box.before(_,E);return r.secretbox.open(x,S,T)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(bs),S=new Uint8Array(Yn);return Ti(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yn)throw new Error("bad secret key size");var S=new Uint8Array(bs);return rn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=bs,r.box.secretKeyLength=Yn,r.box.sharedKeyLength=ii,r.box.nonceLength=Mr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==$t)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return ti(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),E=kr(_,x,x.length,S);if(E<0)return null;for(var T=new Uint8Array(E),D=0;D<T.length;D++)T[D]=_[D];return T},r.sign.detached=function(x,S){for(var _=r.sign(x,S),E=new Uint8Array(Qe),T=0;T<E.length;T++)E[T]=_[T];return E},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var E=new Uint8Array(Qe+x.length),T=new Uint8Array(Qe+x.length),D;for(D=0;D<Qe;D++)E[D]=S[D];for(D=0;D<x.length;D++)E[D+Qe]=x[D];return kr(T,E,E.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array($t);return ds(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==$t)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==ri)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array($t),E=0;E<32;E++)_[E]=x[E];return ds(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=$t,r.sign.seedLength=ri,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(Rr);return ct(S,x,x.length),S},r.hash.hashLength=Rr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,E){var T,D=new Uint8Array(E);for(T=0;T<E;T+=S)x.getRandomValues(D.subarray(T,T+Math.min(E-T,S)));for(T=0;T<E;T++)_[T]=D[T];Ri(D)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,E){var T,D=x.randomBytes(E);for(T=0;T<E;T++)_[T]=D[T];Ri(D)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const hc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;hc.sign.keyPair.fromSeed,hc.sign.detached,hc.sign.detached.verify,hc.randomBytes;var x0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(x0||(x0={}));var v0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(v0||(v0={}));function n1(r){return n=>{let s={};return r.forEach(a=>{const c=a(n)||{};s=Object.assign(s,c)}),s}}function s1(){return()=>{}}function i1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function r1(r){return()=>({auth_token:typeof r=="function"?r():r})}const _g=120*1e3,a1=2,wg=2*1e3;function l1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:_g,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:wg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function c1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(r1(r.token)),r.user&&n.push(i1(r.user,r.pass)),n.length===0?s1():n1(n)}function o1(r){const n=`${wf}:${bg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new oe("port and servers options are mutually exclusive",se.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${wf}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Bc(l1(),r);if(s.authenticator=c1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new oe(`${a} option should be a function`,se.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{cs(s.inboxPrefix)}catch(a){throw new oe(a.message,se.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Cf()=="function"),s.resolve&&typeof Cf()!="function")throw new oe("'resolve' is not supported on this client",se.InvalidOption);return s}function u1(r,n){const{proto:s,tls_required:a,tls_available:c}=r;if((s===void 0||s<1)&&n.noEcho)throw new oe("noEcho",se.ServerOptionNotAvailable);const f=a||c||!1;if(n.tls&&!f)throw new oe("tls",se.ServerOptionNotAvailable)}const f1=1024*32,h1=/^INFO\s+([^\r\n]+)\r\n/i,d1=Ca(`PONG\r
38
38
  `),_0=Ca(`PING\r
39
- `);class p1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const c=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Bc(this,c)}}class Sg extends _t{constructor(s,a,c={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");Bc(this,c),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof c.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);c.timeout&&(this.timer=wr(c.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(d=>{this.stop(d),this.noIterator&&this.callback(d,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,c=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(d,g)=>{const{ingest:y}=c(g);y&&f(g)&&(a(d,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isClosed()?Promise.reject(oe.errorForCode(se.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class g1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let c;if(s.operation==="subscription"&&(c=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(c=a.find(f=>f.requestSubject===s.subject)),c)return c.callback(n,{}),c.close(),this.subs.delete(c.sid),c!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Rc{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=h1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new g1,this.muxSubscriptions=new Zv,this.outbound=new Er,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Mv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new Kv(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new b0(this),this.heartbeats=new Wv(this,this.options.pingInterval||_g,this.options.maxPingOut||l1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=oe.errorForCode(se.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new b0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=zv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:yr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:yr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:ls.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:ls.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===se.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=wr(this.options.timeout||2e4);const c=this.transport.connect(n,this.options);await Promise.race([c,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(c){s.reject(c)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(c){throw a&&a.cancel(),await this.transport.close(c),c}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Cf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let c=null;for(const f of a)try{c=null,this.dispatchStatus({type:yr.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){c=h}throw c}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():wg;let a=s;const c=this.selectServer();if(!c||this.abortReconnect)throw n||(this.lastError?this.lastError:oe.errorForCode(se.ConnectionRefused));const f=Date.now();if(c.lastConnect===0||c.lastConnect+s<=f){c.lastConnect=Date.now();try{await this._doDial(c);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}c.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&c.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,c.lastConnect+s-f),await Ar(a)}}static async connect(n,s){const a=new Rc(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new oe(n,se.PermissionsViolation),c=n.match(/(Publish|Subscription) to "(\S+)"/);if(c){a.permissionContext={operation:c[1].toLowerCase(),subject:c[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new oe(n,se.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new oe(n,se.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new oe(n,se.AccountExpired):s.indexOf("authentication timeout")!==-1?new oe(n,se.AuthenticationTimeout):new oe(n,se.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new Qf(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=s0(n),a=Rc.toError(s),c={type:ls.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){c.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(c),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(m1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(s0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Si(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new p1({version:f,lang:h},this.options,s.nonce);s.headers&&(d.headers=!0,d.no_responders=!0);const g=JSON.stringify(d);this.transport.send(Ca(`CONNECT ${g}${xc}`)),this.transport.send(_0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:ls.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:ls.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let c;typeof n=="string"?c=Ca(n):c=n,this.outbound.fill(c,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=tn,a){let c;if(s instanceof Uint8Array)c=s;else if(typeof s=="string")c=Oi.encode(s);else throw oe.errorForCode(se.BadPayload);let f=c.length;a=a||{},a.reply=a.reply||"";let h=tn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new oe("headers",se.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=c.length+d}if(this.info&&f>this.info.max_payload)throw oe.errorForCode(se.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
39
+ `);class m1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const c=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Bc(this,c)}}class Sg extends _t{constructor(s,a,c={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");Bc(this,c),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof c.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);c.timeout&&(this.timer=wr(c.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(d=>{this.stop(d),this.noIterator&&this.callback(d,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,c=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(d,g)=>{const{ingest:y}=c(g);y&&f(g)&&(a(d,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isClosed()?Promise.reject(oe.errorForCode(se.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class p1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let c;if(s.operation==="subscription"&&(c=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(c=a.find(f=>f.requestSubject===s.subject)),c)return c.callback(n,{}),c.close(),this.subs.delete(c.sid),c!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Rc{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=f1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new p1,this.muxSubscriptions=new Kv,this.outbound=new Er,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new kv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new Iv(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new b0(this),this.heartbeats=new Zv(this,this.options.pingInterval||_g,this.options.maxPingOut||a1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=oe.errorForCode(se.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new b0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Dv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:yr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:yr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:ls.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:ls.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===se.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=wr(this.options.timeout||2e4);const c=this.transport.connect(n,this.options);await Promise.race([c,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(c){s.reject(c)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(c){throw a&&a.cancel(),await this.transport.close(c),c}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Cf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let c=null;for(const f of a)try{c=null,this.dispatchStatus({type:yr.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){c=h}throw c}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():wg;let a=s;const c=this.selectServer();if(!c||this.abortReconnect)throw n||(this.lastError?this.lastError:oe.errorForCode(se.ConnectionRefused));const f=Date.now();if(c.lastConnect===0||c.lastConnect+s<=f){c.lastConnect=Date.now();try{await this._doDial(c);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}c.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&c.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,c.lastConnect+s-f),await Ar(a)}}static async connect(n,s){const a=new Rc(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new oe(n,se.PermissionsViolation),c=n.match(/(Publish|Subscription) to "(\S+)"/);if(c){a.permissionContext={operation:c[1].toLowerCase(),subject:c[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new oe(n,se.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new oe(n,se.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new oe(n,se.AccountExpired):s.indexOf("authentication timeout")!==-1?new oe(n,se.AuthenticationTimeout):new oe(n,se.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new Qf(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=s0(n),a=Rc.toError(s),c={type:ls.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){c.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(c),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(d1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(s0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Si(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new m1({version:f,lang:h},this.options,s.nonce);s.headers&&(d.headers=!0,d.no_responders=!0);const g=JSON.stringify(d);this.transport.send(Ca(`CONNECT ${g}${xc}`)),this.transport.send(_0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:ls.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:ls.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let c;typeof n=="string"?c=Ca(n):c=n,this.outbound.fill(c,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=tn,a){let c;if(s instanceof Uint8Array)c=s;else if(typeof s=="string")c=Oi.encode(s);else throw oe.errorForCode(se.BadPayload);let f=c.length;a=a||{},a.reply=a.reply||"";let h=tn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new oe("headers",se.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=c.length+d}if(this.info&&f>this.info.max_payload)throw oe.errorForCode(se.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
40
40
  `:g=`HPUB ${n} ${d} ${f}\r
41
41
  `,this.sendCommand(g,h,c,Mc)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
42
42
  `:g=`PUB ${n} ${f}\r
@@ -44,20 +44,20 @@ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cance
44
44
  `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
45
45
  `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
46
46
  `):this.sendCommand(`UNSUB ${n.sid}\r
47
- `),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(_0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${xc}`):n.push(`SUB ${a.subject} ${a.sid}${xc}`)}),n.length&&this.transport.send(Ca(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Sg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const y1="$SRV";class w0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,c){var f,h;return c=c||{},c.headers=c.headers||os(),(f=c.headers)==null||f.set(Tc,`${n}`),(h=c.headers)==null||h.set(jc,s),this.msg.respond(a,c)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class qa{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&x1("service group",s);let c="";if(n instanceof Pa)this.srv=n,c="";else if(n instanceof qa){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),c=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(c,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;ja("endpoint",n);let{subject:c,handler:f,metadata:h,queue:d}=a;c=c||n,d=d||this.queue,b1("endpoint subject",c),c=this.calcSubject(this.subject,c);const g={name:n,subject:c,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new qa(this,n,s)}}function b1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,c)=>{if(a===">"&&c!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function x1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class Pa{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),ja("name",this.config.name),ja("queue",this.config.queue),Si(this.config.version),this._id=Is.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",c){const f=c??y1;return s===""&&a===""?`${f}.${n}`:(ja("control subject name",s),a!==""?(ja("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=os();if(n instanceof Nc){const a=n;s.set(jc,a.message),s.set(Tc,`${a.code}`)}else s.set(jc,n.message),s.set(Tc,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:c,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new v1(c,f,a),d.queue=a;const g=h?(y,A)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new w0(A))}catch(j){d.stats.countError(j),A==null||A.respond(tn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const A=new Error(`required subscription ${n.subject} errored: ${y.message}`);A.stack=y.stack,this.close(A).catch()}}),d}info(){return{type:ka.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:c,queue:f}=n;return{subject:s,metadata:a,name:c,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:ka.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,c="",f=""){const h={};h.name=n,h.subject=Pa.controlSubject(s,c,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Tn(),s=(h,d)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(d==null||d.respond(n.encode(g)),Promise.resolve())),a=(h,d)=>h?(this.close(h),Promise.reject(h)):(d==null||d.respond(n.encode(this.info())),Promise.resolve()),c=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(c),Promise.resolve());return this.addInternalHandler(Fs.PING,f),this.addInternalHandler(Fs.STATS,s),this.addInternalHandler(Fs.INFO,a),this.handlers.forEach(h=>{const{subject:d}=h;typeof d=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:ka.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new qa(this,n,s)}addEndpoint(n,s){return new qa(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(c,f)=>{c?this.stop(c).catch():s.push(new w0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class v1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:c,num_requests:f,processing_time:h,last_error:d,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:c,num_requests:f,processing_time:h,last_error:d,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class _1{constructor(n,s={strategy:jn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Fs.PING,n,s)}stats(n="",s=""){return this.q(Fs.STATS,n,s)}info(n="",s=""){return this.q(Fs.INFO,n,s)}async q(n,s="",a=""){const c=new _t,f=Tn(),h=Pa.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,tn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);c.push(y)}catch(y){c.push(()=>{c.stop(y)})}c.push(()=>{c.stop()})})().catch(g=>{c.stop(g)}),c}}function Eg(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function w1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Eg(),storage:jf.File}}const Dc="KV-Operation",S0="$KV",S1=/^[-/=.\w]+$/,E1=/^[-/=.>*\w]+$/,A1=/^[-\w]+$/;function O1(r){if(r.startsWith(".")||r.endsWith(".")||!S1.test(r))throw new Error(`invalid key: ${r}`)}function j1(r){if(r.startsWith(".")||r.endsWith(".")||!E1.test(r))throw new Error(`invalid key: ${r}`)}function T1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function vc(r){if(!A1.test(r))throw new Error(`invalid bucket name: ${r}`)}var zn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(zn||(zn={}));class Ua{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",O1);v(this,"validateSearchKey",j1);v(this,"hasWildcards",T1);vc(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=S0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){vc(s);const c=await n.jetstreamManager(),f=new Ua(s,n,c);return await f.init(a),f}static async bind(n,s,a={}){const c=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};vc(s);const h=new Ua(s,n,c);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Eg(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(w1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Of.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const c=n.placementCluster??"";if(c&&(n.placement={},n.placement.cluster=c,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(j=>{const z=Object.assign({},j),R=z.name.startsWith(Zt)?z.name.substring(Zt.length):z.name;return z.name.startsWith(Zt)||(z.name=`${Zt}${z.name}`),!j.external&&R!==this.bucket&&(z.subject_transforms=[{src:`$KV.${R}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ks.S2:Ks.None);const f=this.js.nc,h=f.getServerVersion(),d=h?Nf(h,Si("2.7.2"))>=0:!1;a.discard=d?za.New:za.Old;const{ok:g,min:y}=f.features.get(ze.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let A;try{A=await this.jsm.streams.info(a.name),!A.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")A=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(A)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const c=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${c}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${S0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new $1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new G1(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let c=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(c=h!==null?h.revision:0,this.update(n,s,c)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,d;const c=this.encodeKey(n);this.validateKey(c);const f={};if(a.previousSeq!==void 0){const g=os();f.headers=g,g.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(c,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(d=y.api_error)==null?void 0:d.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let c={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(c={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),c):f=await this.jsm.streams.getMessage(this.bucketName(),c);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===se.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],c=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of c)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,c.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),d=await Promise.all(h);return d.unshift({success:!0,purged:0}),d.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const c=await this.keys(n),f=[];for await(const h of c)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const c=this.encodeKey(n);this.validateKey(c);const f=os();f.set(Dc,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(c,!0),tn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===An.AllHistory&&(h=ft.All),s===An.UpdatesOnly&&(h=ft.New);let d;return f.length===1&&(d=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:d,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,c={};c.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,An.AllHistory,c),g=d.filter_subject,y=Qs(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,j)=>{if(w){a.stop(w);return}if(j){const z=this.jmToEntry(j);a.push(z),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const A=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=A,j=w.num_pending+w.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(z){a.stop(z)}finally{f=void 0}else h=j}return a._data=A,a.iterClosed.then(()=>{A.unsubscribe()}),A.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(ze.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,c={};c.headers_only=n.headers_only||!1;let f=An.LastValue;n.include===An.AllHistory?f=An.AllHistory:n.include===An.UpdatesOnly&&(f=An.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,c),A=y.filter_subject,w=Qs(y);this.canSetWatcherName()&&w.consumerName(Is.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((z,R)=>{if(z){a.stop(z);return}if(R){const H=this.jmToEntry(R);if(h&&H.operation==="DEL")return;a.push(H),a.received++,d&&(g>0&&a.received>=g||R.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(A,w);if(d){const{info:{last:z}}=j,R=z.num_pending+z.delivered.consumer_seq;if(R===0||a.received>=R)try{d()}catch(H){a.stop(H)}finally{d=void 0}else g=R}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(z=>{a.stop(z)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,An.LastValue,{headers_only:!0}),c=Array.isArray(n)?">":a.filter_subject,f=Qs(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(c,f);return(async()=>{var g;for await(const y of h){const A=(g=y.headers)==null?void 0:g.get(Dc);if(A!=="DEL"&&A!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),c=await this.jsm.streams.info(a);return new Ag(c,s)}}class Ag{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Jf(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Ks.None:!1}}const If="OBJ_",E0="SHA-256=";function N1(r){return vc(r),`${If}${r}`}function C1(r){return r.startsWith(If)?r.substring(4):r}class Rf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return C1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Ks.None:!1}}function dc(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var gn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(gn||(gn={}));var qn;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(qn||(qn={}));var _r;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(_r||(_r={}));const A0=Uint8Array.of(43,65,67,75),k1=Uint8Array.of(45,78,65,75),Sa=Uint8Array.of(43,87,80,73),M1=Uint8Array.of(43,78,88,84),R1=Uint8Array.of(43,84,69,82,77),D1=Uint8Array.of(32);function Ba(r,n=5e3){return new K1(r,n)}class df extends _t{constructor(s,a,c=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,c),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=c,this.timeout=null,this.inbox=cs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:c,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,j,z,R;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Af(y))return;const H=(j=y.headers)==null?void 0:j.code,ee=((R=(z=y.headers)==null?void 0:z.description)==null?void 0:R.toLowerCase())||"unknown",{msgsLeft:ne,bytesLeft:W}=this.parseDiscard(y.headers);if(ne>0||W>0)this.pending.msgs-=ne,this.pending.bytes-=W,this.pending.requests--,this.notify(_r.Discard,{msgsLeft:ne,bytesLeft:W});else if(H===400){this.stop(new oe(ee,`${H}`));return}else if(H===409&&ee==="consumer deleted"){if(this.notify(qn.ConsumerDeleted,`${H} ${ee}`),!this.refilling||this.abortOnMissingResource){const me=new oe(ee,`${H}`);this.stop(me);return}}else if(H===503){if(this.notify(qn.NoResponders,`${H} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new oe("no responders",`${H}`);this.stop(me);return}}else this.notify(_r.DebugEvent,`${H} ${ee}`)}else this._push(Ba(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const H=this.pullOptions();this.pull(H)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),c&&(this.monitor=new Xf(c,g=>(this.notify(qn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const A of g)switch(A.type){case ls.Disconnect:(y=this.monitor)==null||y.cancel();break;case ls.Reconnect:this.resetPending().then(w=>{var j;w&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(c){this.stop(c)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(c=>{c.done||c.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const c=Ff([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(qn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(qn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const d=c.backoff(f),g=Ar(d);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(_r.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,c=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:c,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},c=s==null?void 0:s.get(Dt.PendingMessagesHdr);c&&(a.msgsLeft=parseInt(c));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,c;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(c=this.statusIterator)==null||c.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const c=s||{};if(c.max_messages=c.max_messages||0,c.max_bytes=c.max_bytes||0,c.max_messages!==0&&c.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(c.max_messages===0&&(c.max_messages=100),c.expires=c.expires||3e4,c.expires<1e3)throw new Error("expires should be at least 1000ms");if(c.idle_heartbeat=c.idle_heartbeat||c.expires/2,c.idle_heartbeat=c.idle_heartbeat>3e4?3e4:c.idle_heartbeat,a){const f=Math.round(c.max_messages*.75)||1;c.threshold_messages=c.threshold_messages||f;const h=Math.round(c.max_bytes*.75)||1;c.threshold_bytes=c.threshold_bytes||h}return c}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class z1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const c of a)this.notify(c.type,c.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(c=>{c.done||c.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(c=>{c.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Df{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new df(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new df(this,n,!1),a=Math.round(s.opts.expires*1.05),c=wr(a);return s.closed().catch(()=>{}).finally(()=>{c.cancel()}),c.catch(()=>{s.close().catch()}),s.trackTimeout(c),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const c=new df(this,a,!1),f=Math.round(c.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await c.status())if(d.type===qn.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of c){s.resolve(d);break}})().catch(()=>{});const h=wr(f);return c.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),c.close().catch()}),c.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(c=>(this._info=c,this._info))}}class q1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Is.next(),typeof a.name_prefix=="string"&&(Lc("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=gn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,d,g,y,A;Is.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const c=Ff([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(qn.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(qn.StreamNotFound,w),this.type===gn.Fetch||this.opts.abort_on_missing_resource===!0))return(A=this.iter)==null||A.stop(j),Promise.reject(j);if(s&&w>=this.maxInitialReset)throw j;await Ar(c.backoff(w+1))}return f}internalHandler(n){return s=>{var c;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(c=this.iter)==null||c.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,c=s.orderedReset||!1;if(this.type===gn.Fetch&&c){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||c)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new z1),this.consumer=new Df(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===gn.Fetch&&a?h=await this.consumer.fetch(n):this.type===gn.Consume&&(h=await this.consumer.consume(n));const d=h;d.forOrderedConsumer=!0,d.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(d)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(_r.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var c;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((c=this.iter)==null?void 0:c.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class zf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ze.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Df(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Df(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new Kf(a.nc,a.opts).info(n).then(f=>Promise.resolve(new q1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Pc{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Pc(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new zf(new kc(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new zf(new kc(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class Kf extends Ha{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:c,ok:f}=s.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${c}`)}if(n.first_seq){const{min:c,ok:f}=s.features.get(ze.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${c}`)}if(n.subject_transform){const{min:c,ok:f}=s.features.get(ze.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${c}`)}if(n.compression){const{min:c,ok:f}=s.features.get(ze.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${c}`)}if(n.consumer_limits){const{min:c,ok:f}=s.features.get(ze.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${c}`)}function a(c,f){var d;if((((d=f==null?void 0:f.subject_transforms)==null?void 0:d.length)||0)>0){const{min:g,ok:y}=s.features.get(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${c} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(c=>{a("stream sources",c)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var c;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=dc(n.mirror),n.sources=(c=n.sources)==null?void 0:c.map(dc);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var d;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),c=Object.assign(a.config,s);c.mirror=dc(c.mirror),c.sources=(d=c.sources)==null?void 0:d.map(dc);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,c);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:d}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],A=s||{};let w=0;for(;h>g;){w++,A.offset=d*w;const z=await this._request(a,A);h=z.total,y.push(z);const R=Object.getOwnPropertyNames(z.state.subjects).length;if(g+=R,R<d)break}let j={};for(let z=0;z<y.length;z++)f=y[z],f.state.subjects&&(j=Object.assign(j,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=j}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(d=>{this._fixInfo(d)}),h.streams},c=`${this.prefix}.STREAM.LIST`;return new Ta(c,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:c,seq:f}=s;if(typeof c=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const c={seq:s};return a||(c.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,c)).success}async getMessage(n,s){Mt(n);const c=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Og(c)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Ag(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Ta(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(If));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new Rf(d))},s=`${this.prefix}.STREAM.LIST`;return new Ta(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,c=`${this.prefix}.STREAM.NAMES`;return new Ta(c,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Pc(this,s))}}class U1 extends Ha{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:c}=a;c&&(a=null);const f=a?this.jc.encode(a):tn,h=this.opts.apiPrefix||"$JS.API",d=c?`${h}.DIRECT.GET.${n}.${c}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=xr(g);if(y)return Promise.reject(y);const A=new qf(g);return Promise.resolve(A)}async getBatch(n,s){Mt(n);const c=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,d=await this.nc.requestMany(c,f,{strategy:jn.SentinelMsg});return(async()=>{var w,j,z;let g=!1,y=!1,A;for await(const R of d){if(!g){g=!0;const H=((w=R.headers)==null?void 0:w.code)||0;if(H!==0&&H<200||H>299){A=(j=R.headers)==null?void 0:j.description.toLowerCase();break}if(((z=R.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){y=!0;break}}if(R.data.length===0)break;h.push(new qf(R))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(A)throw new Error(`bad request: ${A}`);h.stop()})})(),Promise.resolve(h)}}class qf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(gr.Subject)}get seq(){const n=this.header.last(gr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(gr.TimeStamp)}get stream(){return this.header.last(gr.Stream)}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(qf,"jc");class B1 extends Ha{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new Kf(s,a),this.consumers=new kc(s,a),this.direct=new U1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,c)=>{if(a)throw a;try{const f=this.parseJsResponse(c),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class Og{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):tn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Js.decode(n)}else this._header=os();return this._header}_parse(n){const s=atob(n),a=s.length,c=new Uint8Array(a);for(let f=0;f<a;f++)c[f]=s.charCodeAt(f);return c}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(Og,"jc");class L1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Pc(this.api,s))}}class mf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Js.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function O0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function H1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Ra{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new mf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const c=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:c}),d=Tn().decode(f.data);return d.revision=f.seq,d}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new Rf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Rf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var be;const c=this.js.getOptions();a=a||{timeout:c.timeout},a.timeout=a.timeout||c.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,d=this.js.nc.info,g=(d==null?void 0:d.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((be=n.options)==null?void 0:be.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const A=await this.info(n.name),{name:w,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const z=Is.next(),R=this._chunkSubject(z),H=this._metaSubject(w),ee=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},O0(n)),ne=st(),W=[],me=new Er;try{const k=s?s.getReader():null,I=p0.create();for(;;){const{done:ie,value:Z}=k?await k.read():{done:!0,value:void 0};if(ie){if(me.size()>0){const re=me.drain();I.update(re),ee.chunks++,ee.size+=re.length,W.push(this.js.publish(R,re,{timeout:f}))}await Promise.all(W),W.length=0,ee.mtime=new Date().toISOString();const Q=vr.encode(I.digest());ee.digest=`${E0}${Q}`,ee.deleted=!1;const K=os();typeof h=="number"&&K.set(zn.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(H,Tn().encode(ee),{headers:K,timeout:f});if(ee.revision=ae.seq,A)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${A.nuid}`})}catch{}ne.resolve(new mf(ee));break}if(Z)for(me.fill(Z);me.size()>y;){ee.chunks++,ee.size+=y;const Q=me.drain(n.options.max_chunk_size);I.update(Q),W.push(this.js.publish(R,Q,{timeout:f}))}}}catch(k){await this.jsm.streams.purge(this.stream,{filter:R}),ne.reject(k)}return ne}putBlob(n,s,a){function c(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,c(s),a)}put(n,s,a){var c;return(c=n==null?void 0:n.options)!=null&&c.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Er,d=f.getReader();for(;;){const{done:g,value:y}=await d.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const c=await Promise.all([a.error,s(a.data)]);return c[0]?Promise.reject(c[0]):Promise.resolve(c[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Ra.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(E0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Tf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const c=st(),f={info:new mf(s),error:c};if(s.size===0)return f.data=H1(),c.resolve(null),Promise.resolve(f);let h;const d=Qs();d.orderedConsumer();const g=p0.create(),y=`$O.${this.name}.C.${s.nuid}`,A=await this.js.subscribe(y,d);return(async()=>{for await(const w of A)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(Tv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),A.unsubscribe())})().then(()=>{c.resolve()}).catch(w=>{h.error(w),c.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){A.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Ra))return Promise.reject("bucket required");const a=s,{name:c,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:c,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:c}=this._checkNotEmpty(n);if(c)return Promise.reject(c);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},d={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(d));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=Tn(),c=os();return c.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:c}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:c,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=c;const h=Object.assign({},a,O0(s)),d=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(d)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,c=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:c})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Tn(),h=Qs();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var A;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((A=y.info)==null?void 0:A.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(c,h);return a._data=d,a.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${vr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=N1(this.name)}catch(c){return Promise.reject(c)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=za.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ks.S2:Ks.None);try{await this.jsm.streams.info(a.name)}catch(c){c.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const c=await n.jetstreamManager(),f=new Ra(s,c,n);return await f.init(a),Promise.resolve(f)}}class P1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:c,min:f}=a.nc.features.get(ze.JS_KV);return c?s.bindOnly?Ua.bind(this.js,n,s):Ua.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:c,min:f}=a.nc.features.get(ze.JS_OBJECTSTORE);return c?Ra.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class Zf extends Ha{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new kc(s,a),this.streamAPI=new Kf(s,a),this.consumers=new zf(this.consumerAPI),this.streams=new L1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new P1(this)}async publish(s,a=tn,c){c=c||{},c.expect=c.expect||{};const f=(c==null?void 0:c.headers)||os();c&&(c.msgID&&f.set(zn.MsgIdHdr,c.msgID),c.expect.lastMsgID&&f.set(zn.ExpectedLastMsgIdHdr,c.expect.lastMsgID),c.expect.streamName&&f.set(zn.ExpectedStreamHdr,c.expect.streamName),typeof c.expect.lastSequence=="number"&&f.set(zn.ExpectedLastSeqHdr,`${c.expect.lastSequence}`),typeof c.expect.lastSubjectSequence=="number"&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${c.expect.lastSubjectSequence}`));const h=c.timeout||this.timeout,d={};h&&(d.timeout=h),c&&(d.headers=f);let{retries:g,retry_delay:y}=c;g=g||1,y=y||250;let A;for(let j=0;j<g;j++)try{A=await this.nc.request(s,a,d);break}catch(z){if(z.code==="503"&&j+1<g)await Ar(y);else throw z}const w=this.parseJsResponse(A);if(w.stream==="")throw oe.errorForCode(se.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,c=0){Mt(s),br(a);let f=this.timeout;c>f&&(f=c),c=c<0?0:nt(c);const h={batch:1,no_wait:c===0,expires:c},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=xr(d);if(g)throw g;return Ba(d,this.timeout)}fetch(s,a,c={}){Mt(s),br(a);let f=null;const h=(c.max_bytes??0)>0;let d=0;const g=h?c.max_bytes:0;let y=null;const A={};if(A.batch=c.batch||1,g){const W=this.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!W.ok)throw new Error(`max_bytes is only supported on servers ${W.min} or better`);A.max_bytes=g}A.no_wait=c.no_wait||!1,A.no_wait&&A.expires&&(A.expires=0);const w=c.expires||0;if(w&&(A.expires=nt(w)),w===0&&A.no_wait===!1)throw new Error("expires or no_wait is required");const j=c.idle_heartbeat||0;j&&(A.idle_heartbeat=nt(j),c.delay_heartbeat===!0&&(A.idle_heartbeat=nt(j*4)));const z=new _t,R=A.batch;let H=0;z.protocolFilterFn=(W,me=!1)=>Af(W.msg)?(y==null||y.work(),!1):!0,z.dispatchedFn=W=>{if(W){if(h&&(d+=W.data.length),H++,f&&W.info.pending===0)return;(z.getPending()===1&&W.info.pending===0||R===H||g>0&&d>=g)&&z.stop()}};const ee=cs(this.nc.options.inboxPrefix),ne=this.nc.subscribe(ee,{max:c.batch,callback:(W,me)=>{W===null&&(W=xr(me)),W!==null?(f&&(f.cancel(),f=null),ov(W)?z.stop(Tg(W)===null?void 0:W):z.stop(W)):(y==null||y.work(),z.received++,z.push(Ba(me,this.timeout)))}});return w&&(f=wr(w),f.catch(()=>{ne.isClosed()||(ne.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new Xf(j,W=>(z.push(()=>{z.err=new oe(`${yn.IdleHeartbeatMissed}: ${W}`,se.JetStreamIdleHeartBeat)}),!0)))}catch{}await ne.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),z.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(A),{reply:ee}),z}async pullSubscribe(s,a=Qs()){const c=await this._processOptions(s,a);if(c.ordered)throw new Error("pull subscribers cannot be be ordered");if(c.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=c.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(c),d=new V1(this,c.deliver,h);d.info=c;try{await this._maybeCreateConsumer(c)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Qs()){const c=await this._processOptions(s,a);if(!c.isBind&&!c.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(c),h=new jg(this,c.deliver,f);h.info=c;try{await this._maybeCreateConsumer(c)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Qs()){const c=f0(a)?a.getOpts():a;if(c.isBind=f0(a)?a.isBind:!1,c.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},c.ordered){if(c.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},c.config.ack_policy!==vt.NotSet&&c.config.ack_policy!==vt.None)throw new oe("ordered consumer: ack_policy can only be set to 'none'",se.ApiError);if(c.config.durable_name&&c.config.durable_name.length>0)throw new oe("ordered consumer: durable_name cannot be set",se.ApiError);if(c.config.deliver_subject&&c.config.deliver_subject.length>0)throw new oe("ordered consumer: deliver_subject cannot be set",se.ApiError);if(c.config.max_deliver!==void 0&&c.config.max_deliver>1)throw new oe("ordered consumer: max_deliver cannot be set",se.ApiError);if(c.config.deliver_group&&c.config.deliver_group.length>0)throw new oe("ordered consumer: deliver_group cannot be set",se.ApiError);c.config.deliver_subject=cs(this.nc.options.inboxPrefix),c.config.ack_policy=vt.None,c.config.max_deliver=1,c.config.flow_control=!0,c.config.idle_heartbeat=c.config.idle_heartbeat||nt(5e3),c.config.ack_wait=nt(1320*60*1e3),c.config.mem_storage=!0,c.config.num_replicas=1}if(c.config.ack_policy===vt.NotSet&&(c.config.ack_policy=vt.All),c.api=this,c.config=c.config||{},c.stream=c.stream?c.stream:await this.findStream(s),c.attached=!1,c.config.durable_name)try{const f=await this.consumerAPI.info(c.stream,c.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=c.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const d=f.config.deliver_group??"";if(h!==d)throw d===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${d}'`);c.last=f,c.config=f.config,c.attached=!0,c.config.durable_name||(c.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!c.attached&&c.config.filter_subject===void 0&&c.config.filter_subjects===void 0&&(c.config.filter_subject=s),c.deliver=c.config.deliver_subject||cs(this.nc.options.inboxPrefix),c}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=F1(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=Zf.ingestionFn(s.ordered),a.protocolFilterFn=(c,f=!1)=>{const h=c;return Ef(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=X1),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Sr.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,c)=>{var g;const f=c;if(!a)return{ingest:!1,protocol:!1};const h=a;if(xr(h.msg)||(g=f.monitor)==null||g.work(),Af(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Ef(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class Wf{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=u1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const c=new Wf(n);Rc.connect(c.options,c).then(f=>{c.protocol=f,(async function(){for await(const h of f.status())c.listeners.forEach(d=>{d.push(h)})})(),s(c)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw oe.errorForCode(se.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw oe.errorForCode(se.ConnectionDraining);if(n=n||"",n.length===0)throw oe.errorForCode(se.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Sg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const c=n;c.max=a,a&&(c.max=a+c.received),this.protocol.resub(c,s)}requestMany(n,s=tn,a={maxWait:1e3,maxMessages:-1}){const c=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||jn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new oe("timeout",se.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function d(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=c?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const A=this.subscribe(cs(this.options.inboxPrefix),{callback:(R,H)=>{var ee,ne;if(((ee=H==null?void 0:H.data)==null?void 0:ee.length)===0&&((ne=H==null?void 0:H.headers)==null?void 0:ne.status)===se.NoResponders&&(R=oe.errorForCode(se.NoResponders)),R){g&&(R.stack+=`
47
+ `),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(_0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${xc}`):n.push(`SUB ${a.subject} ${a.sid}${xc}`)}),n.length&&this.transport.send(Ca(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Sg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const g1="$SRV";class w0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,c){var f,h;return c=c||{},c.headers=c.headers||os(),(f=c.headers)==null||f.set(Tc,`${n}`),(h=c.headers)==null||h.set(jc,s),this.msg.respond(a,c)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class qa{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&b1("service group",s);let c="";if(n instanceof Pa)this.srv=n,c="";else if(n instanceof qa){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),c=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(c,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;ja("endpoint",n);let{subject:c,handler:f,metadata:h,queue:d}=a;c=c||n,d=d||this.queue,y1("endpoint subject",c),c=this.calcSubject(this.subject,c);const g={name:n,subject:c,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new qa(this,n,s)}}function y1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,c)=>{if(a===">"&&c!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function b1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class Pa{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),ja("name",this.config.name),ja("queue",this.config.queue),Si(this.config.version),this._id=Is.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",c){const f=c??g1;return s===""&&a===""?`${f}.${n}`:(ja("control subject name",s),a!==""?(ja("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=os();if(n instanceof Nc){const a=n;s.set(jc,a.message),s.set(Tc,`${a.code}`)}else s.set(jc,n.message),s.set(Tc,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:c,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new x1(c,f,a),d.queue=a;const g=h?(y,A)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new w0(A))}catch(j){d.stats.countError(j),A==null||A.respond(tn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const A=new Error(`required subscription ${n.subject} errored: ${y.message}`);A.stack=y.stack,this.close(A).catch()}}),d}info(){return{type:ka.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:c,queue:f}=n;return{subject:s,metadata:a,name:c,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:ka.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,c="",f=""){const h={};h.name=n,h.subject=Pa.controlSubject(s,c,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Tn(),s=(h,d)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(d==null||d.respond(n.encode(g)),Promise.resolve())),a=(h,d)=>h?(this.close(h),Promise.reject(h)):(d==null||d.respond(n.encode(this.info())),Promise.resolve()),c=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(c),Promise.resolve());return this.addInternalHandler(Fs.PING,f),this.addInternalHandler(Fs.STATS,s),this.addInternalHandler(Fs.INFO,a),this.handlers.forEach(h=>{const{subject:d}=h;typeof d=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:ka.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new qa(this,n,s)}addEndpoint(n,s){return new qa(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(c,f)=>{c?this.stop(c).catch():s.push(new w0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class x1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:c,num_requests:f,processing_time:h,last_error:d,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:c,num_requests:f,processing_time:h,last_error:d,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class v1{constructor(n,s={strategy:jn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Fs.PING,n,s)}stats(n="",s=""){return this.q(Fs.STATS,n,s)}info(n="",s=""){return this.q(Fs.INFO,n,s)}async q(n,s="",a=""){const c=new _t,f=Tn(),h=Pa.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,tn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);c.push(y)}catch(y){c.push(()=>{c.stop(y)})}c.push(()=>{c.stop()})})().catch(g=>{c.stop(g)}),c}}function Eg(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function _1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Eg(),storage:jf.File}}const Dc="KV-Operation",S0="$KV",w1=/^[-/=.\w]+$/,S1=/^[-/=.>*\w]+$/,E1=/^[-\w]+$/;function A1(r){if(r.startsWith(".")||r.endsWith(".")||!w1.test(r))throw new Error(`invalid key: ${r}`)}function O1(r){if(r.startsWith(".")||r.endsWith(".")||!S1.test(r))throw new Error(`invalid key: ${r}`)}function j1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function vc(r){if(!E1.test(r))throw new Error(`invalid bucket name: ${r}`)}var zn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(zn||(zn={}));class Ua{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",A1);v(this,"validateSearchKey",O1);v(this,"hasWildcards",j1);vc(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=S0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){vc(s);const c=await n.jetstreamManager(),f=new Ua(s,n,c);return await f.init(a),f}static async bind(n,s,a={}){const c=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};vc(s);const h=new Ua(s,n,c);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Eg(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(_1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Of.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const c=n.placementCluster??"";if(c&&(n.placement={},n.placement.cluster=c,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(j=>{const z=Object.assign({},j),R=z.name.startsWith(Zt)?z.name.substring(Zt.length):z.name;return z.name.startsWith(Zt)||(z.name=`${Zt}${z.name}`),!j.external&&R!==this.bucket&&(z.subject_transforms=[{src:`$KV.${R}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ks.S2:Ks.None);const f=this.js.nc,h=f.getServerVersion(),d=h?Nf(h,Si("2.7.2"))>=0:!1;a.discard=d?za.New:za.Old;const{ok:g,min:y}=f.features.get(ze.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let A;try{A=await this.jsm.streams.info(a.name),!A.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")A=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(A)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const c=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${c}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${S0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new Y1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new $1(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let c=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(c=h!==null?h.revision:0,this.update(n,s,c)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,d;const c=this.encodeKey(n);this.validateKey(c);const f={};if(a.previousSeq!==void 0){const g=os();f.headers=g,g.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(c,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(d=y.api_error)==null?void 0:d.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let c={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(c={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),c):f=await this.jsm.streams.getMessage(this.bucketName(),c);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===se.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],c=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of c)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,c.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),d=await Promise.all(h);return d.unshift({success:!0,purged:0}),d.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const c=await this.keys(n),f=[];for await(const h of c)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const c=this.encodeKey(n);this.validateKey(c);const f=os();f.set(Dc,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(c,!0),tn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===An.AllHistory&&(h=ft.All),s===An.UpdatesOnly&&(h=ft.New);let d;return f.length===1&&(d=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:d,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,c={};c.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,An.AllHistory,c),g=d.filter_subject,y=Qs(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,j)=>{if(w){a.stop(w);return}if(j){const z=this.jmToEntry(j);a.push(z),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const A=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=A,j=w.num_pending+w.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(z){a.stop(z)}finally{f=void 0}else h=j}return a._data=A,a.iterClosed.then(()=>{A.unsubscribe()}),A.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(ze.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,c={};c.headers_only=n.headers_only||!1;let f=An.LastValue;n.include===An.AllHistory?f=An.AllHistory:n.include===An.UpdatesOnly&&(f=An.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,c),A=y.filter_subject,w=Qs(y);this.canSetWatcherName()&&w.consumerName(Is.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((z,R)=>{if(z){a.stop(z);return}if(R){const H=this.jmToEntry(R);if(h&&H.operation==="DEL")return;a.push(H),a.received++,d&&(g>0&&a.received>=g||R.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(A,w);if(d){const{info:{last:z}}=j,R=z.num_pending+z.delivered.consumer_seq;if(R===0||a.received>=R)try{d()}catch(H){a.stop(H)}finally{d=void 0}else g=R}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(z=>{a.stop(z)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,An.LastValue,{headers_only:!0}),c=Array.isArray(n)?">":a.filter_subject,f=Qs(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(c,f);return(async()=>{var g;for await(const y of h){const A=(g=y.headers)==null?void 0:g.get(Dc);if(A!=="DEL"&&A!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),c=await this.jsm.streams.info(a);return new Ag(c,s)}}class Ag{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Jf(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Ks.None:!1}}const If="OBJ_",E0="SHA-256=";function T1(r){return vc(r),`${If}${r}`}function N1(r){return r.startsWith(If)?r.substring(4):r}class Rf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return N1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Ks.None:!1}}function dc(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var gn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(gn||(gn={}));var qn;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(qn||(qn={}));var _r;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(_r||(_r={}));const A0=Uint8Array.of(43,65,67,75),C1=Uint8Array.of(45,78,65,75),Sa=Uint8Array.of(43,87,80,73),k1=Uint8Array.of(43,78,88,84),M1=Uint8Array.of(43,84,69,82,77),R1=Uint8Array.of(32);function Ba(r,n=5e3){return new I1(r,n)}class df extends _t{constructor(s,a,c=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,c),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=c,this.timeout=null,this.inbox=cs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:c,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,j,z,R;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Af(y))return;const H=(j=y.headers)==null?void 0:j.code,ee=((R=(z=y.headers)==null?void 0:z.description)==null?void 0:R.toLowerCase())||"unknown",{msgsLeft:ne,bytesLeft:W}=this.parseDiscard(y.headers);if(ne>0||W>0)this.pending.msgs-=ne,this.pending.bytes-=W,this.pending.requests--,this.notify(_r.Discard,{msgsLeft:ne,bytesLeft:W});else if(H===400){this.stop(new oe(ee,`${H}`));return}else if(H===409&&ee==="consumer deleted"){if(this.notify(qn.ConsumerDeleted,`${H} ${ee}`),!this.refilling||this.abortOnMissingResource){const me=new oe(ee,`${H}`);this.stop(me);return}}else if(H===503){if(this.notify(qn.NoResponders,`${H} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new oe("no responders",`${H}`);this.stop(me);return}}else this.notify(_r.DebugEvent,`${H} ${ee}`)}else this._push(Ba(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const H=this.pullOptions();this.pull(H)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),c&&(this.monitor=new Xf(c,g=>(this.notify(qn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const A of g)switch(A.type){case ls.Disconnect:(y=this.monitor)==null||y.cancel();break;case ls.Reconnect:this.resetPending().then(w=>{var j;w&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(c){this.stop(c)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(c=>{c.done||c.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const c=Ff([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(qn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(qn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const d=c.backoff(f),g=Ar(d);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(_r.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,c=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:c,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},c=s==null?void 0:s.get(Dt.PendingMessagesHdr);c&&(a.msgsLeft=parseInt(c));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,c;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(c=this.statusIterator)==null||c.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const c=s||{};if(c.max_messages=c.max_messages||0,c.max_bytes=c.max_bytes||0,c.max_messages!==0&&c.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(c.max_messages===0&&(c.max_messages=100),c.expires=c.expires||3e4,c.expires<1e3)throw new Error("expires should be at least 1000ms");if(c.idle_heartbeat=c.idle_heartbeat||c.expires/2,c.idle_heartbeat=c.idle_heartbeat>3e4?3e4:c.idle_heartbeat,a){const f=Math.round(c.max_messages*.75)||1;c.threshold_messages=c.threshold_messages||f;const h=Math.round(c.max_bytes*.75)||1;c.threshold_bytes=c.threshold_bytes||h}return c}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class D1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const c of a)this.notify(c.type,c.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(c=>{c.done||c.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(c=>{c.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Df{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new df(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new df(this,n,!1),a=Math.round(s.opts.expires*1.05),c=wr(a);return s.closed().catch(()=>{}).finally(()=>{c.cancel()}),c.catch(()=>{s.close().catch()}),s.trackTimeout(c),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const c=new df(this,a,!1),f=Math.round(c.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await c.status())if(d.type===qn.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of c){s.resolve(d);break}})().catch(()=>{});const h=wr(f);return c.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),c.close().catch()}),c.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(c=>(this._info=c,this._info))}}class z1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Is.next(),typeof a.name_prefix=="string"&&(Lc("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=gn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,d,g,y,A;Is.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const c=Ff([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(qn.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(qn.StreamNotFound,w),this.type===gn.Fetch||this.opts.abort_on_missing_resource===!0))return(A=this.iter)==null||A.stop(j),Promise.reject(j);if(s&&w>=this.maxInitialReset)throw j;await Ar(c.backoff(w+1))}return f}internalHandler(n){return s=>{var c;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(c=this.iter)==null||c.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,c=s.orderedReset||!1;if(this.type===gn.Fetch&&c){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||c)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new D1),this.consumer=new Df(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===gn.Fetch&&a?h=await this.consumer.fetch(n):this.type===gn.Consume&&(h=await this.consumer.consume(n));const d=h;d.forOrderedConsumer=!0,d.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(d)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(_r.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var c;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((c=this.iter)==null?void 0:c.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class zf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ze.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Df(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Df(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new Kf(a.nc,a.opts).info(n).then(f=>Promise.resolve(new z1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Pc{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Pc(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new zf(new kc(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new zf(new kc(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class Kf extends Ha{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:c,ok:f}=s.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${c}`)}if(n.first_seq){const{min:c,ok:f}=s.features.get(ze.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${c}`)}if(n.subject_transform){const{min:c,ok:f}=s.features.get(ze.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${c}`)}if(n.compression){const{min:c,ok:f}=s.features.get(ze.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${c}`)}if(n.consumer_limits){const{min:c,ok:f}=s.features.get(ze.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${c}`)}function a(c,f){var d;if((((d=f==null?void 0:f.subject_transforms)==null?void 0:d.length)||0)>0){const{min:g,ok:y}=s.features.get(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${c} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(c=>{a("stream sources",c)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var c;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=dc(n.mirror),n.sources=(c=n.sources)==null?void 0:c.map(dc);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var d;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),c=Object.assign(a.config,s);c.mirror=dc(c.mirror),c.sources=(d=c.sources)==null?void 0:d.map(dc);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,c);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:d}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],A=s||{};let w=0;for(;h>g;){w++,A.offset=d*w;const z=await this._request(a,A);h=z.total,y.push(z);const R=Object.getOwnPropertyNames(z.state.subjects).length;if(g+=R,R<d)break}let j={};for(let z=0;z<y.length;z++)f=y[z],f.state.subjects&&(j=Object.assign(j,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=j}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(d=>{this._fixInfo(d)}),h.streams},c=`${this.prefix}.STREAM.LIST`;return new Ta(c,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:c,seq:f}=s;if(typeof c=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const c={seq:s};return a||(c.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,c)).success}async getMessage(n,s){Mt(n);const c=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Og(c)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Ag(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Ta(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(If));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new Rf(d))},s=`${this.prefix}.STREAM.LIST`;return new Ta(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,c=`${this.prefix}.STREAM.NAMES`;return new Ta(c,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Pc(this,s))}}class q1 extends Ha{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:c}=a;c&&(a=null);const f=a?this.jc.encode(a):tn,h=this.opts.apiPrefix||"$JS.API",d=c?`${h}.DIRECT.GET.${n}.${c}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=xr(g);if(y)return Promise.reject(y);const A=new qf(g);return Promise.resolve(A)}async getBatch(n,s){Mt(n);const c=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,d=await this.nc.requestMany(c,f,{strategy:jn.SentinelMsg});return(async()=>{var w,j,z;let g=!1,y=!1,A;for await(const R of d){if(!g){g=!0;const H=((w=R.headers)==null?void 0:w.code)||0;if(H!==0&&H<200||H>299){A=(j=R.headers)==null?void 0:j.description.toLowerCase();break}if(((z=R.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){y=!0;break}}if(R.data.length===0)break;h.push(new qf(R))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(A)throw new Error(`bad request: ${A}`);h.stop()})})(),Promise.resolve(h)}}class qf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(gr.Subject)}get seq(){const n=this.header.last(gr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(gr.TimeStamp)}get stream(){return this.header.last(gr.Stream)}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(qf,"jc");class U1 extends Ha{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new Kf(s,a),this.consumers=new kc(s,a),this.direct=new q1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,c)=>{if(a)throw a;try{const f=this.parseJsResponse(c),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class Og{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):tn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Js.decode(n)}else this._header=os();return this._header}_parse(n){const s=atob(n),a=s.length,c=new Uint8Array(a);for(let f=0;f<a;f++)c[f]=s.charCodeAt(f);return c}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(Og,"jc");class B1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Pc(this.api,s))}}class mf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Js.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function O0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function L1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Ra{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new mf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const c=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:c}),d=Tn().decode(f.data);return d.revision=f.seq,d}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new Rf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Rf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var be;const c=this.js.getOptions();a=a||{timeout:c.timeout},a.timeout=a.timeout||c.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,d=this.js.nc.info,g=(d==null?void 0:d.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((be=n.options)==null?void 0:be.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const A=await this.info(n.name),{name:w,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const z=Is.next(),R=this._chunkSubject(z),H=this._metaSubject(w),ee=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},O0(n)),ne=st(),W=[],me=new Er;try{const k=s?s.getReader():null,I=p0.create();for(;;){const{done:ie,value:Z}=k?await k.read():{done:!0,value:void 0};if(ie){if(me.size()>0){const re=me.drain();I.update(re),ee.chunks++,ee.size+=re.length,W.push(this.js.publish(R,re,{timeout:f}))}await Promise.all(W),W.length=0,ee.mtime=new Date().toISOString();const Q=vr.encode(I.digest());ee.digest=`${E0}${Q}`,ee.deleted=!1;const K=os();typeof h=="number"&&K.set(zn.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(H,Tn().encode(ee),{headers:K,timeout:f});if(ee.revision=ae.seq,A)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${A.nuid}`})}catch{}ne.resolve(new mf(ee));break}if(Z)for(me.fill(Z);me.size()>y;){ee.chunks++,ee.size+=y;const Q=me.drain(n.options.max_chunk_size);I.update(Q),W.push(this.js.publish(R,Q,{timeout:f}))}}}catch(k){await this.jsm.streams.purge(this.stream,{filter:R}),ne.reject(k)}return ne}putBlob(n,s,a){function c(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,c(s),a)}put(n,s,a){var c;return(c=n==null?void 0:n.options)!=null&&c.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Er,d=f.getReader();for(;;){const{done:g,value:y}=await d.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const c=await Promise.all([a.error,s(a.data)]);return c[0]?Promise.reject(c[0]):Promise.resolve(c[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Ra.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(E0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Tf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const c=st(),f={info:new mf(s),error:c};if(s.size===0)return f.data=L1(),c.resolve(null),Promise.resolve(f);let h;const d=Qs();d.orderedConsumer();const g=p0.create(),y=`$O.${this.name}.C.${s.nuid}`,A=await this.js.subscribe(y,d);return(async()=>{for await(const w of A)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(jv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),A.unsubscribe())})().then(()=>{c.resolve()}).catch(w=>{h.error(w),c.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){A.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Ra))return Promise.reject("bucket required");const a=s,{name:c,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:c,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:c}=this._checkNotEmpty(n);if(c)return Promise.reject(c);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},d={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(d));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=Tn(),c=os();return c.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:c}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:c,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=c;const h=Object.assign({},a,O0(s)),d=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(d)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,c=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:c})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Tn(),h=Qs();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var A;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((A=y.info)==null?void 0:A.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(c,h);return a._data=d,a.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${vr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=T1(this.name)}catch(c){return Promise.reject(c)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=za.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ks.S2:Ks.None);try{await this.jsm.streams.info(a.name)}catch(c){c.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const c=await n.jetstreamManager(),f=new Ra(s,c,n);return await f.init(a),Promise.resolve(f)}}class H1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:c,min:f}=a.nc.features.get(ze.JS_KV);return c?s.bindOnly?Ua.bind(this.js,n,s):Ua.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:c,min:f}=a.nc.features.get(ze.JS_OBJECTSTORE);return c?Ra.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class Zf extends Ha{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new kc(s,a),this.streamAPI=new Kf(s,a),this.consumers=new zf(this.consumerAPI),this.streams=new B1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new H1(this)}async publish(s,a=tn,c){c=c||{},c.expect=c.expect||{};const f=(c==null?void 0:c.headers)||os();c&&(c.msgID&&f.set(zn.MsgIdHdr,c.msgID),c.expect.lastMsgID&&f.set(zn.ExpectedLastMsgIdHdr,c.expect.lastMsgID),c.expect.streamName&&f.set(zn.ExpectedStreamHdr,c.expect.streamName),typeof c.expect.lastSequence=="number"&&f.set(zn.ExpectedLastSeqHdr,`${c.expect.lastSequence}`),typeof c.expect.lastSubjectSequence=="number"&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${c.expect.lastSubjectSequence}`));const h=c.timeout||this.timeout,d={};h&&(d.timeout=h),c&&(d.headers=f);let{retries:g,retry_delay:y}=c;g=g||1,y=y||250;let A;for(let j=0;j<g;j++)try{A=await this.nc.request(s,a,d);break}catch(z){if(z.code==="503"&&j+1<g)await Ar(y);else throw z}const w=this.parseJsResponse(A);if(w.stream==="")throw oe.errorForCode(se.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,c=0){Mt(s),br(a);let f=this.timeout;c>f&&(f=c),c=c<0?0:nt(c);const h={batch:1,no_wait:c===0,expires:c},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=xr(d);if(g)throw g;return Ba(d,this.timeout)}fetch(s,a,c={}){Mt(s),br(a);let f=null;const h=(c.max_bytes??0)>0;let d=0;const g=h?c.max_bytes:0;let y=null;const A={};if(A.batch=c.batch||1,g){const W=this.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!W.ok)throw new Error(`max_bytes is only supported on servers ${W.min} or better`);A.max_bytes=g}A.no_wait=c.no_wait||!1,A.no_wait&&A.expires&&(A.expires=0);const w=c.expires||0;if(w&&(A.expires=nt(w)),w===0&&A.no_wait===!1)throw new Error("expires or no_wait is required");const j=c.idle_heartbeat||0;j&&(A.idle_heartbeat=nt(j),c.delay_heartbeat===!0&&(A.idle_heartbeat=nt(j*4)));const z=new _t,R=A.batch;let H=0;z.protocolFilterFn=(W,me=!1)=>Af(W.msg)?(y==null||y.work(),!1):!0,z.dispatchedFn=W=>{if(W){if(h&&(d+=W.data.length),H++,f&&W.info.pending===0)return;(z.getPending()===1&&W.info.pending===0||R===H||g>0&&d>=g)&&z.stop()}};const ee=cs(this.nc.options.inboxPrefix),ne=this.nc.subscribe(ee,{max:c.batch,callback:(W,me)=>{W===null&&(W=xr(me)),W!==null?(f&&(f.cancel(),f=null),cv(W)?z.stop(Tg(W)===null?void 0:W):z.stop(W)):(y==null||y.work(),z.received++,z.push(Ba(me,this.timeout)))}});return w&&(f=wr(w),f.catch(()=>{ne.isClosed()||(ne.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new Xf(j,W=>(z.push(()=>{z.err=new oe(`${yn.IdleHeartbeatMissed}: ${W}`,se.JetStreamIdleHeartBeat)}),!0)))}catch{}await ne.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),z.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(A),{reply:ee}),z}async pullSubscribe(s,a=Qs()){const c=await this._processOptions(s,a);if(c.ordered)throw new Error("pull subscribers cannot be be ordered");if(c.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=c.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(c),d=new G1(this,c.deliver,h);d.info=c;try{await this._maybeCreateConsumer(c)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Qs()){const c=await this._processOptions(s,a);if(!c.isBind&&!c.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(c),h=new jg(this,c.deliver,f);h.info=c;try{await this._maybeCreateConsumer(c)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Qs()){const c=f0(a)?a.getOpts():a;if(c.isBind=f0(a)?a.isBind:!1,c.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},c.ordered){if(c.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},c.config.ack_policy!==vt.NotSet&&c.config.ack_policy!==vt.None)throw new oe("ordered consumer: ack_policy can only be set to 'none'",se.ApiError);if(c.config.durable_name&&c.config.durable_name.length>0)throw new oe("ordered consumer: durable_name cannot be set",se.ApiError);if(c.config.deliver_subject&&c.config.deliver_subject.length>0)throw new oe("ordered consumer: deliver_subject cannot be set",se.ApiError);if(c.config.max_deliver!==void 0&&c.config.max_deliver>1)throw new oe("ordered consumer: max_deliver cannot be set",se.ApiError);if(c.config.deliver_group&&c.config.deliver_group.length>0)throw new oe("ordered consumer: deliver_group cannot be set",se.ApiError);c.config.deliver_subject=cs(this.nc.options.inboxPrefix),c.config.ack_policy=vt.None,c.config.max_deliver=1,c.config.flow_control=!0,c.config.idle_heartbeat=c.config.idle_heartbeat||nt(5e3),c.config.ack_wait=nt(1320*60*1e3),c.config.mem_storage=!0,c.config.num_replicas=1}if(c.config.ack_policy===vt.NotSet&&(c.config.ack_policy=vt.All),c.api=this,c.config=c.config||{},c.stream=c.stream?c.stream:await this.findStream(s),c.attached=!1,c.config.durable_name)try{const f=await this.consumerAPI.info(c.stream,c.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=c.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const d=f.config.deliver_group??"";if(h!==d)throw d===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${d}'`);c.last=f,c.config=f.config,c.attached=!0,c.config.durable_name||(c.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!c.attached&&c.config.filter_subject===void 0&&c.config.filter_subjects===void 0&&(c.config.filter_subject=s),c.deliver=c.config.deliver_subject||cs(this.nc.options.inboxPrefix),c}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=V1(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=Zf.ingestionFn(s.ordered),a.protocolFilterFn=(c,f=!1)=>{const h=c;return Ef(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=Q1),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Sr.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,c)=>{var g;const f=c;if(!a)return{ingest:!1,protocol:!1};const h=a;if(xr(h.msg)||(g=f.monitor)==null||g.work(),Af(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Ef(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class Wf{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=o1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const c=new Wf(n);Rc.connect(c.options,c).then(f=>{c.protocol=f,(async function(){for await(const h of f.status())c.listeners.forEach(d=>{d.push(h)})})(),s(c)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw oe.errorForCode(se.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw oe.errorForCode(se.ConnectionDraining);if(n=n||"",n.length===0)throw oe.errorForCode(se.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Sg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const c=n;c.max=a,a&&(c.max=a+c.received),this.protocol.resub(c,s)}requestMany(n,s=tn,a={maxWait:1e3,maxMessages:-1}){const c=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||jn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new oe("timeout",se.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function d(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=c?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const A=this.subscribe(cs(this.options.inboxPrefix),{callback:(R,H)=>{var ee,ne;if(((ee=H==null?void 0:H.data)==null?void 0:ee.length)===0&&((ne=H==null?void 0:H.headers)==null?void 0:ne.status)===se.NoResponders&&(R=oe.errorForCode(se.NoResponders)),R){g&&(R.stack+=`
48
48
 
49
- ${g}`),w(R);return}d(null,H),a.strategy===jn.Count&&(y--,y===0&&w()),a.strategy===jn.JitterTimer&&(z(),j=setTimeout(()=>{w()},300)),a.strategy===jn.SentinelMsg&&H&&H.data.length===0&&w()}});A.requestSubject=n,A.closed.then(()=>{h()}).catch(R=>{f.stop(R)});const w=R=>{R&&f.push(()=>{throw R}),z(),A.drain().then(()=>{h()}).catch(H=>{h()})};f.iterClosed.then(()=>{z(),A==null||A.unsubscribe()}).catch(R=>{z(),A==null||A.unsubscribe()});try{this.publish(n,s,{reply:A.getSubject()})}catch(R){w(R)}let j=setTimeout(()=>{w()},a.maxWait);const z=()=>{j&&clearTimeout(j)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(A=>{y.cancel(A)});const y=new Nv(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(A){y.cancel(A)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const c=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new oe("timeout",se.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new oe("reply can only be used with noMux",se.InvalidOption));if(a.noMux){const f=a.reply?a.reply:cs(this.options.inboxPrefix),h=st(),d=c?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,A)=>{y?(d&&y.code!==se.Timeout&&(y.stack+=`
49
+ ${g}`),w(R);return}d(null,H),a.strategy===jn.Count&&(y--,y===0&&w()),a.strategy===jn.JitterTimer&&(z(),j=setTimeout(()=>{w()},300)),a.strategy===jn.SentinelMsg&&H&&H.data.length===0&&w()}});A.requestSubject=n,A.closed.then(()=>{h()}).catch(R=>{f.stop(R)});const w=R=>{R&&f.push(()=>{throw R}),z(),A.drain().then(()=>{h()}).catch(H=>{h()})};f.iterClosed.then(()=>{z(),A==null||A.unsubscribe()}).catch(R=>{z(),A==null||A.unsubscribe()});try{this.publish(n,s,{reply:A.getSubject()})}catch(R){w(R)}let j=setTimeout(()=>{w()},a.maxWait);const z=()=>{j&&clearTimeout(j)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(A=>{y.cancel(A)});const y=new Tv(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(A){y.cancel(A)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const c=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new oe("timeout",se.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new oe("reply can only be used with noMux",se.InvalidOption));if(a.noMux){const f=a.reply?a.reply:cs(this.options.inboxPrefix),h=st(),d=c?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,A)=>{y?(d&&y.code!==se.Timeout&&(y.stack+=`
50
50
 
51
51
  ${d.stack}`),g.unsubscribe(),h.reject(y)):(y=mg(A),y?(d&&(y.stack+=`
52
52
 
53
- ${d.stack}`),h.reject(y)):h.resolve(A))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new yg(this.protocol.muxSubscriptions,n,a,c);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(d){f.cancel(d)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isDraining()?Promise.reject(oe.errorForCode(se.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new B1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const c=a;throw c.code===se.NoResponders&&(c.code=se.JetStreamNotEnabled),c}return s}jetstream(n={}){return new Zf(this,n)}getServerVersion(){const n=this.info;return n?Si(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw oe.errorForCode(se.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new Y1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isDraining()?Promise.reject(oe.errorForCode(se.ConnectionDraining)):this.protocol.reconnect()}}class Y1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Pa(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new _1(this.nc,n,s)}}class $1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Dc)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class G1{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Jf(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Dc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class jg extends Rv{constructor(s,a,c){super(s.nc,a,c);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=cs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Is.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const d=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(d,h,{retries:-1}).then(g=>{const y=g,A=this.sub.info;A.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new oe(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,se.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,c;const s=((c=(a=this.info)==null?void 0:a.config)==null?void 0:c.idle_heartbeat)||0;s&&this._setupHbMonitoring(Jf(s))}_setupHbMonitoring(s,a=0){const c={cancelAfter:0,maxOut:2};a&&(c.cancelAfter=a);const f=this.sub,h=d=>{var A,w,j,z;const g=dv(409,`${yn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((A=this.info)==null?void 0:A.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const R=((j=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(R+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new Xf(s,h,c)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const c=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,c!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,c=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=c,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,c=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(c)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,c=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(c);return s.last=f,f}}class V1 extends jg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:c}=this.sub.info,f=a.durable_name??c,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let d=0;n.expires&&n.expires>0&&(d=n.expires,h.expires=nt(d));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&d===0)throw new Error("idle_heartbeat requires expires");if(g>d)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),d&&g&&(this.monitor?this.monitor._change(g,d):this._setupHbMonitoring(g,d));const y=this.info.api,A=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(A,y.jc.encode(h),{reply:w})}}}function F1(r,n){return r?Q1(n):J1(n)}function J1(r){return(n,s)=>n?[n,null]:(n=xr(s),n?[n,null]:[null,Ba(s,r)])}function Q1(r){return(n,s)=>{if(n)return[n,null];const a=xr(s);return a!==null?[Tg(a),null]:[null,Ba(s,r)]}}function Tg(r){if(r!==null)switch(r.code){case se.JetStream404NoMessages:case se.JetStream408RequestTimeout:return null;case se.JetStream409:return mv(r)?r:null;default:return r}return null}function X1(r){r&&r.ack()}function I1(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class K1{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=I1(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Sa[0]&&n[1]===Sa[1]&&n[2]===Sa[2]&&n[3]===Sa[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),d=new yg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,A0,{reply:`${f.muxSubscriptions.baseInbox}${d.token}`})}catch(g){d.cancel(g)}try{await Promise.race([d.timer,d.deferred]),s.resolve(!0)}catch(g){d.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(A0)}nak(n){let s=k1;n&&(s=Sf().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Sa)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const c=Tn().encode(a),f=Er.concat(M1,D1,c),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=R1;(n==null?void 0:n.length)>0&&(s=Sf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const Z1="1.30.3",W1="nats.ws";class e_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=Z1,this.lang=W1,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new oe("tls",se.InvalidOption)),a;this.options=s;const c=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=c.indexOf("wss://")===0,this.socket=new WebSocket(c);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Er.concat(...this.yields),d=Lv(h);if(d!==""){const g=d1.exec(d);if(!g){s.debug&&console.error("!!!",uc(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);f1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,d=new oe(h.message,se.Unknown,new Error(h.error));a.reject(d)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Ar(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${uc(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${uc(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${uc(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function t_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const c=a.protocol.toLowerCase();c==="ws:"&&(n=!1),c==="wss:"&&(n=!0),c!=="https:"&&c!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const d=a.hostname,g=a.pathname,y=a.search||"";switch(c){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${d}:${h}${g}${y}`}function n_(r={}){return Dv({defaultPort:443,urlParseFn:t_,factory:()=>new e_}),Wf.connect(r)}const s_="ws://localhost:9222",i_="dev_api_secret",r_="lt.events";function Ng(r,n){const s=r.split("."),a=n.split(".");for(let c=0;c<a.length;c++){const f=a[c];if(f===">")return!0;if(c>=s.length||f!=="*"&&f!==s[c])return!1}return s.length===a.length}const Yc=N.createContext({connected:!1,subscribe:()=>()=>{}});function a_(){const{connected:r}=N.useContext(Yc);return{connected:r}}function Cg(r,n){const{subscribe:s}=N.useContext(Yc),a=N.useRef(n);a.current=n,N.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const l_=N.createContext({connected:!1,subscribe:()=>()=>{}}),c_=Sf();function o_({children:r,url:n,token:s}){const a=N.useRef(null),c=N.useRef(null),[f,h]=N.useState(!1),d=N.useRef(null),g=N.useRef(new Map),y=N.useCallback((j,z)=>{const R=g.current;return R.has(j)||R.set(j,new Set),R.get(j).add(z),()=>{const H=R.get(j);H&&(H.delete(z),H.size===0&&R.delete(j))}},[]),A=N.useCallback((j,z)=>{for(const[R,H]of g.current)if(Ng(j,R))for(const ee of H)try{ee(z)}catch{}},[]),w=N.useCallback(async()=>{try{if(a.current)return;const j=await n_({servers:n||s_,token:s||i_,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=j,h(!0);const z=j.subscribe("lt.>");c.current=z,(async()=>{for await(const R of z)try{const H=JSON.parse(c_.decode(R.data));A(R.subject,H)}catch{}})(),(async()=>{for await(const R of j.status())R.type==="disconnect"||R.type==="error"?h(!1):R.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[A]);return N.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),p.jsx(l_.Provider,{value:{connected:f,subscribe:y},children:p.jsx(Yc.Provider,{value:{connected:f,subscribe:y},children:r})})}const Bn=Object.create(null);Bn.open="0";Bn.close="1";Bn.ping="2";Bn.pong="3";Bn.message="4";Bn.upgrade="5";Bn.noop="6";const _c=Object.create(null);Object.keys(Bn).forEach(r=>{_c[Bn[r]]=r});const Uf={type:"error",data:"parser error"},kg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mg=typeof ArrayBuffer=="function",Rg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,eh=({type:r,data:n},s,a)=>kg&&n instanceof Blob?s?a(n):j0(n,a):Mg&&(n instanceof ArrayBuffer||Rg(n))?s?a(n):j0(new Blob([n]),a):a(Bn[r]+(n||"")),j0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function T0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let pf;function u_(r,n){if(kg&&r.data instanceof Blob)return r.data.arrayBuffer().then(T0).then(n);if(Mg&&(r.data instanceof ArrayBuffer||Rg(r.data)))return n(T0(r.data));eh(r,!1,s=>{pf||(pf=new TextEncoder),n(pf.encode(s))})}const N0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Na=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<N0.length;r++)Na[N0.charCodeAt(r)]=r;const f_=r=>{let n=r.length*.75,s=r.length,a,c=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),A=new Uint8Array(y);for(a=0;a<s;a+=4)f=Na[r.charCodeAt(a)],h=Na[r.charCodeAt(a+1)],d=Na[r.charCodeAt(a+2)],g=Na[r.charCodeAt(a+3)],A[c++]=f<<2|h>>4,A[c++]=(h&15)<<4|d>>2,A[c++]=(d&3)<<6|g&63;return y},h_=typeof ArrayBuffer=="function",th=(r,n)=>{if(typeof r!="string")return{type:"message",data:Dg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:d_(r.substring(1),n)}:_c[s]?r.length>1?{type:_c[s],data:r.substring(1)}:{type:_c[s]}:Uf},d_=(r,n)=>{if(h_){const s=f_(r);return Dg(s,n)}else return{base64:!0,data:r}},Dg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},zg="",m_=(r,n)=>{const s=r.length,a=new Array(s);let c=0;r.forEach((f,h)=>{eh(f,!1,d=>{a[h]=d,++c===s&&n(a.join(zg))})})},p_=(r,n)=>{const s=r.split(zg),a=[];for(let c=0;c<s.length;c++){const f=th(s[c],n);if(a.push(f),f.type==="error")break}return a};function g_(){return new TransformStream({transform(r,n){u_(r,s=>{const a=s.length;let c;if(a<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,a);else if(a<65536){c=new Uint8Array(3);const f=new DataView(c.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{c=new Uint8Array(9);const f=new DataView(c.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(c[0]|=128),n.enqueue(c),n.enqueue(s)})}})}let gf;function mc(r){return r.reduce((n,s)=>n+s.length,0)}function pc(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let c=0;c<n;c++)s[c]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function y_(r,n){gf||(gf=new TextDecoder);const s=[];let a=0,c=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(mc(s)<1)break;const g=pc(s,1);f=(g[0]&128)===128,c=g[0]&127,c<126?a=3:c===126?a=1:a=2}else if(a===1){if(mc(s)<2)break;const g=pc(s,2);c=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(mc(s)<8)break;const g=pc(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),A=y.getUint32(0);if(A>Math.pow(2,21)-1){d.enqueue(Uf);break}c=A*Math.pow(2,32)+y.getUint32(4),a=3}else{if(mc(s)<c)break;const g=pc(s,c);d.enqueue(th(f?g:gf.decode(g),n)),a=0}if(c===0||c>r){d.enqueue(Uf);break}}}})}const qg=4;function gt(r){if(r)return b_(r)}function b_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,c=0;c<s.length;c++)if(a=s[c],a===n||a.fn===n){s.splice(c,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,c=s.length;a<c;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const $c=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),bn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),x_="arraybuffer";function Ug(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const v_=bn.setTimeout,__=bn.clearTimeout;function Gc(r,n){n.useNativeTimers?(r.setTimeoutFn=v_.bind(bn),r.clearTimeoutFn=__.bind(bn)):(r.setTimeoutFn=bn.setTimeout.bind(bn),r.clearTimeoutFn=bn.clearTimeout.bind(bn))}const w_=1.33;function S_(r){return typeof r=="string"?E_(r):Math.ceil((r.byteLength||r.size)*w_)}function E_(r){let n=0,s=0;for(let a=0,c=r.length;a<c;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Bg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function A_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function O_(r){let n={},s=r.split("&");for(let a=0,c=s.length;a<c;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class j_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class nh extends gt{constructor(n){super(),this.writable=!1,Gc(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new j_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=th(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=A_(n);return s.length?"?"+s:""}}class T_ extends nh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};p_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,m_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Bg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Lg=!1;try{Lg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const N_=Lg;function C_(){}class k_ extends T_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(c,f)=>{this.onError("xhr post error",c,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Un extends gt{constructor(n,s,a){super(),this.createRequest=n,Gc(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Ug(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&a.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var c;a.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=Un.requestsCount++,Un.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=C_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Un.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Un.requestsCount=0;Un.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",C0);else if(typeof addEventListener=="function"){const r="onpagehide"in bn?"pagehide":"unload";addEventListener(r,C0,!1)}}function C0(){for(let r in Un.requests)Un.requests.hasOwnProperty(r)&&Un.requests[r].abort()}const M_=(function(){const r=Hg({xdomain:!1});return r&&r.responseType!==null})();class R_ extends k_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=M_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Un(Hg,this.uri(),n)}}function Hg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||N_))return new XMLHttpRequest}catch{}if(!n)try{return new bn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Pg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class D_ extends nh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Pg?{}:Ug(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],c=s===n.length-1;eh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}c&&$c(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Bg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const yf=bn.WebSocket||bn.MozWebSocket;class z_ extends D_{createSocket(n,s,a){return Pg?new yf(n,s,a):s?new yf(n,s):new yf(n)}doWrite(n,s){this.ws.send(s)}}class q_ extends nh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=y_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),c=g_();c.readable.pipeTo(n.writable),this._writer=c.writable.getWriter();const f=()=>{a.read().then(({done:d,value:g})=>{d||(this.onPacket(g),f())}).catch(d=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],c=s===n.length-1;this._writer.write(a).then(()=>{c&&$c(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const U_={websocket:z_,webtransport:q_,polling:R_},B_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,L_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let c=B_.exec(r||""),f={},h=14;for(;h--;)f[L_[h]]=c[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=H_(f,f.path),f.queryKey=P_(f,f.query),f}function H_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function P_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,c,f){c&&(s[c]=f)}),s}const Lf=typeof addEventListener=="function"&&typeof removeEventListener=="function",wc=[];Lf&&addEventListener("offline",()=>{wc.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=x_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Bf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Bf(s.host).host);Gc(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const c=a.prototype.name;this.transports.push(c),this._transportsByName[c]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=O_(this.opts.query)),Lf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},wc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=qg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const c=this.writeBuffer[a].data;if(c&&(s+=S_(c)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,$c(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,c){if(typeof s=="function"&&(c=s,s=void 0),typeof a=="function"&&(c=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),c&&this.once("flush",c),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Lf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=wc.indexOf(this._offlineEventListener);a!==-1&&wc.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=qg;class Y_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const c=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(A(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=s.name,this.emitReserved("upgradeError",j)}}))};function f(){a||(a=!0,A(),s.close(),s=null)}const h=w=>{const j=new Error("probe error: "+w);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const A=()=>{s.removeListener("open",c),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",c),s.once("error",h),s.once("close",d),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let $_=class extends Y_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(c=>U_[c]).filter(c=>!!c)),super(n,a)}};function G_(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Bf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const V_=typeof ArrayBuffer=="function",F_=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Yg=Object.prototype.toString,J_=typeof Blob=="function"||typeof Blob<"u"&&Yg.call(Blob)==="[object BlobConstructor]",Q_=typeof File=="function"||typeof File<"u"&&Yg.call(File)==="[object FileConstructor]";function sh(r){return V_&&(r instanceof ArrayBuffer||F_(r))||J_&&r instanceof Blob||Q_&&r instanceof File}function Sc(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(Sc(r[s]))return!0;return!1}if(sh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Sc(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&Sc(r[s]))return!0;return!1}function X_(r){const n=[],s=r.data,a=r;return a.data=Hf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Hf(r,n){if(!r)return r;if(sh(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=Hf(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=Hf(r[a],n));return s}return r}function I_(r,n){return r.data=Pf(r.data,n),delete r.attachments,r}function Pf(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Pf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Pf(r[s],n));return r}const K_=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var De;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(De||(De={}));class Z_{constructor(n){this.replacer=n}encode(n){return(n.type===De.EVENT||n.type===De.ACK)&&Sc(n)?this.encodeAsBinary({type:n.type===De.EVENT?De.BINARY_EVENT:De.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===De.BINARY_EVENT||n.type===De.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=X_(n),a=this.encodeAsString(s.packet),c=s.buffers;return c.unshift(a),c}}class ih extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===De.BINARY_EVENT;a||s.type===De.BINARY_ACK?(s.type=a?De.EVENT:De.ACK,this.reconstructor=new W_(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(sh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(De[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===De.BINARY_EVENT||a.type===De.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const d=Number(h);if(!ew(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=d}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const c=n.charAt(s+1);if(c!==""&&Number(c)==c){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(ih.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case De.CONNECT:return k0(s);case De.DISCONNECT:return s===void 0;case De.CONNECT_ERROR:return typeof s=="string"||k0(s);case De.EVENT:case De.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&K_.indexOf(s[0])===-1);case De.ACK:case De.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class W_{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=I_(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const ew=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function k0(r){return Object.prototype.toString.call(r)==="[object Object]"}const tw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ih,Encoder:Z_,get PacketType(){return De}},Symbol.toStringTag,{value:"Module"}));function On(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const nw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class $g extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[On(n,"open",this.onopen.bind(this)),On(n,"packet",this.onpacket.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,c,f;if(nw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:De.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const A=this.ids++,w=s.pop();this._registerAckCallback(A,w),h.id=A}const d=(c=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||c===void 0?void 0:c.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!d||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const c=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(c===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===n&&this.sendBuffer.splice(d,1);s.call(this,new Error("operation has timed out"))},c),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,c)=>{const f=(h,d)=>h?c(h):a(d);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((c,...f)=>(this._queue[0],c!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(c)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:De.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case De.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case De.EVENT:case De.BINARY_EVENT:this.onevent(n);break;case De.ACK:case De.BINARY_ACK:this.onack(n);break;case De.DISCONNECT:this.ondisconnect();break;case De.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...c){a||(a=!0,s.packet({type:De.ACK,id:n,data:c}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:De.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function Or(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Or.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};Or.prototype.reset=function(){this.attempts=0};Or.prototype.setMin=function(r){this.ms=r};Or.prototype.setMax=function(r){this.max=r};Or.prototype.setJitter=function(r){this.jitter=r};class Yf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Gc(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Or({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const c=s.parser||tw;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new $_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const c=On(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=On(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{c(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(c),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(On(n,"ping",this.onping.bind(this)),On(n,"data",this.ondata.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this)),On(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){$c(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new $g(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(c=>{c?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",c)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Ea={};function Ec(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=G_(r,n.path||"/socket.io"),a=s.source,c=s.id,f=s.path,h=Ea[c]&&f in Ea[c].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Yf(a,n):(Ea[c]||(Ea[c]=new Yf(a,n)),g=Ea[c]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(Ec,{Manager:Yf,Socket:$g,io:Ec,connect:Ec});const sw=N.createContext({connected:!1,subscribe:()=>()=>{}});function iw({children:r}){const n=N.useRef(null),[s,a]=N.useState(!1),c=N.useRef(new Map),f=N.useCallback((d,g)=>{const y=c.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const A=y.get(d);A&&(A.delete(g),A.size===0&&y.delete(d))}},[]),h=N.useCallback((d,g)=>{for(const[y,A]of c.current)if(Ng(d,y))for(const w of A)try{w(g)}catch{}},[]);return N.useEffect(()=>{const d=ug(),g=Ec({path:"/socket.io",transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...d?{auth:{token:d}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,A)=>{if(y.startsWith("lt."))try{const w=typeof A=="string"?JSON.parse(A):A;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),p.jsx(sw.Provider,{value:{connected:s,subscribe:f},children:p.jsx(Yc.Provider,{value:{connected:s,subscribe:f},children:r})})}function rw({children:r}){const[n,s]=N.useState(null),[a,c]=N.useState({url:null,token:null});return N.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch("/api/settings");if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),A=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",A),!f){if(A==="nats"){let w=y.events.natsWsUrl??null,j=null;const z=ug();if(z)try{const R=await fetch("/api/nats-credentials",{headers:{Authorization:`Bearer ${z}`}});if(R.ok){const H=await R.json();w=H.natsWsUrl??w,j=H.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}c({url:w,token:j})}s(A==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?p.jsx(o_,{url:a.url,token:a.token,children:r}):n==="socketio"?p.jsx(iw,{children:r}):p.jsx(p.Fragment,{children:r})}const Gg=N.createContext(null),M0="lt_sidebar_collapsed";function aw({children:r}){const[n,s]=N.useState(()=>{try{return localStorage.getItem(M0)==="true"}catch{return!1}}),a=N.useCallback(()=>{s(c=>{const f=!c;try{localStorage.setItem(M0,String(f))}catch{}return f})},[]);return p.jsx(Gg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Vg(){const r=N.useContext(Gg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function gE(r){const n=r?`?period=${r}`:"";return fs({queryKey:["escalationStats",r],queryFn:()=>Ie(`/escalations/stats${n}`)})}function yE(){return fs({queryKey:["escalationTypes"],queryFn:()=>Ie("/escalations/types")})}function lw(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.status&&a.set("status",s.status),s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.assigned_to&&a.set("assigned_to",s.assigned_to),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),fs({queryKey:["escalations",s],queryFn:()=>Ie(`/escalations?${a}`),enabled:n})}function cw(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),fs({queryKey:["escalations","available",s],queryFn:()=>Ie(`/escalations/available?${a}`),enabled:n})}function bE(r){return fs({queryKey:["escalations","by-workflow",r],queryFn:()=>Ie(`/escalations/by-workflow/${r}`),enabled:!!r})}function xE(r){return fs({queryKey:["escalations",r],queryFn:()=>Ie(`/escalations/${r}`),enabled:!!r})}function vE(){const r=Nn();return Ln({mutationFn:({id:n,durationMinutes:s})=>Ie(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function _E(){const r=Nn();return Ln({mutationFn:n=>Ie(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function wE(){const r=Nn();return Ln({mutationFn:({id:n,resolverPayload:s})=>Ie(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"}),r.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),r.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function SE(){const r=Nn();return Ln({mutationFn:({id:n,targetRole:s})=>Ie(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function EE(){const r=Nn();return Ln({mutationFn:({ids:n,priority:s})=>Ie("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function AE(){const r=Nn();return Ln({mutationFn:({ids:n,durationMinutes:s})=>Ie("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function OE(){const r=Nn();return Ln({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Ie("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function jE(){const r=Nn();return Ln({mutationFn:({ids:n,targetRole:s})=>Ie("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function TE(){const r=Nn();return Ln({mutationFn:({ids:n,hint:s})=>Ie("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function ow(){const{user:r}=Ai(),n=r==null?void 0:r.userId,s=Nn(),a=N.useRef(null),c=N.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);Cg(`${r_}.escalation.>`,c);const{data:f}=cw({limit:1}),{data:h}=lw({assigned_to:n,status:"pending",limit:200}),d=new Date,g=((h==null?void 0:h.escalations)??[]).filter(y=>y.assigned_until&&new Date(y.assigned_until)>d);return{available:(f==null?void 0:f.total)??0,mine:g.length}}function rh({size:r="sm",hideLabel:n=!1}){const s=r==="lg",a=s?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",c=s?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return p.jsxs("div",{className:"flex items-center",style:{height:"50px"},children:[p.jsx("img",{src:"/logo512.png",alt:"LongTail",className:`shrink-0 z-0 ${a}`}),p.jsx("span",{className:`z-[1] transition-opacity duration-300 ${c} ${n?"opacity-0":""}`,children:"LongTail"})]})}function uw({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Ai(),{available:c,mine:f}=ow(),{connected:h}=a_(),[d,g]=N.useState(!1),y=N.useRef(null);return N.useEffect(()=>{if(!d)return;const A=w=>{y.current&&!y.current.contains(w.target)&&g(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[d]),p.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[p.jsx("div",{className:"flex items-center gap-4",children:p.jsx(pr,{to:"/","aria-label":"Home",children:p.jsx(rh,{})})}),p.jsxs("div",{className:"flex items-center gap-5",children:[p.jsxs(pr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${c>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[p.jsx(wx,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"all",c>0&&p.jsx("span",{className:"tabular-nums font-medium",children:c})]}),p.jsxs(pr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[p.jsx(Sx,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",f>0&&p.jsx("span",{className:"tabular-nums font-medium",children:f})]}),p.jsx("div",{className:"w-px h-4 bg-surface-border"}),p.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1.5 text-[11px] transition-colors ${h?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:h?"Live events — click to toggle feed":"Events disconnected",children:[p.jsx(sg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),p.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[p.jsx(ig,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]}),p.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&p.jsxs("div",{className:"relative",ref:y,children:[p.jsxs("button",{onClick:()=>g(A=>!A),className:"btn-ghost text-xs flex items-center gap-1",children:[p.jsx(Ex,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,p.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),d&&p.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[p.jsx(pr,{to:"/credentials",onClick:()=>g(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),p.jsx("button",{onClick:()=>{g(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function ah({open:r,children:n}){const[s,a]=N.useState(r);return N.useEffect(()=>{r&&a(!0)},[r]),p.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:p.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function $f(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",c="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:c}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:c}`}}function fw(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function hw({group:r,collapsed:n}){const{pathname:s}=Ei(),a=r.matchPaths.some(d=>s.startsWith(d)),[c,f]=N.useState(a),h=c||a;return n?p.jsx(p.Fragment,{children:r.items.map(d=>p.jsx(Ac,{to:d.to,className:$f(!0),title:d.label,children:d.icon&&p.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):p.jsxs("div",{children:[p.jsxs("button",{onClick:()=>f(d=>!d),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[p.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:r.label})]}),p.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),p.jsx(ah,{open:h,children:r.items.map(d=>p.jsxs(Ac,{to:d.to,end:d.end,className:fw(),children:[d.icon&&p.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:d.label})]},d.to))})]})}function dw(r){return r.kind==="group"}function mw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ei();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=$f(n)({isActive:d});return p.jsxs(Ac,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&p.jsx("span",{children:r.label})]})}return p.jsxs(Ac,{to:r.to,end:r.end,className:$f(n),title:n?r.label:void 0,children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&p.jsx("span",{children:r.label})]})}function Vc({heading:r,entries:n}){const{collapsed:s}=Vg();return p.jsxs("div",{className:"space-y-1",children:[s?p.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):p.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>dw(a)?p.jsx(hw,{group:a,collapsed:s},a.label):p.jsx(mw,{entry:a,collapsed:s},a.to))]})}const pw=[{to:"/",label:"Recent Activity",icon:Ax,end:!0},{to:"/capabilities",label:"Capabilities",icon:Ox},{to:"/agents",label:"Agents",icon:jx},{to:"/topics",label:"Topics",icon:sg}];function gw(){return p.jsx(Vc,{heading:"Work",entries:pw})}const yw=[{kind:"group",label:"Workflows",icon:Qp,matchPaths:["/workflows"],items:[{to:"/workflows/registry",label:"Registry",icon:Qp},{to:"/workflows/start",label:"Invoke",icon:Tx},{to:"/workflows/executions",label:"Executions",icon:Xp}]},{kind:"group",label:"Pipelines",icon:Oc,matchPaths:["/mcp"],items:[{to:"/mcp/queries",label:"Designer",icon:Nx},{to:"/mcp/servers",label:"Servers & Tools",icon:rg},{to:"/mcp/workflows",label:"Pipeline Tools",icon:Oc},{to:"/mcp/executions",label:"Executions",icon:Xp}]}];function bw(){return p.jsx(Vc,{heading:"Build",entries:yw})}const xw=[{to:"/files",label:"Files",icon:Cx},{to:"/knowledge",label:"Knowledge",icon:kx}];function vw(){return p.jsx(Vc,{heading:"Storage",entries:xw})}const Fg=N.forwardRef((r,n)=>p.jsx(Mx,{ref:n,...r,style:{...r.style,transform:"rotate(90deg)"}}));Fg.displayName="QueueIcon";const _w=[{kind:"group",label:"Identity & Access",icon:zx,matchPaths:["/admin/users","/admin/roles"],items:[{to:"/admin/users",label:"Accounts",icon:Rx},{to:"/admin/roles",label:"Roles & Permissions",icon:Dx}]},{kind:"group",label:"Infrastructure",icon:rg,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Queues",icon:Fg},{to:"/admin/streams",label:"Messages",icon:qx},{to:"/admin/maintenance",label:"DB Maintenance",icon:Ux}]}];function ww(){return p.jsx(Vc,{heading:"Admin",entries:_w})}function Sw({children:r,className:n=""}){return p.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const bf=280,R0="cubic-bezier(0.4, 0, 0.2, 1)",gc=40;function Ew(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-gc*2,c=s-gc*2,f=r.width/a,h=r.height/c,d=r.left+r.width/2-(gc+a/2),g=r.top+r.height/2-(gc+c/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Jg({open:r,onClose:n,sourceRef:s,children:a}){const[c,f]=N.useState(null),h=N.useRef(null),d=N.useRef(!1);N.useEffect(()=>{var j,z;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&c==="open"&&(h.current=((z=s==null?void 0:s.current)==null?void 0:z.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,c]),N.useEffect(()=>{if(c!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[c]),N.useEffect(()=>{if(c)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[c]),N.useEffect(()=>{if(!c)return;const j=z=>{z.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[c,n]);const g=N.useCallback(j=>{j.propertyName==="transform"&&c==="exiting"&&f(null)},[c]);if(N.useEffect(()=>{if(c!=="exiting")return;const j=setTimeout(()=>f(null),bf+50);return()=>clearTimeout(j)},[c]),!c)return null;const y=c==="entering"||c==="exiting",A=y?Ew(h.current):"none",w=y?0:1;return tg.createPortal(p.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${bf}ms ${R0}, opacity ${bf}ms ${R0}`,transform:A,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function Aw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Ow({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function jw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function Tw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Nw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function Cw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function kw(r){const n=r.trim().split(`
54
- `);if(n.length<2)return r;const s=d=>d.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),c=n.slice(2),f=a.map(d=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${d}</th>`).join(""),h=c.map(d=>`<tr class="border-t border-surface-border">${s(d).map(A=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${A}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${h}</tbody></table>`}function yc(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Mw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,A)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${A}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,A,w)=>kw(`${y}
53
+ ${d.stack}`),h.reject(y)):h.resolve(A))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new yg(this.protocol.muxSubscriptions,n,a,c);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(d){f.cancel(d)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isDraining()?Promise.reject(oe.errorForCode(se.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new U1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const c=a;throw c.code===se.NoResponders&&(c.code=se.JetStreamNotEnabled),c}return s}jetstream(n={}){return new Zf(this,n)}getServerVersion(){const n=this.info;return n?Si(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw oe.errorForCode(se.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new P1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isDraining()?Promise.reject(oe.errorForCode(se.ConnectionDraining)):this.protocol.reconnect()}}class P1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Pa(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new v1(this.nc,n,s)}}class Y1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Dc)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class $1{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Jf(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Dc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class jg extends Mv{constructor(s,a,c){super(s.nc,a,c);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=cs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Is.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const d=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(d,h,{retries:-1}).then(g=>{const y=g,A=this.sub.info;A.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new oe(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,se.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,c;const s=((c=(a=this.info)==null?void 0:a.config)==null?void 0:c.idle_heartbeat)||0;s&&this._setupHbMonitoring(Jf(s))}_setupHbMonitoring(s,a=0){const c={cancelAfter:0,maxOut:2};a&&(c.cancelAfter=a);const f=this.sub,h=d=>{var A,w,j,z;const g=hv(409,`${yn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((A=this.info)==null?void 0:A.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const R=((j=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(R+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new Xf(s,h,c)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const c=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,c!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,c=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=c,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,c=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(c)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,c=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(c);return s.last=f,f}}class G1 extends jg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:c}=this.sub.info,f=a.durable_name??c,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let d=0;n.expires&&n.expires>0&&(d=n.expires,h.expires=nt(d));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&d===0)throw new Error("idle_heartbeat requires expires");if(g>d)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),d&&g&&(this.monitor?this.monitor._change(g,d):this._setupHbMonitoring(g,d));const y=this.info.api,A=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(A,y.jc.encode(h),{reply:w})}}}function V1(r,n){return r?J1(n):F1(n)}function F1(r){return(n,s)=>n?[n,null]:(n=xr(s),n?[n,null]:[null,Ba(s,r)])}function J1(r){return(n,s)=>{if(n)return[n,null];const a=xr(s);return a!==null?[Tg(a),null]:[null,Ba(s,r)]}}function Tg(r){if(r!==null)switch(r.code){case se.JetStream404NoMessages:case se.JetStream408RequestTimeout:return null;case se.JetStream409:return dv(r)?r:null;default:return r}return null}function Q1(r){r&&r.ack()}function X1(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class I1{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=X1(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Sa[0]&&n[1]===Sa[1]&&n[2]===Sa[2]&&n[3]===Sa[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),d=new yg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,A0,{reply:`${f.muxSubscriptions.baseInbox}${d.token}`})}catch(g){d.cancel(g)}try{await Promise.race([d.timer,d.deferred]),s.resolve(!0)}catch(g){d.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(A0)}nak(n){let s=C1;n&&(s=Sf().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Sa)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const c=Tn().encode(a),f=Er.concat(k1,R1,c),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=M1;(n==null?void 0:n.length)>0&&(s=Sf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const K1="1.30.3",Z1="nats.ws";class W1{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=K1,this.lang=Z1,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new oe("tls",se.InvalidOption)),a;this.options=s;const c=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=c.indexOf("wss://")===0,this.socket=new WebSocket(c);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Er.concat(...this.yields),d=Bv(h);if(d!==""){const g=h1.exec(d);if(!g){s.debug&&console.error("!!!",uc(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);u1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,d=new oe(h.message,se.Unknown,new Error(h.error));a.reject(d)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Ar(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${uc(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${uc(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${uc(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function e_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const c=a.protocol.toLowerCase();c==="ws:"&&(n=!1),c==="wss:"&&(n=!0),c!=="https:"&&c!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const d=a.hostname,g=a.pathname,y=a.search||"";switch(c){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${d}:${h}${g}${y}`}function t_(r={}){return Rv({defaultPort:443,urlParseFn:e_,factory:()=>new W1}),Wf.connect(r)}const n_="ws://localhost:9222",s_="dev_api_secret",i_="lt.events";function Ng(r,n){const s=r.split("."),a=n.split(".");for(let c=0;c<a.length;c++){const f=a[c];if(f===">")return!0;if(c>=s.length||f!=="*"&&f!==s[c])return!1}return s.length===a.length}const Yc=C.createContext({connected:!1,subscribe:()=>()=>{}});function r_(){const{connected:r}=C.useContext(Yc);return{connected:r}}function Cg(r,n){const{subscribe:s}=C.useContext(Yc),a=C.useRef(n);a.current=n,C.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const a_=C.createContext({connected:!1,subscribe:()=>()=>{}}),l_=Sf();function c_({children:r,url:n,token:s}){const a=C.useRef(null),c=C.useRef(null),[f,h]=C.useState(!1),d=C.useRef(null),g=C.useRef(new Map),y=C.useCallback((j,z)=>{const R=g.current;return R.has(j)||R.set(j,new Set),R.get(j).add(z),()=>{const H=R.get(j);H&&(H.delete(z),H.size===0&&R.delete(j))}},[]),A=C.useCallback((j,z)=>{for(const[R,H]of g.current)if(Ng(j,R))for(const ee of H)try{ee(z)}catch{}},[]),w=C.useCallback(async()=>{try{if(a.current)return;const j=await t_({servers:n||n_,token:s||s_,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=j,h(!0);const z=j.subscribe("lt.>");c.current=z,(async()=>{for await(const R of z)try{const H=JSON.parse(l_.decode(R.data));A(R.subject,H)}catch{}})(),(async()=>{for await(const R of j.status())R.type==="disconnect"||R.type==="error"?h(!1):R.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[A]);return C.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),p.jsx(a_.Provider,{value:{connected:f,subscribe:y},children:p.jsx(Yc.Provider,{value:{connected:f,subscribe:y},children:r})})}const Bn=Object.create(null);Bn.open="0";Bn.close="1";Bn.ping="2";Bn.pong="3";Bn.message="4";Bn.upgrade="5";Bn.noop="6";const _c=Object.create(null);Object.keys(Bn).forEach(r=>{_c[Bn[r]]=r});const Uf={type:"error",data:"parser error"},kg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mg=typeof ArrayBuffer=="function",Rg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,eh=({type:r,data:n},s,a)=>kg&&n instanceof Blob?s?a(n):j0(n,a):Mg&&(n instanceof ArrayBuffer||Rg(n))?s?a(n):j0(new Blob([n]),a):a(Bn[r]+(n||"")),j0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function T0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let pf;function o_(r,n){if(kg&&r.data instanceof Blob)return r.data.arrayBuffer().then(T0).then(n);if(Mg&&(r.data instanceof ArrayBuffer||Rg(r.data)))return n(T0(r.data));eh(r,!1,s=>{pf||(pf=new TextEncoder),n(pf.encode(s))})}const N0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Na=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<N0.length;r++)Na[N0.charCodeAt(r)]=r;const u_=r=>{let n=r.length*.75,s=r.length,a,c=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),A=new Uint8Array(y);for(a=0;a<s;a+=4)f=Na[r.charCodeAt(a)],h=Na[r.charCodeAt(a+1)],d=Na[r.charCodeAt(a+2)],g=Na[r.charCodeAt(a+3)],A[c++]=f<<2|h>>4,A[c++]=(h&15)<<4|d>>2,A[c++]=(d&3)<<6|g&63;return y},f_=typeof ArrayBuffer=="function",th=(r,n)=>{if(typeof r!="string")return{type:"message",data:Dg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:h_(r.substring(1),n)}:_c[s]?r.length>1?{type:_c[s],data:r.substring(1)}:{type:_c[s]}:Uf},h_=(r,n)=>{if(f_){const s=u_(r);return Dg(s,n)}else return{base64:!0,data:r}},Dg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},zg="",d_=(r,n)=>{const s=r.length,a=new Array(s);let c=0;r.forEach((f,h)=>{eh(f,!1,d=>{a[h]=d,++c===s&&n(a.join(zg))})})},m_=(r,n)=>{const s=r.split(zg),a=[];for(let c=0;c<s.length;c++){const f=th(s[c],n);if(a.push(f),f.type==="error")break}return a};function p_(){return new TransformStream({transform(r,n){o_(r,s=>{const a=s.length;let c;if(a<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,a);else if(a<65536){c=new Uint8Array(3);const f=new DataView(c.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{c=new Uint8Array(9);const f=new DataView(c.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(c[0]|=128),n.enqueue(c),n.enqueue(s)})}})}let gf;function mc(r){return r.reduce((n,s)=>n+s.length,0)}function pc(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let c=0;c<n;c++)s[c]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function g_(r,n){gf||(gf=new TextDecoder);const s=[];let a=0,c=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(mc(s)<1)break;const g=pc(s,1);f=(g[0]&128)===128,c=g[0]&127,c<126?a=3:c===126?a=1:a=2}else if(a===1){if(mc(s)<2)break;const g=pc(s,2);c=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(mc(s)<8)break;const g=pc(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),A=y.getUint32(0);if(A>Math.pow(2,21)-1){d.enqueue(Uf);break}c=A*Math.pow(2,32)+y.getUint32(4),a=3}else{if(mc(s)<c)break;const g=pc(s,c);d.enqueue(th(f?g:gf.decode(g),n)),a=0}if(c===0||c>r){d.enqueue(Uf);break}}}})}const qg=4;function gt(r){if(r)return y_(r)}function y_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,c=0;c<s.length;c++)if(a=s[c],a===n||a.fn===n){s.splice(c,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,c=s.length;a<c;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const $c=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),bn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),b_="arraybuffer";function Ug(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const x_=bn.setTimeout,v_=bn.clearTimeout;function Gc(r,n){n.useNativeTimers?(r.setTimeoutFn=x_.bind(bn),r.clearTimeoutFn=v_.bind(bn)):(r.setTimeoutFn=bn.setTimeout.bind(bn),r.clearTimeoutFn=bn.clearTimeout.bind(bn))}const __=1.33;function w_(r){return typeof r=="string"?S_(r):Math.ceil((r.byteLength||r.size)*__)}function S_(r){let n=0,s=0;for(let a=0,c=r.length;a<c;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Bg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function E_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function A_(r){let n={},s=r.split("&");for(let a=0,c=s.length;a<c;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class O_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class nh extends gt{constructor(n){super(),this.writable=!1,Gc(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new O_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=th(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=E_(n);return s.length?"?"+s:""}}class j_ extends nh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};m_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,d_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Bg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Lg=!1;try{Lg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const T_=Lg;function N_(){}class C_ extends j_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(c,f)=>{this.onError("xhr post error",c,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Un extends gt{constructor(n,s,a){super(),this.createRequest=n,Gc(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Ug(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&a.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var c;a.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=Un.requestsCount++,Un.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=N_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Un.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Un.requestsCount=0;Un.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",C0);else if(typeof addEventListener=="function"){const r="onpagehide"in bn?"pagehide":"unload";addEventListener(r,C0,!1)}}function C0(){for(let r in Un.requests)Un.requests.hasOwnProperty(r)&&Un.requests[r].abort()}const k_=(function(){const r=Hg({xdomain:!1});return r&&r.responseType!==null})();class M_ extends C_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=k_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Un(Hg,this.uri(),n)}}function Hg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||T_))return new XMLHttpRequest}catch{}if(!n)try{return new bn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Pg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class R_ extends nh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Pg?{}:Ug(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],c=s===n.length-1;eh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}c&&$c(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Bg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const yf=bn.WebSocket||bn.MozWebSocket;class D_ extends R_{createSocket(n,s,a){return Pg?new yf(n,s,a):s?new yf(n,s):new yf(n)}doWrite(n,s){this.ws.send(s)}}class z_ extends nh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=g_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),c=p_();c.readable.pipeTo(n.writable),this._writer=c.writable.getWriter();const f=()=>{a.read().then(({done:d,value:g})=>{d||(this.onPacket(g),f())}).catch(d=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],c=s===n.length-1;this._writer.write(a).then(()=>{c&&$c(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const q_={websocket:D_,webtransport:z_,polling:M_},U_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,B_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let c=U_.exec(r||""),f={},h=14;for(;h--;)f[B_[h]]=c[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=L_(f,f.path),f.queryKey=H_(f,f.query),f}function L_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function H_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,c,f){c&&(s[c]=f)}),s}const Lf=typeof addEventListener=="function"&&typeof removeEventListener=="function",wc=[];Lf&&addEventListener("offline",()=>{wc.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=b_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Bf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Bf(s.host).host);Gc(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const c=a.prototype.name;this.transports.push(c),this._transportsByName[c]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=A_(this.opts.query)),Lf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},wc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=qg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const c=this.writeBuffer[a].data;if(c&&(s+=w_(c)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,$c(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,c){if(typeof s=="function"&&(c=s,s=void 0),typeof a=="function"&&(c=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),c&&this.once("flush",c),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Lf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=wc.indexOf(this._offlineEventListener);a!==-1&&wc.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=qg;class P_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const c=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(A(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=s.name,this.emitReserved("upgradeError",j)}}))};function f(){a||(a=!0,A(),s.close(),s=null)}const h=w=>{const j=new Error("probe error: "+w);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const A=()=>{s.removeListener("open",c),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",c),s.once("error",h),s.once("close",d),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let Y_=class extends P_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(c=>q_[c]).filter(c=>!!c)),super(n,a)}};function $_(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Bf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const G_=typeof ArrayBuffer=="function",V_=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Yg=Object.prototype.toString,F_=typeof Blob=="function"||typeof Blob<"u"&&Yg.call(Blob)==="[object BlobConstructor]",J_=typeof File=="function"||typeof File<"u"&&Yg.call(File)==="[object FileConstructor]";function sh(r){return G_&&(r instanceof ArrayBuffer||V_(r))||F_&&r instanceof Blob||J_&&r instanceof File}function Sc(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(Sc(r[s]))return!0;return!1}if(sh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Sc(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&Sc(r[s]))return!0;return!1}function Q_(r){const n=[],s=r.data,a=r;return a.data=Hf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Hf(r,n){if(!r)return r;if(sh(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=Hf(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=Hf(r[a],n));return s}return r}function X_(r,n){return r.data=Pf(r.data,n),delete r.attachments,r}function Pf(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Pf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Pf(r[s],n));return r}const I_=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var De;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(De||(De={}));class K_{constructor(n){this.replacer=n}encode(n){return(n.type===De.EVENT||n.type===De.ACK)&&Sc(n)?this.encodeAsBinary({type:n.type===De.EVENT?De.BINARY_EVENT:De.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===De.BINARY_EVENT||n.type===De.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=Q_(n),a=this.encodeAsString(s.packet),c=s.buffers;return c.unshift(a),c}}class ih extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===De.BINARY_EVENT;a||s.type===De.BINARY_ACK?(s.type=a?De.EVENT:De.ACK,this.reconstructor=new Z_(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(sh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(De[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===De.BINARY_EVENT||a.type===De.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const d=Number(h);if(!W_(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=d}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const c=n.charAt(s+1);if(c!==""&&Number(c)==c){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(ih.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case De.CONNECT:return k0(s);case De.DISCONNECT:return s===void 0;case De.CONNECT_ERROR:return typeof s=="string"||k0(s);case De.EVENT:case De.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&I_.indexOf(s[0])===-1);case De.ACK:case De.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Z_{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=X_(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const W_=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function k0(r){return Object.prototype.toString.call(r)==="[object Object]"}const ew=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ih,Encoder:K_,get PacketType(){return De}},Symbol.toStringTag,{value:"Module"}));function On(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const tw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class $g extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[On(n,"open",this.onopen.bind(this)),On(n,"packet",this.onpacket.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,c,f;if(tw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:De.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const A=this.ids++,w=s.pop();this._registerAckCallback(A,w),h.id=A}const d=(c=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||c===void 0?void 0:c.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!d||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const c=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(c===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===n&&this.sendBuffer.splice(d,1);s.call(this,new Error("operation has timed out"))},c),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,c)=>{const f=(h,d)=>h?c(h):a(d);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((c,...f)=>(this._queue[0],c!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(c)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:De.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case De.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case De.EVENT:case De.BINARY_EVENT:this.onevent(n);break;case De.ACK:case De.BINARY_ACK:this.onack(n);break;case De.DISCONNECT:this.ondisconnect();break;case De.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...c){a||(a=!0,s.packet({type:De.ACK,id:n,data:c}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:De.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function Or(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Or.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};Or.prototype.reset=function(){this.attempts=0};Or.prototype.setMin=function(r){this.ms=r};Or.prototype.setMax=function(r){this.max=r};Or.prototype.setJitter=function(r){this.jitter=r};class Yf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Gc(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Or({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const c=s.parser||ew;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new Y_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const c=On(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=On(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{c(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(c),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(On(n,"ping",this.onping.bind(this)),On(n,"data",this.ondata.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this)),On(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){$c(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new $g(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(c=>{c?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",c)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Ea={};function Ec(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=$_(r,n.path||"/socket.io"),a=s.source,c=s.id,f=s.path,h=Ea[c]&&f in Ea[c].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Yf(a,n):(Ea[c]||(Ea[c]=new Yf(a,n)),g=Ea[c]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(Ec,{Manager:Yf,Socket:$g,io:Ec,connect:Ec});const nw=C.createContext({connected:!1,subscribe:()=>()=>{}});function sw({children:r}){const n=C.useRef(null),[s,a]=C.useState(!1),c=C.useRef(new Map),f=C.useCallback((d,g)=>{const y=c.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const A=y.get(d);A&&(A.delete(g),A.size===0&&y.delete(d))}},[]),h=C.useCallback((d,g)=>{for(const[y,A]of c.current)if(Ng(d,y))for(const w of A)try{w(g)}catch{}},[]);return C.useEffect(()=>{const d=ug(),g=Ec({path:"/socket.io",transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...d?{auth:{token:d}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,A)=>{if(y.startsWith("lt."))try{const w=typeof A=="string"?JSON.parse(A):A;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),p.jsx(nw.Provider,{value:{connected:s,subscribe:f},children:p.jsx(Yc.Provider,{value:{connected:s,subscribe:f},children:r})})}function iw({children:r}){const[n,s]=C.useState(null),[a,c]=C.useState({url:null,token:null});return C.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch("/api/settings");if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),A=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",A),!f){if(A==="nats"){let w=y.events.natsWsUrl??null,j=null;const z=ug();if(z)try{const R=await fetch("/api/nats-credentials",{headers:{Authorization:`Bearer ${z}`}});if(R.ok){const H=await R.json();w=H.natsWsUrl??w,j=H.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}c({url:w,token:j})}s(A==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?p.jsx(c_,{url:a.url,token:a.token,children:r}):n==="socketio"?p.jsx(sw,{children:r}):p.jsx(p.Fragment,{children:r})}const Gg=C.createContext(null),M0="lt_sidebar_collapsed";function rw({children:r}){const[n,s]=C.useState(()=>{try{return localStorage.getItem(M0)==="true"}catch{return!1}}),a=C.useCallback(()=>{s(c=>{const f=!c;try{localStorage.setItem(M0,String(f))}catch{}return f})},[]);return p.jsx(Gg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Vg(){const r=C.useContext(Gg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function pE(r){const n=r?`?period=${r}`:"";return fs({queryKey:["escalationStats",r],queryFn:()=>Ie(`/escalations/stats${n}`)})}function gE(){return fs({queryKey:["escalationTypes"],queryFn:()=>Ie("/escalations/types")})}function aw(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.status&&a.set("status",s.status),s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.assigned_to&&a.set("assigned_to",s.assigned_to),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),fs({queryKey:["escalations",s],queryFn:()=>Ie(`/escalations?${a}`),enabled:n})}function lw(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),fs({queryKey:["escalations","available",s],queryFn:()=>Ie(`/escalations/available?${a}`),enabled:n})}function yE(r){return fs({queryKey:["escalations","by-workflow",r],queryFn:()=>Ie(`/escalations/by-workflow/${r}`),enabled:!!r})}function bE(r){return fs({queryKey:["escalations",r],queryFn:()=>Ie(`/escalations/${r}`),enabled:!!r})}function xE(){const r=Nn();return Ln({mutationFn:({id:n,durationMinutes:s})=>Ie(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function vE(){const r=Nn();return Ln({mutationFn:n=>Ie(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function _E(){const r=Nn();return Ln({mutationFn:({id:n,resolverPayload:s})=>Ie(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"}),r.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),r.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function wE(){const r=Nn();return Ln({mutationFn:({id:n,targetRole:s})=>Ie(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function SE(){const r=Nn();return Ln({mutationFn:({ids:n,priority:s})=>Ie("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function EE(){const r=Nn();return Ln({mutationFn:({ids:n,durationMinutes:s})=>Ie("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function AE(){const r=Nn();return Ln({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Ie("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function OE(){const r=Nn();return Ln({mutationFn:({ids:n,targetRole:s})=>Ie("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function jE(){const r=Nn();return Ln({mutationFn:({ids:n,hint:s})=>Ie("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function cw(){const{user:r}=Ai(),n=r==null?void 0:r.userId,s=Nn(),a=C.useRef(null),c=C.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);Cg(`${i_}.escalation.>`,c);const{data:f}=lw({limit:1}),{data:h}=aw({assigned_to:n,status:"pending",limit:200}),d=new Date,g=((h==null?void 0:h.escalations)??[]).filter(y=>y.assigned_until&&new Date(y.assigned_until)>d);return{available:(f==null?void 0:f.total)??0,mine:g.length}}function rh({size:r="sm",hideLabel:n=!1}){const s=r==="lg",a=s?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",c=s?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return p.jsxs("div",{className:"flex items-center",style:{height:"50px"},children:[p.jsx("img",{src:"/logo512.png",alt:"LongTail",className:`shrink-0 z-0 ${a}`}),p.jsx("span",{className:`z-[1] transition-opacity duration-300 ${c} ${n?"opacity-0":""}`,children:"LongTail"})]})}function ow({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Ai(),{available:c,mine:f}=cw(),{connected:h}=r_(),[d,g]=C.useState(!1),y=C.useRef(null);return C.useEffect(()=>{if(!d)return;const A=w=>{y.current&&!y.current.contains(w.target)&&g(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[d]),p.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[p.jsx("div",{className:"flex items-center gap-4",children:p.jsx(pr,{to:"/","aria-label":"Home",children:p.jsx(rh,{})})}),p.jsxs("div",{className:"flex items-center gap-5",children:[p.jsxs(pr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${c>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[p.jsx(_x,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"all",c>0&&p.jsx("span",{className:"tabular-nums font-medium",children:c})]}),p.jsxs(pr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[p.jsx(wx,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",f>0&&p.jsx("span",{className:"tabular-nums font-medium",children:f})]}),p.jsx("div",{className:"w-px h-4 bg-surface-border"}),p.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1.5 text-[11px] transition-colors ${h?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:h?"Live events — click to toggle feed":"Events disconnected",children:[p.jsx(sg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),p.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[p.jsx(ig,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]}),p.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&p.jsxs("div",{className:"relative",ref:y,children:[p.jsxs("button",{onClick:()=>g(A=>!A),className:"btn-ghost text-xs flex items-center gap-1",children:[p.jsx(Sx,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,p.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),d&&p.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[p.jsx(pr,{to:"/credentials",onClick:()=>g(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),p.jsx("button",{onClick:()=>{g(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function ah({open:r,children:n}){const[s,a]=C.useState(r);return C.useEffect(()=>{r&&a(!0)},[r]),p.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:p.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function $f(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",c="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:c}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:c}`}}function uw(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function fw({group:r,collapsed:n}){const{pathname:s}=Ei(),a=r.matchPaths.some(d=>s.startsWith(d)),[c,f]=C.useState(a),h=c||a;return n?p.jsx(p.Fragment,{children:r.items.map(d=>p.jsx(Ac,{to:d.to,className:$f(!0),title:d.label,children:d.icon&&p.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):p.jsxs("div",{children:[p.jsxs("button",{onClick:()=>f(d=>!d),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[p.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:r.label})]}),p.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),p.jsx(ah,{open:h,children:r.items.map(d=>p.jsxs(Ac,{to:d.to,end:d.end,className:uw(),children:[d.icon&&p.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:d.label})]},d.to))})]})}function hw(r){return r.kind==="group"}function dw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ei();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=$f(n)({isActive:d});return p.jsxs(Ac,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&p.jsx("span",{children:r.label})]})}return p.jsxs(Ac,{to:r.to,end:r.end,className:$f(n),title:n?r.label:void 0,children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&p.jsx("span",{children:r.label})]})}function Vc({heading:r,entries:n}){const{collapsed:s}=Vg();return p.jsxs("div",{className:"space-y-1",children:[s?p.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):p.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>hw(a)?p.jsx(fw,{group:a,collapsed:s},a.label):p.jsx(dw,{entry:a,collapsed:s},a.to))]})}const mw=[{to:"/",label:"Recent Activity",icon:Ex,end:!0},{to:"/capabilities",label:"Capabilities",icon:Ax},{to:"/agents",label:"Agents",icon:Ox},{to:"/topics",label:"Topics",icon:sg}];function pw(){return p.jsx(Vc,{heading:"Work",entries:mw})}const gw=[{kind:"group",label:"Workflows",icon:Qp,matchPaths:["/workflows"],items:[{to:"/workflows/registry",label:"Registry",icon:Qp},{to:"/workflows/start",label:"Invoke",icon:jx},{to:"/workflows/executions",label:"Executions",icon:Xp}]},{kind:"group",label:"Pipelines",icon:Oc,matchPaths:["/mcp"],items:[{to:"/mcp/queries",label:"Designer",icon:Tx},{to:"/mcp/servers",label:"Servers & Tools",icon:rg},{to:"/mcp/workflows",label:"Pipeline Tools",icon:Oc},{to:"/mcp/executions",label:"Executions",icon:Xp}]}];function yw(){return p.jsx(Vc,{heading:"Build",entries:gw})}const bw=[{to:"/files",label:"Files",icon:Nx},{to:"/knowledge",label:"Knowledge",icon:Cx}];function xw(){return p.jsx(Vc,{heading:"Storage",entries:bw})}const vw=[{kind:"group",label:"Identity & Access",icon:Rx,matchPaths:["/admin/users","/admin/roles"],items:[{to:"/admin/users",label:"Accounts",icon:kx},{to:"/admin/roles",label:"Roles & Permissions",icon:Mx}]},{kind:"group",label:"Infrastructure",icon:rg,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:Dx},{to:"/admin/streams",label:"Messages",icon:zx},{to:"/admin/maintenance",label:"DB Maintenance",icon:qx}]}];function _w(){return p.jsx(Vc,{heading:"Admin",entries:vw})}function ww({children:r,className:n=""}){return p.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const bf=280,R0="cubic-bezier(0.4, 0, 0.2, 1)",gc=40;function Sw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-gc*2,c=s-gc*2,f=r.width/a,h=r.height/c,d=r.left+r.width/2-(gc+a/2),g=r.top+r.height/2-(gc+c/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Fg({open:r,onClose:n,sourceRef:s,children:a}){const[c,f]=C.useState(null),h=C.useRef(null),d=C.useRef(!1);C.useEffect(()=>{var j,z;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&c==="open"&&(h.current=((z=s==null?void 0:s.current)==null?void 0:z.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,c]),C.useEffect(()=>{if(c!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[c]),C.useEffect(()=>{if(c)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[c]),C.useEffect(()=>{if(!c)return;const j=z=>{z.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[c,n]);const g=C.useCallback(j=>{j.propertyName==="transform"&&c==="exiting"&&f(null)},[c]);if(C.useEffect(()=>{if(c!=="exiting")return;const j=setTimeout(()=>f(null),bf+50);return()=>clearTimeout(j)},[c]),!c)return null;const y=c==="entering"||c==="exiting",A=y?Sw(h.current):"none",w=y?0:1;return tg.createPortal(p.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${bf}ms ${R0}, opacity ${bf}ms ${R0}`,transform:A,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function Ew({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Aw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Ow({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function jw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Tw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function Nw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function Cw(r){const n=r.trim().split(`
54
+ `);if(n.length<2)return r;const s=d=>d.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),c=n.slice(2),f=a.map(d=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${d}</th>`).join(""),h=c.map(d=>`<tr class="border-t border-surface-border">${s(d).map(A=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${A}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${h}</tbody></table>`}function yc(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function kw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,A)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${A}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,A,w)=>Cw(`${y}
55
55
  ${A}
56
- ${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${yc(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${yc(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${yc(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${yc(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),A=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${A?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${A?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const c=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${c(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",d=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const A=[];let w=y,j;for(;(j=d.exec(w))!==null;){const z=j.index+j[0].length;A.push(w.slice(0,z)),w=w.slice(z).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&A.push(w),A.map(z=>{const R=z.trim();return R?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(R)?R:`<p class="${h}">${R}</p>`:""}).join("")}).join(""),s}const Rw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Dw(r){return Rw.test(r)}function lh({content:r,className:n,onClick:s}){const a=N.useMemo(()=>Mw(r),[r]);return p.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function zc({data:r,depth:n=0,generation:s}){const c=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=N.useState(c),[d,g]=N.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return p.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?p.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,A)=>p.jsxs("div",{children:[p.jsx(zc,{data:y,depth:n+1,generation:s}),A<r.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},A))}),p.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?p.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?p.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([A,w],j)=>p.jsxs("div",{children:[p.jsx("span",{className:"text-text-secondary",children:A}),p.jsx("span",{className:"text-text-tertiary",children:": "}),p.jsx(zc,{data:w,depth:n+1,generation:s}),j<y.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},A))}),p.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return p.jsx("span",{children:String(r)})}function Da({data:r,depth:n=0}){if(r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Dw(r)?p.jsx(lh,{content:r}):p.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):p.jsx("div",{className:"space-y-2",children:r.map((s,a)=>p.jsxs("div",{className:"flex items-baseline gap-2",children:[p.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),p.jsx("div",{className:"flex-1",children:p.jsx(Da,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):p.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,c])=>{const f=c===null||typeof c!="object";return p.jsxs("div",{children:[p.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?p.jsx("p",{className:"text-sm text-text-primary",children:p.jsx(Da,{data:c,depth:n+1})}):p.jsx(Da,{data:c,depth:n+1})]},a)})})}return p.jsx("span",{children:String(r)})}function D0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:c,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",A=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return p.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&p.jsx("button",{onClick:a,className:A,title:s?"Expand all":"Collapse all",children:s?p.jsx(Cw,{className:y}):p.jsx(Nw,{className:y})}),p.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:A,title:r==="json"?"Outline view":"JSON view",children:r==="json"?p.jsx(Aw,{className:y}):p.jsx(Ow,{className:y})}),p.jsx("button",{onClick:c,className:A,title:"Copy to clipboard",children:f?p.jsx(Tw,{className:`${y} text-status-success`}):p.jsx(jw,{className:y})}),h&&p.jsx("button",{onClick:h,className:A,title:"Fullscreen",children:p.jsx(ag,{className:y})}),d&&p.jsx("button",{onClick:d,className:A,title:"Close (Esc)",children:p.jsx(lg,{className:y})})]})}function zw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:c}){const f=N.useRef(null),[h,d]=N.useState(c??"json"),[g,y]=N.useState(!1),[A,w]=N.useState(!1),[j,z]=N.useState(a?0:1),[R,H]=N.useState(1),ee=j%2===0,ne=R%2===0,W=N.useCallback(()=>z(K=>K+1),[]),me=N.useCallback(()=>H(K=>K+1),[]);let be=r;if(typeof r=="string")try{be=JSON.parse(r)}catch{}const k=async()=>{const K=typeof r=="string"?r:JSON.stringify(be,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},I=N.useCallback(()=>{H(1),w(!0)},[]),ie=s==="panel",Z=ie?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",Q=ie?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return p.jsxs("div",{className:Z,children:[n&&p.jsx(Sw,{children:n}),p.jsxs("div",{ref:f,className:"relative",children:[p.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:p.jsx(D0,{mode:h,setMode:d,isCollapsed:ee,onToggleCollapse:W,onCopy:k,copied:g,onFullscreen:I})}),p.jsx("div",{className:Q,children:h==="json"?p.jsx(zc,{data:be,generation:j}):p.jsx(Da,{data:be})})]}),p.jsxs(Jg,{open:A,onClose:()=>w(!1),sourceRef:f,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx(D0,{mode:h,setMode:d,isCollapsed:ne,onToggleCollapse:me,onCopy:k,copied:g,onClose:()=>w(!1),large:!0})}),p.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?p.jsx(zc,{data:be,generation:R}):p.jsx(Da,{data:be})})]})]})}const qw=100,z0=500;let Uw=0;const Qg={"escalation.created":"text-status-warning","escalation.claimed":"text-blue-400","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function q0({event:r,forceExpanded:n=!1}){var j,z;const[s,a]=N.useState(n),c=Qg[r.type]||"text-text-tertiary";N.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",d=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",A=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return p.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[p.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${A} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[p.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),p.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${c} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),p.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(j=r.data)!=null&&j.workflowId?String(r.data.workflowId):"",(z=r.data)!=null&&z.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),p.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),p.jsx(ah,{open:s,children:p.jsx("div",{className:w,children:p.jsx(zw,{data:r.data})})})]})}function Bw({open:r,onToggle:n}){const[s,a]=N.useState([]),[c,f]=N.useState(!1),h=N.useRef(null),d=N.useRef(new Map);return Cg("lt.events.>",N.useCallback(g=>{const y=String(g.type||"unknown");if(y.startsWith("mesh."))return;const A=`${y}:${g.timestamp||""}:${g.escalationId||g.workflowId||g.taskId||""}`,w=Date.now(),j=d.current.get(A);if(!(j&&w-j<z0)){if(d.current.set(A,w),d.current.size>200)for(const[z,R]of d.current)w-R>z0*2&&d.current.delete(z);a(z=>[{id:++Uw,type:y,timestamp:g.timestamp||new Date().toISOString(),data:g},...z].slice(0,qw))}},[])),N.useEffect(()=>{r&&h.current&&(h.current.scrollTop=0)},[s.length,r]),p.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-40 border-t border-surface-border bg-surface-raised",children:[p.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?p.jsx(Bx,{className:"w-3 h-3 text-text-tertiary"}):p.jsx(Lx,{className:"w-3 h-3 text-text-tertiary"}),p.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),s.length>0&&p.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[s.length," events"]}),s.length>0&&!r&&p.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Qg[s[0].type]||"text-text-tertiary"} bg-surface-sunken`,children:s[0].type}),s.length>0&&p.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:g=>{g.stopPropagation(),f(!0)},children:p.jsx(ag,{className:"w-3 h-3"})}),p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:g=>{g.stopPropagation(),a([])},children:p.jsx(Hx,{className:"w-3 h-3"})})]})]}),p.jsx(ah,{open:r,children:p.jsx("div",{ref:h,className:"h-48 overflow-y-auto",children:s.length===0?p.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):s.map(g=>p.jsx(q0,{event:g},g.id))})}),p.jsxs(Jg,{open:c,onClose:()=>f(!1),sourceRef:h,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx("button",{onClick:()=>f(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:p.jsx(lg,{className:"w-5 h-5"})})}),s.length===0?p.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):s.map(g=>p.jsx(q0,{event:g,forceExpanded:!0},g.id))]})]})}function Lw(){return fs({queryKey:["docs"],queryFn:()=>Ie("/docs"),staleTime:5*6e4})}function Hw(r){return fs({queryKey:["docs",r],queryFn:()=>Ie(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function Pw(){const[r,n]=N.useState([]),[s,a]=N.useState([]),[c,f]=N.useState(null),h=N.useRef(c),d=N.useRef(r),g=N.useRef(s);h.current=c,d.current=r,g.current=s;const y=N.useCallback((R,H)=>{var ne;const ee=h.current;if(ee){const W=((ne=H==null?void 0:H.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...ee,scrollTop:W}])}a([]),f({path:R,scrollTop:0})},[]),A=N.useCallback(R=>{var W;const H=d.current;if(H.length===0)return;const ee=H[H.length-1],ne=h.current;if(ne){const me=((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0;a([...g.current,{...ne,scrollTop:me}])}n(H.slice(0,-1)),f(ee),requestAnimationFrame(()=>{R!=null&&R.current&&(R.current.scrollTop=ee.scrollTop)})},[]),w=N.useCallback(R=>{var W;const H=g.current;if(H.length===0)return;const ee=H[H.length-1],ne=h.current;if(ne){const me=((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0;n([...d.current,{...ne,scrollTop:me}])}a(H.slice(0,-1)),f(ee),requestAnimationFrame(()=>{R!=null&&R.current&&(R.current.scrollTop=ee.scrollTop)})},[]),j=N.useCallback(R=>{var ne,W;const H=h.current;if(!H)return;const ee=((ne=R==null?void 0:R.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...H,scrollTop:ee}]),a([]),f({...H,scrollTop:((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0})},[]),z=N.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:c,backStack:r,forwardStack:s,navigate:y,goBack:A,goForward:w,pushScrollPosition:j,reset:z}}function Yw(r,n){const[s,a]=r.split("#");let c=s;if(c.startsWith("./")||c.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+c).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);c=d.join("/")}return{path:c,anchor:a}}function $w(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function Gw(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function Vw({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const c=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const A=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(A)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:A,anchor:w}=Yw(g.dataset.docLink,n);s(A,w);return}};return p.jsx(lh,{content:r,className:"docs-content",onClick:c})}function Fw(r){const n=[],s=new Map;for(const a of r){const c=a.path.split("/");if(c.length===1){n.push(a);continue}let f=s;for(let h=0;h<c.length-1;h++){const d=c[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===c.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function Jw({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:c}=Fw(r),f=d=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===d?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(d,g){return p.jsxs("details",{open:!0,children:[p.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[p.jsx(Px,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),p.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>p.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return p.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>p.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...c.values()].map(d=>h(d))]})}function Qw({open:r,onClose:n}){var ie,Z,Q;const[s,a]=N.useState(!1),{data:c}=Lw(),f=Pw(),{data:h,isLoading:d}=Hw(((ie=f.current)==null?void 0:ie.path)??null),g=N.useRef(null),[y,A]=N.useState(null);N.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var ae;const K=(ae=g.current)==null?void 0:ae.querySelector(`#${CSS.escape(y)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),A(null)})},[y,h]);const w=N.useCallback(()=>{var re;const K=$w(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((re=f.current)==null?void 0:re.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&A(K.anchor)},[f]),j=N.useRef(!0);N.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const K=Gw(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(Z=f.current)==null?void 0:Z.path]),N.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const z=N.useCallback((K,ae)=>{ae&&A(ae),f.navigate(K,g)},[f]),R=N.useCallback(K=>{f.navigate(K,g)},[f]),H=N.useCallback(()=>{f.goBack(g)},[f]),ee=N.useCallback(()=>{f.goForward(g)},[f]),ne=N.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(N.useEffect(()=>{if(r){j.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},be=((Q=f.current)==null?void 0:Q.path)??null,k=f.backStack.length>0,I=f.forwardStack.length>0;return p.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[p.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),p.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:H,disabled:!k,className:`p-0.5 transition-colors ${k?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:p.jsx(Yx,{className:"w-4 h-4"})}),p.jsx("button",{onClick:ee,disabled:!I,className:`p-0.5 transition-colors ${I?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:p.jsx(Ip,{className:"w-4 h-4"})}),p.jsx(ig,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),p.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),p.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:p.jsx(Gf,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:c!=null&&c.docs?p.jsx(Jw,{docs:c.docs,selected:be,onSelect:R}):p.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),p.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:be?d?p.jsxs("div",{className:"animate-pulse space-y-2",children:[p.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?p.jsx(Vw,{content:h.content,currentPath:be,onNavigate:z,onAnchorClick:ne}):p.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[p.jsx(Ip,{className:"w-5 h-5 mb-2"}),p.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function Xw(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const U0=2e3;function Iw(r){const s=r.filter(c=>!c.pending).slice(-8);return s.length===0?"":`[Prior conversation]
56
+ ${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${yc(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${yc(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${yc(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${yc(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),A=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${A?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${A?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const c=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${c(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",d=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const A=[];let w=y,j;for(;(j=d.exec(w))!==null;){const z=j.index+j[0].length;A.push(w.slice(0,z)),w=w.slice(z).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&A.push(w),A.map(z=>{const R=z.trim();return R?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(R)?R:`<p class="${h}">${R}</p>`:""}).join("")}).join(""),s}const Mw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Rw(r){return Mw.test(r)}function lh({content:r,className:n,onClick:s}){const a=C.useMemo(()=>kw(r),[r]);return p.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function zc({data:r,depth:n=0,generation:s}){const c=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=C.useState(c),[d,g]=C.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return p.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?p.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,A)=>p.jsxs("div",{children:[p.jsx(zc,{data:y,depth:n+1,generation:s}),A<r.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},A))}),p.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?p.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?p.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([A,w],j)=>p.jsxs("div",{children:[p.jsx("span",{className:"text-text-secondary",children:A}),p.jsx("span",{className:"text-text-tertiary",children:": "}),p.jsx(zc,{data:w,depth:n+1,generation:s}),j<y.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},A))}),p.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return p.jsx("span",{children:String(r)})}function Da({data:r,depth:n=0}){if(r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Rw(r)?p.jsx(lh,{content:r}):p.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):p.jsx("div",{className:"space-y-2",children:r.map((s,a)=>p.jsxs("div",{className:"flex items-baseline gap-2",children:[p.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),p.jsx("div",{className:"flex-1",children:p.jsx(Da,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):p.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,c])=>{const f=c===null||typeof c!="object";return p.jsxs("div",{children:[p.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?p.jsx("p",{className:"text-sm text-text-primary",children:p.jsx(Da,{data:c,depth:n+1})}):p.jsx(Da,{data:c,depth:n+1})]},a)})})}return p.jsx("span",{children:String(r)})}function D0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:c,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",A=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return p.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&p.jsx("button",{onClick:a,className:A,title:s?"Expand all":"Collapse all",children:s?p.jsx(Nw,{className:y}):p.jsx(Tw,{className:y})}),p.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:A,title:r==="json"?"Outline view":"JSON view",children:r==="json"?p.jsx(Ew,{className:y}):p.jsx(Aw,{className:y})}),p.jsx("button",{onClick:c,className:A,title:"Copy to clipboard",children:f?p.jsx(jw,{className:`${y} text-status-success`}):p.jsx(Ow,{className:y})}),h&&p.jsx("button",{onClick:h,className:A,title:"Fullscreen",children:p.jsx(ag,{className:y})}),d&&p.jsx("button",{onClick:d,className:A,title:"Close (Esc)",children:p.jsx(lg,{className:y})})]})}function Dw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:c}){const f=C.useRef(null),[h,d]=C.useState(c??"json"),[g,y]=C.useState(!1),[A,w]=C.useState(!1),[j,z]=C.useState(a?0:1),[R,H]=C.useState(1),ee=j%2===0,ne=R%2===0,W=C.useCallback(()=>z(K=>K+1),[]),me=C.useCallback(()=>H(K=>K+1),[]);let be=r;if(typeof r=="string")try{be=JSON.parse(r)}catch{}const k=async()=>{const K=typeof r=="string"?r:JSON.stringify(be,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},I=C.useCallback(()=>{H(1),w(!0)},[]),ie=s==="panel",Z=ie?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",Q=ie?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return p.jsxs("div",{className:Z,children:[n&&p.jsx(ww,{children:n}),p.jsxs("div",{ref:f,className:"relative",children:[p.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:p.jsx(D0,{mode:h,setMode:d,isCollapsed:ee,onToggleCollapse:W,onCopy:k,copied:g,onFullscreen:I})}),p.jsx("div",{className:Q,children:h==="json"?p.jsx(zc,{data:be,generation:j}):p.jsx(Da,{data:be})})]}),p.jsxs(Fg,{open:A,onClose:()=>w(!1),sourceRef:f,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx(D0,{mode:h,setMode:d,isCollapsed:ne,onToggleCollapse:me,onCopy:k,copied:g,onClose:()=>w(!1),large:!0})}),p.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?p.jsx(zc,{data:be,generation:R}):p.jsx(Da,{data:be})})]})]})}const zw=100,z0=500;let qw=0;const Jg={"escalation.created":"text-status-warning","escalation.claimed":"text-blue-400","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function q0({event:r,forceExpanded:n=!1}){var j,z;const[s,a]=C.useState(n),c=Jg[r.type]||"text-text-tertiary";C.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",d=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",A=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return p.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[p.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${A} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[p.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),p.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${c} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),p.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(j=r.data)!=null&&j.workflowId?String(r.data.workflowId):"",(z=r.data)!=null&&z.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),p.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),p.jsx(ah,{open:s,children:p.jsx("div",{className:w,children:p.jsx(Dw,{data:r.data})})})]})}function Uw({open:r,onToggle:n}){const[s,a]=C.useState([]),[c,f]=C.useState(!1),h=C.useRef(null),d=C.useRef(new Map);return Cg("lt.events.>",C.useCallback(g=>{const y=String(g.type||"unknown");if(y.startsWith("mesh."))return;const A=`${y}:${g.timestamp||""}:${g.escalationId||g.workflowId||g.taskId||""}`,w=Date.now(),j=d.current.get(A);if(!(j&&w-j<z0)){if(d.current.set(A,w),d.current.size>200)for(const[z,R]of d.current)w-R>z0*2&&d.current.delete(z);a(z=>[{id:++qw,type:y,timestamp:g.timestamp||new Date().toISOString(),data:g},...z].slice(0,zw))}},[])),C.useEffect(()=>{r&&h.current&&(h.current.scrollTop=0)},[s.length,r]),p.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-40 border-t border-surface-border bg-surface-raised",children:[p.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?p.jsx(Ux,{className:"w-3 h-3 text-text-tertiary"}):p.jsx(Bx,{className:"w-3 h-3 text-text-tertiary"}),p.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),s.length>0&&p.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[s.length," events"]}),s.length>0&&!r&&p.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Jg[s[0].type]||"text-text-tertiary"} bg-surface-sunken`,children:s[0].type}),s.length>0&&p.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:g=>{g.stopPropagation(),f(!0)},children:p.jsx(ag,{className:"w-3 h-3"})}),p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:g=>{g.stopPropagation(),a([])},children:p.jsx(Lx,{className:"w-3 h-3"})})]})]}),p.jsx(ah,{open:r,children:p.jsx("div",{ref:h,className:"h-48 overflow-y-auto",children:s.length===0?p.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):s.map(g=>p.jsx(q0,{event:g},g.id))})}),p.jsxs(Fg,{open:c,onClose:()=>f(!1),sourceRef:h,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx("button",{onClick:()=>f(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:p.jsx(lg,{className:"w-5 h-5"})})}),s.length===0?p.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):s.map(g=>p.jsx(q0,{event:g,forceExpanded:!0},g.id))]})]})}function Bw(){return fs({queryKey:["docs"],queryFn:()=>Ie("/docs"),staleTime:5*6e4})}function Lw(r){return fs({queryKey:["docs",r],queryFn:()=>Ie(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function Hw(){const[r,n]=C.useState([]),[s,a]=C.useState([]),[c,f]=C.useState(null),h=C.useRef(c),d=C.useRef(r),g=C.useRef(s);h.current=c,d.current=r,g.current=s;const y=C.useCallback((R,H)=>{var ne;const ee=h.current;if(ee){const W=((ne=H==null?void 0:H.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...ee,scrollTop:W}])}a([]),f({path:R,scrollTop:0})},[]),A=C.useCallback(R=>{var W;const H=d.current;if(H.length===0)return;const ee=H[H.length-1],ne=h.current;if(ne){const me=((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0;a([...g.current,{...ne,scrollTop:me}])}n(H.slice(0,-1)),f(ee),requestAnimationFrame(()=>{R!=null&&R.current&&(R.current.scrollTop=ee.scrollTop)})},[]),w=C.useCallback(R=>{var W;const H=g.current;if(H.length===0)return;const ee=H[H.length-1],ne=h.current;if(ne){const me=((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0;n([...d.current,{...ne,scrollTop:me}])}a(H.slice(0,-1)),f(ee),requestAnimationFrame(()=>{R!=null&&R.current&&(R.current.scrollTop=ee.scrollTop)})},[]),j=C.useCallback(R=>{var ne,W;const H=h.current;if(!H)return;const ee=((ne=R==null?void 0:R.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...H,scrollTop:ee}]),a([]),f({...H,scrollTop:((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0})},[]),z=C.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:c,backStack:r,forwardStack:s,navigate:y,goBack:A,goForward:w,pushScrollPosition:j,reset:z}}function Pw(r,n){const[s,a]=r.split("#");let c=s;if(c.startsWith("./")||c.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+c).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);c=d.join("/")}return{path:c,anchor:a}}function Yw(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function $w(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function Gw({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const c=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const A=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(A)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:A,anchor:w}=Pw(g.dataset.docLink,n);s(A,w);return}};return p.jsx(lh,{content:r,className:"docs-content",onClick:c})}function Vw(r){const n=[],s=new Map;for(const a of r){const c=a.path.split("/");if(c.length===1){n.push(a);continue}let f=s;for(let h=0;h<c.length-1;h++){const d=c[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===c.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function Fw({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:c}=Vw(r),f=d=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===d?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(d,g){return p.jsxs("details",{open:!0,children:[p.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[p.jsx(Hx,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),p.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>p.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return p.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>p.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...c.values()].map(d=>h(d))]})}function Jw({open:r,onClose:n}){var ie,Z,Q;const[s,a]=C.useState(!1),{data:c}=Bw(),f=Hw(),{data:h,isLoading:d}=Lw(((ie=f.current)==null?void 0:ie.path)??null),g=C.useRef(null),[y,A]=C.useState(null);C.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var ae;const K=(ae=g.current)==null?void 0:ae.querySelector(`#${CSS.escape(y)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),A(null)})},[y,h]);const w=C.useCallback(()=>{var re;const K=Yw(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((re=f.current)==null?void 0:re.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&A(K.anchor)},[f]),j=C.useRef(!0);C.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const K=$w(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(Z=f.current)==null?void 0:Z.path]),C.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const z=C.useCallback((K,ae)=>{ae&&A(ae),f.navigate(K,g)},[f]),R=C.useCallback(K=>{f.navigate(K,g)},[f]),H=C.useCallback(()=>{f.goBack(g)},[f]),ee=C.useCallback(()=>{f.goForward(g)},[f]),ne=C.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(C.useEffect(()=>{if(r){j.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},be=((Q=f.current)==null?void 0:Q.path)??null,k=f.backStack.length>0,I=f.forwardStack.length>0;return p.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[p.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),p.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:H,disabled:!k,className:`p-0.5 transition-colors ${k?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:p.jsx(Px,{className:"w-4 h-4"})}),p.jsx("button",{onClick:ee,disabled:!I,className:`p-0.5 transition-colors ${I?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:p.jsx(Ip,{className:"w-4 h-4"})}),p.jsx(ig,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),p.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),p.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:p.jsx(Gf,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:c!=null&&c.docs?p.jsx(Fw,{docs:c.docs,selected:be,onSelect:R}):p.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),p.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:be?d?p.jsxs("div",{className:"animate-pulse space-y-2",children:[p.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?p.jsx(Gw,{content:h.content,currentPath:be,onNavigate:z,onAnchorClick:ne}):p.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[p.jsx(Ip,{className:"w-5 h-5 mb-2"}),p.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function Qw(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const U0=2e3;function Xw(r){const s=r.filter(c=>!c.pending).slice(-8);return s.length===0?"":`[Prior conversation]
57
57
  ${s.map(c=>`${c.role==="user"?"User":"Assistant"}: ${c.content}`).join(`
58
58
  `)}
59
59
  [End prior conversation]
60
60
 
61
- `}function Kw(r){const n=r.summary,s=r.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof r=="string"?r:"Query completed.")}const Xg=N.createContext(null);function Zw({children:r}){const n=Ei(),[s,a]=N.useState(!1),[c,f]=N.useState([]),[h,d]=N.useState(null),[g,y]=N.useState({}),A=N.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??Xw(n.pathname)};N.useEffect(()=>()=>{A.current&&clearInterval(A.current)},[]);const j=N.useCallback(()=>a(ne=>!ne),[]),z=N.useCallback(ne=>{y(ne)},[]),R=N.useCallback(()=>{f([]),d(null)},[]),H=N.useCallback(async ne=>{var Z;const W=new Date().toISOString(),me={id:`user-${Date.now()}`,role:"user",content:ne,timestamp:W},be={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:W,pending:!0};f(Q=>[...Q,me,be]);const k={...w};(Z=k.entities)!=null&&Z.yamlContent&&k.entities.yamlContent.length>U0&&(k.entities={...k.entities,yamlContent:k.entities.yamlContent.slice(0,U0)+`
62
- ... (truncated)`});const ie=`${Iw(c.concat(me))}${ne}`;try{const K=(await Ie("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ie,tags:k.suggestedTags,context:k,wait:!1,direct:!0})})).workflow_id;d(K),f(ae=>ae.map(re=>re.id===be.id?{...re,workflowId:K}:re)),A.current&&clearInterval(A.current),A.current=setInterval(async()=>{var ae;try{const re=await Ie(`/workflows/${K}/result`),qe=(ae=re==null?void 0:re.result)==null?void 0:ae.data;if(qe){A.current&&clearInterval(A.current),A.current=null,d(null);const Ge=Kw(qe);let Le;try{Le=(await Ie(`/workflow-states/${K}/execution`)).duration_ms}catch{}f(Y=>Y.map(te=>te.id===be.id?{...te,content:Ge,timestamp:new Date().toISOString(),pending:!1,durationMs:Le}:te))}}catch{}},3e3)}catch{f(Q=>Q.map(K=>K.id===be.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[c,w]),ee=N.useCallback(async ne=>{const W=c.find(k=>k.id===ne);if(!(W!=null&&W.workflowId)||W.compilationStatus==="compiling"||W.compilationStatus==="done")return;const me=c.indexOf(W),be=c.slice(0,me).reverse().find(k=>k.role==="user");if(be){f(k=>k.map(I=>I.id===ne?{...I,compilationStatus:"compiling"}:I));try{const k=await Ie("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:be.content,summary:W.content})}),I=await Ie("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:W.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:k.tool_name,description:k.description,tags:k.tags,app_id:"longtail"})});await Ie(`/yaml-workflows/${I.id}/deploy`,{method:"POST"}),f(ie=>ie.map(Z=>Z.id===ne?{...Z,compilationStatus:"done"}:Z))}catch(k){const I=k instanceof Error?k.message:"Compilation failed";f(ie=>ie.map(Z=>Z.id===ne?{...Z,compilationStatus:"error",compilationError:I}:Z))}}},[c]);return p.jsx(Xg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:c,sendMessage:H,pageContext:w,setPageContext:z,activeWorkflowId:h,clearMessages:R,compileMessage:ee},children:r})}function Ig(){const r=N.useContext(Xg);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function Ww(){const{helpOpen:r,toggleHelp:n}=Ig();return p.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"calc(var(--feed-height, 32px) + 12px)"},"aria-label":r?"Close help":"Ask for help",children:r?p.jsx(Gf,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):p.jsx("img",{src:"/logo512.png",alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const Kg=6048e5,e2=864e5,B0=6e4,L0=525600,H0=43200,P0=1440,Y0=Symbol.for("constructDateFrom");function us(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&Y0 in r?r[Y0](n):r instanceof Date?new r.constructor(n):new Date(n)}function nn(r,n){return us(n||r,r)}let t2={};function Ya(){return t2}function La(r,n){var d,g,y,A;const s=Ya(),a=(n==null?void 0:n.weekStartsOn)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((A=(y=s.locale)==null?void 0:y.options)==null?void 0:A.weekStartsOn)??0,c=nn(r,n==null?void 0:n.in),f=c.getDay(),h=(f<a?7:0)+f-a;return c.setDate(c.getDate()-h),c.setHours(0,0,0,0),c}function qc(r,n){return La(r,{...n,weekStartsOn:1})}function Zg(r,n){const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),c=us(s,0);c.setFullYear(a+1,0,4),c.setHours(0,0,0,0);const f=qc(c),h=us(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=qc(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Uc(r){const n=nn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function Wg(r,...n){const s=us.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function $0(r,n){const s=nn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function n2(r,n,s){const[a,c]=Wg(s==null?void 0:s.in,r,n),f=$0(a),h=$0(c),d=+f-Uc(f),g=+h-Uc(h);return Math.round((d-g)/e2)}function s2(r,n){const s=Zg(r,n),a=us(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),qc(a)}function i2(r,n){const s=+nn(r)-+nn(n);return s<0?-1:s>0?1:s}function r2(r){return us(r,Date.now())}function a2(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function l2(r){return!(!a2(r)&&typeof r!="number"||isNaN(+nn(r)))}function c2(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function o2(r,n){const s=nn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const u2={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},f2=(r,n,s)=>{let a;const c=u2[r];return typeof c=="string"?a=c:n===1?a=c.one:a=c.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function xf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const h2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},d2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},m2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},p2={date:xf({formats:h2,defaultWidth:"full"}),time:xf({formats:d2,defaultWidth:"full"}),dateTime:xf({formats:m2,defaultWidth:"full"})},g2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},y2=(r,n,s,a)=>g2[r];function Aa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let c;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;c=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;c=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return c[f]}}const b2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},x2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},v2={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},_2={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},w2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},S2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},E2=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},A2={ordinalNumber:E2,era:Aa({values:b2,defaultWidth:"wide"}),quarter:Aa({values:x2,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Aa({values:v2,defaultWidth:"wide"}),day:Aa({values:_2,defaultWidth:"wide"}),dayPeriod:Aa({values:w2,defaultWidth:"wide",formattingValues:S2,defaultFormattingWidth:"wide"})};function Oa(r){return(n,s={})=>{const a=s.width,c=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(c);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?j2(d,w=>w.test(h)):O2(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const A=n.slice(h.length);return{value:y,rest:A}}}function O2(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function j2(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function T2(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const c=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const d=n.slice(c.length);return{value:h,rest:d}}}const N2=/^(\d+)(th|st|nd|rd)?/i,C2=/\d+/i,k2={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},M2={any:[/^b/i,/^(a|c)/i]},R2={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},D2={any:[/1/i,/2/i,/3/i,/4/i]},z2={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},q2={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},U2={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},B2={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},L2={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},H2={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},P2={ordinalNumber:T2({matchPattern:N2,parsePattern:C2,valueCallback:r=>parseInt(r,10)}),era:Oa({matchPatterns:k2,defaultMatchWidth:"wide",parsePatterns:M2,defaultParseWidth:"any"}),quarter:Oa({matchPatterns:R2,defaultMatchWidth:"wide",parsePatterns:D2,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Oa({matchPatterns:z2,defaultMatchWidth:"wide",parsePatterns:q2,defaultParseWidth:"any"}),day:Oa({matchPatterns:U2,defaultMatchWidth:"wide",parsePatterns:B2,defaultParseWidth:"any"}),dayPeriod:Oa({matchPatterns:L2,defaultMatchWidth:"any",parsePatterns:H2,defaultParseWidth:"any"})},ey={code:"en-US",formatDistance:f2,formatLong:p2,formatRelative:y2,localize:A2,match:P2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Y2(r,n){const s=nn(r,n==null?void 0:n.in);return n2(s,o2(s))+1}function $2(r,n){const s=nn(r,n==null?void 0:n.in),a=+qc(s)-+s2(s);return Math.round(a/Kg)+1}function ty(r,n){var A,w,j,z;const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),c=Ya(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(A=n==null?void 0:n.locale)==null?void 0:A.options)==null?void 0:w.firstWeekContainsDate)??c.firstWeekContainsDate??((z=(j=c.locale)==null?void 0:j.options)==null?void 0:z.firstWeekContainsDate)??1,h=us((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=La(h,n),g=us((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=La(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function G2(r,n){var d,g,y,A;const s=Ya(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((A=(y=s.locale)==null?void 0:y.options)==null?void 0:A.firstWeekContainsDate)??1,c=ty(r,n),f=us((n==null?void 0:n.in)||r,0);return f.setFullYear(c,0,a),f.setHours(0,0,0,0),La(f,n)}function V2(r,n){const s=nn(r,n==null?void 0:n.in),a=+La(s,n)-+G2(s,n);return Math.round(a/Kg)+1}function $e(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const $s={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return $e(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):$e(s+1,2)},d(r,n){return $e(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return $e(r.getHours()%12||12,n.length)},H(r,n){return $e(r.getHours(),n.length)},m(r,n){return $e(r.getMinutes(),n.length)},s(r,n){return $e(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),c=Math.trunc(a*Math.pow(10,s-3));return $e(c,n.length)}},mr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},G0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),c=a>0?a:1-a;return s.ordinalNumber(c,{unit:"year"})}return $s.y(r,n)},Y:function(r,n,s,a){const c=ty(r,a),f=c>0?c:1-c;if(n==="YY"){const h=f%100;return $e(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):$e(f,n.length)},R:function(r,n){const s=Zg(r);return $e(s,n.length)},u:function(r,n){const s=r.getFullYear();return $e(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return $e(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return $e(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return $s.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return $e(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const c=V2(r,a);return n==="wo"?s.ordinalNumber(c,{unit:"week"}):$e(c,n.length)},I:function(r,n,s){const a=$2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):$e(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):$s.d(r,n)},D:function(r,n,s){const a=Y2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):$e(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const c=r.getDay(),f=(c-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return $e(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(c,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(c,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(c,{width:"short",context:"formatting"});case"eeee":default:return s.day(c,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const c=r.getDay(),f=(c-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return $e(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(c,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(c,{width:"narrow",context:"standalone"});case"cccccc":return s.day(c,{width:"short",context:"standalone"});case"cccc":default:return s.day(c,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),c=a===0?7:a;switch(n){case"i":return String(c);case"ii":return $e(c,n.length);case"io":return s.ordinalNumber(c,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const c=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let c;switch(a===12?c=mr.noon:a===0?c=mr.midnight:c=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let c;switch(a>=17?c=mr.evening:a>=12?c=mr.afternoon:a>=4?c=mr.morning:c=mr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return $s.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):$s.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):$e(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):$e(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):$s.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):$s.s(r,n)},S:function(r,n){return $s.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return F0(a);case"XXXX":case"XX":return wi(a);case"XXXXX":case"XXX":default:return wi(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return F0(a);case"xxxx":case"xx":return wi(a);case"xxxxx":case"xxx":default:return wi(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+V0(a,":");case"OOOO":default:return"GMT"+wi(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+V0(a,":");case"zzzz":default:return"GMT"+wi(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return $e(a,n.length)},T:function(r,n,s){return $e(+r,n.length)}};function V0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),c=Math.trunc(a/60),f=a%60;return f===0?s+String(c):s+String(c)+n+$e(f,2)}function F0(r,n){return r%60===0?(r>0?"-":"+")+$e(Math.abs(r)/60,2):wi(r,n)}function wi(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),c=$e(Math.trunc(a/60),2),f=$e(a%60,2);return s+c+n+f}const J0=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},ny=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},F2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],c=s[2];if(!c)return J0(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",J0(a,n)).replace("{{time}}",ny(c,n))},J2={p:ny,P:F2},Q2=/^D+$/,X2=/^Y+$/,I2=["D","DD","YY","YYYY"];function K2(r){return Q2.test(r)}function Z2(r){return X2.test(r)}function W2(r,n,s){const a=eS(r,n,s);if(console.warn(a),I2.includes(r))throw new RangeError(a)}function eS(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const tS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,nS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sS=/^'([^]*?)'?$/,iS=/''/g,rS=/[a-zA-Z]/;function sy(r,n,s){var A,w,j,z;const a=Ya(),c=a.locale??ey,f=a.firstWeekContainsDate??((w=(A=a.locale)==null?void 0:A.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((z=(j=a.locale)==null?void 0:j.options)==null?void 0:z.weekStartsOn)??0,d=nn(r,s==null?void 0:s.in);if(!l2(d))throw new RangeError("Invalid time value");let g=n.match(nS).map(R=>{const H=R[0];if(H==="p"||H==="P"){const ee=J2[H];return ee(R,c.formatLong)}return R}).join("").match(tS).map(R=>{if(R==="''")return{isToken:!1,value:"'"};const H=R[0];if(H==="'")return{isToken:!1,value:aS(R)};if(G0[H])return{isToken:!0,value:R};if(H.match(rS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+H+"`");return{isToken:!1,value:R}});c.localize.preprocessor&&(g=c.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:c};return g.map(R=>{if(!R.isToken)return R.value;const H=R.value;(Z2(H)||K2(H))&&W2(H,n,String(r));const ee=G0[H[0]];return ee(d,H,c.localize,y)}).join("")}function aS(r){const n=r.match(sS);return n?n[1].replace(iS,"'"):r}function lS(r,n,s){const a=Ya(),c=(s==null?void 0:s.locale)??a.locale??ey,f=i2(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[d,g]=Wg(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=c2((s==null?void 0:s.roundingMethod)??"round"),A=g.getTime()-d.getTime(),w=A/B0,j=Uc(g)-Uc(d),z=(A-j)/B0,R=s==null?void 0:s.unit;let H;if(R?H=R:w<1?H="second":w<60?H="minute":w<P0?H="hour":z<H0?H="day":z<L0?H="month":H="year",H==="second"){const ee=y(A/1e3);return c.formatDistance("xSeconds",ee,h)}else if(H==="minute"){const ee=y(w);return c.formatDistance("xMinutes",ee,h)}else if(H==="hour"){const ee=y(w/60);return c.formatDistance("xHours",ee,h)}else if(H==="day"){const ee=y(z/P0);return c.formatDistance("xDays",ee,h)}else if(H==="month"){const ee=y(z/H0);return ee===12&&R!=="month"?c.formatDistance("xYears",1,h):c.formatDistance("xMonths",ee,h)}else{const ee=y(z/L0);return c.formatDistance("xYears",ee,h)}}function cS(r,n){return lS(r,r2(r),n)}function oS(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":cS(n,{addSuffix:!0})}function NE(r){return r<=0?"Expired":ch(r)}function uS(r){return r==null?"--":ch(r)}function ch(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),c=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?c>0?`${a}h ${c}m`:`${a}h`:f>0?`${c}m ${f}s`:`${c}m`}function CE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return ch(a-s)}function iy({options:r,children:n,className:s=""}){const[a,c]=N.useState(!1),[f,h]=N.useState(null),[d,g]=N.useState(null),y=N.useRef(null),A=N.useRef(void 0),w=N.useRef(void 0),j=220,z=N.useCallback(()=>{if(!y.current)return;const ne=y.current.getBoundingClientRect(),W=window.innerWidth-j-8,me=Math.max(8,Math.min(ne.left,W));g({top:ne.bottom+4,left:me})},[]),R=N.useCallback(async(ne,W)=>{try{await navigator.clipboard.writeText(ne),h(W),clearTimeout(A.current),A.current=setTimeout(()=>h(null),1200)}catch{}},[]),H=N.useCallback(()=>{clearTimeout(w.current),z(),c(!0)},[z]),ee=N.useCallback(()=>{w.current=setTimeout(()=>c(!1),150)},[]);return N.useEffect(()=>()=>{clearTimeout(A.current),clearTimeout(w.current)},[]),p.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:H,onMouseLeave:ee,children:[n,a&&d&&tg.createPortal(p.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:d.top,left:d.left},onMouseEnter:H,onMouseLeave:ee,children:r.map(ne=>p.jsxs("button",{onClick:W=>{W.stopPropagation(),R(ne.value,ne.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[p.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ne.label}),p.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===ne.label?"✓":ne.value})]},ne.label))}),document.body)]})}function fS(r,n){const s=new Date(r);switch(n){case"relative":return oS(r);case"datetime":return sy(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function hS(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:sy(n,"MMM d, yyyy h:mm:ss a")}]}function dS({date:r,format:n="relative",className:s=""}){const[,a]=N.useState(0);N.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const c=N.useMemo(()=>hS(r),[r]);return p.jsx(iy,{options:c,children:p.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:fS(r,n)})})}function mS({ms:r,className:n=""}){const s=uS(r),a=N.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?p.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):p.jsx(iy,{options:a,children:p.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const pS=["sm","md","lg","full"],Q0={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},X0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function gS({which:r}){const n="stroke-current";switch(r){case"sm":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function yS({msg:r}){const[n,s]=N.useState(0);N.useEffect(()=>{const h=new Date(r.timestamp).getTime(),d=()=>s(Math.floor((Date.now()-h)/1e3));d();const g=setInterval(d,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),c=n%60,f=a>0?`${a}m ${c}s`:`${c}s`;return p.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),p.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&p.jsxs(pr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[p.jsx(Oc,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function bS({msg:r,compileMessage:n}){const s=r.role==="assistant";return p.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[p.jsx(dS,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),p.jsx(mS,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&p.jsx(pr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:p.jsx(Oc,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&p.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:p.jsx($x,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function xS(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:c,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Ig(),[g,y]=N.useState(""),[A,w]=N.useState("md"),[j,z]=N.useState(!0),R=N.useRef(null),H=N.useRef(null);if(N.useEffect(()=>{R.current&&(R.current.scrollTop=R.current.scrollHeight)},[s]),N.useEffect(()=>{r&&H.current&&H.current.focus()},[r]),N.useEffect(()=>{if(!r)return;const k=I=>{I.key==="Escape"&&(A==="full"?w("lg"):A==="lg"?w("md"):A==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r,A,n]),!r)return null;const ee=()=>{const k=g.trim();!k||f||(a(k),y(""),H.current&&(H.current.style.height="auto"))},ne=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),ee())},W=A==="full",me=c.page.replace(/-/g," "),be=W?{}:{bottom:"calc(var(--feed-height, 32px) + 76px)"};return p.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${W?Q0.full:`right-6 ${Q0[A]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:be,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[p.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),p.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),p.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[p.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:pS.map(k=>p.jsx("button",{onClick:()=>w(k),className:`p-1 rounded transition-colors ${k===A?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":k===A,"aria-label":X0[k],title:X0[k],children:p.jsx(gS,{which:k})},k))}),s.length>0&&p.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:p.jsx(Gx,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),p.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:p.jsx(Gf,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),p.jsxs("div",{ref:R,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&p.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(k=>p.jsxs("div",{className:`text-xs leading-relaxed ${k.role==="user"?"text-right":"text-left"}`,children:[p.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${k.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:k.pending?p.jsx(yS,{msg:k}):k.role==="assistant"?p.jsx(lh,{content:k.content}):k.content}),!k.pending&&p.jsx("div",{className:"mt-0.5",children:p.jsx(bS,{msg:k,compileMessage:d})})]},k.id))]}),p.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsx("textarea",{ref:H,value:g,onChange:k=>{y(k.target.value);const I=k.target;I.style.height="auto",I.style.height=`${Math.min(I.scrollHeight,120)}px`},onKeyDown:ne,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),p.jsx("button",{onClick:ee,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:p.jsx(Vx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function vS(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Ai(),{collapsed:a,toggle:c}=Vg(),[f,h]=N.useState(!1),[d,g]=N.useState(()=>window.location.hash.startsWith("#docs")),y=Ei(),A=N.useRef(null);return N.useEffect(()=>{const w=A.current;w&&(w.classList.remove("animate-page-in"),w.offsetWidth,w.classList.add("animate-page-in"))},[y.pathname]),N.useEffect(()=>{const w=()=>{window.location.hash.startsWith("#docs")&&g(!0)};return window.addEventListener("hashchange",w),()=>window.removeEventListener("hashchange",w)},[]),p.jsxs("div",{className:"h-screen bg-surface flex flex-col",style:{"--feed-height":f?"224px":"32px"},children:[p.jsx(uw,{onToggleEventFeed:()=>h(w=>!w),onToggleDocs:()=>g(w=>!w)}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsxs("aside",{className:`${a?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[p.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[p.jsx(gw,{}),(r||n("admin")||s("engineer"))&&p.jsx(bw,{}),(r||n("admin")||s("engineer"))&&p.jsx(vw,{}),(r||n("admin"))&&p.jsx(ww,{})]}),p.jsx("button",{onClick:c,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${a?"flex justify-center":"flex items-center px-7"}`,"aria-label":a?"Expand sidebar":"Collapse sidebar",children:a?p.jsx(Fx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):p.jsx(Jx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),p.jsx("main",{className:"flex-1 overflow-y-auto",children:p.jsx("div",{ref:A,className:`max-w-dashboard mx-auto px-10 py-10 animate-page-in ${f?"pb-60":"pb-16"}`,children:p.jsx(bc,{})})})]}),p.jsx(Bw,{open:f,onToggle:()=>h(w=>!w)}),p.jsx(Qw,{open:d,onClose:()=>{g(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),p.jsx(Ww,{}),p.jsx(xS,{})]})}function _S(){const{isAuthenticated:r}=Ai(),n=Ei();return r?p.jsx(aw,{children:p.jsx(Zw,{children:p.jsx(vS,{})})}):p.jsx(Vs,{to:"/login",state:{from:n.pathname},replace:!0})}function ry({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),p.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),p.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),p.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return p.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),p.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),p.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),p.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return p.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("path",{d:"M12 8v4l3 3"})]})}}async function wS(){return Ie("/auth/oauth/providers")}async function SS(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Ie(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function kE(){return fs({queryKey:["oauth-connections"],queryFn:()=>Ie("/auth/oauth/connections")})}function ME(){const r=Nn();return Ln({mutationFn:({provider:n,label:s})=>SS(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function ES(){var I;const{login:r,isAuthenticated:n}=Ai(),s=ng(),a=Ei(),c=new URLSearchParams(a.search),f=c.get("token"),h=c.get("error"),d=((I=a.state)==null?void 0:I.from)??c.get("returnTo")??"/",g=N.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:c.get("displayName"),username:c.get("username")}));const[y,A]=N.useState(""),[w,j]=N.useState(""),[z,R]=N.useState(h||""),[H,ee]=N.useState(!1),[ne,W]=N.useState(!!f),[me,be]=N.useState([]);if(N.useEffect(()=>{f||wS().then(be).catch(()=>{})},[]),N.useEffect(()=>{if(!ne)return;const ie=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(ie)},[ne]),n&&!ne)return p.jsx(Vs,{to:d,replace:!0});const k=async ie=>{var Z,Q;if(ie.preventDefault(),R(""),!y.trim()||!w){R("Username and password are required");return}ee(!0);try{const K=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ae=await K.json();if(!K.ok){R(ae.error||"Login failed");return}W(!0),r(ae.token,{username:y.trim(),password:w},{displayName:(Z=ae.user)==null?void 0:Z.display_name,username:(Q=ae.user)==null?void 0:Q.external_id})}catch{R("Unable to connect to server")}finally{ee(!1)}};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ne?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:p.jsx(rh,{size:"lg",hideLabel:ne})}),p.jsxs("form",{onSubmit:k,className:`space-y-5 transition-opacity duration-300 ${ne?"opacity-0":""}`,children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),p.jsx("input",{id:"username",type:"text",value:y,onChange:ie=>A(ie.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ne,autoComplete:"username"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),p.jsx("input",{id:"password",type:"password",value:w,onChange:ie=>j(ie.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),z&&p.jsx("p",{className:"text-sm text-status-error",children:z}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:H||ne,children:H?"Signing in...":"Sign In"}),me.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[p.jsx("div",{className:"flex-1 h-px bg-border"}),p.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),p.jsx("div",{className:"flex-1 h-px bg-border"})]}),p.jsx("div",{className:"space-y-2",children:me.filter(ie=>ie.provider!=="anthropic").map(ie=>p.jsxs("a",{href:`/api/auth/oauth/${ie.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[p.jsx(ry,{provider:ie.provider}),"Sign in with ",ie.name]},ie.provider))})]})]})]})})}function I0(){const{isAuthenticated:r}=Ai(),n=ng(),s=Ei(),a=new URLSearchParams(s.search),c=a.get("state")||"";N.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=N.useState(""),[d,g]=N.useState(a.get("label")||"default"),[y,A]=N.useState(""),[w,j]=N.useState(!1),z=f.trim().startsWith("sk-ant-oat"),R=f.trim().startsWith("sk-ant-api"),H=ee=>{ee.preventDefault();const ne=f.trim();if(!ne){A("A token or API key is required");return}if(!ne.startsWith("sk-ant-")){A('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),A("");const W=`/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ne)}&state=${encodeURIComponent(c)}`;window.location.href=W};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:"mb-10",children:p.jsx(rh,{size:"lg"})}),p.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[p.jsx(ry,{provider:"anthropic",className:"w-6 h-6"}),p.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),p.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),p.jsxs("form",{onSubmit:H,className:"space-y-5",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),p.jsx("input",{id:"token",type:"password",value:f,onChange:ee=>h(ee.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),z&&p.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),R&&p.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),p.jsx("input",{id:"label",type:"text",value:d,onChange:ee=>g(ee.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),p.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&p.jsx("p",{className:"text-sm text-status-error",children:y}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),p.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),p.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",p.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",p.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function vf({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:c,hasRoleType:f}=Ai();return a?p.jsx(bc,{}):r&&r.some(h=>f(h))?p.jsx(bc,{}):n&&n.some(h=>c(h))?p.jsx(bc,{}):p.jsx(Vs,{to:s,replace:!0})}const AS=N.lazy(()=>Ae(()=>import("./ProcessesListPage-CAmVcn1P.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(r=>({default:r.ProcessesListPage}))),OS=N.lazy(()=>Ae(()=>import("./ProcessDetailPage-DS1AwTso.js"),__vite__mapDeps([16,1,2,4,17,18,13,19,15,9,6,20,21,22])).then(r=>({default:r.ProcessDetailPage}))),jS=N.lazy(()=>Ae(()=>import("./McpOverview-O8XrOzy0.js"),__vite__mapDeps([23,1,24,25,26,27,12,13,28,6])).then(r=>({default:r.McpOverview}))),TS=N.lazy(()=>Ae(()=>import("./McpRunsPage-QUY3pWp9.js"),__vite__mapDeps([29,1,25,26,27,5,6,7,8,15,13,9,30,12,11,10,14,31])).then(r=>({default:r.McpRunsPage}))),NS=N.lazy(()=>Ae(()=>import("./McpRunDetailPage-B1kNnD_t.js"),__vite__mapDeps([32,1,25,17,19,12,13,33,6,34,35,11,36,14])).then(r=>({default:r.McpRunDetailPage}))),CS=N.lazy(()=>Ae(()=>import("./McpQueryPage-Czot0nfl.js"),__vite__mapDeps([37,1,12,13,7,8,11,10,14,9,30,15,31,5,6,4,38])).then(r=>({default:r.McpQueryPage}))),kS=N.lazy(()=>Ae(()=>import("./McpQueryDetailPage-DhiR0Xrx.js"),__vite__mapDeps([39,1,12,13,19,38,40,6,26,4,41,34,25,3,2,42,43,44,45,33,46,36])).then(r=>({default:r.McpQueryDetailPage}))),MS=N.lazy(()=>Ae(()=>import("./EscalationsOverview-BEuUFGwC.js"),__vite__mapDeps([47,1,4,12,13,28,6])).then(r=>({default:r.EscalationsOverview}))),RS=N.lazy(()=>Ae(()=>import("./AvailableEscalationsPage-DmUid1h0.js"),__vite__mapDeps([48,1,4,49,5,6,7,8,10,12,13,50,51,17,52,22,53,11,54,20,15,9,55,31,14])).then(r=>({default:r.AvailableEscalationsPage}))),DS=N.lazy(()=>Ae(()=>import("./OperatorDashboard-BG1Q9qZk.js"),__vite__mapDeps([56,1,4,49,5,6,7,8,12,13,10,31,53,11,54,20,15,9,55,14])).then(r=>({default:r.OperatorDashboard}))),zS=N.lazy(()=>Ae(()=>import("./index-C4W1_Rfk.js"),__vite__mapDeps([57,1,49,12,13,55,3,17,4,21,22,51,50,19,20,33,6,34])).then(r=>({default:r.EscalationDetailPage}))),qS=N.lazy(()=>Ae(()=>import("./WorkflowsOverview-CBOYkfpD.js"),__vite__mapDeps([58,1,3,4,12,13,28,6])).then(r=>({default:r.WorkflowsOverview}))),US=N.lazy(()=>Ae(()=>import("./index-C2yJWps6.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,19])).then(r=>({default:r.StartWorkflowPage}))),BS=N.lazy(()=>Ae(()=>import("./index-C2yJWps6.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,19])).then(r=>({default:r.DurableInvokePage}))),LS=N.lazy(()=>Ae(()=>import("./WorkflowsDashboard-DdJm6X7x.js"),__vite__mapDeps([61,1,9,30,3,4,5,6,7,8,15,13,12,11,10,14,31])).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),HS=N.lazy(()=>Ae(()=>import("./WorkflowsDashboard-DdJm6X7x.js"),__vite__mapDeps([61,1,9,30,3,4,5,6,7,8,15,13,12,11,10,14,31])).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),PS=N.lazy(()=>Ae(()=>import("./YamlWorkflowsPage-BZnD_hMw.js"),__vite__mapDeps([62,1,26,40,5,6,63,12,13,11,8,43,44,45,42,60,46,19,64])).then(r=>({default:r.YamlWorkflowsPage}))),YS=N.lazy(()=>Ae(()=>import("./TasksListPage-CJB-EvKX.js"),__vite__mapDeps([65,1,2,3,5,6,7,8,19,54,46,10,11,12,13,15])).then(r=>({default:r.TasksListPage}))),$S=N.lazy(()=>Ae(()=>import("./TaskDetailPage-B49WQj8W.js"),__vite__mapDeps([66,1,2,19,54,12,13,6])).then(r=>({default:r.TaskDetailPage}))),K0=N.lazy(()=>Ae(()=>import("./WorkflowExecutionPage-DYNPy7Gk.js"),__vite__mapDeps([67,1,3,4,35,11,36,19,6,2,12,13,34,14])).then(r=>({default:r.WorkflowExecutionPage}))),GS=N.lazy(()=>Ae(()=>import("./AdminDashboard-CR0FtTE6.js"),__vite__mapDeps([68,1,2,4,24,18,13,6])).then(r=>({default:r.AdminDashboard}))),VS=N.lazy(()=>Ae(()=>import("./index-Bh9g-EOF.js"),__vite__mapDeps([69,1,3,7,8,11,31,5,6,12,13,70,15])).then(r=>({default:r.WorkersPage}))),FS=N.lazy(()=>Ae(()=>import("./index-D6YjH5uG.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,31,5,12,13,20,70,15,73,49,44,45])).then(r=>({default:r.WorkflowConfigsPage}))),Z0=N.lazy(()=>Ae(()=>import("./index-D6YjH5uG.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,31,5,12,13,20,70,15,73,49,44,45])).then(r=>({default:r.WorkflowConfigDetailPage}))),JS=N.lazy(()=>Ae(()=>import("./index-CY3EhrEA.js"),__vite__mapDeps([74,1,24,8,72,52,6,12,13,11,10,5,63,75,43,44,45,42,64,31,19])).then(r=>({default:r.McpServersPage}))),W0=N.lazy(()=>Ae(()=>import("./index-zHicKKh9.js"),__vite__mapDeps([76,1,24,73,12,13,41,6])).then(r=>({default:r.McpServerDetailPage}))),QS=N.lazy(()=>Ae(()=>import("./index-CVRVw3g_.js"),__vite__mapDeps([77,1,22,5,6,7,8,10,11,9,72,52,31,12,13,20,45,49,46])).then(r=>({default:r.UsersPage}))),XS=N.lazy(()=>Ae(()=>import("./RolesPage-CFdIXfmv.js"),__vite__mapDeps([78,1,49,7,8,72,52,6,12,13,20,31])).then(r=>({default:r.RolesPage}))),IS=N.lazy(()=>Ae(()=>import("./index-D-q2lzup.js"),__vite__mapDeps([79,1,12,13,52,6,50])).then(r=>({default:r.MaintenancePage}))),KS=N.lazy(()=>Ae(()=>import("./index-Bn-VSH41.js"),__vite__mapDeps([80,1,18,13,11,5,6,81,52,34,70,7,8,31])).then(r=>({default:r.ControlPlanePage}))),ZS=N.lazy(()=>Ae(()=>import("./index-ht5r_7jQ.js"),__vite__mapDeps([82,1,6,81,5,7,8,10,11,9,12,13,14])).then(r=>({default:r.StreamMessagesPage}))),WS=N.lazy(()=>Ae(()=>import("./CredentialsPage-Dvb4QelY.js"),__vite__mapDeps([83,1,12,13,46,72,52,6])).then(r=>({default:r.CredentialsPage}))),eE=N.lazy(()=>Ae(()=>import("./index-B9t_vpam.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,46])).then(r=>({default:r.FilesPage}))),tE=N.lazy(()=>Ae(()=>import("./index-CEF3Idec.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,46,87,41,6])).then(r=>({default:r.KnowledgePage}))),nE=N.lazy(()=>Ae(()=>import("./HomePage-BH-F5ws9.js"),__vite__mapDeps([88,1,3,25,81,2,4,20,13,15,14,89,6])).then(r=>({default:r.HomePage}))),sE=N.lazy(()=>Ae(()=>import("./AgentsPage-j-zblMNR.js"),__vite__mapDeps([90,1,91,4,5,6,7,8,10,11,12,13,14])).then(r=>({default:r.AgentsPage}))),iE=N.lazy(()=>Ae(()=>import("./AgentDetailPage-D64ath8c.js"),__vite__mapDeps([92,1,91,93,13,4,89,15,6])).then(r=>({default:r.AgentDetailPage}))),eg=N.lazy(()=>Ae(()=>import("./AgentConfigPage-BVypgq9m.js"),__vite__mapDeps([94,1,91,93,13,12,87,43,44,45,3,95,26,89,15,6])).then(r=>({default:r.AgentConfigPage}))),rE=N.lazy(()=>Ae(()=>import("./CapabilitiesPage-g5iUvHRL.js"),__vite__mapDeps([96,1,75,24,43,44,45,13,42,64,6,12])).then(r=>({default:r.CapabilitiesPage}))),aE=N.lazy(()=>Ae(()=>import("./TopicsPage-KjODhitc.js"),__vite__mapDeps([97,1,95,5,6,7,8,10,11,12,13,14])).then(r=>({default:r.TopicsPage}))),lE=N.lazy(()=>Ae(()=>import("./TopicDetailPage-ClibbST4.js"),__vite__mapDeps([98,1,95,14,13,6])).then(r=>({default:r.TopicDetailPage})));function cE(){return p.jsxs("div",{className:"animate-pulse space-y-4",children:[p.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return p.jsx(N.Suspense,{fallback:p.jsx(cE,{}),children:p.jsx("div",{className:"animate-page-enter",children:r})})}const ay=new yx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{ay.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),window.location.pathname!=="/login"&&(window.location.href=`/login?returnTo=${encodeURIComponent(window.location.pathname)}`)});const oE=vx([{path:"/login",element:p.jsx(ES,{})},{path:"/connect/anthropic",element:p.jsx(I0,{})},{path:"/connect/:provider",element:p.jsx(I0,{})},{path:"/",element:p.jsx(_S,{}),children:[{index:!0,element:p.jsx(xe,{children:p.jsx(nE,{})})},{path:"processes/all",element:p.jsx(xe,{children:p.jsx(AS,{})})},{path:"processes/detail/:originId",element:p.jsx(xe,{children:p.jsx(OS,{})})},{path:"credentials",element:p.jsx(xe,{children:p.jsx(WS,{})})},{path:"connections",element:p.jsx(Vs,{to:"/credentials",replace:!0})},{path:"escalations",element:p.jsx(xe,{children:p.jsx(MS,{})})},{path:"escalations/available",element:p.jsx(xe,{children:p.jsx(RS,{})})},{path:"escalations/queue",element:p.jsx(xe,{children:p.jsx(DS,{})})},{path:"escalations/detail/:id",element:p.jsx(xe,{children:p.jsx(zS,{})})},{path:"capabilities",element:p.jsx(xe,{children:p.jsx(rE,{})})},{path:"agents",element:p.jsx(xe,{children:p.jsx(sE,{})})},{path:"agents/new",element:p.jsx(xe,{children:p.jsx(eg,{})})},{path:"agents/:id",element:p.jsx(xe,{children:p.jsx(iE,{})})},{path:"agents/:id/edit",element:p.jsx(xe,{children:p.jsx(eg,{})})},{path:"topics",element:p.jsx(xe,{children:p.jsx(aE,{})})},{path:"topics/:topic",element:p.jsx(xe,{children:p.jsx(lE,{})})},{element:p.jsx(vf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:p.jsx(xe,{children:p.jsx(qS,{})})},{path:"workflows/executions",element:p.jsx(xe,{children:p.jsx(HS,{})})},{path:"workflows/durable/executions",element:p.jsx(xe,{children:p.jsx(LS,{})})},{path:"workflows/durable/executions/:workflowId",element:p.jsx(xe,{children:p.jsx(K0,{})})},{path:"workflows/tasks",element:p.jsx(xe,{children:p.jsx(YS,{})})},{path:"workflows/tasks/detail/:id",element:p.jsx(xe,{children:p.jsx($S,{})})},{path:"workflows/executions/:workflowId",element:p.jsx(xe,{children:p.jsx(K0,{})})},{path:"workflows/start",element:p.jsx(xe,{children:p.jsx(US,{})})},{path:"workflows/durable/invoke",element:p.jsx(xe,{children:p.jsx(BS,{})})},{path:"workflows/cron",element:p.jsx(Vs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:p.jsx(xe,{children:p.jsx(VS,{})})},{path:"workflows/registry",element:p.jsx(xe,{children:p.jsx(FS,{})})},{path:"workflows/registry/new",element:p.jsx(xe,{children:p.jsx(Z0,{})})},{path:"workflows/registry/:workflowType",element:p.jsx(xe,{children:p.jsx(Z0,{})})}]},{element:p.jsx(vf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:p.jsx(xe,{children:p.jsx(jS,{})})},{path:"mcp/queries",element:p.jsx(xe,{children:p.jsx(CS,{})})},{path:"mcp/queries/:workflowId",element:p.jsx(xe,{children:p.jsx(kS,{})})},{path:"mcp/tools",element:p.jsx(Vs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:p.jsx(xe,{children:p.jsx(JS,{})})},{path:"mcp/servers/new",element:p.jsx(xe,{children:p.jsx(W0,{})})},{path:"mcp/servers/:serverId",element:p.jsx(xe,{children:p.jsx(W0,{})})},{path:"mcp/workflows",element:p.jsx(xe,{children:p.jsx(PS,{})})},{path:"mcp/executions",element:p.jsx(xe,{children:p.jsx(TS,{})})},{path:"mcp/executions/:jobId",element:p.jsx(xe,{children:p.jsx(NS,{})})},{path:"files",element:p.jsx(xe,{children:p.jsx(eE,{})})},{path:"knowledge",element:p.jsx(xe,{children:p.jsx(tE,{})})}]},{element:p.jsx(vf,{roleTypes:["admin","superadmin"]}),children:[{path:"admin",element:p.jsx(xe,{children:p.jsx(GS,{})})},{path:"admin/users",element:p.jsx(xe,{children:p.jsx(QS,{})})},{path:"admin/bots",element:p.jsx(Vs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:p.jsx(Vs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:p.jsx(xe,{children:p.jsx(XS,{})})},{path:"admin/maintenance",element:p.jsx(xe,{children:p.jsx(IS,{})})},{path:"admin/controlplane",element:p.jsx(xe,{children:p.jsx(KS,{})})},{path:"admin/streams",element:p.jsx(xe,{children:p.jsx(ZS,{})})}]}]}]);function uE(){return p.jsx(bx,{client:ay,children:p.jsx(nv,{children:p.jsx(rw,{children:p.jsx(_x,{router:oE})})})})}Zx.createRoot(document.getElementById("root")).render(p.jsx(N.StrictMode,{children:p.jsx(uE,{})}));export{ME as A,ug as B,ah as C,mS as D,Jg as F,zw as J,r_ as N,ry as O,Sw as S,CE as a,Ie as b,dS as c,bE as d,vE as e,uS as f,wE as g,gE as h,Ai as i,EE as j,AE as k,OE as l,jE as m,TE as n,yE as o,cw as p,lw as q,_E as r,xE as s,SE as t,Cg as u,sy as v,iy as w,NE as x,ch as y,kE as z};
63
- //# sourceMappingURL=index-BhhWCADo.js.map
61
+ `}function Iw(r){const n=r.summary,s=r.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof r=="string"?r:"Query completed.")}const Qg=C.createContext(null);function Kw({children:r}){const n=Ei(),[s,a]=C.useState(!1),[c,f]=C.useState([]),[h,d]=C.useState(null),[g,y]=C.useState({}),A=C.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??Qw(n.pathname)};C.useEffect(()=>()=>{A.current&&clearInterval(A.current)},[]);const j=C.useCallback(()=>a(ne=>!ne),[]),z=C.useCallback(ne=>{y(ne)},[]),R=C.useCallback(()=>{f([]),d(null)},[]),H=C.useCallback(async ne=>{var Z;const W=new Date().toISOString(),me={id:`user-${Date.now()}`,role:"user",content:ne,timestamp:W},be={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:W,pending:!0};f(Q=>[...Q,me,be]);const k={...w};(Z=k.entities)!=null&&Z.yamlContent&&k.entities.yamlContent.length>U0&&(k.entities={...k.entities,yamlContent:k.entities.yamlContent.slice(0,U0)+`
62
+ ... (truncated)`});const ie=`${Xw(c.concat(me))}${ne}`;try{const K=(await Ie("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ie,tags:k.suggestedTags,context:k,wait:!1,direct:!0})})).workflow_id;d(K),f(ae=>ae.map(re=>re.id===be.id?{...re,workflowId:K}:re)),A.current&&clearInterval(A.current),A.current=setInterval(async()=>{var ae;try{const re=await Ie(`/workflows/${K}/result`),qe=(ae=re==null?void 0:re.result)==null?void 0:ae.data;if(qe){A.current&&clearInterval(A.current),A.current=null,d(null);const Ge=Iw(qe);let Le;try{Le=(await Ie(`/workflow-states/${K}/execution`)).duration_ms}catch{}f(Y=>Y.map(te=>te.id===be.id?{...te,content:Ge,timestamp:new Date().toISOString(),pending:!1,durationMs:Le}:te))}}catch{}},3e3)}catch{f(Q=>Q.map(K=>K.id===be.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[c,w]),ee=C.useCallback(async ne=>{const W=c.find(k=>k.id===ne);if(!(W!=null&&W.workflowId)||W.compilationStatus==="compiling"||W.compilationStatus==="done")return;const me=c.indexOf(W),be=c.slice(0,me).reverse().find(k=>k.role==="user");if(be){f(k=>k.map(I=>I.id===ne?{...I,compilationStatus:"compiling"}:I));try{const k=await Ie("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:be.content,summary:W.content})}),I=await Ie("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:W.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:k.tool_name,description:k.description,tags:k.tags,app_id:"longtail"})});await Ie(`/yaml-workflows/${I.id}/deploy`,{method:"POST"}),f(ie=>ie.map(Z=>Z.id===ne?{...Z,compilationStatus:"done"}:Z))}catch(k){const I=k instanceof Error?k.message:"Compilation failed";f(ie=>ie.map(Z=>Z.id===ne?{...Z,compilationStatus:"error",compilationError:I}:Z))}}},[c]);return p.jsx(Qg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:c,sendMessage:H,pageContext:w,setPageContext:z,activeWorkflowId:h,clearMessages:R,compileMessage:ee},children:r})}function Xg(){const r=C.useContext(Qg);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function Zw(){const{helpOpen:r,toggleHelp:n}=Xg();return p.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"calc(var(--feed-height, 32px) + 12px)"},"aria-label":r?"Close help":"Ask for help",children:r?p.jsx(Gf,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):p.jsx("img",{src:"/logo512.png",alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const Ig=6048e5,Ww=864e5,B0=6e4,L0=525600,H0=43200,P0=1440,Y0=Symbol.for("constructDateFrom");function us(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&Y0 in r?r[Y0](n):r instanceof Date?new r.constructor(n):new Date(n)}function nn(r,n){return us(n||r,r)}let e2={};function Ya(){return e2}function La(r,n){var d,g,y,A;const s=Ya(),a=(n==null?void 0:n.weekStartsOn)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((A=(y=s.locale)==null?void 0:y.options)==null?void 0:A.weekStartsOn)??0,c=nn(r,n==null?void 0:n.in),f=c.getDay(),h=(f<a?7:0)+f-a;return c.setDate(c.getDate()-h),c.setHours(0,0,0,0),c}function qc(r,n){return La(r,{...n,weekStartsOn:1})}function Kg(r,n){const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),c=us(s,0);c.setFullYear(a+1,0,4),c.setHours(0,0,0,0);const f=qc(c),h=us(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=qc(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Uc(r){const n=nn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function Zg(r,...n){const s=us.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function $0(r,n){const s=nn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function t2(r,n,s){const[a,c]=Zg(s==null?void 0:s.in,r,n),f=$0(a),h=$0(c),d=+f-Uc(f),g=+h-Uc(h);return Math.round((d-g)/Ww)}function n2(r,n){const s=Kg(r,n),a=us(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),qc(a)}function s2(r,n){const s=+nn(r)-+nn(n);return s<0?-1:s>0?1:s}function i2(r){return us(r,Date.now())}function r2(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function a2(r){return!(!r2(r)&&typeof r!="number"||isNaN(+nn(r)))}function l2(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function c2(r,n){const s=nn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const o2={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},u2=(r,n,s)=>{let a;const c=o2[r];return typeof c=="string"?a=c:n===1?a=c.one:a=c.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function xf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const f2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},h2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},d2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},m2={date:xf({formats:f2,defaultWidth:"full"}),time:xf({formats:h2,defaultWidth:"full"}),dateTime:xf({formats:d2,defaultWidth:"full"})},p2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},g2=(r,n,s,a)=>p2[r];function Aa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let c;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;c=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;c=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return c[f]}}const y2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},b2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},x2={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},v2={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},_2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},w2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},S2=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},E2={ordinalNumber:S2,era:Aa({values:y2,defaultWidth:"wide"}),quarter:Aa({values:b2,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Aa({values:x2,defaultWidth:"wide"}),day:Aa({values:v2,defaultWidth:"wide"}),dayPeriod:Aa({values:_2,defaultWidth:"wide",formattingValues:w2,defaultFormattingWidth:"wide"})};function Oa(r){return(n,s={})=>{const a=s.width,c=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(c);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?O2(d,w=>w.test(h)):A2(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const A=n.slice(h.length);return{value:y,rest:A}}}function A2(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function O2(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function j2(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const c=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const d=n.slice(c.length);return{value:h,rest:d}}}const T2=/^(\d+)(th|st|nd|rd)?/i,N2=/\d+/i,C2={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},k2={any:[/^b/i,/^(a|c)/i]},M2={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},R2={any:[/1/i,/2/i,/3/i,/4/i]},D2={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},z2={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},q2={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},U2={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},B2={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},L2={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},H2={ordinalNumber:j2({matchPattern:T2,parsePattern:N2,valueCallback:r=>parseInt(r,10)}),era:Oa({matchPatterns:C2,defaultMatchWidth:"wide",parsePatterns:k2,defaultParseWidth:"any"}),quarter:Oa({matchPatterns:M2,defaultMatchWidth:"wide",parsePatterns:R2,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Oa({matchPatterns:D2,defaultMatchWidth:"wide",parsePatterns:z2,defaultParseWidth:"any"}),day:Oa({matchPatterns:q2,defaultMatchWidth:"wide",parsePatterns:U2,defaultParseWidth:"any"}),dayPeriod:Oa({matchPatterns:B2,defaultMatchWidth:"any",parsePatterns:L2,defaultParseWidth:"any"})},Wg={code:"en-US",formatDistance:u2,formatLong:m2,formatRelative:g2,localize:E2,match:H2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function P2(r,n){const s=nn(r,n==null?void 0:n.in);return t2(s,c2(s))+1}function Y2(r,n){const s=nn(r,n==null?void 0:n.in),a=+qc(s)-+n2(s);return Math.round(a/Ig)+1}function ey(r,n){var A,w,j,z;const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),c=Ya(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(A=n==null?void 0:n.locale)==null?void 0:A.options)==null?void 0:w.firstWeekContainsDate)??c.firstWeekContainsDate??((z=(j=c.locale)==null?void 0:j.options)==null?void 0:z.firstWeekContainsDate)??1,h=us((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=La(h,n),g=us((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=La(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function $2(r,n){var d,g,y,A;const s=Ya(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((A=(y=s.locale)==null?void 0:y.options)==null?void 0:A.firstWeekContainsDate)??1,c=ey(r,n),f=us((n==null?void 0:n.in)||r,0);return f.setFullYear(c,0,a),f.setHours(0,0,0,0),La(f,n)}function G2(r,n){const s=nn(r,n==null?void 0:n.in),a=+La(s,n)-+$2(s,n);return Math.round(a/Ig)+1}function $e(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const $s={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return $e(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):$e(s+1,2)},d(r,n){return $e(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return $e(r.getHours()%12||12,n.length)},H(r,n){return $e(r.getHours(),n.length)},m(r,n){return $e(r.getMinutes(),n.length)},s(r,n){return $e(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),c=Math.trunc(a*Math.pow(10,s-3));return $e(c,n.length)}},mr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},G0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),c=a>0?a:1-a;return s.ordinalNumber(c,{unit:"year"})}return $s.y(r,n)},Y:function(r,n,s,a){const c=ey(r,a),f=c>0?c:1-c;if(n==="YY"){const h=f%100;return $e(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):$e(f,n.length)},R:function(r,n){const s=Kg(r);return $e(s,n.length)},u:function(r,n){const s=r.getFullYear();return $e(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return $e(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return $e(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return $s.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return $e(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const c=G2(r,a);return n==="wo"?s.ordinalNumber(c,{unit:"week"}):$e(c,n.length)},I:function(r,n,s){const a=Y2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):$e(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):$s.d(r,n)},D:function(r,n,s){const a=P2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):$e(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const c=r.getDay(),f=(c-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return $e(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(c,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(c,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(c,{width:"short",context:"formatting"});case"eeee":default:return s.day(c,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const c=r.getDay(),f=(c-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return $e(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(c,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(c,{width:"narrow",context:"standalone"});case"cccccc":return s.day(c,{width:"short",context:"standalone"});case"cccc":default:return s.day(c,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),c=a===0?7:a;switch(n){case"i":return String(c);case"ii":return $e(c,n.length);case"io":return s.ordinalNumber(c,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const c=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let c;switch(a===12?c=mr.noon:a===0?c=mr.midnight:c=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let c;switch(a>=17?c=mr.evening:a>=12?c=mr.afternoon:a>=4?c=mr.morning:c=mr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return $s.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):$s.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):$e(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):$e(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):$s.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):$s.s(r,n)},S:function(r,n){return $s.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return F0(a);case"XXXX":case"XX":return wi(a);case"XXXXX":case"XXX":default:return wi(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return F0(a);case"xxxx":case"xx":return wi(a);case"xxxxx":case"xxx":default:return wi(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+V0(a,":");case"OOOO":default:return"GMT"+wi(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+V0(a,":");case"zzzz":default:return"GMT"+wi(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return $e(a,n.length)},T:function(r,n,s){return $e(+r,n.length)}};function V0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),c=Math.trunc(a/60),f=a%60;return f===0?s+String(c):s+String(c)+n+$e(f,2)}function F0(r,n){return r%60===0?(r>0?"-":"+")+$e(Math.abs(r)/60,2):wi(r,n)}function wi(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),c=$e(Math.trunc(a/60),2),f=$e(a%60,2);return s+c+n+f}const J0=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},ty=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},V2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],c=s[2];if(!c)return J0(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",J0(a,n)).replace("{{time}}",ty(c,n))},F2={p:ty,P:V2},J2=/^D+$/,Q2=/^Y+$/,X2=["D","DD","YY","YYYY"];function I2(r){return J2.test(r)}function K2(r){return Q2.test(r)}function Z2(r,n,s){const a=W2(r,n,s);if(console.warn(a),X2.includes(r))throw new RangeError(a)}function W2(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const eS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nS=/^'([^]*?)'?$/,sS=/''/g,iS=/[a-zA-Z]/;function ny(r,n,s){var A,w,j,z;const a=Ya(),c=a.locale??Wg,f=a.firstWeekContainsDate??((w=(A=a.locale)==null?void 0:A.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((z=(j=a.locale)==null?void 0:j.options)==null?void 0:z.weekStartsOn)??0,d=nn(r,s==null?void 0:s.in);if(!a2(d))throw new RangeError("Invalid time value");let g=n.match(tS).map(R=>{const H=R[0];if(H==="p"||H==="P"){const ee=F2[H];return ee(R,c.formatLong)}return R}).join("").match(eS).map(R=>{if(R==="''")return{isToken:!1,value:"'"};const H=R[0];if(H==="'")return{isToken:!1,value:rS(R)};if(G0[H])return{isToken:!0,value:R};if(H.match(iS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+H+"`");return{isToken:!1,value:R}});c.localize.preprocessor&&(g=c.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:c};return g.map(R=>{if(!R.isToken)return R.value;const H=R.value;(K2(H)||I2(H))&&Z2(H,n,String(r));const ee=G0[H[0]];return ee(d,H,c.localize,y)}).join("")}function rS(r){const n=r.match(nS);return n?n[1].replace(sS,"'"):r}function aS(r,n,s){const a=Ya(),c=(s==null?void 0:s.locale)??a.locale??Wg,f=s2(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[d,g]=Zg(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=l2((s==null?void 0:s.roundingMethod)??"round"),A=g.getTime()-d.getTime(),w=A/B0,j=Uc(g)-Uc(d),z=(A-j)/B0,R=s==null?void 0:s.unit;let H;if(R?H=R:w<1?H="second":w<60?H="minute":w<P0?H="hour":z<H0?H="day":z<L0?H="month":H="year",H==="second"){const ee=y(A/1e3);return c.formatDistance("xSeconds",ee,h)}else if(H==="minute"){const ee=y(w);return c.formatDistance("xMinutes",ee,h)}else if(H==="hour"){const ee=y(w/60);return c.formatDistance("xHours",ee,h)}else if(H==="day"){const ee=y(z/P0);return c.formatDistance("xDays",ee,h)}else if(H==="month"){const ee=y(z/H0);return ee===12&&R!=="month"?c.formatDistance("xYears",1,h):c.formatDistance("xMonths",ee,h)}else{const ee=y(z/L0);return c.formatDistance("xYears",ee,h)}}function lS(r,n){return aS(r,i2(r),n)}function cS(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":lS(n,{addSuffix:!0})}function TE(r){return r<=0?"Expired":ch(r)}function oS(r){return r==null?"--":ch(r)}function ch(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),c=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?c>0?`${a}h ${c}m`:`${a}h`:f>0?`${c}m ${f}s`:`${c}m`}function NE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return ch(a-s)}function sy({options:r,children:n,className:s=""}){const[a,c]=C.useState(!1),[f,h]=C.useState(null),[d,g]=C.useState(null),y=C.useRef(null),A=C.useRef(void 0),w=C.useRef(void 0),j=220,z=C.useCallback(()=>{if(!y.current)return;const ne=y.current.getBoundingClientRect(),W=window.innerWidth-j-8,me=Math.max(8,Math.min(ne.left,W));g({top:ne.bottom+4,left:me})},[]),R=C.useCallback(async(ne,W)=>{try{await navigator.clipboard.writeText(ne),h(W),clearTimeout(A.current),A.current=setTimeout(()=>h(null),1200)}catch{}},[]),H=C.useCallback(()=>{clearTimeout(w.current),z(),c(!0)},[z]),ee=C.useCallback(()=>{w.current=setTimeout(()=>c(!1),150)},[]);return C.useEffect(()=>()=>{clearTimeout(A.current),clearTimeout(w.current)},[]),p.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:H,onMouseLeave:ee,children:[n,a&&d&&tg.createPortal(p.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:d.top,left:d.left},onMouseEnter:H,onMouseLeave:ee,children:r.map(ne=>p.jsxs("button",{onClick:W=>{W.stopPropagation(),R(ne.value,ne.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[p.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ne.label}),p.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===ne.label?"✓":ne.value})]},ne.label))}),document.body)]})}function uS(r,n){const s=new Date(r);switch(n){case"relative":return cS(r);case"datetime":return ny(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function fS(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:ny(n,"MMM d, yyyy h:mm:ss a")}]}function hS({date:r,format:n="relative",className:s=""}){const[,a]=C.useState(0);C.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const c=C.useMemo(()=>fS(r),[r]);return p.jsx(sy,{options:c,children:p.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:uS(r,n)})})}function dS({ms:r,className:n=""}){const s=oS(r),a=C.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?p.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):p.jsx(sy,{options:a,children:p.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const mS=["sm","md","lg","full"],Q0={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},X0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function pS({which:r}){const n="stroke-current";switch(r){case"sm":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function gS({msg:r}){const[n,s]=C.useState(0);C.useEffect(()=>{const h=new Date(r.timestamp).getTime(),d=()=>s(Math.floor((Date.now()-h)/1e3));d();const g=setInterval(d,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),c=n%60,f=a>0?`${a}m ${c}s`:`${c}s`;return p.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),p.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&p.jsxs(pr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[p.jsx(Oc,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function yS({msg:r,compileMessage:n}){const s=r.role==="assistant";return p.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[p.jsx(hS,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),p.jsx(dS,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&p.jsx(pr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:p.jsx(Oc,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&p.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:p.jsx(Yx,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function bS(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:c,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Xg(),[g,y]=C.useState(""),[A,w]=C.useState("md"),[j,z]=C.useState(!0),R=C.useRef(null),H=C.useRef(null);if(C.useEffect(()=>{R.current&&(R.current.scrollTop=R.current.scrollHeight)},[s]),C.useEffect(()=>{r&&H.current&&H.current.focus()},[r]),C.useEffect(()=>{if(!r)return;const k=I=>{I.key==="Escape"&&(A==="full"?w("lg"):A==="lg"?w("md"):A==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r,A,n]),!r)return null;const ee=()=>{const k=g.trim();!k||f||(a(k),y(""),H.current&&(H.current.style.height="auto"))},ne=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),ee())},W=A==="full",me=c.page.replace(/-/g," "),be=W?{}:{bottom:"calc(var(--feed-height, 32px) + 76px)"};return p.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${W?Q0.full:`right-6 ${Q0[A]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:be,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[p.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),p.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),p.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[p.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:mS.map(k=>p.jsx("button",{onClick:()=>w(k),className:`p-1 rounded transition-colors ${k===A?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":k===A,"aria-label":X0[k],title:X0[k],children:p.jsx(pS,{which:k})},k))}),s.length>0&&p.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:p.jsx($x,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),p.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:p.jsx(Gf,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),p.jsxs("div",{ref:R,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&p.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(k=>p.jsxs("div",{className:`text-xs leading-relaxed ${k.role==="user"?"text-right":"text-left"}`,children:[p.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${k.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:k.pending?p.jsx(gS,{msg:k}):k.role==="assistant"?p.jsx(lh,{content:k.content}):k.content}),!k.pending&&p.jsx("div",{className:"mt-0.5",children:p.jsx(yS,{msg:k,compileMessage:d})})]},k.id))]}),p.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsx("textarea",{ref:H,value:g,onChange:k=>{y(k.target.value);const I=k.target;I.style.height="auto",I.style.height=`${Math.min(I.scrollHeight,120)}px`},onKeyDown:ne,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),p.jsx("button",{onClick:ee,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:p.jsx(Gx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function xS(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Ai(),{collapsed:a,toggle:c}=Vg(),[f,h]=C.useState(!1),[d,g]=C.useState(()=>window.location.hash.startsWith("#docs")),y=Ei(),A=C.useRef(null);return C.useEffect(()=>{const w=A.current;w&&(w.classList.remove("animate-page-in"),w.offsetWidth,w.classList.add("animate-page-in"))},[y.pathname]),C.useEffect(()=>{const w=()=>{window.location.hash.startsWith("#docs")&&g(!0)};return window.addEventListener("hashchange",w),()=>window.removeEventListener("hashchange",w)},[]),p.jsxs("div",{className:"h-screen bg-surface flex flex-col",style:{"--feed-height":f?"224px":"32px"},children:[p.jsx(ow,{onToggleEventFeed:()=>h(w=>!w),onToggleDocs:()=>g(w=>!w)}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsxs("aside",{className:`${a?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[p.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[p.jsx(pw,{}),(r||n("admin")||s("engineer"))&&p.jsx(yw,{}),(r||n("admin")||s("engineer"))&&p.jsx(xw,{}),(r||n("admin"))&&p.jsx(_w,{})]}),p.jsx("button",{onClick:c,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${a?"flex justify-center":"flex items-center px-7"}`,"aria-label":a?"Expand sidebar":"Collapse sidebar",children:a?p.jsx(Vx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):p.jsx(Fx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),p.jsx("main",{className:"flex-1 overflow-y-auto",children:p.jsx("div",{ref:A,className:`max-w-dashboard mx-auto px-10 py-10 animate-page-in ${f?"pb-60":"pb-16"}`,children:p.jsx(bc,{})})})]}),p.jsx(Uw,{open:f,onToggle:()=>h(w=>!w)}),p.jsx(Jw,{open:d,onClose:()=>{g(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),p.jsx(Zw,{}),p.jsx(bS,{})]})}function vS(){const{isAuthenticated:r}=Ai(),n=Ei();return r?p.jsx(rw,{children:p.jsx(Kw,{children:p.jsx(xS,{})})}):p.jsx(Vs,{to:"/login",state:{from:n.pathname},replace:!0})}function iy({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),p.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),p.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),p.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return p.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),p.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),p.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),p.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return p.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("path",{d:"M12 8v4l3 3"})]})}}async function _S(){return Ie("/auth/oauth/providers")}async function wS(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Ie(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function CE(){return fs({queryKey:["oauth-connections"],queryFn:()=>Ie("/auth/oauth/connections")})}function kE(){const r=Nn();return Ln({mutationFn:({provider:n,label:s})=>wS(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function SS(){var I;const{login:r,isAuthenticated:n}=Ai(),s=ng(),a=Ei(),c=new URLSearchParams(a.search),f=c.get("token"),h=c.get("error"),d=((I=a.state)==null?void 0:I.from)??c.get("returnTo")??"/",g=C.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:c.get("displayName"),username:c.get("username")}));const[y,A]=C.useState(""),[w,j]=C.useState(""),[z,R]=C.useState(h||""),[H,ee]=C.useState(!1),[ne,W]=C.useState(!!f),[me,be]=C.useState([]);if(C.useEffect(()=>{f||_S().then(be).catch(()=>{})},[]),C.useEffect(()=>{if(!ne)return;const ie=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(ie)},[ne]),n&&!ne)return p.jsx(Vs,{to:d,replace:!0});const k=async ie=>{var Z,Q;if(ie.preventDefault(),R(""),!y.trim()||!w){R("Username and password are required");return}ee(!0);try{const K=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ae=await K.json();if(!K.ok){R(ae.error||"Login failed");return}W(!0),r(ae.token,{username:y.trim(),password:w},{displayName:(Z=ae.user)==null?void 0:Z.display_name,username:(Q=ae.user)==null?void 0:Q.external_id})}catch{R("Unable to connect to server")}finally{ee(!1)}};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ne?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:p.jsx(rh,{size:"lg",hideLabel:ne})}),p.jsxs("form",{onSubmit:k,className:`space-y-5 transition-opacity duration-300 ${ne?"opacity-0":""}`,children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),p.jsx("input",{id:"username",type:"text",value:y,onChange:ie=>A(ie.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ne,autoComplete:"username"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),p.jsx("input",{id:"password",type:"password",value:w,onChange:ie=>j(ie.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),z&&p.jsx("p",{className:"text-sm text-status-error",children:z}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:H||ne,children:H?"Signing in...":"Sign In"}),me.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[p.jsx("div",{className:"flex-1 h-px bg-border"}),p.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),p.jsx("div",{className:"flex-1 h-px bg-border"})]}),p.jsx("div",{className:"space-y-2",children:me.filter(ie=>ie.provider!=="anthropic").map(ie=>p.jsxs("a",{href:`/api/auth/oauth/${ie.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[p.jsx(iy,{provider:ie.provider}),"Sign in with ",ie.name]},ie.provider))})]})]})]})})}function I0(){const{isAuthenticated:r}=Ai(),n=ng(),s=Ei(),a=new URLSearchParams(s.search),c=a.get("state")||"";C.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=C.useState(""),[d,g]=C.useState(a.get("label")||"default"),[y,A]=C.useState(""),[w,j]=C.useState(!1),z=f.trim().startsWith("sk-ant-oat"),R=f.trim().startsWith("sk-ant-api"),H=ee=>{ee.preventDefault();const ne=f.trim();if(!ne){A("A token or API key is required");return}if(!ne.startsWith("sk-ant-")){A('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),A("");const W=`/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ne)}&state=${encodeURIComponent(c)}`;window.location.href=W};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:"mb-10",children:p.jsx(rh,{size:"lg"})}),p.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[p.jsx(iy,{provider:"anthropic",className:"w-6 h-6"}),p.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),p.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),p.jsxs("form",{onSubmit:H,className:"space-y-5",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),p.jsx("input",{id:"token",type:"password",value:f,onChange:ee=>h(ee.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),z&&p.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),R&&p.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),p.jsx("input",{id:"label",type:"text",value:d,onChange:ee=>g(ee.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),p.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&p.jsx("p",{className:"text-sm text-status-error",children:y}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),p.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),p.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",p.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",p.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function vf({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:c,hasRoleType:f}=Ai();return a?p.jsx(bc,{}):r&&r.some(h=>f(h))?p.jsx(bc,{}):n&&n.some(h=>c(h))?p.jsx(bc,{}):p.jsx(Vs,{to:s,replace:!0})}const ES=C.lazy(()=>Ae(()=>import("./ProcessesListPage-Bmn33g_l.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(r=>({default:r.ProcessesListPage}))),AS=C.lazy(()=>Ae(()=>import("./ProcessDetailPage-DzGacZpO.js"),__vite__mapDeps([16,1,2,4,17,18,13,19,15,9,6,20,21,22])).then(r=>({default:r.ProcessDetailPage}))),OS=C.lazy(()=>Ae(()=>import("./McpOverview-D34bLMuP.js"),__vite__mapDeps([23,1,24,25,26,27,12,13,28,6])).then(r=>({default:r.McpOverview}))),jS=C.lazy(()=>Ae(()=>import("./McpRunsPage-BUSxdydO.js"),__vite__mapDeps([29,1,25,26,27,5,6,7,8,15,13,9,30,12,11,10,14,31])).then(r=>({default:r.McpRunsPage}))),TS=C.lazy(()=>Ae(()=>import("./McpRunDetailPage-SoXudCbq.js"),__vite__mapDeps([32,1,25,17,19,12,13,33,6,34,35,11,36,14])).then(r=>({default:r.McpRunDetailPage}))),NS=C.lazy(()=>Ae(()=>import("./McpQueryPage-wPHJkhEp.js"),__vite__mapDeps([37,1,12,13,7,8,11,10,14,9,30,15,31,5,6,4,38])).then(r=>({default:r.McpQueryPage}))),CS=C.lazy(()=>Ae(()=>import("./McpQueryDetailPage-gLGTGX6g.js"),__vite__mapDeps([39,1,12,13,19,38,40,6,26,4,41,34,25,3,2,42,43,44,45,33,46,36])).then(r=>({default:r.McpQueryDetailPage}))),kS=C.lazy(()=>Ae(()=>import("./EscalationsOverview-Cg2SN0WK.js"),__vite__mapDeps([47,1,4,12,13,28,6])).then(r=>({default:r.EscalationsOverview}))),MS=C.lazy(()=>Ae(()=>import("./AvailableEscalationsPage-DrarbHov.js"),__vite__mapDeps([48,1,4,49,5,6,7,8,10,12,13,50,51,17,52,22,53,11,54,20,15,9,55,31,14])).then(r=>({default:r.AvailableEscalationsPage}))),RS=C.lazy(()=>Ae(()=>import("./OperatorDashboard-CYCl2our.js"),__vite__mapDeps([56,1,4,49,5,6,7,8,12,13,10,31,53,11,54,20,15,9,55,14])).then(r=>({default:r.OperatorDashboard}))),DS=C.lazy(()=>Ae(()=>import("./index-DDxZOINn.js"),__vite__mapDeps([57,1,49,12,13,55,3,17,4,21,22,51,50,19,20,33,6,34])).then(r=>({default:r.EscalationDetailPage}))),zS=C.lazy(()=>Ae(()=>import("./WorkflowsOverview-C_y7JCg2.js"),__vite__mapDeps([58,1,3,4,12,13,28,6])).then(r=>({default:r.WorkflowsOverview}))),qS=C.lazy(()=>Ae(()=>import("./index-DqFfgd-7.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,19])).then(r=>({default:r.StartWorkflowPage}))),US=C.lazy(()=>Ae(()=>import("./index-DqFfgd-7.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,19])).then(r=>({default:r.DurableInvokePage}))),BS=C.lazy(()=>Ae(()=>import("./WorkflowsDashboard-BFzCyvgv.js"),__vite__mapDeps([61,1,9,30,3,4,5,6,7,8,15,13,12,11,10,14,31])).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),LS=C.lazy(()=>Ae(()=>import("./WorkflowsDashboard-BFzCyvgv.js"),__vite__mapDeps([61,1,9,30,3,4,5,6,7,8,15,13,12,11,10,14,31])).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),HS=C.lazy(()=>Ae(()=>import("./YamlWorkflowsPage-CYQjp3JI.js"),__vite__mapDeps([62,1,26,40,5,6,63,12,13,11,8,43,44,45,42,60,46,19,64])).then(r=>({default:r.YamlWorkflowsPage}))),PS=C.lazy(()=>Ae(()=>import("./TasksListPage-D-vHndyV.js"),__vite__mapDeps([65,1,2,3,5,6,7,8,19,54,46,10,11,12,13,15])).then(r=>({default:r.TasksListPage}))),YS=C.lazy(()=>Ae(()=>import("./TaskDetailPage-CZw_F8y4.js"),__vite__mapDeps([66,1,2,19,54,12,13,6])).then(r=>({default:r.TaskDetailPage}))),K0=C.lazy(()=>Ae(()=>import("./WorkflowExecutionPage-CVGztAdK.js"),__vite__mapDeps([67,1,3,4,35,11,36,19,6,2,12,13,34,14])).then(r=>({default:r.WorkflowExecutionPage}))),$S=C.lazy(()=>Ae(()=>import("./AdminDashboard-C0_qN2h3.js"),__vite__mapDeps([68,1,2,4,24,18,13,6])).then(r=>({default:r.AdminDashboard}))),GS=C.lazy(()=>Ae(()=>import("./index-CvzfRxnj.js"),__vite__mapDeps([69,1,3,7,8,11,31,5,6,12,13,70,15])).then(r=>({default:r.WorkersPage}))),VS=C.lazy(()=>Ae(()=>import("./index-CovZsMow.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,31,5,12,13,20,70,15,73,49,44,45])).then(r=>({default:r.WorkflowConfigsPage}))),Z0=C.lazy(()=>Ae(()=>import("./index-CovZsMow.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,31,5,12,13,20,70,15,73,49,44,45])).then(r=>({default:r.WorkflowConfigDetailPage}))),FS=C.lazy(()=>Ae(()=>import("./index-dzxsXeMO.js"),__vite__mapDeps([74,1,24,8,72,52,6,12,13,11,10,5,63,75,43,44,45,42,64,31,19])).then(r=>({default:r.McpServersPage}))),W0=C.lazy(()=>Ae(()=>import("./index-C_A76Dl1.js"),__vite__mapDeps([76,1,24,73,12,13,41,6])).then(r=>({default:r.McpServerDetailPage}))),JS=C.lazy(()=>Ae(()=>import("./index-BMo7wCw8.js"),__vite__mapDeps([77,1,22,5,6,7,8,10,11,9,72,52,31,12,13,20,45,49,46])).then(r=>({default:r.UsersPage}))),QS=C.lazy(()=>Ae(()=>import("./RolesPage-BTtaabkS.js"),__vite__mapDeps([78,1,49,7,8,72,52,6,12,13,20,31])).then(r=>({default:r.RolesPage}))),XS=C.lazy(()=>Ae(()=>import("./index-J0dMfAmE.js"),__vite__mapDeps([79,1,12,13,52,6,50])).then(r=>({default:r.MaintenancePage}))),IS=C.lazy(()=>Ae(()=>import("./index-CryoNbg0.js"),__vite__mapDeps([80,1,18,13,11,5,6,81,52,34,70,7,8,31])).then(r=>({default:r.ControlPlanePage}))),KS=C.lazy(()=>Ae(()=>import("./index-CFJc47B8.js"),__vite__mapDeps([82,1,6,81,5,7,8,10,11,9,12,13,14])).then(r=>({default:r.StreamMessagesPage}))),ZS=C.lazy(()=>Ae(()=>import("./CredentialsPage-C-rjAIK3.js"),__vite__mapDeps([83,1,12,13,46,72,52,6])).then(r=>({default:r.CredentialsPage}))),WS=C.lazy(()=>Ae(()=>import("./index-CdNXBj7w.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,46])).then(r=>({default:r.FilesPage}))),eE=C.lazy(()=>Ae(()=>import("./index-ugekH3E2.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,46,87,41,6])).then(r=>({default:r.KnowledgePage}))),tE=C.lazy(()=>Ae(()=>import("./HomePage-74mCQ5nB.js"),__vite__mapDeps([88,1,3,25,81,2,4,20,13,15,14,89,6])).then(r=>({default:r.HomePage}))),nE=C.lazy(()=>Ae(()=>import("./AgentsPage-DJWSuoJA.js"),__vite__mapDeps([90,1,91,4,5,6,7,8,10,11,12,13,14])).then(r=>({default:r.AgentsPage}))),sE=C.lazy(()=>Ae(()=>import("./AgentDetailPage-B5kaAJDM.js"),__vite__mapDeps([92,1,91,93,13,4,89,15,6])).then(r=>({default:r.AgentDetailPage}))),eg=C.lazy(()=>Ae(()=>import("./AgentConfigPage-DG1zOIiz.js"),__vite__mapDeps([94,1,91,93,13,12,87,43,44,45,3,95,26,89,15,6])).then(r=>({default:r.AgentConfigPage}))),iE=C.lazy(()=>Ae(()=>import("./CapabilitiesPage-BiL9QUxI.js"),__vite__mapDeps([96,1,75,24,43,44,45,13,42,64,6,12])).then(r=>({default:r.CapabilitiesPage}))),rE=C.lazy(()=>Ae(()=>import("./TopicsPage-Cbc0nVj9.js"),__vite__mapDeps([97,1,95,5,6,7,8,10,11,12,13,14])).then(r=>({default:r.TopicsPage}))),aE=C.lazy(()=>Ae(()=>import("./TopicDetailPage-C5ZUZpU5.js"),__vite__mapDeps([98,1,95,14,13,6])).then(r=>({default:r.TopicDetailPage})));function lE(){return p.jsxs("div",{className:"animate-pulse space-y-4",children:[p.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return p.jsx(C.Suspense,{fallback:p.jsx(lE,{}),children:p.jsx("div",{className:"animate-page-enter",children:r})})}const ry=new gx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{ry.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),window.location.pathname!=="/login"&&(window.location.href=`/login?returnTo=${encodeURIComponent(window.location.pathname)}`)});const cE=xx([{path:"/login",element:p.jsx(SS,{})},{path:"/connect/anthropic",element:p.jsx(I0,{})},{path:"/connect/:provider",element:p.jsx(I0,{})},{path:"/",element:p.jsx(vS,{}),children:[{index:!0,element:p.jsx(xe,{children:p.jsx(tE,{})})},{path:"processes/all",element:p.jsx(xe,{children:p.jsx(ES,{})})},{path:"processes/detail/:originId",element:p.jsx(xe,{children:p.jsx(AS,{})})},{path:"credentials",element:p.jsx(xe,{children:p.jsx(ZS,{})})},{path:"connections",element:p.jsx(Vs,{to:"/credentials",replace:!0})},{path:"escalations",element:p.jsx(xe,{children:p.jsx(kS,{})})},{path:"escalations/available",element:p.jsx(xe,{children:p.jsx(MS,{})})},{path:"escalations/queue",element:p.jsx(xe,{children:p.jsx(RS,{})})},{path:"escalations/detail/:id",element:p.jsx(xe,{children:p.jsx(DS,{})})},{path:"capabilities",element:p.jsx(xe,{children:p.jsx(iE,{})})},{path:"agents",element:p.jsx(xe,{children:p.jsx(nE,{})})},{path:"agents/new",element:p.jsx(xe,{children:p.jsx(eg,{})})},{path:"agents/:id",element:p.jsx(xe,{children:p.jsx(sE,{})})},{path:"agents/:id/edit",element:p.jsx(xe,{children:p.jsx(eg,{})})},{path:"topics",element:p.jsx(xe,{children:p.jsx(rE,{})})},{path:"topics/:topic",element:p.jsx(xe,{children:p.jsx(aE,{})})},{element:p.jsx(vf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:p.jsx(xe,{children:p.jsx(zS,{})})},{path:"workflows/executions",element:p.jsx(xe,{children:p.jsx(LS,{})})},{path:"workflows/durable/executions",element:p.jsx(xe,{children:p.jsx(BS,{})})},{path:"workflows/durable/executions/:workflowId",element:p.jsx(xe,{children:p.jsx(K0,{})})},{path:"workflows/tasks",element:p.jsx(xe,{children:p.jsx(PS,{})})},{path:"workflows/tasks/detail/:id",element:p.jsx(xe,{children:p.jsx(YS,{})})},{path:"workflows/executions/:workflowId",element:p.jsx(xe,{children:p.jsx(K0,{})})},{path:"workflows/start",element:p.jsx(xe,{children:p.jsx(qS,{})})},{path:"workflows/durable/invoke",element:p.jsx(xe,{children:p.jsx(US,{})})},{path:"workflows/cron",element:p.jsx(Vs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:p.jsx(xe,{children:p.jsx(GS,{})})},{path:"workflows/registry",element:p.jsx(xe,{children:p.jsx(VS,{})})},{path:"workflows/registry/new",element:p.jsx(xe,{children:p.jsx(Z0,{})})},{path:"workflows/registry/:workflowType",element:p.jsx(xe,{children:p.jsx(Z0,{})})}]},{element:p.jsx(vf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:p.jsx(xe,{children:p.jsx(OS,{})})},{path:"mcp/queries",element:p.jsx(xe,{children:p.jsx(NS,{})})},{path:"mcp/queries/:workflowId",element:p.jsx(xe,{children:p.jsx(CS,{})})},{path:"mcp/tools",element:p.jsx(Vs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:p.jsx(xe,{children:p.jsx(FS,{})})},{path:"mcp/servers/new",element:p.jsx(xe,{children:p.jsx(W0,{})})},{path:"mcp/servers/:serverId",element:p.jsx(xe,{children:p.jsx(W0,{})})},{path:"mcp/workflows",element:p.jsx(xe,{children:p.jsx(HS,{})})},{path:"mcp/executions",element:p.jsx(xe,{children:p.jsx(jS,{})})},{path:"mcp/executions/:jobId",element:p.jsx(xe,{children:p.jsx(TS,{})})},{path:"files",element:p.jsx(xe,{children:p.jsx(WS,{})})},{path:"knowledge",element:p.jsx(xe,{children:p.jsx(eE,{})})}]},{element:p.jsx(vf,{roleTypes:["admin","superadmin"]}),children:[{path:"admin",element:p.jsx(xe,{children:p.jsx($S,{})})},{path:"admin/users",element:p.jsx(xe,{children:p.jsx(JS,{})})},{path:"admin/bots",element:p.jsx(Vs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:p.jsx(Vs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:p.jsx(xe,{children:p.jsx(QS,{})})},{path:"admin/maintenance",element:p.jsx(xe,{children:p.jsx(XS,{})})},{path:"admin/controlplane",element:p.jsx(xe,{children:p.jsx(IS,{})})},{path:"admin/streams",element:p.jsx(xe,{children:p.jsx(KS,{})})}]}]}]);function oE(){return p.jsx(yx,{client:ry,children:p.jsx(tv,{children:p.jsx(iw,{children:p.jsx(vx,{router:cE})})})})}Kx.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(oE,{})}));export{kE as A,ug as B,ah as C,dS as D,Fg as F,Dw as J,i_ as N,iy as O,ww as S,NE as a,Ie as b,hS as c,yE as d,xE as e,oS as f,_E as g,pE as h,Ai as i,SE as j,EE as k,AE as l,OE as m,jE as n,gE as o,lw as p,aw as q,vE as r,bE as s,wE as t,Cg as u,ny as v,sy as w,TE as x,ch as y,CE as z};
63
+ //# sourceMappingURL=index-CBS8FBcp.js.map