@hotmeshio/long-tail 0.4.4 → 0.4.5

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 (295) hide show
  1. package/build/api/agent-subscriptions.js +14 -0
  2. package/build/lib/events/index.js +3 -0
  3. package/build/lib/events/nats.js +2 -0
  4. package/build/services/agent/index.js +14 -0
  5. package/build/services/agent/trigger-registry.d.ts +2 -0
  6. package/build/services/agent/trigger-registry.js +37 -8
  7. package/build/start/workers.js +3 -0
  8. package/build/types/events.d.ts +1 -1
  9. package/dashboard/dist/assets/AdminDashboard-ntLz5Pro.js +2 -0
  10. package/dashboard/dist/assets/{AdminDashboard-DISq0Tz8.js.map → AdminDashboard-ntLz5Pro.js.map} +1 -1
  11. package/dashboard/dist/assets/AgentConfigPage-D27vWOI6.js +16 -0
  12. package/dashboard/dist/assets/{AgentConfigPage-DqaJpB3K.js.map → AgentConfigPage-D27vWOI6.js.map} +1 -1
  13. package/dashboard/dist/assets/AgentDetailPage-Cm2KFR4O.js +4 -0
  14. package/dashboard/dist/assets/{AgentDetailPage-BPzPk2GC.js.map → AgentDetailPage-Cm2KFR4O.js.map} +1 -1
  15. package/dashboard/dist/assets/AgentsPage-_ptA-0YO.js +2 -0
  16. package/dashboard/dist/assets/{AgentsPage-CLcxJWjC.js.map → AgentsPage-_ptA-0YO.js.map} +1 -1
  17. package/dashboard/dist/assets/AvailableEscalationsPage-bdPqEzbx.js +2 -0
  18. package/dashboard/dist/assets/{AvailableEscalationsPage-hOcjAAIj.js.map → AvailableEscalationsPage-bdPqEzbx.js.map} +1 -1
  19. package/dashboard/dist/assets/BotPicker-CYfFMpkY.js +2 -0
  20. package/dashboard/dist/assets/{BotPicker-DuAZgHbJ.js.map → BotPicker-CYfFMpkY.js.map} +1 -1
  21. package/dashboard/dist/assets/CapabilitiesPage-M7-ZTFNV.js +2 -0
  22. package/dashboard/dist/assets/{CapabilitiesPage-PRel6TXd.js.map → CapabilitiesPage-M7-ZTFNV.js.map} +1 -1
  23. package/dashboard/dist/assets/CollapsibleSection-DU5KAtQ-.js +2 -0
  24. package/dashboard/dist/assets/{CollapsibleSection-DnoUFQVf.js.map → CollapsibleSection-DU5KAtQ-.js.map} +1 -1
  25. package/dashboard/dist/assets/ConfirmDeleteModal-_hW5Vc05.js +2 -0
  26. package/dashboard/dist/assets/{ConfirmDeleteModal-dOxidrSR.js.map → ConfirmDeleteModal-_hW5Vc05.js.map} +1 -1
  27. package/dashboard/dist/assets/CopyableId-DiWqv41D.js +2 -0
  28. package/dashboard/dist/assets/{CopyableId-D0SQ39nR.js.map → CopyableId-DiWqv41D.js.map} +1 -1
  29. package/dashboard/dist/assets/CredentialsPage-CmbwypSF.js +2 -0
  30. package/dashboard/dist/assets/{CredentialsPage-CqedUU7b.js.map → CredentialsPage-CmbwypSF.js.map} +1 -1
  31. package/dashboard/dist/assets/CronLabel-nycfAefc.js +2 -0
  32. package/dashboard/dist/assets/{CronLabel-CPEjE-mH.js.map → CronLabel-nycfAefc.js.map} +1 -1
  33. package/dashboard/dist/assets/CustomDurationPicker-gNZRBaHg.js +2 -0
  34. package/dashboard/dist/assets/{CustomDurationPicker-BIQWzbv0.js.map → CustomDurationPicker-gNZRBaHg.js.map} +1 -1
  35. package/dashboard/dist/assets/DataTable-DGerT2ZM.js +2 -0
  36. package/dashboard/dist/assets/{DataTable-D9yuBv0w.js.map → DataTable-DGerT2ZM.js.map} +1 -1
  37. package/dashboard/dist/assets/DropZone-vNcqMd05.js +2 -0
  38. package/dashboard/dist/assets/{DropZone-e5EOL5gC.js.map → DropZone-vNcqMd05.js.map} +1 -1
  39. package/dashboard/dist/assets/ElapsedCell-CdvQbtve.js +2 -0
  40. package/dashboard/dist/assets/{ElapsedCell-CzVjr74Y.js.map → ElapsedCell-CdvQbtve.js.map} +1 -1
  41. package/dashboard/dist/assets/EmptyState-DMldv8c5.js +2 -0
  42. package/dashboard/dist/assets/{EmptyState-BcsfPq9T.js.map → EmptyState-DMldv8c5.js.map} +1 -1
  43. package/dashboard/dist/assets/EscalationsOverview-BNENCL_2.js +2 -0
  44. package/dashboard/dist/assets/{EscalationsOverview-Bcrb44xJ.js.map → EscalationsOverview-BNENCL_2.js.map} +1 -1
  45. package/dashboard/dist/assets/EventTable-BqDAyXyc.js +2 -0
  46. package/dashboard/dist/assets/{EventTable-CGfJU7e1.js.map → EventTable-BqDAyXyc.js.map} +1 -1
  47. package/dashboard/dist/assets/EventTopicPill-CnHFBglc.js +2 -0
  48. package/dashboard/dist/assets/{EventTopicPill-xJJnxvlP.js.map → EventTopicPill-CnHFBglc.js.map} +1 -1
  49. package/dashboard/dist/assets/FilterBar-TYiTtUgv.js +2 -0
  50. package/dashboard/dist/assets/{FilterBar-Ck4K4rzu.js.map → FilterBar-TYiTtUgv.js.map} +1 -1
  51. package/dashboard/dist/assets/HomePage-fterfLKH.js +2 -0
  52. package/dashboard/dist/assets/{HomePage-BIzUcGW9.js.map → HomePage-fterfLKH.js.map} +1 -1
  53. package/dashboard/dist/assets/ListToolbar-BO5Igi6v.js +2 -0
  54. package/dashboard/dist/assets/{ListToolbar-DNAGFe14.js.map → ListToolbar-BO5Igi6v.js.map} +1 -1
  55. package/dashboard/dist/assets/McpOverview-BQokGg0z.js +2 -0
  56. package/dashboard/dist/assets/{McpOverview-BpYk21es.js.map → McpOverview-BQokGg0z.js.map} +1 -1
  57. package/dashboard/dist/assets/McpQueryDetailPage-0WOp2n_j.js +5 -0
  58. package/dashboard/dist/assets/{McpQueryDetailPage-DlrZiSuL.js.map → McpQueryDetailPage-0WOp2n_j.js.map} +1 -1
  59. package/dashboard/dist/assets/McpQueryPage-DUey_h9J.js +2 -0
  60. package/dashboard/dist/assets/{McpQueryPage-COfPssO7.js.map → McpQueryPage-DUey_h9J.js.map} +1 -1
  61. package/dashboard/dist/assets/McpRunDetailPage-Cv4qyr91.js +2 -0
  62. package/dashboard/dist/assets/{McpRunDetailPage-Cra0nQSw.js.map → McpRunDetailPage-Cv4qyr91.js.map} +1 -1
  63. package/dashboard/dist/assets/McpRunsPage-B3R6KZ61.js +2 -0
  64. package/dashboard/dist/assets/{McpRunsPage-BlgcGN3k.js.map → McpRunsPage-B3R6KZ61.js.map} +1 -1
  65. package/dashboard/dist/assets/Modal-Qe8lW7gQ.js +2 -0
  66. package/dashboard/dist/assets/{Modal-DEODGeqx.js.map → Modal-Qe8lW7gQ.js.map} +1 -1
  67. package/dashboard/dist/assets/OperatorDashboard-dldvzjcg.js +2 -0
  68. package/dashboard/dist/assets/{OperatorDashboard-BbO6cWzb.js.map → OperatorDashboard-dldvzjcg.js.map} +1 -1
  69. package/dashboard/dist/assets/PageHeader-DF4BeEm4.js +2 -0
  70. package/dashboard/dist/assets/{PageHeader-B_gV_jKk.js.map → PageHeader-DF4BeEm4.js.map} +1 -1
  71. package/dashboard/dist/assets/PageHeaderWithStats-BQZw6BgA.js +2 -0
  72. package/dashboard/dist/assets/{PageHeaderWithStats-D0I0nrnx.js.map → PageHeaderWithStats-BQZw6BgA.js.map} +1 -1
  73. package/dashboard/dist/assets/PriorityBadge-DMyB3WLZ.js +2 -0
  74. package/dashboard/dist/assets/{PriorityBadge-DfQY9St9.js.map → PriorityBadge-DMyB3WLZ.js.map} +1 -1
  75. package/dashboard/dist/assets/ProcessDetailPage-Beo-QVL-.js +2 -0
  76. package/dashboard/dist/assets/{ProcessDetailPage-s_iV8ICg.js.map → ProcessDetailPage-Beo-QVL-.js.map} +1 -1
  77. package/dashboard/dist/assets/ProcessesListPage-C_ars8gp.js +2 -0
  78. package/dashboard/dist/assets/{ProcessesListPage-MnLMnxAa.js.map → ProcessesListPage-C_ars8gp.js.map} +1 -1
  79. package/dashboard/dist/assets/RolePill-DrBZ7JJj.js +2 -0
  80. package/dashboard/dist/assets/{RolePill-BOBytzrP.js.map → RolePill-DrBZ7JJj.js.map} +1 -1
  81. package/dashboard/dist/assets/RolesPage-DgSXFFGL.js +2 -0
  82. package/dashboard/dist/assets/{RolesPage-BH7KASM7.js.map → RolesPage-DgSXFFGL.js.map} +1 -1
  83. package/dashboard/dist/assets/RowActions-QcakGbVA.js +2 -0
  84. package/dashboard/dist/assets/{RowActions-Dg-Fsm5O.js.map → RowActions-QcakGbVA.js.map} +1 -1
  85. package/dashboard/dist/assets/RunAsSelector-CYMeZwrM.js +2 -0
  86. package/dashboard/dist/assets/{RunAsSelector-_QbJKhlo.js.map → RunAsSelector-CYMeZwrM.js.map} +1 -1
  87. package/dashboard/dist/assets/ServerName-D5NKD06M.js +2 -0
  88. package/dashboard/dist/assets/{ServerName-uqa4eBqm.js.map → ServerName-D5NKD06M.js.map} +1 -1
  89. package/dashboard/dist/assets/StatCard-PZQmmCHK.js +2 -0
  90. package/dashboard/dist/assets/{StatCard-DlgF0CJC.js.map → StatCard-PZQmmCHK.js.map} +1 -1
  91. package/dashboard/dist/assets/StatusBadge-ME2R6a7K.js +2 -0
  92. package/dashboard/dist/assets/{StatusBadge-XQlNFwmH.js.map → StatusBadge-ME2R6a7K.js.map} +1 -1
  93. package/dashboard/dist/assets/StepIndicator-CDDVahOz.js +2 -0
  94. package/dashboard/dist/assets/{StepIndicator-CuUIGxKk.js.map → StepIndicator-CDDVahOz.js.map} +1 -1
  95. package/dashboard/dist/assets/StickyPagination-Ddy93Q5I.js +2 -0
  96. package/dashboard/dist/assets/{StickyPagination-F9FZsRy9.js.map → StickyPagination-Ddy93Q5I.js.map} +1 -1
  97. package/dashboard/dist/assets/SwimlaneTimeline-CYYA8nd9.js +2 -0
  98. package/dashboard/dist/assets/{SwimlaneTimeline-og79Llvs.js.map → SwimlaneTimeline-CYYA8nd9.js.map} +1 -1
  99. package/dashboard/dist/assets/TagInput-B45Dm3IW.js +2 -0
  100. package/dashboard/dist/assets/{TagInput-D3f11sbM.js.map → TagInput-B45Dm3IW.js.map} +1 -1
  101. package/dashboard/dist/assets/TaskDetailPage-CoZFkJ6d.js +2 -0
  102. package/dashboard/dist/assets/TaskDetailPage-CoZFkJ6d.js.map +1 -0
  103. package/dashboard/dist/assets/TaskQueuePill-BJRUjVDv.js +2 -0
  104. package/dashboard/dist/assets/{TaskQueuePill-Bc45J7X1.js.map → TaskQueuePill-BJRUjVDv.js.map} +1 -1
  105. package/dashboard/dist/assets/TasksListPage-Czu08px3.js +2 -0
  106. package/dashboard/dist/assets/{TasksListPage-BYj3OqUi.js.map → TasksListPage-Czu08px3.js.map} +1 -1
  107. package/dashboard/dist/assets/TimeAgo-CJ56IUy6.js +2 -0
  108. package/dashboard/dist/assets/{TimeAgo-W7TdJpV-.js.map → TimeAgo-CJ56IUy6.js.map} +1 -1
  109. package/dashboard/dist/assets/TimestampCell-QtcYZ9Jx.js +2 -0
  110. package/dashboard/dist/assets/{TimestampCell-Bi2nc9Q_.js.map → TimestampCell-QtcYZ9Jx.js.map} +1 -1
  111. package/dashboard/dist/assets/ToolPill-DpDv3FwI.js +2 -0
  112. package/dashboard/dist/assets/{ToolPill-CuoXcmhv.js.map → ToolPill-DpDv3FwI.js.map} +1 -1
  113. package/dashboard/dist/assets/ToolTestPanel-BzFOwzd_.js +2 -0
  114. package/dashboard/dist/assets/{ToolTestPanel-Dl3C53zb.js.map → ToolTestPanel-BzFOwzd_.js.map} +1 -1
  115. package/dashboard/dist/assets/TopicDetailPage-DwShZbh9.js +9 -0
  116. package/dashboard/dist/assets/{TopicDetailPage-CjaZn4WP.js.map → TopicDetailPage-DwShZbh9.js.map} +1 -1
  117. package/dashboard/dist/assets/TopicsPage-DKXlpZl_.js +2 -0
  118. package/dashboard/dist/assets/{TopicsPage-BfsJEC1p.js.map → TopicsPage-DKXlpZl_.js.map} +1 -1
  119. package/dashboard/dist/assets/UserName-zlR1so37.js +2 -0
  120. package/dashboard/dist/assets/{UserName-b4baWHM_.js.map → UserName-zlR1so37.js.map} +1 -1
  121. package/dashboard/dist/assets/WorkflowExecutionPage-BMNIxeJB.js +2 -0
  122. package/dashboard/dist/assets/{WorkflowExecutionPage-BGmJnXnk.js.map → WorkflowExecutionPage-BMNIxeJB.js.map} +1 -1
  123. package/dashboard/dist/assets/WorkflowPill-B5B3yGlh.js +2 -0
  124. package/dashboard/dist/assets/{WorkflowPill-Bg2-0Hkg.js.map → WorkflowPill-B5B3yGlh.js.map} +1 -1
  125. package/dashboard/dist/assets/WorkflowsDashboard-BlAPZbQZ.js +2 -0
  126. package/dashboard/dist/assets/{WorkflowsDashboard-BzH7jMRu.js.map → WorkflowsDashboard-BlAPZbQZ.js.map} +1 -1
  127. package/dashboard/dist/assets/WorkflowsOverview-NnPi6rwS.js +2 -0
  128. package/dashboard/dist/assets/{WorkflowsOverview-BcUgBvjD.js.map → WorkflowsOverview-NnPi6rwS.js.map} +1 -1
  129. package/dashboard/dist/assets/YamlWorkflowsPage-C4mZum6x.js +2 -0
  130. package/dashboard/dist/assets/{YamlWorkflowsPage-OhpCQJ0l.js.map → YamlWorkflowsPage-C4mZum6x.js.map} +1 -1
  131. package/dashboard/dist/assets/{agents-Ce3HmPz4.js → agents-B5wvILeV.js} +2 -2
  132. package/dashboard/dist/assets/{agents-Ce3HmPz4.js.map → agents-B5wvILeV.js.map} +1 -1
  133. package/dashboard/dist/assets/{bots-B0BomNnf.js → bots-BPlouRDm.js} +2 -2
  134. package/dashboard/dist/assets/{bots-B0BomNnf.js.map → bots-BPlouRDm.js.map} +1 -1
  135. package/dashboard/dist/assets/capabilities-DkvRG09b.js +2 -0
  136. package/dashboard/dist/assets/{capabilities-t-w5N9K9.js.map → capabilities-DkvRG09b.js.map} +1 -1
  137. package/dashboard/dist/assets/{controlplane-BrtAZnJM.js → controlplane-0m_rA-UW.js} +2 -2
  138. package/dashboard/dist/assets/{controlplane-BrtAZnJM.js.map → controlplane-0m_rA-UW.js.map} +1 -1
  139. package/dashboard/dist/assets/escalation-CfIAIUg2.js +2 -0
  140. package/dashboard/dist/assets/{escalation-DilnDxw2.js.map → escalation-CfIAIUg2.js.map} +1 -1
  141. package/dashboard/dist/assets/escalation-columns-CLIdxlbe.js +2 -0
  142. package/dashboard/dist/assets/{escalation-columns-C0slywOY.js.map → escalation-columns-CLIdxlbe.js.map} +1 -1
  143. package/dashboard/dist/assets/helpers-prGqC38M.js +2 -0
  144. package/dashboard/dist/assets/{helpers-BMvPqQr8.js.map → helpers-prGqC38M.js.map} +1 -1
  145. package/dashboard/dist/assets/index-4T7Z_gQ4.js +281 -0
  146. package/dashboard/dist/assets/index-4T7Z_gQ4.js.map +1 -0
  147. package/dashboard/dist/assets/index-BR3SwTNI.js +2 -0
  148. package/dashboard/dist/assets/{index-pIMl0mYp.js.map → index-BR3SwTNI.js.map} +1 -1
  149. package/dashboard/dist/assets/index-BWKIigEk.js +2 -0
  150. package/dashboard/dist/assets/{index-qNuxC8kX.js.map → index-BWKIigEk.js.map} +1 -1
  151. package/dashboard/dist/assets/index-BgVuyWhi.js +15 -0
  152. package/dashboard/dist/assets/{index-D_wqdvG_.js.map → index-BgVuyWhi.js.map} +1 -1
  153. package/dashboard/dist/assets/index-C0sDEKdo.js +2 -0
  154. package/dashboard/dist/assets/{index-30-pN97P.js.map → index-C0sDEKdo.js.map} +1 -1
  155. package/dashboard/dist/assets/index-C2MJzu6J.js +2 -0
  156. package/dashboard/dist/assets/{index-f-0Duls3.js.map → index-C2MJzu6J.js.map} +1 -1
  157. package/dashboard/dist/assets/index-CFoddJDr.js +6 -0
  158. package/dashboard/dist/assets/{index-Ck2QdJXT.js.map → index-CFoddJDr.js.map} +1 -1
  159. package/dashboard/dist/assets/index-CrMxD5Ib.js +6 -0
  160. package/dashboard/dist/assets/{index-DPW_i3fH.js.map → index-CrMxD5Ib.js.map} +1 -1
  161. package/dashboard/dist/assets/index-CuY5hPYB.js +2 -0
  162. package/dashboard/dist/assets/{index-DnsVYMMg.js.map → index-CuY5hPYB.js.map} +1 -1
  163. package/dashboard/dist/assets/index-CwkJBn87.js +2 -0
  164. package/dashboard/dist/assets/{index-Bl9wzQ8Q.js.map → index-CwkJBn87.js.map} +1 -1
  165. package/dashboard/dist/assets/index-DeL84Cag.js +2 -0
  166. package/dashboard/dist/assets/{index-DNmlrCAp.js.map → index-DeL84Cag.js.map} +1 -1
  167. package/dashboard/dist/assets/index-DqeLbz6j.js +2 -0
  168. package/dashboard/dist/assets/{index-BxOuF0hm.js.map → index-DqeLbz6j.js.map} +1 -1
  169. package/dashboard/dist/assets/index-P9huxx3-.js +2 -0
  170. package/dashboard/dist/assets/{index-H5TlloTk.js.map → index-P9huxx3-.js.map} +1 -1
  171. package/dashboard/dist/assets/{knowledge-D01NdF5h.js → knowledge-CUZxyRCO.js} +2 -2
  172. package/dashboard/dist/assets/{knowledge-D01NdF5h.js.map → knowledge-CUZxyRCO.js.map} +1 -1
  173. package/dashboard/dist/assets/{mcp-CjXjDZI0.js → mcp-B5VQPoF3.js} +2 -2
  174. package/dashboard/dist/assets/{mcp-CjXjDZI0.js.map → mcp-B5VQPoF3.js.map} +1 -1
  175. package/dashboard/dist/assets/{mcp-query-LlKQcWLJ.js → mcp-query-Ba5Zj3yg.js} +2 -2
  176. package/dashboard/dist/assets/{mcp-query-LlKQcWLJ.js.map → mcp-query-Ba5Zj3yg.js.map} +1 -1
  177. package/dashboard/dist/assets/{mcp-runs-C0C54hU6.js → mcp-runs-CAiEr5Fc.js} +2 -2
  178. package/dashboard/dist/assets/{mcp-runs-C0C54hU6.js.map → mcp-runs-CAiEr5Fc.js.map} +1 -1
  179. package/dashboard/dist/assets/namespaces-sVr5scma.js +2 -0
  180. package/dashboard/dist/assets/{namespaces-6qWDXXJV.js.map → namespaces-sVr5scma.js.map} +1 -1
  181. package/dashboard/dist/assets/{roles-Dtj0uabn.js → roles-E_bA4e0f.js} +2 -2
  182. package/dashboard/dist/assets/{roles-Dtj0uabn.js.map → roles-E_bA4e0f.js.map} +1 -1
  183. package/dashboard/dist/assets/{tasks-BevFBjZq.js → tasks-CL6Gv8jB.js} +2 -2
  184. package/dashboard/dist/assets/{tasks-BevFBjZq.js.map → tasks-CL6Gv8jB.js.map} +1 -1
  185. package/dashboard/dist/assets/{topics-BMG5tx2g.js → topics-DbtPHERP.js} +2 -2
  186. package/dashboard/dist/assets/{topics-BMG5tx2g.js.map → topics-DbtPHERP.js.map} +1 -1
  187. package/dashboard/dist/assets/{useCollapsedSections-BU5HULGs.js → useCollapsedSections-CGNA5oKV.js} +2 -2
  188. package/dashboard/dist/assets/{useCollapsedSections-BU5HULGs.js.map → useCollapsedSections-CGNA5oKV.js.map} +1 -1
  189. package/dashboard/dist/assets/{useEventHooks-CPyvFlVR.js → useEventHooks-C6c618cj.js} +2 -2
  190. package/dashboard/dist/assets/{useEventHooks-CPyvFlVR.js.map → useEventHooks-C6c618cj.js.map} +1 -1
  191. package/dashboard/dist/assets/{useExpandedRows-CkcEntB-.js → useExpandedRows-Cg9iq6Vy.js} +2 -2
  192. package/dashboard/dist/assets/{useExpandedRows-CkcEntB-.js.map → useExpandedRows-Cg9iq6Vy.js.map} +1 -1
  193. package/dashboard/dist/assets/{useFilterParams-DZCAaBC7.js → useFilterParams-CGRYFw_A.js} +2 -2
  194. package/dashboard/dist/assets/{useFilterParams-DZCAaBC7.js.map → useFilterParams-CGRYFw_A.js.map} +1 -1
  195. package/dashboard/dist/assets/{useYamlActivityEvents-Bll8NPNQ.js → useYamlActivityEvents-eK7kIUdh.js} +2 -2
  196. package/dashboard/dist/assets/{useYamlActivityEvents-Bll8NPNQ.js.map → useYamlActivityEvents-eK7kIUdh.js.map} +1 -1
  197. package/dashboard/dist/assets/{users-XZ349b0r.js → users-CCHSIAxt.js} +2 -2
  198. package/dashboard/dist/assets/{users-XZ349b0r.js.map → users-CCHSIAxt.js.map} +1 -1
  199. package/dashboard/dist/assets/{vendor-icons-B_Yla7iD.js → vendor-icons-D8-ZINAH.js} +2 -2
  200. package/dashboard/dist/assets/{vendor-icons-B_Yla7iD.js.map → vendor-icons-D8-ZINAH.js.map} +1 -1
  201. package/dashboard/dist/assets/vendor-query-DLp59M9_.js +35 -0
  202. package/dashboard/dist/assets/vendor-query-DLp59M9_.js.map +1 -0
  203. package/dashboard/dist/assets/vendor-react-Co3Y8ikm.js +26 -0
  204. package/dashboard/dist/assets/vendor-react-Co3Y8ikm.js.map +1 -0
  205. package/dashboard/dist/assets/{workflows-Do-Eiv8f.js → workflows-BNbocg_9.js} +2 -2
  206. package/dashboard/dist/assets/{workflows-Do-Eiv8f.js.map → workflows-BNbocg_9.js.map} +1 -1
  207. package/dashboard/dist/assets/{yaml-workflows-DolGRQ5f.js → yaml-workflows-Cu1FUwrc.js} +2 -2
  208. package/dashboard/dist/assets/{yaml-workflows-DolGRQ5f.js.map → yaml-workflows-Cu1FUwrc.js.map} +1 -1
  209. package/dashboard/dist/index.html +4 -4
  210. package/package.json +1 -1
  211. package/dashboard/dist/assets/AdminDashboard-DISq0Tz8.js +0 -2
  212. package/dashboard/dist/assets/AgentConfigPage-DqaJpB3K.js +0 -16
  213. package/dashboard/dist/assets/AgentDetailPage-BPzPk2GC.js +0 -4
  214. package/dashboard/dist/assets/AgentsPage-CLcxJWjC.js +0 -2
  215. package/dashboard/dist/assets/AvailableEscalationsPage-hOcjAAIj.js +0 -2
  216. package/dashboard/dist/assets/BotPicker-DuAZgHbJ.js +0 -2
  217. package/dashboard/dist/assets/CapabilitiesPage-PRel6TXd.js +0 -2
  218. package/dashboard/dist/assets/CollapsibleSection-DnoUFQVf.js +0 -2
  219. package/dashboard/dist/assets/ConfirmDeleteModal-dOxidrSR.js +0 -2
  220. package/dashboard/dist/assets/CopyableId-D0SQ39nR.js +0 -2
  221. package/dashboard/dist/assets/CredentialsPage-CqedUU7b.js +0 -2
  222. package/dashboard/dist/assets/CronLabel-CPEjE-mH.js +0 -2
  223. package/dashboard/dist/assets/CustomDurationPicker-BIQWzbv0.js +0 -2
  224. package/dashboard/dist/assets/DataTable-D9yuBv0w.js +0 -2
  225. package/dashboard/dist/assets/DropZone-e5EOL5gC.js +0 -2
  226. package/dashboard/dist/assets/ElapsedCell-CzVjr74Y.js +0 -2
  227. package/dashboard/dist/assets/EmptyState-BcsfPq9T.js +0 -2
  228. package/dashboard/dist/assets/EscalationsOverview-Bcrb44xJ.js +0 -2
  229. package/dashboard/dist/assets/EventTable-CGfJU7e1.js +0 -2
  230. package/dashboard/dist/assets/EventTopicPill-xJJnxvlP.js +0 -2
  231. package/dashboard/dist/assets/FilterBar-Ck4K4rzu.js +0 -2
  232. package/dashboard/dist/assets/HomePage-BIzUcGW9.js +0 -2
  233. package/dashboard/dist/assets/ListToolbar-DNAGFe14.js +0 -2
  234. package/dashboard/dist/assets/McpOverview-BpYk21es.js +0 -2
  235. package/dashboard/dist/assets/McpQueryDetailPage-DlrZiSuL.js +0 -5
  236. package/dashboard/dist/assets/McpQueryPage-COfPssO7.js +0 -2
  237. package/dashboard/dist/assets/McpRunDetailPage-Cra0nQSw.js +0 -2
  238. package/dashboard/dist/assets/McpRunsPage-BlgcGN3k.js +0 -2
  239. package/dashboard/dist/assets/Modal-DEODGeqx.js +0 -2
  240. package/dashboard/dist/assets/OperatorDashboard-BbO6cWzb.js +0 -2
  241. package/dashboard/dist/assets/PageHeader-B_gV_jKk.js +0 -2
  242. package/dashboard/dist/assets/PageHeaderWithStats-D0I0nrnx.js +0 -2
  243. package/dashboard/dist/assets/PriorityBadge-DfQY9St9.js +0 -2
  244. package/dashboard/dist/assets/ProcessDetailPage-s_iV8ICg.js +0 -2
  245. package/dashboard/dist/assets/ProcessesListPage-MnLMnxAa.js +0 -2
  246. package/dashboard/dist/assets/RolePill-BOBytzrP.js +0 -2
  247. package/dashboard/dist/assets/RolesPage-BH7KASM7.js +0 -2
  248. package/dashboard/dist/assets/RowActions-Dg-Fsm5O.js +0 -2
  249. package/dashboard/dist/assets/RunAsSelector-_QbJKhlo.js +0 -2
  250. package/dashboard/dist/assets/ServerName-uqa4eBqm.js +0 -2
  251. package/dashboard/dist/assets/StatCard-DlgF0CJC.js +0 -2
  252. package/dashboard/dist/assets/StatusBadge-XQlNFwmH.js +0 -2
  253. package/dashboard/dist/assets/StepIndicator-CuUIGxKk.js +0 -2
  254. package/dashboard/dist/assets/StickyPagination-F9FZsRy9.js +0 -2
  255. package/dashboard/dist/assets/SwimlaneTimeline-og79Llvs.js +0 -2
  256. package/dashboard/dist/assets/TagInput-D3f11sbM.js +0 -2
  257. package/dashboard/dist/assets/TaskDetailPage-DPV4ySd9.js +0 -2
  258. package/dashboard/dist/assets/TaskDetailPage-DPV4ySd9.js.map +0 -1
  259. package/dashboard/dist/assets/TaskQueuePill-Bc45J7X1.js +0 -2
  260. package/dashboard/dist/assets/TasksListPage-BYj3OqUi.js +0 -2
  261. package/dashboard/dist/assets/TimeAgo-W7TdJpV-.js +0 -2
  262. package/dashboard/dist/assets/TimestampCell-Bi2nc9Q_.js +0 -2
  263. package/dashboard/dist/assets/ToolPill-CuoXcmhv.js +0 -2
  264. package/dashboard/dist/assets/ToolTestPanel-Dl3C53zb.js +0 -2
  265. package/dashboard/dist/assets/TopicDetailPage-CjaZn4WP.js +0 -9
  266. package/dashboard/dist/assets/TopicsPage-BfsJEC1p.js +0 -2
  267. package/dashboard/dist/assets/UserName-b4baWHM_.js +0 -2
  268. package/dashboard/dist/assets/WorkflowExecutionPage-BGmJnXnk.js +0 -2
  269. package/dashboard/dist/assets/WorkflowPill-Bg2-0Hkg.js +0 -2
  270. package/dashboard/dist/assets/WorkflowsDashboard-BzH7jMRu.js +0 -2
  271. package/dashboard/dist/assets/WorkflowsOverview-BcUgBvjD.js +0 -2
  272. package/dashboard/dist/assets/YamlWorkflowsPage-OhpCQJ0l.js +0 -2
  273. package/dashboard/dist/assets/capabilities-t-w5N9K9.js +0 -2
  274. package/dashboard/dist/assets/escalation-DilnDxw2.js +0 -2
  275. package/dashboard/dist/assets/escalation-columns-C0slywOY.js +0 -2
  276. package/dashboard/dist/assets/helpers-BMvPqQr8.js +0 -2
  277. package/dashboard/dist/assets/index-30-pN97P.js +0 -2
  278. package/dashboard/dist/assets/index-Bl9wzQ8Q.js +0 -2
  279. package/dashboard/dist/assets/index-BxOuF0hm.js +0 -2
  280. package/dashboard/dist/assets/index-Ck2QdJXT.js +0 -6
  281. package/dashboard/dist/assets/index-DNmlrCAp.js +0 -2
  282. package/dashboard/dist/assets/index-DPW_i3fH.js +0 -6
  283. package/dashboard/dist/assets/index-DZX-E_3q.js +0 -63
  284. package/dashboard/dist/assets/index-DZX-E_3q.js.map +0 -1
  285. package/dashboard/dist/assets/index-D_wqdvG_.js +0 -15
  286. package/dashboard/dist/assets/index-DnsVYMMg.js +0 -2
  287. package/dashboard/dist/assets/index-H5TlloTk.js +0 -2
  288. package/dashboard/dist/assets/index-f-0Duls3.js +0 -2
  289. package/dashboard/dist/assets/index-pIMl0mYp.js +0 -2
  290. package/dashboard/dist/assets/index-qNuxC8kX.js +0 -2
  291. package/dashboard/dist/assets/namespaces-6qWDXXJV.js +0 -2
  292. package/dashboard/dist/assets/vendor-query-B2UbickB.js +0 -18
  293. package/dashboard/dist/assets/vendor-query-B2UbickB.js.map +0 -1
  294. package/dashboard/dist/assets/vendor-react-CX88sFS5.js +0 -22
  295. package/dashboard/dist/assets/vendor-react-CX88sFS5.js.map +0 -1
@@ -1,63 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProcessesListPage-MnLMnxAa.js","assets/vendor-query-B2UbickB.js","assets/tasks-BevFBjZq.js","assets/workflows-Do-Eiv8f.js","assets/useEventHooks-CPyvFlVR.js","assets/useFilterParams-DZCAaBC7.js","assets/vendor-react-CX88sFS5.js","assets/DataTable-D9yuBv0w.js","assets/EmptyState-BcsfPq9T.js","assets/TimestampCell-Bi2nc9Q_.js","assets/StickyPagination-F9FZsRy9.js","assets/FilterBar-Ck4K4rzu.js","assets/PageHeader-B_gV_jKk.js","assets/vendor-icons-B_Yla7iD.js","assets/ListToolbar-DNAGFe14.js","assets/WorkflowPill-Bg2-0Hkg.js","assets/ProcessDetailPage-s_iV8ICg.js","assets/PageHeaderWithStats-D0I0nrnx.js","assets/StatusBadge-XQlNFwmH.js","assets/RolePill-BOBytzrP.js","assets/UserName-b4baWHM_.js","assets/users-XZ349b0r.js","assets/McpOverview-BpYk21es.js","assets/mcp-CjXjDZI0.js","assets/mcp-runs-C0C54hU6.js","assets/yaml-workflows-DolGRQ5f.js","assets/namespaces-6qWDXXJV.js","assets/StatCard-DlgF0CJC.js","assets/McpRunsPage-BlgcGN3k.js","assets/ElapsedCell-CzVjr74Y.js","assets/RowActions-Dg-Fsm5O.js","assets/McpRunDetailPage-Cra0nQSw.js","assets/CopyableId-D0SQ39nR.js","assets/CollapsibleSection-DnoUFQVf.js","assets/useCollapsedSections-BU5HULGs.js","assets/SwimlaneTimeline-og79Llvs.js","assets/EventTable-CGfJU7e1.js","assets/McpQueryPage-COfPssO7.js","assets/mcp-query-LlKQcWLJ.js","assets/McpQueryDetailPage-DlrZiSuL.js","assets/useYamlActivityEvents-Bll8NPNQ.js","assets/TagInput-D3f11sbM.js","assets/ToolPill-CuoXcmhv.js","assets/RunAsSelector-_QbJKhlo.js","assets/BotPicker-DuAZgHbJ.js","assets/bots-B0BomNnf.js","assets/TimeAgo-W7TdJpV-.js","assets/EscalationsOverview-Bcrb44xJ.js","assets/AvailableEscalationsPage-hOcjAAIj.js","assets/roles-Dtj0uabn.js","assets/constants-BHkpVaqx.js","assets/CustomDurationPicker-BIQWzbv0.js","assets/Modal-DEODGeqx.js","assets/escalation-columns-C0slywOY.js","assets/PriorityBadge-DfQY9St9.js","assets/escalation-DilnDxw2.js","assets/OperatorDashboard-BbO6cWzb.js","assets/index-DPW_i3fH.js","assets/WorkflowsOverview-BcUgBvjD.js","assets/index-Ck2QdJXT.js","assets/helpers-BMvPqQr8.js","assets/WorkflowsDashboard-BzH7jMRu.js","assets/YamlWorkflowsPage-OhpCQJ0l.js","assets/useExpandedRows-CkcEntB-.js","assets/ServerName-uqa4eBqm.js","assets/TasksListPage-BYj3OqUi.js","assets/TaskDetailPage-DPV4ySd9.js","assets/WorkflowExecutionPage-BGmJnXnk.js","assets/AdminDashboard-DISq0Tz8.js","assets/index-DNmlrCAp.js","assets/TaskQueuePill-Bc45J7X1.js","assets/index-D_wqdvG_.js","assets/ConfirmDeleteModal-dOxidrSR.js","assets/StepIndicator-CuUIGxKk.js","assets/index-f-0Duls3.js","assets/ToolTestPanel-Dl3C53zb.js","assets/index-BxOuF0hm.js","assets/index-H5TlloTk.js","assets/RolesPage-BH7KASM7.js","assets/index-qNuxC8kX.js","assets/index-pIMl0mYp.js","assets/controlplane-BrtAZnJM.js","assets/index-Bl9wzQ8Q.js","assets/CredentialsPage-CqedUU7b.js","assets/index-DnsVYMMg.js","assets/DropZone-e5EOL5gC.js","assets/index-30-pN97P.js","assets/knowledge-D01NdF5h.js","assets/HomePage-BIzUcGW9.js","assets/EventTopicPill-xJJnxvlP.js","assets/AgentsPage-CLcxJWjC.js","assets/agents-Ce3HmPz4.js","assets/AgentDetailPage-BPzPk2GC.js","assets/CronLabel-CPEjE-mH.js","assets/AgentConfigPage-DqaJpB3K.js","assets/capabilities-t-w5N9K9.js","assets/topics-BMG5tx2g.js","assets/CapabilitiesPage-PRel6TXd.js","assets/TopicsPage-BfsJEC1p.js","assets/TopicDetailPage-CjaZn4WP.js"])))=>i.map(i=>d[i]);
2
- var px=Object.defineProperty;var gx=(r,n,s)=>n in r?px(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>gx(r,typeof n!="symbol"?n+"":n,s);import{r as yx,a as N,j as p,u as Ln,b as Nn,c as Hn,Q as bx,d as xx}from"./vendor-query-B2UbickB.js";import{r as vx,L as pr,u as Ei,N as Oc,a as sg,b as Vs,O as xc,c as ig,d as _x,R as wx}from"./vendor-react-CX88sFS5.js";import{C as Sx,I as Ex,R as rg,B as ag,U as Ax,A as Ox,Z as jx,a as Tx,S as sf,P as Nx,L as rf,W as Cx,b as lg,c as Ca,F as kx,d as Mx,e as Rx,T as Dx,f as zx,N as qx,g as Ux,D as Bx,M as cg,h as og,i as Lx,j as Hx,E as Px,k as Yx,l as $x,m as Zp,X as Qf,G as Gx,n as Vx,o as Fx,p as Jx,q as Qx}from"./vendor-icons-B_Yla7iD.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 af={exports:{}},_a={},lf={exports:{}},cf={};/**
3
- * @license React
4
- * scheduler.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var Wp;function Ix(){return Wp||(Wp=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,S=null,j=3,z=!1,k=!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 M(Y){if(H=!1,be(Y),!k)if(s(g)!==null)k=!0,X||(X=!0,re());else{var te=s(y);te!==null&&Le(M,te.startTime-Y)}}var X=!1,ie=-1,Z=5,Q=-1;function K(){return ee?!0:!(r.unstable_now()-Q<Z)}function ae(){if(ee=!1,X){var Y=r.unstable_now();Q=Y;var te=!0;try{e:{k=!1,H&&(H=!1,W(ie),ie=-1),z=!0;var he=j;try{t:{for(be(Y),S=s(g);S!==null&&!(S.expirationTime>Y&&K());){var ve=S.callback;if(typeof ve=="function"){S.callback=null,j=S.priorityLevel;var ye=ve(S.expirationTime<=Y);if(Y=r.unstable_now(),typeof ye=="function"){S.callback=ye,be(Y),te=!0;break t}S===s(g)&&a(g),be(Y)}else a(g);S=s(g)}if(S!==null)te=!0;else{var je=s(y);je!==null&&Le(M,je.startTime-Y),te=!1}}break e}finally{S=null,j=he,z=!1}te=void 0}}finally{te?re():X=!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(M,he-ve))):(Y.sortIndex=ye,n(g,Y),k||z||(k=!0,X||(X=!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}}}})(cf)),cf}var e0;function Xx(){return e0||(e0=1,lf.exports=Ix()),lf.exports}/**
11
- * @license React
12
- * react-dom-client.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var t0;function Kx(){if(t0)return _a;t0=1;var r=Xx(),n=yx(),s=vx();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 S=Object.assign,j=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),k=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"),M=Symbol.for("react.suspense"),X=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 M:return"Suspense";case X:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k: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)?_p(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=_p(t),e=wp(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=wp(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
- at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
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
- `),U=b.split(`
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
- `+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 Ga(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 Va(e){try{var t="",i=null;do t+=Ga(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
24
- Error generating stack: `+l.message+`
25
- `+l.stack}}var jr=Object.prototype.hasOwnProperty,Tr=r.unstable_scheduleCallback,Pn=r.unstable_cancelCallback,Fa=r.unstable_shouldYield,Ni=r.unstable_requestPaint,et=r.unstable_now,Fc=r.unstable_getCurrentPriorityLevel,Ja=r.unstable_ImmediatePriority,Qa=r.unstable_UserBlockingPriority,Ci=r.unstable_NormalPriority,Jc=r.unstable_LowPriority,Ia=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,Yn=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:$n(i),(i&(e.suspendedLanes|t))!==0?0:i}function $n(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:Vp(e.type))}function Ka(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,Za="__reactHandles$"+Cn,Wa="__reactResources$"+Cn,yt="__reactMarker$"+Cn;function Ri(e){delete e[Qe],delete e[it],delete e[ri],delete e[Rr],delete e[Za]}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=Np(e);e!==null;){if(i=e[Qe])return i;e=Np(e)}return t}e=i,i=e.parentNode}return null}function w(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[Wa];return t||(t=e[Wa]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function T(e){e[yt]=!0}var D=new Set,F={};function I(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 Gn(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 dh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cy(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 Ic(e){if(!e._valueTracker){var t=dh(e)?"checked":"value";e._valueTracker=cy(e,t,""+e[t])}}function mh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=dh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function el(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 oy=/[\n"\\]/g;function ln(e){return e.replace(oy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xc(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 ph(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)){Ic(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),Ic(e)}function Kc(e,t,i){t==="number"&&el(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 gh(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 yh(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),Ic(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 uy=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 bh(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||uy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function xh(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&&bh(e,o,l)}else for(var u in t)t.hasOwnProperty(u)&&bh(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 fy=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"]]),hy=/^[\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 tl(e){return hy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Vn(){}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 vh(e){var t=w(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Xc(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));Xc(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&&mh(l)}break e;case"textarea":gh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&Di(e,!!i.multiple,t,!1)}}}var to=!1;function _h(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)&&(Yl(),qi&&(t=qi,e=Ui,Ui=qi=null,vh(t),e)))for(t=0;t<e.length;t++)vh(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 Fn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),no=!1;if(Fn)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,nl=null;function wh(){if(nl)return nl;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 nl=o.slice(e,1<l?1-l:void 0)}function sl(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 il(){return!0}function Sh(){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)?il:Sh,this.isPropagationStopped=Sh,this}return S(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=il)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=il)},persist:function(){},isPersistent:il}),t}var ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rl=zt(ai),qr=S({},ai,{view:0,detail:0}),dy=zt(qr),io,ro,Ur,al=S({},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}}),Eh=zt(al),my=S({},al,{dataTransfer:0}),py=zt(my),gy=S({},qr,{relatedTarget:0}),ao=zt(gy),yy=S({},ai,{animationName:0,elapsedTime:0,pseudoElement:0}),by=zt(yy),xy=S({},ai,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vy=zt(xy),_y=S({},ai,{data:0}),Ah=zt(_y),wy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sy={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"},Ey={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ay(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ey[e])?!!t[e]:!1}function lo(){return Ay}var Oy=S({},qr,{key:function(e){if(e.key){var t=wy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=sl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Sy[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"?sl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?sl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),jy=zt(Oy),Ty=S({},al,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oh=zt(Ty),Ny=S({},qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lo}),Cy=zt(Ny),ky=S({},ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),My=zt(ky),Ry=S({},al,{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}),Dy=zt(Ry),zy=S({},ai,{newState:0,oldState:0}),qy=zt(zy),Uy=[9,13,27,32],co=Fn&&"CompositionEvent"in window,Br=null;Fn&&"documentMode"in document&&(Br=document.documentMode);var By=Fn&&"TextEvent"in window&&!Br,jh=Fn&&(!co||Br&&8<Br&&11>=Br),Th=" ",Nh=!1;function Ch(e,t){switch(e){case"keyup":return Uy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bi=!1;function Ly(e,t){switch(e){case"compositionend":return kh(t);case"keypress":return t.which!==32?null:(Nh=!0,Th);case"textInput":return e=t.data,e===Th&&Nh?null:e;default:return null}}function Hy(e,t){if(Bi)return e==="compositionend"||!co&&Ch(e,t)?(e=wh(),nl=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 jh&&t.locale!=="ko"?null:t.data;default:return null}}var Py={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 Mh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Py[e.type]:t==="textarea"}function Rh(e,t,i,l){qi?Ui?Ui.push(l):Ui=[l]:qi=l,t=Il(t,"onChange"),0<t.length&&(i=new rl("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Lr=null,Hr=null;function Yy(e){pp(e,0)}function ll(e){var t=_(e);if(mh(t))return e}function Dh(e,t){if(e==="change")return t}var zh=!1;if(Fn){var oo;if(Fn){var uo="oninput"in document;if(!uo){var qh=document.createElement("div");qh.setAttribute("oninput","return;"),uo=typeof qh.oninput=="function"}oo=uo}else oo=!1;zh=oo&&(!document.documentMode||9<document.documentMode)}function Uh(){Lr&&(Lr.detachEvent("onpropertychange",Bh),Hr=Lr=null)}function Bh(e){if(e.propertyName==="value"&&ll(Hr)){var t=[];Rh(t,Hr,e,eo(e)),_h(Yy,t)}}function $y(e,t,i){e==="focusin"?(Uh(),Lr=t,Hr=i,Lr.attachEvent("onpropertychange",Bh)):e==="focusout"&&Uh()}function Gy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ll(Hr)}function Vy(e,t){if(e==="click")return ll(t)}function Fy(e,t){if(e==="input"||e==="change")return ll(t)}function Jy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Jy;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 Lh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hh(e,t){var i=Lh(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=Lh(i)}}function Ph(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ph(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Yh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=el(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=el(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 Qy=Fn&&"documentMode"in document&&11>=document.documentMode,Li=null,ho=null,Yr=null,mo=!1;function $h(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;mo||Li==null||Li!==el(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=Il(ho,"onSelect"),0<l.length&&(t=new rl("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={},Gh={};Fn&&(Gh=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 Gh)return po[e]=t[i];return e}var Vh=ci("animationend"),Fh=ci("animationiteration"),Jh=ci("animationstart"),Iy=ci("transitionrun"),Xy=ci("transitionstart"),Ky=ci("transitioncancel"),Qh=ci("transitionend"),Ih=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){Ih.set(e,t),I(t,[e])}var cl=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 ol(){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&&Xh(i,o,u)}}function ul(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 ul(e,t,i,l),fl(e)}function oi(e,t){return ul(e,null,null,t),fl(e)}function Xh(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 fl(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 Zy(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 Zy(e,t,i,l)}function xo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jn(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 Kh(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 hl(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=sx(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 M:return e=Vt(13,i,t,o),e.elementType=M,e.lanes=u,e;case X:return e=Vt(19,i,t,o),e.elementType=X,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 Zh(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 Wh=new WeakMap;function on(e,t){if(typeof e=="object"&&e!==null){var i=Wh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Va(t)},Wh.set(e,t),t)}return{value:e,source:t,stack:Va(t)}}var $i=[],Gi=0,dl=null,$r=0,un=[],fn=0,vs=null,kn=1,Mn="";function Qn(e,t){$i[Gi++]=$r,$i[Gi++]=dl,dl=e,$r=t}function ed(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&&(Qn(e,1),ed(e,1,0))}function So(e){for(;e===dl;)dl=$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 td(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 nd(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),ph(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),yh(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||xp(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=Vn),t=!0):t=!1,t||ws(e,!0)}function sd(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 sd(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),sd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Tp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Tp(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,In=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 ml(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,In=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return id(hi,e)}function pl(e,t){return hi===null&&di(e),id(e,t)}function id(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},In===null){if(e===null)throw Error(a(308));In=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else In=In.next=t;return i}var Wy=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()})}},eb=r.unstable_scheduleCallback,tb=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function No(){return{controller:new Wy,data:new Map,refCount:0}}function Vr(e){e.refCount--,e.refCount===0&&eb(tb,function(){e.controller.abort()})}var Fr=null,Co=0,Ji=0,Qi=null;function nb(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(rd,rd),t}function rd(){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 sb(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 ad=Y.S;Y.S=function(e,t){$m=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&nb(e,t),ad!==null&&ad(e,t)};var mi=je(null);function ko(){var e=mi.current;return e!==null?e:Ie.pooledCache}function gl(e,t){t===null?Te(mi,mi.current):Te(mi,t.pool)}function ld(){var e=ko();return e===null?null:{parent:ht._currentValue,pool:e}}var Ii=Error(a(460)),Mo=Error(a(474)),yl=Error(a(542)),bl={then:function(){}};function cd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function od(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Vn,Vn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fd(e),e;default:if(typeof t.status=="string")t.then(Vn,Vn);else{if(e=Ie,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,fd(e),e}throw gi=t,Ii}}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,Ii):i}}var gi=null;function ud(){if(gi===null)throw Error(a(459));var e=gi;return gi=null,e}function fd(e){if(e===Ii||e===yl)throw Error(a(483))}var Xi=null,Jr=0;function xl(e){var t=Jr;return Jr+=1,Xi===null&&(Xi=[]),od(Xi,e,t)}function Qr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function vl(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 hd(e){function t(R,C){if(e){var q=R.deletions;q===null?(R.deletions=[C],R.flags|=16):q.push(C)}}function i(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function l(R){for(var C=new Map;R!==null;)R.key!==null?C.set(R.key,R):C.set(R.index,R),R=R.sibling;return C}function o(R,C){return R=Jn(R,C),R.index=0,R.sibling=null,R}function u(R,C,q){return R.index=q,e?(q=R.alternate,q!==null?(q=q.index,q<C?(R.flags|=67108866,C):q):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function m(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,C,q,G){return C===null||C.tag!==6?(C=vo(q,R.mode,G),C.return=R,C):(C=o(C,q),C.return=R,C)}function O(R,C,q,G){var pe=q.type;return pe===H?$(R,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=R,C):(C=hl(q.type,q.key,q.props,null,R.mode,G),Qr(C,q),C.return=R,C)}function U(R,C,q,G){return C===null||C.tag!==4||C.stateNode.containerInfo!==q.containerInfo||C.stateNode.implementation!==q.implementation?(C=_o(q,R.mode,G),C.return=R,C):(C=o(C,q.children||[]),C.return=R,C)}function $(R,C,q,G,pe){return C===null||C.tag!==7?(C=ui(q,R.mode,G,pe),C.return=R,C):(C=o(C,q),C.return=R,C)}function J(R,C,q){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=vo(""+C,R.mode,q),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case z:return q=hl(C.type,C.key,C.props,null,R.mode,q),Qr(q,C),q.return=R,q;case k:return C=_o(C,R.mode,q),C.return=R,C;case Z:return C=pi(C),J(R,C,q)}if(Le(C)||re(C))return C=ui(C,R.mode,q,null),C.return=R,C;if(typeof C.then=="function")return J(R,xl(C),q);if(C.$$typeof===me)return J(R,pl(R,C),q);vl(R,C)}return null}function B(R,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(R,C,""+q,G);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case z:return q.key===pe?O(R,C,q,G):null;case k:return q.key===pe?U(R,C,q,G):null;case Z:return q=pi(q),B(R,C,q,G)}if(Le(q)||re(q))return pe!==null?null:$(R,C,q,G,null);if(typeof q.then=="function")return B(R,C,xl(q),G);if(q.$$typeof===me)return B(R,C,pl(R,q),G);vl(R,q)}return null}function P(R,C,q,G,pe){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return R=R.get(q)||null,b(C,R,""+G,pe);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case z:return R=R.get(G.key===null?q:G.key)||null,O(C,R,G,pe);case k:return R=R.get(G.key===null?q:G.key)||null,U(C,R,G,pe);case Z:return G=pi(G),P(R,C,q,G,pe)}if(Le(G)||re(G))return R=R.get(q)||null,$(C,R,G,pe,null);if(typeof G.then=="function")return P(R,C,q,xl(G),pe);if(G.$$typeof===me)return P(R,C,q,pl(C,G),pe);vl(C,G)}return null}function fe(R,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(R,de,q[Ee],G);if(Be===null){de===null&&(de=Me);break}e&&de&&Be.alternate===null&&t(R,de),C=u(Be,C,Ee),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be,de=Me}if(Ee===q.length)return i(R,de),Re&&Qn(R,Ee),pe;if(de===null){for(;Ee<q.length;Ee++)de=J(R,q[Ee],G),de!==null&&(C=u(de,C,Ee),Ue===null?pe=de:Ue.sibling=de,Ue=de);return Re&&Qn(R,Ee),pe}for(de=l(de);Ee<q.length;Ee++)Me=P(de,R,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(R,Ps)}),Re&&Qn(R,Ee),pe}function ge(R,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(R,de,Be.value,G);if(Ps===null){de===null&&(de=Me);break}e&&de&&Ps.alternate===null&&t(R,de),C=u(Ps,C,Ee),Ue===null?pe=Ps:Ue.sibling=Ps,Ue=Ps,de=Me}if(Be.done)return i(R,de),Re&&Qn(R,Ee),pe;if(de===null){for(;!Be.done;Ee++,Be=q.next())Be=J(R,Be.value,G),Be!==null&&(C=u(Be,C,Ee),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be);return Re&&Qn(R,Ee),pe}for(de=l(de);!Be.done;Ee++,Be=q.next())Be=P(de,R,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(mx){return t(R,mx)}),Re&&Qn(R,Ee),pe}function Je(R,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(R,C.sibling),G=o(C,q.props.children),G.return=R,R=G;break e}}else if(C.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Z&&pi(pe)===C.type){i(R,C.sibling),G=o(C,q.props),Qr(G,q),G.return=R,R=G;break e}i(R,C);break}else t(R,C);C=C.sibling}q.type===H?(G=ui(q.props.children,R.mode,G,q.key),G.return=R,R=G):(G=hl(q.type,q.key,q.props,null,R.mode,G),Qr(G,q),G.return=R,R=G)}return m(R);case k: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(R,C.sibling),G=o(C,q.children||[]),G.return=R,R=G;break e}else{i(R,C);break}else t(R,C);C=C.sibling}G=_o(q,R.mode,G),G.return=R,R=G}return m(R);case Z:return q=pi(q),Je(R,C,q,G)}if(Le(q))return fe(R,C,q,G);if(re(q)){if(pe=re(q),typeof pe!="function")throw Error(a(150));return q=pe.call(q),ge(R,C,q,G)}if(typeof q.then=="function")return Je(R,C,xl(q),G);if(q.$$typeof===me)return Je(R,C,pl(R,q),G);vl(R,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,C!==null&&C.tag===6?(i(R,C.sibling),G=o(C,q),G.return=R,R=G):(i(R,C),G=vo(q,R.mode,G),G.return=R,R=G),m(R)):i(R,C)}return function(R,C,q,G){try{Jr=0;var pe=Je(R,C,q,G);return Xi=null,pe}catch(de){if(de===Ii||de===yl)throw de;var Ue=Vt(29,de,null,R.mode);return Ue.lanes=G,Ue.return=R,Ue}finally{}}}var yi=hd(!0),dd=hd(!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=fl(e),Xh(e,null,i),t}return ul(e,l,t,i),fl(e)}function Ir(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 Xr(){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=S({},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 md(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function pd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)md(i[e],t)}var Ki=je(null),_l=je(0);function gd(e,t){e=rs,Te(_l,e),Te(Ki,t),rs=e|t.baseLanes}function Uo(){Te(_l,rs),Te(Ki,Ki.current)}function Bo(){rs=_l.current,_e(Ki),_e(_l)}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 yd(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 wl(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 Kn=0,Se=null,Ve=null,dt=null,Sl=!1,Zi=!1,bi=!1,El=0,Zr=0,Wi=null,ib=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 Kn=u,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Y.H=e===null||e.memoizedState===null?em:nu,bi=!1,u=i(l,o),bi=!1,Zi&&(u=xd(t,i,l,o)),bd(e),u}function bd(e){Y.H=ta;var t=Ve!==null&&Ve.next!==null;if(Kn=0,dt=Ve=Se=null,Sl=!1,Zr=0,Wi=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&ml(e)&&(mt=!0))}function xd(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=tm,u=t(i,l)}while(Zi);return u}function rb(){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=El!==0;return El=0,e}function $o(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Go(e){if(Sl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Sl=!1}Kn=0,dt=Ve=Se=null,Zi=!1,Zr=El=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 Al(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wr(e){var t=Zr;return Zr+=1,Wi===null&&(Wi=[]),e=od(Wi,e,t),t=Se,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,Y.H=t===null||t.memoizedState===null?em:nu),e}function Ol(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=Al(),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 Zn(e,t){return typeof t=="function"?t(e):t}function jl(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:(Kn&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((Kn&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 vd(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,Xo(Sd.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},wd.bind(null,l,o,i,t),null),Ie===null)throw Error(a(349));u||(Kn&127)!==0||_d(l,t,i)}return i}function _d(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Se.updateQueue,t===null?(t=Al(),Se.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function wd(e,t,i,l){t.value=i,t.getSnapshot=l,Ed(t)&&Ad(e)}function Sd(e,t,i){return i(function(){Ed(t)&&Ad(e)})}function Ed(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Ad(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:Zn,lastRenderedState:e},t}function Od(e,t,i,l){return e.baseState=i,Fo(e,Ve,typeof l=="function"?l:Zn)}function ab(e,t,i,l,o){if(Cl(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,jd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function jd(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),Td(e,t,b)}catch(U){Io(e,t,U)}finally{u!==null&&m.types!==null&&(u.types=m.types),Y.T=u}}else try{u=i(o,l),Td(e,t,u)}catch(U){Io(e,t,U)}}function Td(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Nd(e,t,l)},function(l){return Io(e,t,l)}):Nd(e,t,i)}function Nd(e,t,i){t.status="fulfilled",t.value=i,Cd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,jd(e,i)))}function Io(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Cd(t),t=t.next;while(t!==l)}e.action=null}function Cd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function kd(e,t){return t}function Md(e,t){if(Re){var i=Ie.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:kd,lastRenderedState:t},i.queue=l,i=Kd.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=ab.bind(null,Se,o,u,i),o.dispatch=i,l.memoizedState=e,[t,i,!1]}function Rd(e){var t=ut();return Dd(t,Ve,e)}function Dd(e,t,i){if(t=Fo(e,t,kd)[0],e=jl(Zn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Wr(t)}catch(m){throw m===Ii?yl: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},lb.bind(null,o,i),null)),[l,u,e]}function lb(e,t){e.action=t}function zd(e){var t=ut(),i=Ve;if(i!==null)return Dd(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=Al(),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 qd(){return ut().memoizedState}function Tl(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 Nl(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 Ud(e,t){Tl(8390656,8,e,t)}function Xo(e,t){Nl(2048,8,e,t)}function cb(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=Al(),Se.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Bd(e){var t=ut().memoizedState;return cb({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Ld(e,t){return Nl(4,2,e,t)}function Hd(e,t){return Nl(4,4,e,t)}function Pd(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 Yd(e,t,i){i=i!=null?i.concat([e]):null,Nl(4,4,Pd.bind(null,t,e),i)}function Ko(){}function $d(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 Gd(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||(Kn&1073741824)!==0&&(ke&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Vm(),Se.lanes|=e,ks|=e,i)}function Vd(e,t,i,l){return Gt(i,t)?i:Ki.current!==null?(e=Zo(e,i,l),Gt(e,t)||(mt=!0),e):(Kn&42)===0||(Kn&1073741824)!==0&&(ke&261930)===0?(mt=!0,e.memoizedState=i):(e=Vm(),Se.lanes|=e,ks|=e,t)}function Fd(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 $=sb(O,l);ea(e,t,$,Xt(e))}else ea(e,t,l,Xt(e))}catch(J){ea(e,t,{then:function(){},status:"rejected",reason:J},Xt())}finally{te.p=u,m!==null&&b.types!==null&&(m.types=b.types),Y.T=m}}function ob(){}function Wo(e,t,i,l){if(e.tag!==5)throw Error(a(476));var o=Jd(e).queue;Fd(e,o,t,he,i===null?ob:function(){return Qd(e),i(l)})}function Jd(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:Zn,lastRenderedState:he},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Qd(e){var t=Jd(e);t.next===null&&(t=e.alternate.memoizedState),ea(e,t.next.queue,{},Xt())}function eu(){return St(ya)}function Id(){return ut().memoizedState}function Xd(){return ut().memoizedState}function ub(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=As(i);var l=Os(t,e,i);l!==null&&(Ht(l,t,i),Ir(l,t,i)),t={cache:No()},e.payload=t;return}t=t.return}}function fb(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Cl(e)?Zd(t,i):(i=bo(e,t,i,l),i!==null&&(Ht(i,e,l),Wd(i,t,l)))}function Kd(e,t,i){var l=Xt();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(Cl(e))Zd(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 ul(e,t,o,0),Ie===null&&ol(),!1}catch{}finally{}if(i=bo(e,t,o,l),i!==null)return Ht(i,e,l),Wd(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},Cl(e)){if(t)throw Error(a(479))}else t=bo(e,i,l,2),t!==null&&Ht(t,e,2)}function Cl(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Zd(e,t){Zi=Sl=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Wd(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:Ol,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 em={readContext:St,use:Ol,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Ud,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,Tl(4194308,4,Pd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Tl(4194308,4,e,t)},useInsertionEffect:function(e,t){Tl(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=fb.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=Kd.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=Fd.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(),Ie===null)throw Error(a(349));(ke&127)!==0||_d(l,t,i)}o.memoizedState=i;var u={value:i,getSnapshot:t};return o.queue=u,Ud(Sd.bind(null,l,u,e),[e]),l.flags|=2048,er(9,{destroy:void 0},wd.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Ie.identifierPrefix;if(Re){var i=Mn,l=kn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=El++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=ib++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:eu,useFormState:Md,useActionState:Md,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=ub.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:Ol,useCallback:$d,useContext:St,useEffect:Xo,useImperativeHandle:Yd,useInsertionEffect:Ld,useLayoutEffect:Hd,useMemo:Gd,useReducer:jl,useRef:qd,useState:function(){return jl(Zn)},useDebugValue:Ko,useDeferredValue:function(e,t){var i=ut();return Vd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=jl(Zn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Wr(e),t]},useSyncExternalStore:vd,useId:Id,useHostTransitionStatus:eu,useFormState:Rd,useActionState:Rd,useOptimistic:function(e,t){var i=ut();return Od(i,Ve,e,t)},useMemoCache:Vo,useCacheRefresh:Xd};nu.useEffectEvent=Bd;var tm={readContext:St,use:Ol,useCallback:$d,useContext:St,useEffect:Xo,useImperativeHandle:Yd,useInsertionEffect:Ld,useLayoutEffect:Hd,useMemo:Gd,useReducer:Jo,useRef:qd,useState:function(){return Jo(Zn)},useDebugValue:Ko,useDeferredValue:function(e,t){var i=ut();return Ve===null?Zo(i,e,t):Vd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Jo(Zn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Wr(e),t]},useSyncExternalStore:vd,useId:Id,useHostTransitionStatus:eu,useFormState:zd,useActionState:zd,useOptimistic:function(e,t){var i=ut();return Ve!==null?Od(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Vo,useCacheRefresh:Xd};tm.useEffectEvent=Bd;function su(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:S({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var iu={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),o=As(l);o.payload=t,i!=null&&(o.callback=i),t=Os(e,o,l),t!==null&&(Ht(t,e,l),Ir(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),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),Ir(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=As(i);l.tag=2,t!=null&&(l.callback=t),t=Os(e,l,i),t!==null&&(Ht(t,e,i),Ir(t,e,i))}};function nm(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 sm(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=S({},i));for(var o in e)i[o]===void 0&&(i[o]=e[o])}return i}function im(e){cl(e)}function rm(e){console.error(e)}function am(e){cl(e)}function kl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function lm(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(){kl(e,t)},i}function cm(e){return e=As(e),e.tag=3,e}function om(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(){lm(t,i,l)}}var m=i.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){lm(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 hb(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?$l():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=o,l===bl?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===bl?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),$l(),!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=cm(o),om(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?dd(t,null,i,l):yi(t,e.child,i,l)}function um(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),Wn(e,t,o)):(Re&&b&&wo(t),t.flags|=1,Et(e,t,l,o),t.child)}function fm(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,hm(e,t,u,l,o)):(e=hl(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 Wn(e,t,o)}return t.flags|=1,e=Jn(u,l),e.ref=t.ref,e.return=t,t.child=e}function hm(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,Wn(e,t,o)}return lu(e,t,i,l,o)}function dm(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 mm(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&gl(t,u!==null?u.cachePool:null),u!==null?gd(t,u):Uo(),yd(t);else return l=t.lanes=536870912,mm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(gl(t,u.cachePool),gd(t,u),Ts(),t.memoizedState=null):(e!==null&&gl(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 mm(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&&gl(t,null),Uo(),yd(t),e!==null&&Fi(e,t,l,!0),t.childLanes=o,null}function Ml(e,t){return t=Dl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pm(e,t,i){return yi(t,e.child,null,i),e=Ml(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function db(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=Ml(t,l),t.lanes=536870912,na(null,e);if(Lo(t),(e=Ze)?(e=jp(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=Zh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw ws(t);return t.lanes=536870912,null}return Ml(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=pm(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=Ie,l!==null&&(m=bs(l,i),m!==0&&m!==u.retryLane))throw u.retryLane=m,oi(e,m),Ht(l,e,m),au;$l(),t=pm(e,t,i)}else e=u.treeContext,Ze=mn(m.nextSibling),wt=t,Re=!0,_s=null,hn=!1,e!==null&&td(t,e),t=Ml(t,l),t.flags|=4096;return t}return e=Jn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Rl(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),Wn(e,t,o)):(Re&&l&&wo(t),t.flags|=1,Et(e,t,i,o),t.child)}function gm(e,t,i,l,o,u){return di(t),t.updateQueue=null,i=xd(t,l,i,o),bd(e),l=Yo(),e!==null&&!mt?($o(e,t,u),Wn(e,t,u)):(Re&&l&&wo(t),t.flags|=1,Et(e,t,i,u),t.child)}function ym(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),Xr(),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)&&sm(t,u,l,m),Es=!1;var B=t.memoizedState;u.state=B,Kr(t,l,u,o),Xr(),U=t.memoizedState,b||B!==U||Es?(typeof J=="function"&&(su(t,i,J,l),U=t.memoizedState),(O=Es||nm(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)&&sm(t,u,l,O),Es=!1,B=t.memoizedState,u.state=B,Kr(t,l,u,o),Xr();var P=t.memoizedState;m!==J||B!==P||Es||e!==null&&e.dependencies!==null&&ml(e.dependencies)?(typeof b=="function"&&(su(t,i,b,l),P=t.memoizedState),($=Es||nm(t,i,$,l,B,P,O)||e!==null&&e.dependencies!==null&&ml(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,Rl(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=Wn(e,t,o),e}function bm(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:ld()}}function uu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=It),e}function xm(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=jp(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=Zh(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=Dl({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=Dl({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=Ie,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)||$l(),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&&td(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=Jn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,U!==null?b=Jn(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=ld(),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=Jn(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=Dl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Dl(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 vm(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 _m(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&&vm(e,i,t);else if(e.tag===19)vm(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&&wl(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&&wl(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 Wn(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=Jn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Jn(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&&ml(e)))}function mb(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?xm(e,t,i):(js(t),e=Wn(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 _m(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,dm(e,t,i,t.pendingProps);case 24:Ss(t,ht,e.memoizedState.cache)}return Wn(e,t,i)}function wm(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,mb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,Re&&(t.flags&1048576)!==0&&ed(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=ym(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=um(null,t,e,l,i);break e}else if(o===ie){t.tag=14,t=fm(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),ym(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),Xr(),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=bm(e,t,l,i);break e}else if(l!==o){o=on(Error(a(424)),t),Gr(o),t=bm(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=dd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(fi(),l===o){t=Wn(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return Rl(e,t),e===null?(i=Rp(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=Rp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Re&&(l=t.stateNode=Cp(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),Rl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((o=l=Ze)&&(l=Gb(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,rb,null,null,i),ya._currentValue=o),Rl(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&Re&&((e=i=Ze)&&(i=Vb(i,t.pendingProps,hn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||ws(t)),null;case 13:return xm(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 um(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 fm(e,t,t.type,t.pendingProps,i);case 15:return hm(e,t,t.type,t.pendingProps,i);case 19:return _m(e,t,i);case 31:return db(e,t,i);case 22:return dm(e,t,i,t.pendingProps);case 24:return di(t),l=St(ht),e===null?(o=ko(),o===null&&(o=Ie,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),Xr()),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 es(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(Im())e.flags|=8192;else throw gi=bl,Mo}else e.flags&=-16777217}function Sm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Bp(t))if(Im())e.flags|=8192;else throw gi=bl,Mo}function zl(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 pb(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)?es(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?(es(t),u!==null?(We(t),Sm(t,u)):(We(t),pu(t,o,null,l,i))):u?u!==e.memoizedState?(es(t),We(t),Sm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&es(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&&es(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Vi(t)?nd(t):(e=Cp(o,l,i),t.stateNode=e,es(t))}return We(t),null;case 5:if(Zs(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&es(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Vi(t))nd(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&&es(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&&es(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||xp(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),zl(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=wl(e),u!==null){for(t.flags|=128,sa(l,!1),e=u.updateQueue,t.updateQueue=e,zl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Kh(i,e),i=i.sibling;return Te(ot,ot.current&1|2),Re&&Qn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Hl&&(t.flags|=128,o=!0,sa(l,!1),t.lanes=4194304)}else{if(!o)if(e=wl(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,zl(t,e),sa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Re)return We(t),null}else 2*et()-l.renderingStartTime>Hl&&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&&Qn(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&&zl(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 gb(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 Em(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 Am(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{pd(t,i)}catch(l){Ye(e,e.return,l)}}}function Om(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 jm(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;Bb(l,e.type,i,t),l[it]=t}catch(o){Ye(e,e.return,o)}}function Tm(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||Tm(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=Vn));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 ql(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(ql(e,t,i),e=e.sibling;e!==null;)ql(e,t,i),e=e.sibling}function Nm(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 ts=!1,pt=!1,xu=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function yb(e,t){if(e=e.containerInfo,Hu=sc,e=Yh(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},sc=!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 km(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:ss(e,i),l&4&&ia(5,i);break;case 1:if(ss(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&&Am(i),l&512&&ra(i,i.return);break;case 3:if(ss(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{pd(e,t)}catch(m){Ye(i,i.return,m)}}break;case 27:t===null&&l&4&&Nm(i);case 26:case 5:ss(e,i),t===null&&l&4&&jm(i),l&512&&ra(i,i.return);break;case 12:ss(e,i);break;case 31:ss(e,i),l&4&&Dm(e,i);break;case 13:ss(e,i),l&4&&zm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Ob.bind(null,i),Fb(e,i))));break;case 22:if(l=i.memoizedState!==null||ts,!l){t=t!==null&&t.memoizedState!==null||pt,o=ts;var u=pt;ts=l,(pt=t)&&!u?is(e,i,(i.subtreeFlags&8772)!==0):ss(e,i),ts=o,pt=u}break;case 30:break;default:ss(e,i)}}function Mm(e){var t=e.alternate;t!==null&&(e.alternate=null,Mm(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 ns(e,t,i){for(i=i.child;i!==null;)Rm(e,t,i),i=i.sibling}function Rm(e,t,i){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(ei,i)}catch{}switch(i.tag){case 26:pt||Rn(i,t),ns(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),ns(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,ns(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,Ap(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),hr(e)):Ap(tt,i.stateNode));break;case 4:l=tt,o=qt,tt=i.stateNode.containerInfo,qt=!0,ns(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),ns(e,t,i);break;case 1:pt||(Rn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Om(i,t,l)),ns(e,t,i);break;case 21:ns(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ns(e,t,i),pt=l;break;default:ns(e,t,i)}}function Dm(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 zm(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 bb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Cm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Cm),t;default:throw Error(a(435,e.tag))}}function Ul(e,t){var i=bb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var o=jb.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));Rm(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;)qm(t,e),t=t.sibling}var Sn=null;function qm(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&&ts&&(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=qp("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=qp("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 Up(o,e.type,e.stateNode);else e.stateNode=zp(o,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Up(o,e.type,e.stateNode):zp(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(Wl=null,o=Sn,Sn=Kl(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,Um(e));break;case 4:l=Sn,Sn=Kl(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,Ul(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Ll=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ul(e,l)));break;case 22:o=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,U=ts,$=pt;if(ts=U||o,pt=$||O,Ut(t,e),pt=$,ts=U,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(i===null||O||ts||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?Op(P,!0):Op(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,Ul(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ul(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(Tm(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);ql(e,u,o);break;case 5:var m=i.stateNode;i.flags&32&&(zi(m,""),i.flags&=-33);var b=yu(e);ql(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 Um(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Um(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ss(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)km(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"&&Om(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 is(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:is(o,u,i),ia(4,u);break;case 1:if(is(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++)md(O[o],b)}catch(U){Ye(l,l.return,U)}}i&&m&64&&Am(u),ra(u,u.return);break;case 27:Nm(u);case 26:case 5:is(o,u,i),i&&l===null&&m&4&&jm(u),ra(u,u.return);break;case 12:is(o,u,i);break;case 31:is(o,u,i),i&&m&4&&Dm(o,u);break;case 13:is(o,u,i),i&&m&4&&zm(o,u);break;case 22:u.memoizedState===null&&is(o,u,i),ra(u,u.return);break;case 30:break;default:is(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;)Bm(e,t,i,l),t=t.sibling}function Bm(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;)Lm(e,t,i),e=e.sibling}function Lm(e,t,i){switch(e.tag){case 26:nr(e,t,i),e.flags&la&&e.memoizedState!==null&&ix(i,Sn,e.memoizedState,e.memoizedProps);break;case 5:nr(e,t,i);break;case 3:case 4:var l=Sn;Sn=Kl(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 Hm(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,Ym(l,e)}Hm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Pm(e),e=e.sibling}function Pm(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,Bl(e)):ca(e);break;default:ca(e)}}function Bl(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,Ym(l,e)}Hm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ns(8,t,t.return),Bl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Bl(t));break;default:Bl(t)}e=e.sibling}}function Ym(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(Mm(l),l===i){xt=null;break e}if(o!==null){o.return=u,xt=o;break e}xt=u}}}var xb={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}},vb=typeof WeakMap=="function"?WeakMap:Map,He=0,Ie=null,Ne=null,ke=0,Pe=0,Qt=null,Cs=!1,sr=!1,wu=!1,rs=0,at=0,ks=0,_i=0,Su=0,It=0,ir=0,oa=null,Lt=null,Eu=!1,Ll=0,$m=0,Hl=1/0,Pl=null,Ms=null,bt=0,Rs=null,rr=null,as=0,Au=0,Ou=null,Gm=null,ua=0,ju=null;function Xt(){return(He&2)!==0&&ke!==0?ke&-ke:Y.T!==null?Ru():Mr()}function Vm(){if(It===0)if((ke&536870912)===0||Re){var e=Yn;Yn<<=1,(Yn&3932160)===0&&(Yn=262144),It=e}else It=536870912;return e=Ft.current,e!==null&&(e.flags|=32),It}function Ht(e,t,i){(e===Ie&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(ar(e,0),Ds(e,ke,It,!1)),vn(e,i),((He&2)===0||e!==Ie)&&(e===Ie&&((He&2)===0&&(_i|=i),at===4&&Ds(e,ke,It,!1)),Dn(e))}function Fm(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?Sb(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&&!_b(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,It,!Cs);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(o=Ll+300-et(),10<o)){if(Ds(l,t,It,!Cs),ti(l,0,!0)!==0)break e;as=t,l.timeoutHandle=Sp(Jm.bind(null,l,i,Lt,Pl,Eu,t,It,_i,ir,Cs,u,"Throttled",-0,0),o);break e}Jm(l,i,Lt,Pl,Eu,t,It,_i,ir,Cs,u,null,-0,0)}}break}while(!0);Dn(e)}function Jm(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:Vn},Lm(t,u,J);var fe=(u&62914560)===u?Ll-et():(u&4194048)===u?$m-et():0;if(fe=rx(J,fe),fe!==null){as=u,e.cancelPendingCommit=fe(tp.bind(null,e,t,u,i,l,o,m,b,O,$,J,null,B,P)),Ds(e,u,m,!U);return}}tp(e,t,u,i,l,o,m,b,O)}function _b(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 Yl(){return(He&6)===0?(fa(0),!1):!0}function Tu(){if(Ne!==null){if(Pe===0)var e=Ne.return;else e=Ne,In=hi=null,Go(e),Xi=null,Jr=0,e=Ne;for(;e!==null;)Em(e.alternate,e),e=e.return;Ne=null}}function ar(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Pb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),as=0,Tu(),Ie=e,Ne=i=Jn(e.current,null),ke=t,Pe=0,Qt=null,Cs=!1,sr=ni(e,t),wu=!1,ir=It=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 rs=t,ol(),i}function Qm(e,t){Se=null,Y.H=ta,t===Ii||t===yl?(t=ud(),Pe=3):t===Mo?(t=ud(),Pe=4):Pe=t===au?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,kl(e,on(t,e.current)))}function Im(){var e=Ft.current;return e===null?!0:(ke&4194048)===ke?dn===null:(ke&62914560)===ke||(ke&536870912)!==0?e===dn:!1}function Xm(){var e=Y.H;return Y.H=ta,e===null?ta:e}function Km(){var e=Y.A;return Y.A=xb,e}function $l(){at=4,Cs||(ke&4194048)!==ke&&Ft.current!==null||(sr=!0),(ks&134217727)===0&&(_i&134217727)===0||Ie===null||Ds(Ie,ke,It,!1)}function Nu(e,t,i){var l=He;He|=2;var o=Xm(),u=Km();(Ie!==e||ke!==t)&&(Pl=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)}}wb(),m=at;break}catch($){Qm(e,$)}while(!0);return t&&e.shellSuspendCounter++,In=hi=null,He=l,Y.H=o,Y.A=u,Ne===null&&(Ie=null,ke=0,ol()),m}function wb(){for(;Ne!==null;)Zm(Ne)}function Sb(e,t){var i=He;He|=2;var l=Xm(),o=Km();Ie!==e||ke!==t?(Pl=null,Hl=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(cd(u)){Pe=0,Qt=null,Wm(t);break}t=function(){Pe!==2&&Pe!==9||Ie!==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:cd(u)?(Pe=0,Qt=null,Wm(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?Bp(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,Gl(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))}}Eb();break}catch($){Qm(e,$)}while(!0);return In=hi=null,Y.H=l,Y.A=o,He=i,Ne!==null?0:(Ie=null,ke=0,ol(),at)}function Eb(){for(;Ne!==null&&!Fa();)Zm(Ne)}function Zm(e){var t=wm(e.alternate,e,rs);e.memoizedProps=e.pendingProps,t===null?Gl(e):Ne=t}function Wm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=gm(i,t,t.pendingProps,t.type,void 0,ke);break;case 11:t=gm(i,t,t.pendingProps,t.type.render,t.ref,ke);break;case 5:Go(t);default:Em(i,t),t=Ne=Kh(t,rs),t=wm(i,t,rs)}e.memoizedProps=e.pendingProps,t===null?Gl(e):Ne=t}function lr(e,t,i,l){In=hi=null,Go(t),Xi=null,Jr=0;var o=t.return;try{if(hb(e,o,t,i,ke)){at=1,kl(e,on(i,e.current)),Ne=null;return}}catch(u){if(o!==null)throw Ne=o,u;at=1,kl(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))),ep(t,e)):Gl(t)}function Gl(e){var t=e;do{if((t.flags&32768)!==0){ep(t,Cs);return}e=t.return;var i=pb(t.alternate,t,rs);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 ep(e,t){do{var i=gb(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 tp(e,t,i,l,o,u,m,b,O){e.cancelPendingCommit=null;do Vl();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===Ie&&(Ne=Ie=null,ke=0),rr=t,Rs=e,as=i,Au=u,Ou=o,Gm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Tb(Ci,function(){return ap(),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{yb(e,t,i)}finally{He=m,te.p=o,Y.T=l}}bt=1,np(),sp(),ip()}}function np(){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{qm(t,e);var u=Pu,m=Yh(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(m!==b&&b&&b.ownerDocument&&Ph(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 R=Hh(b,ge),C=Hh(b,Je);if(R&&C&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==C.node||P.focusOffset!==C.offset)){var q=J.createRange();q.setStart(R.node,R.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}}sc=!!Hu,Pu=Hu=null}finally{He=o,te.p=l,Y.T=i}}e.current=t,bt=2}}function sp(){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{km(e,t.alternate,t)}finally{He=o,te.p=l,Y.T=i}}bt=3}}function ip(){if(bt===4||bt===3){bt=0,Ni();var e=Rs,t=rr,i=as,l=Gm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,rr=Rs=null,rp(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}}(as&3)!==0&&Vl(),Dn(e),o=e.pendingLanes,(i&261930)!==0&&(o&42)!==0?e===ju?ua++:(ua=0,ju=e):ua=0,fa(0)}}function rp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vr(t)))}function Vl(){return np(),sp(),ip(),ap()}function ap(){if(bt!==5)return!1;var e=Rs,t=Au;Au=0;var i=ii(as),l=Y.T,o=te.p;try{te.p=32>i?32:i,Y.T=null,i=Ou,Ou=null;var u=Rs,m=as;if(bt=0,rr=Rs=null,as=0,(He&6)!==0)throw Error(a(331));var b=He;if(He|=4,Pm(u.current),Bm(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,rp(e,t)}}function lp(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)lp(e,e,i);else for(;t!==null;){if(t.tag===3){lp(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=cm(2),l=Os(t,i,2),l!==null&&(om(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 vb;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=Ab.bind(null,e,t,i),t.then(e,e))}function Ab(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ie===e&&(ke&i)===i&&(at===4||at===3&&(ke&62914560)===ke&&300>et()-Ll?(He&2)===0&&ar(e,0):Su|=i,ir===ke&&(ir=0)),Dn(e)}function cp(e,t){t===0&&(t=Mi()),e=oi(e,t),e!==null&&(vn(e,t),Dn(e))}function Ob(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),cp(e,i)}function jb(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),cp(e,i)}function Tb(e,t){return Tr(e,t)}var Fl=null,cr=null,ku=!1,Jl=!1,Mu=!1,zs=0;function Dn(e){e!==cr&&e.next===null&&(cr===null?Fl=cr=e:cr=cr.next=e),Jl=!0,ku||(ku=!0,Cb())}function fa(e,t){if(!Mu&&Jl){Mu=!0;do for(var i=!1,l=Fl;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,hp(l,u))}else u=ke,u=ti(l,l===Ie?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ni(l,u)||(i=!0,hp(l,u));l=l.next}while(i);Mu=!1}}function Nb(){op()}function op(){Jl=ku=!1;var e=0;zs!==0&&Hb()&&(e=zs);for(var t=et(),i=null,l=Fl;l!==null;){var o=l.next,u=up(l,t);u===0?(l.next=null,i===null?Fl=o:i.next=o,o===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Jl=!0)),l=o}bt!==0&&bt!==5||fa(e),zs!==0&&(zs=0)}function up(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=Ie,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&&Pn(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&&Pn(l),ii(i)){case 2:case 8:i=Qa;break;case 32:i=Ci;break;case 268435456:i=Ia;break;default:i=Ci}return l=fp.bind(null,e),i=Tr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&Pn(l),e.callbackPriority=2,e.callbackNode=null,2}function fp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Vl()&&e.callbackNode!==i)return null;var l=ke;return l=ti(e,e===Ie?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Fm(e,l,t),up(e,et()),e.callbackNode!=null&&e.callbackNode===i?fp.bind(null,e):null)}function hp(e,t){if(Vl())return null;Fm(e,t,!0)}function Cb(){Yb(function(){(He&6)!==0?Tr(Ja,Nb):op()})}function Ru(){if(zs===0){var e=Ji;e===0&&(e=ds,ds<<=1,(ds&261888)===0&&(ds=256)),zs=e}return zs}function dp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:tl(""+e)}function mp(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 kb(e,t,i,l,o){if(t==="submit"&&i&&i.stateNode===o){var u=dp((o[it]||null).action),m=l.submitter;m&&(t=(t=m[it]||null)?dp(t.formAction):m.getAttribute("formAction"),t!==null&&(u=t,m=null));var b=new rl("action","action",null,l,o);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(zs!==0){var O=m?mp(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?mp(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],Mb=zu.toLowerCase(),Rb=zu[0].toUpperCase()+zu.slice(1);wn(Mb,"on"+Rb)}wn(Vh,"onAnimationEnd"),wn(Fh,"onAnimationIteration"),wn(Jh,"onAnimationStart"),wn("dblclick","onDoubleClick"),wn("focusin","onFocus"),wn("focusout","onBlur"),wn(Iy,"onTransitionRun"),wn(Xy,"onTransitionStart"),wn(Ky,"onTransitionCancel"),wn(Qh,"onTransitionEnd"),L("onMouseEnter",["mouseout","mouseover"]),L("onMouseLeave",["mouseout","mouseover"]),L("onPointerEnter",["pointerout","pointerover"]),L("onPointerLeave",["pointerout","pointerover"]),I("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),I("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),I("onBeforeInput",["compositionend","keypress","textInput","paste"]),I("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),I("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),I("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(" "),Db=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ha));function pp(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($){cl($)}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($){cl($)}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)||(gp(t,e,2,!1),i.add(l))}function qu(e,t,i){var l=0;t&&(l|=4),gp(i,e,l,t)}var Ql="_reactListening"+Math.random().toString(36).slice(2);function Uu(e){if(!e[Ql]){e[Ql]=!0,D.forEach(function(i){i!=="selectionchange"&&(Db.has(i)||qu(i,!1,e),qu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ql]||(t[Ql]=!0,qu("selectionchange",!1,t))}}function gp(e,t,i,l){switch(Vp(t)){case 2:var o=cx;break;case 8:o=ox;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}_h(function(){var U=u,$=eo(i),J=[];e:{var B=Ih.get(e);if(B!==void 0){var P=rl,fe=e;switch(e){case"keypress":if(sl(i)===0)break e;case"keydown":case"keyup":P=jy;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=Eh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=py;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=Cy;break;case Vh:case Fh:case Jh:P=by;break;case Qh:P=My;break;case"scroll":case"scrollend":P=dy;break;case"wheel":P=Dy;break;case"copy":case"cut":case"paste":P=vy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Oh;break;case"toggle":case"beforetoggle":P=qy}var ge=(t&4)!==0,Je=!ge&&(e==="scroll"||e==="scrollend"),R=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||R===null||(G=Dr(C,R),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=Eh,G="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ge=Oh,G="onPointerLeave",R="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(R,C+"enter",fe,i,$),ge.target=q,ge.relatedTarget=Je,G=ge),Je=G,P&&fe)t:{for(ge=zb,R=P,C=fe,q=0,G=R;G;G=ge(G))q++;G=0;for(var pe=C;pe;pe=ge(pe))G++;for(;0<q-G;)R=ge(R),q--;for(;0<G-q;)C=ge(C),G--;for(;q--;){if(R===C||C!==null&&R===C.alternate){ge=R;break t}R=ge(R),C=ge(C)}ge=null}else ge=null;P!==null&&yp(J,B,P,ge,!1),fe!==null&&Je!==null&&yp(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=Dh;else if(Mh(B))if(zh)Ue=Fy;else{Ue=Gy;var de=$y}else P=B.nodeName,!P||P.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?U&&Zc(U.elementType)&&(Ue=Dh):Ue=Vy;if(Ue&&(Ue=Ue(e,U))){Rh(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":(Mh(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,$h(J,i,$);break;case"selectionchange":if(Qy)break;case"keydown":case"keyup":$h(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?Ch(e,i)&&(Me="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Me="onCompositionStart");Me&&(jh&&i.locale!=="ko"&&(Bi||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Bi&&(Ee=wh()):(xs=$,so="value"in xs?xs.value:xs.textContent,Bi=!0)),de=Il(U,Me),0<de.length&&(Me=new Ah(Me,e,null,i,$),J.push({event:Me,listeners:de}),Ee?Me.data=Ee:(Ee=kh(i),Ee!==null&&(Me.data=Ee)))),(Ee=By?Ly(e,i):Hy(e,i))&&(Me=Il(U,"onBeforeInput"),0<Me.length&&(de=new Ah("onBeforeInput","beforeinput",null,i,$),J.push({event:de,listeners:Me}),de.data=Ee)),kb(J,e,U,i,$)}pp(J,t)})}function da(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Il(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 zb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function yp(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 qb=/\r\n?/g,Ub=/\u0000|\uFFFD/g;function bp(e){return(typeof e=="string"?e:""+e).replace(qb,`
26
- `).replace(Ub,"")}function xp(e,t){return t=bp(t),bp(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":xh(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=tl(""+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=tl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Vn);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=tl(""+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":Gn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Gn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Gn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Gn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Gn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Gn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Gn(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=fy.get(i)||i,Ct(e,i,l))}}function Lu(e,t,i,l,o,u){switch(i){case"style":xh(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=Vn);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)}}ph(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)}yh(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 Bb(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)}}Xc(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)}gh(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 R in i)B=i[R],i.hasOwnProperty(R)&&B!=null&&!l.hasOwnProperty(R)&&Fe(e,t,R,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 vp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Lb(){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&&vp(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;$&&vp(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 _p(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 wp(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 Hb(){var e=window.event;return e&&e.type==="popstate"?e===$u?!1:($u=e,!0):($u=null,!1)}var Sp=typeof setTimeout=="function"?setTimeout:void 0,Pb=typeof clearTimeout=="function"?clearTimeout:void 0,Ep=typeof Promise=="function"?Promise:void 0,Yb=typeof queueMicrotask=="function"?queueMicrotask:typeof Ep<"u"?function(e){return Ep.resolve(null).then(e).catch($b)}:Sp;function $b(e){setTimeout(function(){throw e})}function qs(e){return e==="head"}function Ap(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 Op(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 Gb(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 Vb(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 jp(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 Fb(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 Tp(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 Np(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 Cp(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,kp=new Set;function Kl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ls=te.d;te.d={f:Jb,r:Qb,D:Ib,C:Xb,L:Kb,m:Zb,X:ex,S:Wb,M:tx};function Jb(){var e=ls.f(),t=Yl();return e||t}function Qb(e){var t=w(e);t!==null&&t.tag===5&&t.type==="form"?Qd(t):ls.r(e)}var or=typeof document>"u"?null:document;function Mp(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+'"]'),kp.has(o)||(kp.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 Ib(e){ls.D(e),Mp("dns-prefetch",e,null)}function Xb(e,t){ls.C(e,t),Mp("preconnect",e,t)}function Kb(e,t,i){ls.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=S({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 Zb(e,t){ls.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=S({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 Wb(e,t,i){ls.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=S({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,Zl(m,t,l)}m={type:"stylesheet",instance:m,count:1,state:b},o.set(u,m)}}}function ex(e,t){ls.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=S({src:e,async:!0},t),(t=pn.get(o))&&Iu(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 tx(e,t){ls.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=S({src:e,async:!0,type:"module"},t),(t=pn.get(o))&&Iu(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 Rp(e,t,i,l){var o=(o=sn.current)?Kl(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||nx(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 Dp(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function nx(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 zp(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=S({},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),Zl(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=Dp(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,Zl(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=S({},i),Iu(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,Zl(l,i.precedence,e));return t.instance}function Zl(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 Iu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Wl=null;function qp(e,t,i){if(Wl===null){var l=new Map,o=Wl=new Map;o.set(i,l)}else o=Wl,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 Up(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function sx(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 Bp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ix(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=ec.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,T(u);return}u=t.ownerDocument||t,l=Dp(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=ec.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Xu=0;function rx(e,t){return e.stylesheets&&e.count===0&&nc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&nc(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Xu===0&&(Xu=62500*Lb());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&nc(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Xu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(o)}}:null}function ec(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tc=null;function nc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tc=new Map,t.forEach(ax,e),tc=null,ec.call(e))}function ax(e,t){if(!(t.state.loading&4)){var i=tc.get(e);if(i)var l=i.get(null);else{i=new Map,tc.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=ec.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 lx(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 Lp(e,t,i,l,o,u,m,b,O,U,$,J){return e=new lx(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 Hp(e){return e?(e=Yi,e):Yi}function Pp(e,t,i,l,o,u){o=Hp(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),Ir(i,e,t))}function Yp(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){Yp(e,t),(e=e.alternate)&&Yp(e,t)}function $p(e){if(e.tag===13||e.tag===31){var t=oi(e,67108864);t!==null&&Ht(t,e,67108864),Ku(e,67108864)}}function Gp(e){if(e.tag===13||e.tag===31){var t=Xt();t=$n(t);var i=oi(e,t);i!==null&&Ht(i,e,t),Ku(e,t)}}var sc=!0;function cx(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 ox(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(sc){var o=Wu(l);if(o===null)Bu(e,t,l,ic,i),Fp(e,l);else if(fx(o,e,t,i,l))l.stopPropagation();else if(Fp(e,l),t&4&&-1<ux.indexOf(e)){for(;o!==null;){var u=w(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&&(Hl=et()+500,fa(0))}}break;case 31:case 13:b=oi(u,2),b!==null&&Ht(b,u,2),Yl(),Ku(u,2)}if(u=Wu(l),u===null&&Bu(e,t,l,ic,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 ic=null;function ef(e){if(ic=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 ic=e,null}function Vp(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 Ja:return 2;case Qa:return 8;case Ci:case Jc:return 32;case Ia:return 268435456;default:return 32}default:return 32}}var tf=!1,Us=null,Bs=null,Ls=null,ba=new Map,xa=new Map,Hs=[],ux="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 Fp(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=w(t),t!==null&&$p(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function fx(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 Jp(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,Ka(e.priority,function(){Gp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Ka(e.priority,function(){Gp(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 rc(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=w(i),t!==null&&$p(t),e.blockedOn=i,!1;t.shift()}return!0}function Qp(e,t,i){rc(e)&&i.delete(t)}function hx(){tf=!1,Us!==null&&rc(Us)&&(Us=null),Bs!==null&&rc(Bs)&&(Bs=null),Ls!==null&&rc(Ls)&&(Ls=null),ba.forEach(Qp),xa.forEach(Qp)}function ac(e,t){e.blockedOn===t&&(e.blockedOn=null,tf||(tf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,hx)))}var lc=null;function Ip(e){lc!==e&&(lc=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){lc===e&&(lc=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=w(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 ac(O,e)}Us!==null&&ac(Us,e),Bs!==null&&ac(Bs,e),Ls!==null&&ac(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);)Jp(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||Ip(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),Ip(i)}}}function Xp(){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}cc.prototype.render=nf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Pp(i,l,e,t,null,null)},cc.prototype.unmount=nf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Pp(e.current,2,null,e,null,null),Yl(),t[$t]=null}};function cc(e){this._internalRoot=e}cc.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&&Jp(e)}};var Kp=n.version;if(Kp!=="19.2.4")throw Error(a(527,Kp,"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 dx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oc.isDisabled&&oc.supportsFiber)try{ei=oc.inject(dx),ct=oc}catch{}}return _a.createRoot=function(e,t){if(!c(e))throw Error(a(299));var i=!1,l="",o=im,u=rm,m=am;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=Lp(e,1,!1,null,null,i,l,null,o,u,m,Xp),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=im,m=rm,b=am,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=Lp(e,1,!0,t,i??null,l,o,O,u,m,b,Xp),t.context=Hp(null),i=t.current,l=Xt(),l=$n(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 cc(t)},_a.version="19.2.4",_a}var n0;function Zx(){if(n0)return af.exports;n0=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(),af.exports=Kx(),af.exports}var Wx=Zx();const ev="modulepreload",tv=function(r){return"/"+r},s0={},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(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};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=tv(y),y in s0)return;s0[y]=!0;const A=y.endsWith(".css"),S=A?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${S}`))return;const j=document.createElement("link");if(j.rel=A?"stylesheet":ev,A||(j.as="script"),j.crossOrigin="",j.href=y,g&&j.setAttribute("nonce",g),document.head.appendChild(j),A)return new Promise((z,k)=>{j.addEventListener("load",z),j.addEventListener("error",()=>k(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 ug(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 fg(r){const n=ug(r);return!n||typeof n.exp!="number"?null:n.exp}function If(r,n=0){const s=fg(r);return s===null?!0:Date.now()/1e3>=s-n}const Sf="/api";let Gs=null;function uc(r){Gs=r}function hg(){return Gs}async function i0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${Sf}/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 Xe(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Gs){if(If(Gs)){Ys||(Ys=i0().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(`${Sf}${r}`,{...n,headers:s});if(a.status===401&&Gs){Ys||(Ys=i0().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(`${Sf}${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 dg=N.createContext(null),nv=300;function of(r,n){if(If(r))return null;const s=ug(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 sv({children:r}){const[n,s]=N.useState(()=>{const S=sessionStorage.getItem("lt_token");return S?If(S)?(sessionStorage.removeItem("lt_token"),null):(uc(S),of(S)):null}),a=N.useRef(void 0),c=N.useCallback(S=>{clearTimeout(a.current);const j=fg(S);if(!j)return;const z=(j-nv)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{const k=sessionStorage.getItem("lt_credentials");if(k)try{const{username:H,password:ee}=JSON.parse(k),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((S,j,z)=>{const k={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(j==null?void 0:j.username)??null},H=of(S,k);H&&(uc(S),sessionStorage.setItem("lt_token",S),sessionStorage.setItem("lt_user_info",JSON.stringify(k)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(H),c(S))},[c]),h=N.useCallback(()=>{clearTimeout(a.current),uc(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),s(null)},[]);N.useEffect(()=>{const S=()=>h(),j=z=>{var ee;const k=(ee=z.detail)==null?void 0:ee.token;if(!k)return;const H=of(k);H&&(uc(k),sessionStorage.setItem("lt_token",k),s(H),c(k))};return window.addEventListener("auth:unauthorized",S),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",S),window.removeEventListener("auth:refreshed",j)}},[h,c]),N.useEffect(()=>{const S=sessionStorage.getItem("lt_token");return S&&n&&c(S),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(S=>S.type==="superadmin"))??!1,g=N.useCallback(S=>(n==null?void 0:n.roles.some(j=>j.role===S))??!1,[n]),y=N.useCallback(S=>(n==null?void 0:n.roles.some(j=>j.type===S))??!1,[n]),A=(n==null?void 0:n.roles.map(S=>S.role))??[];return p.jsx(dg.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(dg);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 iv(...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 ka(...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]:iv(...n)}function r0(r){return!r||r.length===0?"":Wt.decode(r)}const a0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",l0=36,rv=0xcfd41b9100000,c0=33,av=333,o0=22;function lv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function cv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):lv(r)}class ov{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(o0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*rv),this.inc=Math.floor(Math.random()*(av-c0)+c0)}setPre(){const n=new Uint8Array(12);cv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=a0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=o0-1;s>=12;s--)this.buf[s]=a0.charCodeAt(n%l0),n=Math.floor(n/l0)}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 Xs=new ov;var cs;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(cs||(cs={}));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 uv(r){return typeof r.code=="string"}class mg{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 fv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const fv=new mg;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=mg.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 Ma;(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"})(Ma||(Ma={}));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 os(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}.${Xs.next()}`}const Ef="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 fc(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 pg(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 hv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Xf(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 hv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Kf(r){return Math.floor(r/1e6)}function u0(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 us(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 uf="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
- `),f=c[0];if(f!==uf){let h=f.replace(uf,"").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=uf;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
- ${s}: ${a[c]}`;return`${n}\r
29
- \r
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=u0(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=u0(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 Af(){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 gg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?oe.errorForCode(se.NoResponders):null}class Zf{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(Zf,"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
- `,"\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=dv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function dv(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 Of(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function jf(r){var n;return Of(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function mv(r,n,s){const a=us(r,n),c={hdr:1,sid:0,size:0},f=new Zf(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?yg(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 pv(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 yg(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 Wf{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 Tf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Tf||(Tf={}));var qa;(function(r){r.Old="old",r.New="new"})(qa||(qa={}));var Nf;(function(r){r.File="file",r.Memory="memory"})(Nf||(Nf={}));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 gv(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 f0;(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"})(f0||(f0={}));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 h0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(h0||(h0={}));const Zt="KV_";class yv{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=gv("",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 yv(r)}function d0(r){return typeof r.getOpts=="function"}class bv{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(bv.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 xv(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 vv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},wa=vv.performance||{};wa.now||wa.mozNow||wa.msNow||wa.oNow||wa.webkitNow;var m0={versions:{}},_v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wv(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 ff,Hc={exports:{}},p0={},g0=wv(xv({__proto__:null,default:p0},[p0]));ff=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&&m0.versions&&m0.versions.node;c?s=_v:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&ff.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],S=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(M){return Object.prototype.toString.call(M)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(M){return typeof M=="object"&&M.buffer&&M.buffer.constructor===ArrayBuffer});var z=function(M,X){return function(ie){return new W(X,!0).update(ie)[M]()}},k=function(M){var X=z("hex",M);c&&(X=H(X,M)),X.create=function(){return new W(M)},X.update=function(Q){return X.create().update(Q)};for(var ie=0;ie<S.length;++ie){var Z=S[ie];X[Z]=z(Z,M)}return X},H=function(M,X){var ie,Z=g0,Q=g0.Buffer,K=X?"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"):M(ae)}},ee=function(M,X){return function(ie,Z){return new me(ie,X,!0).update(Z)[M]()}},ne=function(M){var X=ee("hex",M);X.create=function(Q){return new me(Q,M)},X.update=function(Q,K){return X.create(Q).update(K)};for(var ie=0;ie<S.length;++ie){var Z=S[ie];X[Z]=ee(Z,M)}return X};function W(M,X){X?(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],M?(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=M}function me(M,X,ie){var Z,Q=typeof M;if(Q==="string"){var K,ae=[],re=M.length,qe=0;for(Z=0;Z<re;++Z)(K=M.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&M.charCodeAt(++Z)),ae[qe++]=240|K>>>18,ae[qe++]=128|K>>>12&63,ae[qe++]=128|K>>>6&63,ae[qe++]=128|63&K);M=ae}else{if(Q!=="object")throw new Error(r);if(M===null)throw new Error(r);if(h&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||h&&ArrayBuffer.isView(M)))throw new Error(r)}M.length>64&&(M=new W(X,!0).update(M).array());var Ge=[],Le=[];for(Z=0;Z<64;++Z){var Y=M[Z]||0;Ge[Z]=92^Y,Le[Z]=54^Y}W.call(this,X,ie),this.update(Le),this.oKeyPad=Ge,this.inner=!0,this.sharedMemory=ie}W.prototype.update=function(M){if(!this.finalized){var X,ie=typeof M;if(ie!=="string"){if(ie!=="object")throw new Error(r);if(M===null)throw new Error(r);if(h&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||h&&ArrayBuffer.isView(M)))throw new Error(r);X=!0}for(var Z,Q,K=0,ae=M.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),X)for(Q=this.start;K<ae&&Q<64;++K)re[Q>>>2]|=M[K]<<y[3&Q++];else for(Q=this.start;K<ae&&Q<64;++K)(Z=M.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&M.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 M=this.blocks,X=this.lastByteIndex;M[16]=this.block,M[X>>>2]|=g[3&X],this.block=M[16],X>=56&&(this.hashed||this.hash(),M[0]=this.block,M[16]=M[1]=M[2]=M[3]=M[4]=M[5]=M[6]=M[7]=M[8]=M[9]=M[10]=M[11]=M[12]=M[13]=M[14]=M[15]=0),M[14]=this.hBytes<<3|this.bytes>>>29,M[15]=this.bytes<<3,this.hash()}},W.prototype.hash=function(){var M,X,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(M=16;M<64;++M)X=((Q=_e[M-15])>>>7|Q<<25)^(Q>>>18|Q<<14)^Q>>>3,ie=((Q=_e[M-2])>>>17|Q<<15)^(Q>>>19|Q<<13)^Q>>>10,_e[M]=_e[M-16]+X+_e[M-7]+ie|0;for(qe=Le&Y,M=0;M<64;M+=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):(X=(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[M]+_e[M])|0,te=Q+(X+Z)|0),X=(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[M+1]+_e[M+1])|0,X=((Y=Q+(X+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[M+2]+_e[M+2])|0,X=((Le=Q+(X+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[M+3]+_e[M+3])|0,Ge=Q+(X+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 M=this.h0,X=this.h1,ie=this.h2,Z=this.h3,Q=this.h4,K=this.h5,ae=this.h6,re=this.h7,qe=d[M>>>28&15]+d[M>>>24&15]+d[M>>>20&15]+d[M>>>16&15]+d[M>>>12&15]+d[M>>>8&15]+d[M>>>4&15]+d[15&M]+d[X>>>28&15]+d[X>>>24&15]+d[X>>>20&15]+d[X>>>16&15]+d[X>>>12&15]+d[X>>>8&15]+d[X>>>4&15]+d[15&X]+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 M=this.h0,X=this.h1,ie=this.h2,Z=this.h3,Q=this.h4,K=this.h5,ae=this.h6,re=this.h7,qe=[M>>>24&255,M>>>16&255,M>>>8&255,255&M,X>>>24&255,X>>>16&255,X>>>8&255,255&X,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 M=new ArrayBuffer(this.is224?28:32),X=new DataView(M);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),M},me.prototype=new W,me.prototype.finalize=function(){if(W.prototype.finalize.call(this),this.inner){this.inner=!1;var M=this.array();W.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(M),W.prototype.finalize.call(this)}};var be=k();be.sha256=be,be.sha224=k(!0),be.sha256.hmac=ne(),be.sha224.hmac=ne(!0),f?ff.exports=be:(s.sha256=be.sha256,s.sha224=be.sha224)})();Hc.exports;Hc.exports.sha224;var y0=Hc.exports.sha256;function Cf(r){return Tv(r)}function Sv(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 Ev(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Av(r){return Sv(r)?"hex":Ev(r)?"b64":""}function Ov(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 jv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Tv(r){switch(Av(r)){case"hex":return Ov(r);case"b64":return jv(r)}return null}function Nv(r,n){const s=typeof r=="string"?Cf(r):r,a=typeof n=="string"?Cf(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 bg{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=Xs.next(),a&&(this.ctx=new Error)}}class Cv extends bg{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
-
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 xg extends bg{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
-
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 kv="$JS.API";function Mv(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Bc({apiPrefix:kv,timeout:5e3},r)}class Pa{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=Mv(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=Xf();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=yg(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 kf(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 Rv{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:kf(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)),kf(this.server,n)>=0}}class kc extends Pa{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,k=z.indexOf("cannot contain");throw k!==-1?new Error(`consumer 'name' ${z.substring(k)}`):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 Dv 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,S)=>{this.callback(A,S)};if(c.callback){const A=c.callback;f=(S,j)=>{const[z,k]=this.adapter(S,j);if(z){A(z,null);return}const{ingest:H}=this.ingestionFilterFn?this.ingestionFilterFn(k,this):{ingest:!0};H&&(!this.protocolFilterFn||this.protocolFilterFn(k))&&(A(z,k),this.dispatchedFn&&k&&this.dispatchedFn(k))}}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 zv(r){en=r}function vg(){return en!==void 0&&en.defaultPort!==void 0?en.defaultPort:4222}function hf(){return en!==void 0&&en.urlParseFn?en.urlParseFn:void 0}function qv(){if(!en||typeof en.factory!="function")throw new Error("transport fn is not set");return en.factory()}function Mf(){return en!==void 0&&en.dnsResolveFn?en.dnsResolveFn:void 0}const vc=`\r
37
- `,Mc=Er.fromAscii(vc),Uv=new Uint8Array(Mc)[0],Bv=new Uint8Array(Mc)[1];function Lv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Uv&&r[s]===Bv)return s+1}return 0}function Hv(r){const n=Lv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return Wt.decode(a)}return""}const Pv=4,_g=48,Yv=65,$v=97;function Gv(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 Rf(r){return Vv(r)!==void 0}function Vv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return wg(r);case":":return Fv(r)}}function wg(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}=Jv(r);if(!f||a>255)return;r=r.substring(c),n[s]=a}return Gv(n[0],n[1],n[2],n[3])}function Fv(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}=Qv(r);if(!h||c>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=wg(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+=Pv;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 Jv(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)-_g),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 Qv(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)-_g;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-$v+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Yv+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 Iv(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Df(r){return!Iv(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 Kv(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=Xv(r),Df(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Df(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 Ra{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=Kv(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(Rf(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}://${Df(c)?"["+c+"]":c}`);h.port=`${this.port}`;const d=new Ra(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&pg(s),this.resolves=s,s}}class Zv{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=hf();n&&(n.forEach(c=>{c=a?a(c):c,this.servers.push(new Ra(c))}),this.randomize&&(this.servers=pg(this.servers))),this.servers.length===0&&this.addServer(`${Ef}:${vg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Rf(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=hf();n=a?a(n):n;const c=new Ra(n,s);Rf(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=hf(),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 Ra(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 Wv{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${os(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=gg(s)),c.resolver(n,s))}}}close(){const n=oe.errorForCode(se.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class e1{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 t1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function n1(r,n="Assertion failed."){if(!r)throw new t1(n)}const b0=32*1024,df=2**32-2;function hc(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 mf{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){n1(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=hc(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 hc(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)hc(this._buf.subarray(this._off),this._buf);else{if(c+n>df)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*c+n,df));hc(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,df)),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(b0);for(;;){const c=this.capacity-this.length<b0,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 x0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const s1=48;class v0{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=x0();break;case ce.H:case ce.h:this.state=le.OP_H,this.hdr=0,this.ma=x0();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 mf(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new mf(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 mf(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]-s1)}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,w){this.hi=x|0,this.lo=w|0},s=function(x){var w,_=new Float64Array(16);if(x)for(w=0;w<x.length;w++)_[w]=x[w];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]),S=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 k(x,w){return x<<w|x>>>32-w}function H(x,w){var _=x[w+3]&255;return _=_<<8|x[w+2]&255,_=_<<8|x[w+1]&255,_<<8|x[w+0]&255}function ee(x,w){var _=x[w]<<24|x[w+1]<<16|x[w+2]<<8|x[w+3],E=x[w+4]<<24|x[w+5]<<16|x[w+6]<<8|x[w+7];return new n(_,E)}function ne(x,w,_){var E;for(E=0;E<4;E++)x[w+E]=_&255,_>>>=8}function W(x,w,_){x[w]=_.hi>>24&255,x[w+1]=_.hi>>16&255,x[w+2]=_.hi>>8&255,x[w+3]=_.hi&255,x[w+4]=_.lo>>24&255,x[w+5]=_.lo>>16&255,x[w+6]=_.lo>>8&255,x[w+7]=_.lo&255}function me(x,w,_,E,T){var D,F=0;for(D=0;D<T;D++)F|=x[w+D]^_[E+D];return(1&F-1>>>8)-1}function be(x,w,_,E){return me(x,w,_,E,16)}function M(x,w,_,E){return me(x,w,_,E,32)}function X(x,w,_,E,T){var D=new Uint32Array(16),F=new Uint32Array(16),I=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(w,4*V),F[11+V]=H(_,16+4*V);for(V=0;V<16;V++)I[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]^=k(L[0]+L[3]|0,7),L[2]^=k(L[1]+L[0]|0,9),L[3]^=k(L[2]+L[1]|0,13),L[0]^=k(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]+I[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(w,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]+I[V]|0)}function ie(x,w,_,E){return X(x,w,_,E,!1),0}function Z(x,w,_,E){return X(x,w,_,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,w,_,E,T,D,F){var I=new Uint8Array(16),L=new Uint8Array(64),V,ue;if(!T)return 0;for(ue=0;ue<16;ue++)I[ue]=0;for(ue=0;ue<8;ue++)I[ue]=D[ue];for(;T>=64;){for(ie(L,I,F,Q),ue=0;ue<64;ue++)x[w+ue]=(_?_[E+ue]:0)^L[ue];for(V=1,ue=8;ue<16;ue++)V=V+(I[ue]&255)|0,I[ue]=V&255,V>>>=8;T-=64,w+=64,_&&(E+=64)}if(T>0)for(ie(L,I,F,Q),ue=0;ue<T;ue++)x[w+ue]=(_?_[E+ue]:0)^L[ue];return 0}function ae(x,w,_,E,T){return K(x,w,null,0,_,E,T)}function re(x,w,_,E,T){var D=new Uint8Array(32);return Z(D,E,T,Q),ae(x,w,_,E.subarray(16),D)}function qe(x,w,_,E,T,D,F){var I=new Uint8Array(32);return Z(I,D,F,Q),K(x,w,_,E,T,D.subarray(16),I)}function Ge(x,w){var _,E=0;for(_=0;_<17;_++)E=E+(x[_]+w[_]|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,w,_,E,T,D){var F,I,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),I=0;I<17;I++)for(ue[I]=0,L=0;L<17;L++)ue[I]=ue[I]+Ke[L]*(L<=I?Oe[I-L]:320*Oe[I+17-L]|0)|0|0;for(I=0;I<17;I++)Ke[I]=ue[I];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[w+L]=Ke[L];return 0}function te(x,w,_,E,T,D){var F=new Uint8Array(16);return Y(F,0,_,E,T,D),be(x,w,F,0)}function he(x,w,_,E,T){var D;if(_<32)return-1;for(qe(x,0,w,0,_,E,T),Y(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function ve(x,w,_,E,T){var D,F=new Uint8Array(32);if(_<32||(re(F,0,32,E,T),te(w,16,w,32,_-32,F)!==0))return-1;for(qe(x,0,w,0,_,E,T),D=0;D<32;D++)x[D]=0;return 0}function ye(x,w){var _;for(_=0;_<16;_++)x[_]=w[_]|0}function je(x){var w,_;for(_=0;_<16;_++)x[_]+=65536,w=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=w-1+37*(w-1)*(_===15?1:0),x[_]-=w*65536}function _e(x,w,_){for(var E,T=~(_-1),D=0;D<16;D++)E=T&(x[D]^w[D]),x[D]^=E,w[D]^=E}function Te(x,w){var _,E,T,D=s(),F=s();for(_=0;_<16;_++)F[_]=w[_];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,w){var _=new Uint8Array(32),E=new Uint8Array(32);return Te(_,x),Te(E,w),M(_,0,E,0)}function Pt(x){var w=new Uint8Array(32);return Te(w,x),w[0]&1}function sn(x,w){var _;for(_=0;_<16;_++)x[_]=w[2*_]+(w[2*_+1]<<8);x[15]&=32767}function Ot(x,w,_){var E;for(E=0;E<16;E++)x[E]=w[E]+_[E]|0}function jt(x,w,_){var E;for(E=0;E<16;E++)x[E]=w[E]-_[E]|0}function we(x,w,_){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]+=w[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,w){we(x,w,w)}function Zs(x,w){var _=s(),E;for(E=0;E<16;E++)_[E]=w[E];for(E=253;E>=0;E--)Tt(_,_),E!==2&&E!==4&&we(_,_,w);for(E=0;E<16;E++)x[E]=_[E]}function ji(x,w){var _=s(),E;for(E=0;E<16;E++)_[E]=w[E];for(E=250;E>=0;E--)Tt(_,_),E!==1&&we(_,_,w);for(E=0;E<16;E++)x[E]=_[E]}function Ws(x,w,_){var E=new Uint8Array(32),T=new Float64Array(80),D,F,I=s(),L=s(),V=s(),ue=s(),Oe=s(),Ke=s();for(F=0;F<31;F++)E[F]=w[F];for(E[31]=w[31]&127|64,E[0]&=248,sn(T,_),F=0;F<16;F++)L[F]=T[F],ue[F]=I[F]=V[F]=0;for(I[0]=ue[0]=1,F=254;F>=0;--F)D=E[F>>>3]>>>(F&7)&1,_e(I,L,D),_e(V,ue,D),Ot(Oe,I,V),jt(I,I,V),Ot(V,L,ue),jt(L,L,ue),Tt(ue,Oe),Tt(Ke,I),we(I,V,I),we(V,L,Oe),Ot(Oe,I,V),jt(I,I,V),Tt(L,I),jt(V,ue,Ke),we(I,V,g),Ot(I,I,ue),we(V,V,I),we(I,ue,Ke),we(ue,L,T),Tt(L,Oe),_e(I,L,D),_e(V,ue,D);for(F=0;F<16;F++)T[F+16]=I[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,w){return Ws(x,w,f)}function Ti(x,w){return a(w,32),rn(x,w)}function hs(x,w,_){var E=new Uint8Array(32);return Ws(E,_,w),Z(x,c,E,Q)}var Ga=he,Va=ve;function jr(x,w,_,E,T,D){var F=new Uint8Array(32);return hs(F,T,D),Ga(x,w,_,E,F)}function Tr(x,w,_,E,T,D){var F=new Uint8Array(32);return hs(F,T,D),Va(x,w,_,E,F)}function Pn(){var x=0,w=0,_=0,E=0,T=65535,D,F,I;for(I=0;I<arguments.length;I++)D=arguments[I].lo,F=arguments[I].hi,x+=D&T,w+=D>>>16,_+=F&T,E+=F>>>16;return w+=x>>>16,_+=w>>>16,E+=_>>>16,new n(_&T|E<<16,x&T|w<<16)}function Fa(x,w){return new n(x.hi>>>w,x.lo>>>w|x.hi<<32-w)}function Ni(){var x=0,w=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,w^=arguments[_].hi;return new n(w,x)}function et(x,w){var _,E,T=32-w;return w<32?(_=x.hi>>>w|x.lo<<T,E=x.lo>>>w|x.hi<<T):w<64&&(_=x.lo>>>w|x.hi<<T,E=x.hi>>>w|x.lo<<T),new n(_,E)}function Fc(x,w,_){var E=x.hi&w.hi^~x.hi&_.hi,T=x.lo&w.lo^~x.lo&_.lo;return new n(E,T)}function Ja(x,w,_){var E=x.hi&w.hi^x.hi&_.hi^w.hi&_.hi,T=x.lo&w.lo^x.lo&_.lo^w.lo&_.lo;return new n(E,T)}function Qa(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),Fa(x,7))}function Ia(x){return Ni(et(x,19),et(x,61),Fa(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,w,_){var E=[],T=[],D=[],F=[],I,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(w,8*L+ue);for(L=0;L<80;L++){for(V=0;V<8;V++)T[V]=D[V];for(I=Pn(D[7],Ci(D[4]),Fc(D[4],D[5],D[6]),Qc[L],F[L%16]),T[7]=Pn(I,Qa(D[0]),Ja(D[0],D[1],D[2])),T[3]=Pn(T[3],I),V=0;V<8;V++)D[(V+1)%8]=T[V];if(L%16===15)for(V=0;V<16;V++)F[V]=Pn(F[V],F[(V+9)%16],Jc(F[(V+1)%16]),Ia(F[(V+14)%16]))}for(L=0;L<8;L++)D[L]=Pn(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,w,_){var E=new Uint8Array(64),T=new Uint8Array(256),D,F=_;for(D=0;D<64;D++)E[D]=ei[D];for(Xa(E,w,_),_%=128,D=0;D<256;D++)T[D]=0;for(D=0;D<_;D++)T[D]=w[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,w){var _=s(),E=s(),T=s(),D=s(),F=s(),I=s(),L=s(),V=s(),ue=s();jt(_,x[1],x[0]),jt(ue,w[1],w[0]),we(_,_,ue),Ot(E,x[0],x[1]),Ot(ue,w[0],w[1]),we(E,E,ue),we(T,x[3],w[3]),we(T,T,A),we(D,x[2],w[2]),Ot(D,D,D),jt(F,E,_),jt(I,D,T),Ot(L,D,T),Ot(V,E,_),we(x[0],F,I),we(x[1],V,L),we(x[2],L,I),we(x[3],F,V)}function Nt(x,w,_){var E;for(E=0;E<4;E++)_e(x[E],w[E],_)}function Nr(x,w){var _=s(),E=s(),T=s();Zs(T,w[2]),we(_,w[0],T),we(E,w[1],T),Te(x,E),x[31]^=Pt(_)<<7}function Cr(x,w,_){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,w,E),Yt(w,x),Yt(x,x),Nt(x,w,E)}function ki(x,w){var _=[s(),s(),s(),s()];ye(_[0],S),ye(_[1],j),ye(_[2],d),we(_[3],S,j),Cr(x,_,w)}function ds(x,w,_){var E=new Uint8Array(64),T=[s(),s(),s(),s()],D;for(_||a(w,32),ct(E,w,32),E[0]&=248,E[31]&=127,E[31]|=64,ki(T,E),Nr(x,T),D=0;D<32;D++)w[D+32]=x[D];return 0}var Yn=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,w){var _,E,T,D;for(E=63;E>=32;--E){for(_=0,T=E-32,D=E-12;T<D;++T)w[T]+=_-16*w[E]*Yn[T-(E-32)],_=Math.floor((w[T]+128)/256),w[T]-=_*256;w[T]+=_,w[E]=0}for(_=0,T=0;T<32;T++)w[T]+=_-(w[31]>>4)*Yn[T],_=w[T]>>8,w[T]&=255;for(T=0;T<32;T++)w[T]-=_*Yn[T];for(E=0;E<32;E++)w[E+1]+=w[E]>>8,x[E]=w[E]&255}function xn(x){var w=new Float64Array(64),_;for(_=0;_<64;_++)w[_]=x[_];for(_=0;_<64;_++)x[_]=0;ms(x,w)}function ti(x,w,_,E){var T=new Uint8Array(64),D=new Uint8Array(64),F=new Uint8Array(64),I,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(I=0;I<_;I++)x[64+I]=w[I];for(I=0;I<32;I++)x[32+I]=T[32+I];for(ct(F,x.subarray(32),_+32),xn(F),ki(ue,F),Nr(x,ue),I=32;I<64;I++)x[I]=E[I];for(ct(D,x,_+64),xn(D),I=0;I<64;I++)V[I]=0;for(I=0;I<32;I++)V[I]=F[I];for(I=0;I<32;I++)for(L=0;L<32;L++)V[I+L]+=D[I]*T[L];return ms(x.subarray(32),V),Oe}function ni(x,w){var _=s(),E=s(),T=s(),D=s(),F=s(),I=s(),L=s();return ye(x[2],d),sn(x[1],w),Tt(T,x[1]),we(D,T,y),jt(T,T,x[2]),Ot(D,x[2],D),Tt(F,D),Tt(I,F),we(L,I,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])===w[31]>>7&&jt(x[0],h,x[0]),we(x[3],x[0],x[1]),0)}function kr(x,w,_,E){var T,D=new Uint8Array(32),F=new Uint8Array(64),I=[s(),s(),s(),s()],L=[s(),s(),s(),s()];if(_<64||ni(L,E))return-1;for(T=0;T<_;T++)x[T]=w[T];for(T=0;T<32;T++)x[T+32]=E[T];if(ct(F,x,_),xn(F),Cr(I,L,F),ki(L,w.subarray(32)),Yt(I,L),Nr(D,I),_-=64,M(w,0,D,0)){for(T=0;T<_;T++)x[T]=0;return-1}for(T=0;T<_;T++)x[T]=w[T+64];return _}var Mi=32,ps=24,vn=32,gs=16,ys=32,si=32,bs=32,$n=32,ii=32,Mr=ps,Ka=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:M,crypto_secretbox:he,crypto_secretbox_open:ve,crypto_scalarmult:Ws,crypto_scalarmult_base:rn,crypto_box_beforenm:hs,crypto_box_afternm:Ga,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:$n,crypto_box_BEFORENMBYTES:ii,crypto_box_NONCEBYTES:Mr,crypto_box_ZEROBYTES:Ka,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:Yn,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 Za(x,w){if(x.length!==Mi)throw new Error("bad key size");if(w.length!==ps)throw new Error("bad nonce size")}function Wa(x,w){if(x.length!==bs)throw new Error("bad public key size");if(w.length!==$n)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 w=0;w<x.length;w++)x[w]=0}r.randomBytes=function(x){var w=new Uint8Array(x);return a(w,x),w},r.secretbox=function(x,w,_){yt(x,w,_),Za(_,w);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,w,_),T.subarray(gs)},r.secretbox.open=function(x,w,_){yt(x,w,_),Za(_,w);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,w,_)!==0?null:T.subarray(vn)},r.secretbox.keyLength=Mi,r.secretbox.nonceLength=ps,r.secretbox.overheadLength=gs,r.scalarMult=function(x,w){if(yt(x,w),x.length!==si)throw new Error("bad n size");if(w.length!==ys)throw new Error("bad p size");var _=new Uint8Array(ys);return Ws(_,x,w),_},r.scalarMult.base=function(x){if(yt(x),x.length!==si)throw new Error("bad n size");var w=new Uint8Array(ys);return rn(w,x),w},r.scalarMult.scalarLength=si,r.scalarMult.groupElementLength=ys,r.box=function(x,w,_,E){var T=r.box.before(_,E);return r.secretbox(x,w,T)},r.box.before=function(x,w){yt(x,w),Wa(x,w);var _=new Uint8Array(ii);return hs(_,x,w),_},r.box.after=r.secretbox,r.box.open=function(x,w,_,E){var T=r.box.before(_,E);return r.secretbox.open(x,w,T)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(bs),w=new Uint8Array($n);return Ti(x,w),{publicKey:x,secretKey:w}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==$n)throw new Error("bad secret key size");var w=new Uint8Array(bs);return rn(w,x),{publicKey:w,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=bs,r.box.secretKeyLength=$n,r.box.sharedKeyLength=ii,r.box.nonceLength=Mr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,w){if(yt(x,w),w.length!==$t)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return ti(_,x,x.length,w),_},r.sign.open=function(x,w){if(yt(x,w),w.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),E=kr(_,x,x.length,w);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,w){for(var _=r.sign(x,w),E=new Uint8Array(Qe),T=0;T<E.length;T++)E[T]=_[T];return E},r.sign.detached.verify=function(x,w,_){if(yt(x,w,_),w.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]=w[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),w=new Uint8Array($t);return ds(x,w),{publicKey:x,secretKey:w}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==$t)throw new Error("bad secret key size");for(var w=new Uint8Array(it),_=0;_<w.length;_++)w[_]=x[32+_];return{publicKey:w,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==ri)throw new Error("bad seed size");for(var w=new Uint8Array(it),_=new Uint8Array($t),E=0;E<32;E++)_[E]=x[E];return ds(w,_,!0),{publicKey:w,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=$t,r.sign.seedLength=ri,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var w=new Uint8Array(Rr);return ct(w,x,x.length),w},r.hash.hashLength=Rr,r.verify=function(x,w){return yt(x,w),x.length===0||w.length===0||x.length!==w.length?!1:me(x,0,w,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 w=65536;r.setPRNG(function(_,E){var T,D=new Uint8Array(E);for(T=0;T<E;T+=w)x.getRandomValues(D.subarray(T,T+Math.min(E-T,w)));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 dc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;dc.sign.keyPair.fromSeed,dc.sign.detached,dc.sign.detached.verify,dc.randomBytes;var _0;(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"})(_0||(_0={}));var w0;(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"})(w0||(w0={}));function i1(r){return n=>{let s={};return r.forEach(a=>{const c=a(n)||{};s=Object.assign(s,c)}),s}}function r1(){return()=>{}}function a1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function l1(r){return()=>({auth_token:typeof r=="function"?r():r})}const Sg=120*1e3,c1=2,Eg=2*1e3;function o1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Sg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Eg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function u1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(l1(r.token)),r.user&&n.push(a1(r.user,r.pass)),n.length===0?r1():i1(n)}function f1(r){const n=`${Ef}:${vg()}`;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=[`${Ef}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Bc(o1(),r);if(s.authenticator=u1(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{os(s.inboxPrefix)}catch(a){throw new oe(a.message,se.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Mf()=="function"),s.resolve&&typeof Mf()!="function")throw new oe("'resolve' is not supported on this client",se.InvalidOption);return s}function h1(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 d1=1024*32,m1=/^INFO\s+([^\r\n]+)\r\n/i,p1=ka(`PONG\r
38
- `),S0=ka(`PING\r
39
- `);class g1{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 Ag 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 y1{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=d1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new y1,this.muxSubscriptions=new Wv,this.outbound=new Er,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Rv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new Zv(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new v0(this),this.heartbeats=new e1(this,this.options.pingInterval||Sg,this.options.maxPingOut||c1)}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 v0(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=qv(),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:cs.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:cs.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:Mf(),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():Eg;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 Zf(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=r0(n),a=Rc.toError(s),c={type:cs.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(p1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(r0(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 g1({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(ka(`CONNECT ${g}${vc}`)),this.transport.send(S0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:cs.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:cs.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=ka(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
- `:g=`HPUB ${n} ${d} ${f}\r
41
- `,this.sendCommand(g,h,c,Mc)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
42
- `:g=`PUB ${n} ${f}\r
43
- `,this.sendCommand(g,c,Mc))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
44
- `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
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
- `):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(S0),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}${vc}`):n.push(`SUB ${a.subject} ${a.sid}${vc}`)}),n.length&&this.transport.send(ka(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 Ag(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 b1="$SRV";class E0{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||us(),(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 Ua{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&v1("service group",s);let c="";if(n instanceof Ya)this.srv=n,c="";else if(n instanceof Ua){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,x1("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 Ua(this,n,s)}}function x1(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 v1(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 Ya{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=Xs.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??b1;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=us();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 _1(c,f,a),d.queue=a;const g=h?(y,A)=>{if(y){this.close(y);return}const S=Date.now();try{h(y,new E0(A))}catch(j){d.stats.countError(j),A==null||A.respond(tn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(S)}}: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:Ma.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:Ma.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=Ya.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:Ma.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 Ua(this,n,s)}addEndpoint(n,s){return new Ua(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 E0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class _1{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 w1{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=Ya.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 Og(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function S1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Og(),storage:Nf.File}}const Dc="KV-Operation",A0="$KV",E1=/^[-/=.\w]+$/,A1=/^[-/=.>*\w]+$/,O1=/^[-\w]+$/;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(".")||!A1.test(r))throw new Error(`invalid key: ${r}`)}function N1(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 _c(r){if(!O1.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 Ba{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",j1);v(this,"validateSearchKey",T1);v(this,"hasWildcards",N1);_c(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=A0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){_c(s);const c=await n.jetstreamManager(),f=new Ba(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}};_c(s);const h=new Ba(s,n,c);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Og(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(S1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Tf.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 S=Object.assign({},n.mirror);S.name.startsWith(Zt)||(S.name=`${Zt}${S.name}`),a.mirror=S,a.mirror_direct=!0}else if(n.sources){const S=n.sources.map(j=>{const z=Object.assign({},j),k=z.name.startsWith(Zt)?z.name.substring(Zt.length):z.name;return z.name.startsWith(Zt)||(z.name=`${Zt}${z.name}`),!j.external&&k!==this.bucket&&(z.subject_transforms=[{src:`$KV.${k}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=S,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?kf(h,Si("2.7.2"))>=0:!1;a.discard=d?qa.New:qa.Old;const{ok:g,min:y}=f.features.get(ze.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const S=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${S} - 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(S){if(S.message==="stream not found")A=await this.jsm.streams.add(a);else throw S}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}`:`${A0}.${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 G1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new V1(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=us();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=us();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((S,j)=>{if(S){a.stop(S);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:S}}=A,j=S.num_pending+S.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(S=>{a.stop(S)}),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,S=Qs(y);this.canSetWatcherName()&&S.consumerName(Xs.next()),S.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&S.startSequence(n.resumeFromRevision),S.orderedConsumer(),S.callback((z,k)=>{if(z){a.stop(z);return}if(k){const H=this.jmToEntry(k);if(h&&H.operation==="DEL")return;a.push(H),a.received++,d&&(g>0&&a.received>=g||k.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(A,S);if(d){const{info:{last:z}}=j,k=z.num_pending+z.delivered.consumer_seq;if(k===0||a.received>=k)try{d()}catch(H){a.stop(H)}finally{d=void 0}else g=k}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 S=this.decodeKey(y.subject.substring(this.prefixLen));s.push(S)}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 jg(c,s)}}class jg{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 Kf(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 eh="OBJ_",O0="SHA-256=";function C1(r){return _c(r),`${eh}${r}`}function k1(r){return r.startsWith(eh)?r.substring(4):r}class zf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return k1(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 mc(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 j0=Uint8Array.of(43,65,67,75),M1=Uint8Array.of(45,78,65,75),Sa=Uint8Array.of(43,87,80,73),R1=Uint8Array.of(43,78,88,84),D1=Uint8Array.of(43,84,69,82,77),z1=Uint8Array.of(32);function La(r,n=5e3){return new Z1(r,n)}class pf 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=os(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 S,j,z,k;if(g){this.stop(g);return}if((S=this.monitor)==null||S.work(),y.subject===this.inbox){if(jf(y))return;const H=(j=y.headers)==null?void 0:j.code,ee=((k=(z=y.headers)==null?void 0:z.description)==null?void 0:k.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(La(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 Wf(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 cs.Disconnect:(y=this.monitor)==null||y.cancel();break;case cs.Reconnect:this.resetPending().then(S=>{var j;S&&((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=Xf([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 q1 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 qf{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 pf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new pf(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 pf(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 U1{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=Xs.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;Xs.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=Xf([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let S=0;;S++)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,S),this.type===gn.Fetch||this.opts.abort_on_missing_resource===!0))return(A=this.iter)==null||A.stop(j),Promise.reject(j);if(s&&S>=this.maxInitialReset)throw j;await Ar(c.backoff(S+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 q1),this.consumer=new qf(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 Uf{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 qf(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 qf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new th(a.nc,a.opts).info(n).then(f=>Promise.resolve(new U1(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 Uf(new kc(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Uf(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 th extends Pa{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=mc(n.mirror),n.sources=(c=n.sources)==null?void 0:c.map(mc);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=mc(c.mirror),c.sources=(d=c.sources)==null?void 0:d.map(mc);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 S=0;for(;h>g;){S++,A.offset=d*S;const z=await this._request(a,A);h=z.total,y.push(z);const k=Object.getOwnPropertyNames(z.state.subjects).length;if(g+=k,k<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 Tg(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 jg(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(eh));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new zf(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 B1 extends Pa{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 Bf(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 S,j,z;let g=!1,y=!1,A;for await(const k of d){if(!g){g=!0;const H=((S=k.headers)==null?void 0:S.code)||0;if(H!==0&&H<200||H>299){A=(j=k.headers)==null?void 0:j.description.toLowerCase();break}if(((z=k.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){y=!0;break}}if(k.data.length===0)break;h.push(new Bf(k))}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 Bf{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(Bf,"jc");class L1 extends Pa{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new th(s,a),this.consumers=new kc(s,a),this.direct=new B1(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 Tg{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=us();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(Tg,"jc");class H1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Pc(this.api,s))}}class gf{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 T0(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 P1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Da{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 gf(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 zf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new zf(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:S,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const z=Xs.next(),k=this._chunkSubject(z),H=this._metaSubject(S),ee=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},T0(n)),ne=st(),W=[],me=new Er;try{const M=s?s.getReader():null,X=y0.create();for(;;){const{done:ie,value:Z}=M?await M.read():{done:!0,value:void 0};if(ie){if(me.size()>0){const re=me.drain();X.update(re),ee.chunks++,ee.size+=re.length,W.push(this.js.publish(k,re,{timeout:f}))}await Promise.all(W),W.length=0,ee.mtime=new Date().toISOString();const Q=vr.encode(X.digest());ee.digest=`${O0}${Q}`,ee.deleted=!1;const K=us();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 gf(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);X.update(Q),W.push(this.js.publish(k,Q,{timeout:f}))}}}catch(M){await this.jsm.streams.purge(this.stream,{filter:k}),ne.reject(M)}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 S=s.options.link.name||"";if(S==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Da.create(this.js,s.options.link.bucket):this).get(S)}if(!s.digest.startsWith(O0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Cf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const c=st(),f={info:new gf(s),error:c};if(s.size===0)return f.data=P1(),c.resolve(null),Promise.resolve(f);let h;const d=Qs();d.orderedConsumer();const g=y0.create(),y=`$O.${this.name}.C.${s.nuid}`,A=await this.js.subscribe(y,d);return(async()=>{for await(const S of A)S.data.length>0&&(g.update(S.data),h.enqueue(S.data)),S.info.pending===0&&(Nv(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(S=>{h.error(S),c.reject(S)}),f.data=new ReadableStream({start(S){h=S},cancel(){A.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Da))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=us();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,T0(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 S=f.decode(y.data);S.deleted&&n.ignoreDeletes===!0||a.push(S),((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=C1(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=qa.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 Da(s,c,n);return await f.init(a),Promise.resolve(f)}}class Y1{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?Ba.bind(this.js,n,s):Ba.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?Da.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class nh extends Pa{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 th(s,a),this.consumers=new Uf(this.consumerAPI),this.streams=new H1(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 Y1(this)}async publish(s,a=tn,c){c=c||{},c.expect=c.expect||{};const f=(c==null?void 0:c.headers)||us();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 S=this.parseJsResponse(A);if(S.stream==="")throw oe.errorForCode(se.JetStreamInvalidAck);return S.duplicate=S.duplicate?S.duplicate:!1,S}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 La(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 S=c.expires||0;if(S&&(A.expires=nt(S)),S===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,k=A.batch;let H=0;z.protocolFilterFn=(W,me=!1)=>jf(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||k===H||g>0&&d>=g)&&z.stop()}};const ee=os(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),uv(W)?z.stop(Cg(W)===null?void 0:W):z.stop(W)):(y==null||y.work(),z.received++,z.push(La(me,this.timeout)))}});return S&&(f=wr(S),f.catch(()=>{ne.isClosed()||(ne.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new Wf(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 F1(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 Ng(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=d0(a)?a.getOpts():a;if(c.isBind=d0(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=os(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||os(this.nc.options.inboxPrefix),c}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=J1(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=nh.ingestionFn(s.ordered),a.protocolFilterFn=(c,f=!1)=>{const h=c;return Of(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(),jf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Of(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class sh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=f1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const c=new sh(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 Ag(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(os(this.options.inboxPrefix),{callback:(k,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&&(k=oe.errorForCode(se.NoResponders)),k){g&&(k.stack+=`
48
-
49
- ${g}`),S(k);return}d(null,H),a.strategy===jn.Count&&(y--,y===0&&S()),a.strategy===jn.JitterTimer&&(z(),j=setTimeout(()=>{S()},300)),a.strategy===jn.SentinelMsg&&H&&H.data.length===0&&S()}});A.requestSubject=n,A.closed.then(()=>{h()}).catch(k=>{f.stop(k)});const S=k=>{k&&f.push(()=>{throw k}),z(),A.drain().then(()=>{h()}).catch(H=>{h()})};f.iterClosed.then(()=>{z(),A==null||A.unsubscribe()}).catch(k=>{z(),A==null||A.unsubscribe()});try{this.publish(n,s,{reply:A.getSubject()})}catch(k){S(k)}let j=setTimeout(()=>{S()},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 Cv(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:os(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
-
51
- ${d.stack}`),g.unsubscribe(),h.reject(y)):(y=gg(A),y?(d&&(y.stack+=`
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 xg(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 L1(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 nh(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 $1(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 $1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Ya(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new w1(this.nc,n,s)}}class G1{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 V1{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(Kf(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 Ng extends Dv{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=os(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Xs.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(Kf(s))}_setupHbMonitoring(s,a=0){const c={cancelAfter:0,maxOut:2};a&&(c.cancelAfter=a);const f=this.sub,h=d=>{var A,S,j,z;const g=mv(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 k=((j=(S=this.info)==null?void 0:S.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(k+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new Wf(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 F1 extends Ng{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}`,S=this.sub.subject;y.nc.publish(A,y.jc.encode(h),{reply:S})}}}function J1(r,n){return r?I1(n):Q1(n)}function Q1(r){return(n,s)=>n?[n,null]:(n=xr(s),n?[n,null]:[null,La(s,r)])}function I1(r){return(n,s)=>{if(n)return[n,null];const a=xr(s);return a!==null?[Cg(a),null]:[null,La(s,r)]}}function Cg(r){if(r!==null)switch(r.code){case se.JetStream404NoMessages:case se.JetStream408RequestTimeout:return null;case se.JetStream409:return pv(r)?r:null;default:return r}return null}function X1(r){r&&r.ack()}function K1(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 Z1{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=K1(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 xg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,j0,{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(j0)}nak(n){let s=M1;n&&(s=Af().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(R1,z1,c),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=D1;(n==null?void 0:n.length)>0&&(s=Af().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const W1="1.30.3",e_="nats.ws";class t_{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=W1,this.lang=e_,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=Hv(h);if(d!==""){const g=m1.exec(d);if(!g){s.debug&&console.error("!!!",fc(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);h1(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(`> ${fc(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(`< ${fc(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${fc(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 n_(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 s_(r={}){return zv({defaultPort:443,urlParseFn:n_,factory:()=>new t_}),sh.connect(r)}const i_="ws://localhost:9222",r_="dev_api_secret",a_="lt.events";function kg(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 l_(){const{connected:r}=N.useContext(Yc);return{connected:r}}function Mg(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 c_=N.createContext({connected:!1,subscribe:()=>()=>{}}),o_=Af();function u_({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 k=g.current;return k.has(j)||k.set(j,new Set),k.get(j).add(z),()=>{const H=k.get(j);H&&(H.delete(z),H.size===0&&k.delete(j))}},[]),A=N.useCallback((j,z)=>{for(const[k,H]of g.current)if(kg(j,k))for(const ee of H)try{ee(z)}catch{}},[]),S=N.useCallback(async()=>{try{if(a.current)return;const j=await s_({servers:n||i_,token:s||r_,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=j,h(!0);const z=j.subscribe("lt.>");c.current=z,(async()=>{for await(const k of z)try{const H=JSON.parse(o_.decode(k.data));A(k.subject,H)}catch{}})(),(async()=>{for await(const k of j.status())k.type==="disconnect"||k.type==="error"?h(!1):k.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(S,3e3)}},[A]);return N.useEffect(()=>(S(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[S]),p.jsx(c_.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 wc=Object.create(null);Object.keys(Bn).forEach(r=>{wc[Bn[r]]=r});const Lf={type:"error",data:"parser error"},Rg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Dg=typeof ArrayBuffer=="function",zg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,ih=({type:r,data:n},s,a)=>Rg&&n instanceof Blob?s?a(n):N0(n,a):Dg&&(n instanceof ArrayBuffer||zg(n))?s?a(n):N0(new Blob([n]),a):a(Bn[r]+(n||"")),N0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function C0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let yf;function f_(r,n){if(Rg&&r.data instanceof Blob)return r.data.arrayBuffer().then(C0).then(n);if(Dg&&(r.data instanceof ArrayBuffer||zg(r.data)))return n(C0(r.data));ih(r,!1,s=>{yf||(yf=new TextEncoder),n(yf.encode(s))})}const k0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Na=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<k0.length;r++)Na[k0.charCodeAt(r)]=r;const h_=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},d_=typeof ArrayBuffer=="function",rh=(r,n)=>{if(typeof r!="string")return{type:"message",data:qg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:m_(r.substring(1),n)}:wc[s]?r.length>1?{type:wc[s],data:r.substring(1)}:{type:wc[s]}:Lf},m_=(r,n)=>{if(d_){const s=h_(r);return qg(s,n)}else return{base64:!0,data:r}},qg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Ug="",p_=(r,n)=>{const s=r.length,a=new Array(s);let c=0;r.forEach((f,h)=>{ih(f,!1,d=>{a[h]=d,++c===s&&n(a.join(Ug))})})},g_=(r,n)=>{const s=r.split(Ug),a=[];for(let c=0;c<s.length;c++){const f=rh(s[c],n);if(a.push(f),f.type==="error")break}return a};function y_(){return new TransformStream({transform(r,n){f_(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 bf;function pc(r){return r.reduce((n,s)=>n+s.length,0)}function gc(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 b_(r,n){bf||(bf=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(pc(s)<1)break;const g=gc(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(pc(s)<2)break;const g=gc(s,2);c=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(pc(s)<8)break;const g=gc(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),A=y.getUint32(0);if(A>Math.pow(2,21)-1){d.enqueue(Lf);break}c=A*Math.pow(2,32)+y.getUint32(4),a=3}else{if(pc(s)<c)break;const g=gc(s,c);d.enqueue(rh(f?g:bf.decode(g),n)),a=0}if(c===0||c>r){d.enqueue(Lf);break}}}})}const Bg=4;function gt(r){if(r)return x_(r)}function x_(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")(),v_="arraybuffer";function Lg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const __=bn.setTimeout,w_=bn.clearTimeout;function Gc(r,n){n.useNativeTimers?(r.setTimeoutFn=__.bind(bn),r.clearTimeoutFn=w_.bind(bn)):(r.setTimeoutFn=bn.setTimeout.bind(bn),r.clearTimeoutFn=bn.clearTimeout.bind(bn))}const S_=1.33;function E_(r){return typeof r=="string"?A_(r):Math.ceil((r.byteLength||r.size)*S_)}function A_(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 Hg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function O_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function j_(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 T_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class ah 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 T_(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=rh(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=O_(n);return s.length?"?"+s:""}}class N_ extends ah{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)};g_(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,p_(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]=Hg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Pg=!1;try{Pg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const C_=Pg;function k_(){}class M_ extends N_{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=Lg(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=k_,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",M0);else if(typeof addEventListener=="function"){const r="onpagehide"in bn?"pagehide":"unload";addEventListener(r,M0,!1)}}function M0(){for(let r in Un.requests)Un.requests.hasOwnProperty(r)&&Un.requests[r].abort()}const R_=(function(){const r=Yg({xdomain:!1});return r&&r.responseType!==null})();class D_ extends M_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=R_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Un(Yg,this.uri(),n)}}function Yg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||C_))return new XMLHttpRequest}catch{}if(!n)try{return new bn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const $g=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class z_ extends ah{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=$g?{}:Lg(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;ih(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]=Hg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const xf=bn.WebSocket||bn.MozWebSocket;class q_ extends z_{createSocket(n,s,a){return $g?new xf(n,s,a):s?new xf(n,s):new xf(n)}doWrite(n,s){this.ws.send(s)}}class U_ extends ah{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=b_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),c=y_();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 B_={websocket:q_,webtransport:U_,polling:D_},L_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,H_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Hf(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=L_.exec(r||""),f={},h=14;for(;h--;)f[H_[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=P_(f,f.path),f.queryKey=Y_(f,f.query),f}function P_(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 Y_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,c,f){c&&(s[c]=f)}),s}const Pf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Sc=[];Pf&&addEventListener("offline",()=>{Sc.forEach(r=>r())},!1);class Is extends gt{constructor(n,s){if(super(),this.binaryType=v_,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=Hf(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=Hf(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=j_(this.opts.query)),Pf&&(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"})},Sc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Bg,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&&Is.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",Is.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+=E_(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(Is.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(),Pf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Sc.indexOf(this._offlineEventListener);a!==-1&&Sc.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Is.protocol=Bg;class $_ extends Is{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;Is.priorWebsocketSuccess=!1;const c=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",S=>{if(!a)if(S.type==="pong"&&S.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Is.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=S=>{const j=new Error("probe error: "+S);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(S){s&&S.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 G_=class extends $_{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=>B_[c]).filter(c=>!!c)),super(n,a)}};function V_(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=Hf(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 F_=typeof ArrayBuffer=="function",J_=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Gg=Object.prototype.toString,Q_=typeof Blob=="function"||typeof Blob<"u"&&Gg.call(Blob)==="[object BlobConstructor]",I_=typeof File=="function"||typeof File<"u"&&Gg.call(File)==="[object FileConstructor]";function lh(r){return F_&&(r instanceof ArrayBuffer||J_(r))||Q_&&r instanceof Blob||I_&&r instanceof File}function Ec(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(Ec(r[s]))return!0;return!1}if(lh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Ec(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&Ec(r[s]))return!0;return!1}function X_(r){const n=[],s=r.data,a=r;return a.data=Yf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Yf(r,n){if(!r)return r;if(lh(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]=Yf(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]=Yf(r[a],n));return s}return r}function K_(r,n){return r.data=$f(r.data,n),delete r.attachments,r}function $f(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]=$f(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=$f(r[s],n));return r}const Z_=["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 W_{constructor(n){this.replacer=n}encode(n){return(n.type===De.EVENT||n.type===De.ACK)&&Ec(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 ch 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 ew(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(lh(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(!tw(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(ch.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 R0(s);case De.DISCONNECT:return s===void 0;case De.CONNECT_ERROR:return typeof s=="string"||R0(s);case De.EVENT:case De.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Z_.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 ew{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=K_(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const tw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function R0(r){return Object.prototype.toString.call(r)==="[object Object]"}const nw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ch,Encoder:W_,get PacketType(){return De}},Symbol.toStringTag,{value:"Module"}));function On(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const sw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Vg 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(sw.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++,S=s.pop();this._registerAckCallback(A,S),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 Gf 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||nw;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 G_(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 Vg(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 Ac(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=V_(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 Gf(a,n):(Ea[c]||(Ea[c]=new Gf(a,n)),g=Ea[c]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(Ac,{Manager:Gf,Socket:Vg,io:Ac,connect:Ac});const iw=N.createContext({connected:!1,subscribe:()=>()=>{}});function rw({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(kg(d,y))for(const S of A)try{S(g)}catch{}},[]);return N.useEffect(()=>{const d=hg(),g=Ac({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 S=typeof A=="string"?JSON.parse(A):A;h(y,S)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),p.jsx(iw.Provider,{value:{connected:s,subscribe:f},children:p.jsx(Yc.Provider,{value:{connected:s,subscribe:f},children:r})})}function aw({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 S=y.events.natsWsUrl??null,j=null;const z=hg();if(z)try{const k=await fetch("/api/nats-credentials",{headers:{Authorization:`Bearer ${z}`}});if(k.ok){const H=await k.json();S=H.natsWsUrl??S,j=H.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}c({url:S,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(u_,{url:a.url,token:a.token,children:r}):n==="socketio"?p.jsx(rw,{children:r}):p.jsx(p.Fragment,{children:r})}const Vf="lt_ai_override";function lw(){return Xe("/settings")}function Ff(){try{if(localStorage.getItem(Vf)==="off")return!1}catch{}return null}function cw(){var s;const r=Ln({queryKey:["settings"],queryFn:lw,staleTime:1/0}),n=Ff();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function ow(){const[r,n]=N.useState(()=>Ff()===!1),s=N.useCallback(()=>{const a=Ff()===!1;try{a?localStorage.removeItem(Vf):localStorage.setItem(Vf,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Fg=N.createContext(null),D0="lt_sidebar_collapsed";function uw({children:r}){const[n,s]=N.useState(()=>{try{return localStorage.getItem(D0)==="true"}catch{return!1}}),a=N.useCallback(()=>{s(c=>{const f=!c;try{localStorage.setItem(D0,String(f))}catch{}return f})},[]);return p.jsx(Fg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Jg(){const r=N.useContext(Fg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function bE(r){const n=r?`?period=${r}`:"";return Ln({queryKey:["escalationStats",r],queryFn:()=>Xe(`/escalations/stats${n}`)})}function xE(){return Ln({queryKey:["escalationTypes"],queryFn:()=>Xe("/escalations/types")})}function fw(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),Ln({queryKey:["escalations",s],queryFn:()=>Xe(`/escalations?${a}`),enabled:n})}function hw(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),Ln({queryKey:["escalations","available",s],queryFn:()=>Xe(`/escalations/available?${a}`),enabled:n})}function vE(r){return Ln({queryKey:["escalations","by-workflow",r],queryFn:()=>Xe(`/escalations/by-workflow/${r}`),enabled:!!r})}function _E(r){return Ln({queryKey:["escalations",r],queryFn:()=>Xe(`/escalations/${r}`),enabled:!!r})}function wE(){const r=Nn();return Hn({mutationFn:({id:n,durationMinutes:s})=>Xe(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function SE(){const r=Nn();return Hn({mutationFn:n=>Xe(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function EE(){const r=Nn();return Hn({mutationFn:({id:n,resolverPayload:s})=>Xe(`/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 AE(){const r=Nn();return Hn({mutationFn:({id:n,targetRole:s})=>Xe(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function OE(){const r=Nn();return Hn({mutationFn:({ids:n,priority:s})=>Xe("/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 jE(){const r=Nn();return Hn({mutationFn:({ids:n,durationMinutes:s})=>Xe("/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 TE(){const r=Nn();return Hn({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Xe("/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 NE(){const r=Nn();return Hn({mutationFn:({ids:n,targetRole:s})=>Xe("/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 CE(){const r=Nn();return Hn({mutationFn:({ids:n,hint:s})=>Xe("/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 dw(){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]);Mg(`${a_}.escalation.>`,c);const{data:f}=hw({limit:1}),{data:h}=fw({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 oh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",c=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"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 ${s}`,style:{height:"50px"},children:[p.jsx("img",{src:"/logo512.png",alt:"LongTail",className:`shrink-0 z-0 ${c}`}),p.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function mw({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Ai(),{available:c,mine:f}=dw(),{connected:h}=l_(),{toggleAIOverride:d}=ow(),[g,y]=N.useState(!1),A=N.useRef(null);return N.useEffect(()=>{if(!g)return;const S=j=>{A.current&&!A.current.contains(j.target)&&y(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[g]),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",onClick:S=>{(S.ctrlKey||S.metaKey)&&(S.preventDefault(),d())},children:p.jsx(oh,{})})}),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(Sx,{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(Ex,{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(rg,{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(ag,{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:A,children:[p.jsxs("button",{onClick:()=>y(S=>!S),className:"btn-ghost text-xs flex items-center gap-1",children:[p.jsx(Ax,{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"})})]}),g&&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:()=>y(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),p.jsx("button",{onClick:()=>{y(!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 uh({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 Jf(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 pw(){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 gw({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(Oc,{to:d.to,className:Jf(!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(uh,{open:h,children:r.items.map(d=>p.jsxs(Oc,{to:d.to,end:d.end,className:pw(),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 yw(r){return r.kind==="group"}function bw({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=Jf(n)({isActive:d});return p.jsxs(Oc,{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(Oc,{to:r.to,end:r.end,className:Jf(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}=Jg();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=>yw(a)?p.jsx(gw,{group:a,collapsed:s},a.label):p.jsx(bw,{entry:a,collapsed:s},a.to))]})}function xw({aiEnabled:r=!1}){const n=[{to:"/",label:"Recent Activity",icon:Ox,end:!0},{to:"/capabilities",label:"Capabilities",icon:jx},{to:"/agents",label:r?"Agents":"Automations",icon:Tx},{to:"/topics",label:"Topics",icon:rg}];return p.jsx(Vc,{heading:"Work",entries:n})}function vw({aiEnabled:r=!1}){const n=[{to:"/workflows/registry",label:"Registry",icon:sf},{to:"/workflows/start",label:"Invoke",icon:Nx}];r&&n.push({to:"/workflows/executions",label:"Executions",icon:rf});const s=[{kind:"group",label:"Workflows",icon:sf,matchPaths:["/workflows"],items:n}];return r?s.push({kind:"group",label:"Pipelines",icon:Ca,matchPaths:["/mcp"],items:[{to:"/mcp/queries",label:"Designer",icon:Cx},{to:"/mcp/servers",label:"Servers & Tools",icon:lg},{to:"/mcp/workflows",label:"Pipeline Tools",icon:Ca},{to:"/mcp/executions",label:"Executions",icon:rf}]}):s.push({kind:"group",label:"Executions",icon:rf,matchPaths:["/mcp","/workflows/executions"],items:[{to:"/workflows/executions",label:"Workflows",icon:sf},{to:"/mcp/executions",label:"Pipelines",icon:Ca}]}),p.jsx(Vc,{heading:"Build",entries:s})}const _w=[{to:"/files",label:"Files",icon:kx},{to:"/knowledge",label:"Knowledge",icon:Mx}];function ww(){return p.jsx(Vc,{heading:"Storage",entries:_w})}const Sw=[{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:lg,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:qx},{to:"/admin/streams",label:"Messages",icon:Ux},{to:"/admin/maintenance",label:"DB Maintenance",icon:Bx}]}];function Ew(){return p.jsx(Vc,{heading:"Admin",entries:Sw})}function Aw({children:r,className:n=""}){return p.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const vf=280,z0="cubic-bezier(0.4, 0, 0.2, 1)",yc=40;function Ow(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-yc*2,c=s-yc*2,f=r.width/a,h=r.height/c,d=r.left+r.width/2-(yc+a/2),g=r.top+r.height/2-(yc+c/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Qg({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),vf+50);return()=>clearTimeout(j)},[c]),!c)return null;const y=c==="entering"||c==="exiting",A=y?Ow(h.current):"none",S=y?0:1;return sg.createPortal(p.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${vf}ms ${z0}, opacity ${vf}ms ${z0}`,transform:A,opacity:S,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}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:"M4 6h16M4 12h8M4 18h12"})})}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:"M8 7l-5 5 5 5M16 7l5 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:"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 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:"M5 13l4 4L19 7"})})}function kw({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 Mw({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 Rw(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 bc(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Dw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,A)=>{const S=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${S}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,A,S)=>Rw(`${y}
55
- ${A}
56
- ${S.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="${bc(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${bc(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${bc(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="${bc(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),S=/note:|ℹ️|info/i.test(y);return`<div class="${A?"bg-status-warning/5":S?"bg-accent/5":"bg-surface-sunken/50"} ${A?"border-status-warning":S?"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 S=y,j;for(;(j=d.exec(S))!==null;){const z=j.index+j[0].length;A.push(S.slice(0,z)),S=S.slice(z).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return S&&A.push(S),A.map(z=>{const k=z.trim();return k?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(k)?k:`<p class="${h}">${k}</p>`:""}).join("")}).join(""),s}const zw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function qw(r){return zw.test(r)}function fh({content:r,className:n,onClick:s}){const a=N.useMemo(()=>Dw(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,S],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:S,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 za({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&&qw(r)?p.jsx(fh,{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(za,{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(za,{data:c,depth:n+1})}):p.jsx(za,{data:c,depth:n+1})]},a)})})}return p.jsx("span",{children:String(r)})}function q0({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(Mw,{className:y}):p.jsx(kw,{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(jw,{className:y}):p.jsx(Tw,{className:y})}),p.jsx("button",{onClick:c,className:A,title:"Copy to clipboard",children:f?p.jsx(Cw,{className:`${y} text-status-success`}):p.jsx(Nw,{className:y})}),h&&p.jsx("button",{onClick:h,className:A,title:"Fullscreen",children:p.jsx(cg,{className:y})}),d&&p.jsx("button",{onClick:d,className:A,title:"Close (Esc)",children:p.jsx(og,{className:y})})]})}function Uw({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,S]=N.useState(!1),[j,z]=N.useState(a?0:1),[k,H]=N.useState(1),ee=j%2===0,ne=k%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 M=async()=>{const K=typeof r=="string"?r:JSON.stringify(be,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},X=N.useCallback(()=>{H(1),S(!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(Aw,{children:n}),p.jsxs("div",{ref:f,className:"relative",children:[p.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:p.jsx(q0,{mode:h,setMode:d,isCollapsed:ee,onToggleCollapse:W,onCopy:M,copied:g,onFullscreen:X})}),p.jsx("div",{className:Q,children:h==="json"?p.jsx(zc,{data:be,generation:j}):p.jsx(za,{data:be})})]}),p.jsxs(Qg,{open:A,onClose:()=>S(!1),sourceRef:f,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx(q0,{mode:h,setMode:d,isCollapsed:ne,onToggleCollapse:me,onCopy:M,copied:g,onClose:()=>S(!1),large:!0})}),p.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?p.jsx(zc,{data:be,generation:k}):p.jsx(za,{data:be})})]})]})}const Bw=100,U0=500;let Lw=0;const Ig={"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 B0({event:r,forceExpanded:n=!1}){var j,z;const[s,a]=N.useState(n),c=Ig[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",S=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(uh,{open:s,children:p.jsx("div",{className:S,children:p.jsx(Uw,{data:r.data})})})]})}function Hw({open:r,onToggle:n}){const[s,a]=N.useState([]),[c,f]=N.useState(!1),h=N.useRef(null),d=N.useRef(new Map);return Mg("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||""}`,S=Date.now(),j=d.current.get(A);if(!(j&&S-j<U0)){if(d.current.set(A,S),d.current.size>200)for(const[z,k]of d.current)S-k>U0*2&&d.current.delete(z);a(z=>[{id:++Lw,type:y,timestamp:g.timestamp||new Date().toISOString(),data:g},...z].slice(0,Bw))}},[])),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(Lx,{className:"w-3 h-3 text-text-tertiary"}):p.jsx(Hx,{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 ${Ig[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(cg,{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(Px,{className:"w-3 h-3"})})]})]}),p.jsx(uh,{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(B0,{event:g},g.id))})}),p.jsxs(Qg,{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(og,{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(B0,{event:g,forceExpanded:!0},g.id))]})]})}function Pw(){return Ln({queryKey:["docs"],queryFn:()=>Xe("/docs"),staleTime:5*6e4})}function Yw(r){return Ln({queryKey:["docs",r],queryFn:()=>Xe(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function $w(){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((k,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:k,scrollTop:0})},[]),A=N.useCallback(k=>{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=k==null?void 0:k.current)==null?void 0:W.scrollTop)??0;a([...g.current,{...ne,scrollTop:me}])}n(H.slice(0,-1)),f(ee),requestAnimationFrame(()=>{k!=null&&k.current&&(k.current.scrollTop=ee.scrollTop)})},[]),S=N.useCallback(k=>{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=k==null?void 0:k.current)==null?void 0:W.scrollTop)??0;n([...d.current,{...ne,scrollTop:me}])}a(H.slice(0,-1)),f(ee),requestAnimationFrame(()=>{k!=null&&k.current&&(k.current.scrollTop=ee.scrollTop)})},[]),j=N.useCallback(k=>{var ne,W;const H=h.current;if(!H)return;const ee=((ne=k==null?void 0:k.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...H,scrollTop:ee}]),a([]),f({...H,scrollTop:((W=k==null?void 0:k.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:S,pushScrollPosition:j,reset:z}}function Gw(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 Vw(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 Fw(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function Jw({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,S=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(A)}`);S==null||S.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:A,anchor:S}=Gw(g.dataset.docLink,n);s(A,S);return}};return p.jsx(fh,{content:r,className:"docs-content",onClick:c})}function Qw(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 Iw({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:c}=Qw(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(Yx,{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 Xw({open:r,onClose:n}){var ie,Z,Q;const[s,a]=N.useState(!1),{data:c}=Pw(),f=$w(),{data:h,isLoading:d}=Yw(((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 S=N.useCallback(()=>{var re;const K=Vw(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=Fw(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")&&S()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,S]);const z=N.useCallback((K,ae)=>{ae&&A(ae),f.navigate(K,g)},[f]),k=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,S();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,M=f.backStack.length>0,X=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:!M,className:`p-0.5 transition-colors ${M?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:p.jsx($x,{className:"w-4 h-4"})}),p.jsx("button",{onClick:ee,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:p.jsx(Zp,{className:"w-4 h-4"})}),p.jsx(ag,{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(Qf,{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(Iw,{docs:c.docs,selected:be,onSelect:k}):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(Jw,{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(Zp,{className:"w-5 h-5 mb-2"}),p.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function Kw(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const L0=2e3;function Zw(r){const s=r.filter(c=>!c.pending).slice(-8);return s.length===0?"":`[Prior conversation]
57
- ${s.map(c=>`${c.role==="user"?"User":"Assistant"}: ${c.content}`).join(`
58
- `)}
59
- [End prior conversation]
60
-
61
- `}function Ww(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 e2({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),S={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??Kw(n.pathname)};N.useEffect(()=>()=>{A.current&&clearInterval(A.current)},[]);const j=N.useCallback(()=>a(ne=>!ne),[]),z=N.useCallback(ne=>{y(ne)},[]),k=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 M={...S};(Z=M.entities)!=null&&Z.yamlContent&&M.entities.yamlContent.length>L0&&(M.entities={...M.entities,yamlContent:M.entities.yamlContent.slice(0,L0)+`
62
- ... (truncated)`});const ie=`${Zw(c.concat(me))}${ne}`;try{const K=(await Xe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ie,tags:M.suggestedTags,context:M,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 Xe(`/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=Ww(qe);let Le;try{Le=(await Xe(`/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,S]),ee=N.useCallback(async ne=>{const W=c.find(M=>M.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(M=>M.role==="user");if(be){f(M=>M.map(X=>X.id===ne?{...X,compilationStatus:"compiling"}:X));try{const M=await Xe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:be.content,summary:W.content})}),X=await Xe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:W.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:M.tool_name,description:M.description,tags:M.tags,app_id:"longtail"})});await Xe(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(ie=>ie.map(Z=>Z.id===ne?{...Z,compilationStatus:"done"}:Z))}catch(M){const X=M instanceof Error?M.message:"Compilation failed";f(ie=>ie.map(Z=>Z.id===ne?{...Z,compilationStatus:"error",compilationError:X}:Z))}}},[c]);return p.jsx(Xg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:c,sendMessage:H,pageContext:S,setPageContext:z,activeWorkflowId:h,clearMessages:k,compileMessage:ee},children:r})}function Kg(){const r=N.useContext(Xg);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function t2(){const{helpOpen:r,toggleHelp:n}=Kg();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(Qf,{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 Zg=6048e5,n2=864e5,H0=6e4,P0=525600,Y0=43200,$0=1440,G0=Symbol.for("constructDateFrom");function fs(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&G0 in r?r[G0](n):r instanceof Date?new r.constructor(n):new Date(n)}function nn(r,n){return fs(n||r,r)}let s2={};function $a(){return s2}function Ha(r,n){var d,g,y,A;const s=$a(),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 Ha(r,{...n,weekStartsOn:1})}function Wg(r,n){const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),c=fs(s,0);c.setFullYear(a+1,0,4),c.setHours(0,0,0,0);const f=qc(c),h=fs(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 ey(r,...n){const s=fs.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function V0(r,n){const s=nn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function i2(r,n,s){const[a,c]=ey(s==null?void 0:s.in,r,n),f=V0(a),h=V0(c),d=+f-Uc(f),g=+h-Uc(h);return Math.round((d-g)/n2)}function r2(r,n){const s=Wg(r,n),a=fs(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),qc(a)}function a2(r,n){const s=+nn(r)-+nn(n);return s<0?-1:s>0?1:s}function l2(r){return fs(r,Date.now())}function c2(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function o2(r){return!(!c2(r)&&typeof r!="number"||isNaN(+nn(r)))}function u2(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function f2(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 h2={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"}},d2=(r,n,s)=>{let a;const c=h2[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 _f(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const m2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},p2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},g2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},y2={date:_f({formats:m2,defaultWidth:"full"}),time:_f({formats:p2,defaultWidth:"full"}),dateTime:_f({formats:g2,defaultWidth:"full"})},b2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},x2=(r,n,s,a)=>b2[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 v2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},_2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},w2={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"]},S2={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"]},E2={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"}},A2={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"}},O2=(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"},j2={ordinalNumber:O2,era:Aa({values:v2,defaultWidth:"wide"}),quarter:Aa({values:_2,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Aa({values:w2,defaultWidth:"wide"}),day:Aa({values:S2,defaultWidth:"wide"}),dayPeriod:Aa({values:E2,defaultWidth:"wide",formattingValues:A2,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)?N2(d,S=>S.test(h)):T2(d,S=>S.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 T2(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function N2(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function C2(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 k2=/^(\d+)(th|st|nd|rd)?/i,M2=/\d+/i,R2={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},D2={any:[/^b/i,/^(a|c)/i]},z2={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},q2={any:[/1/i,/2/i,/3/i,/4/i]},U2={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},B2={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]},L2={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},H2={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]},P2={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},Y2={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}},$2={ordinalNumber:C2({matchPattern:k2,parsePattern:M2,valueCallback:r=>parseInt(r,10)}),era:Oa({matchPatterns:R2,defaultMatchWidth:"wide",parsePatterns:D2,defaultParseWidth:"any"}),quarter:Oa({matchPatterns:z2,defaultMatchWidth:"wide",parsePatterns:q2,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Oa({matchPatterns:U2,defaultMatchWidth:"wide",parsePatterns:B2,defaultParseWidth:"any"}),day:Oa({matchPatterns:L2,defaultMatchWidth:"wide",parsePatterns:H2,defaultParseWidth:"any"}),dayPeriod:Oa({matchPatterns:P2,defaultMatchWidth:"any",parsePatterns:Y2,defaultParseWidth:"any"})},ty={code:"en-US",formatDistance:d2,formatLong:y2,formatRelative:x2,localize:j2,match:$2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function G2(r,n){const s=nn(r,n==null?void 0:n.in);return i2(s,f2(s))+1}function V2(r,n){const s=nn(r,n==null?void 0:n.in),a=+qc(s)-+r2(s);return Math.round(a/Zg)+1}function ny(r,n){var A,S,j,z;const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),c=$a(),f=(n==null?void 0:n.firstWeekContainsDate)??((S=(A=n==null?void 0:n.locale)==null?void 0:A.options)==null?void 0:S.firstWeekContainsDate)??c.firstWeekContainsDate??((z=(j=c.locale)==null?void 0:j.options)==null?void 0:z.firstWeekContainsDate)??1,h=fs((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=Ha(h,n),g=fs((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Ha(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function F2(r,n){var d,g,y,A;const s=$a(),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=ny(r,n),f=fs((n==null?void 0:n.in)||r,0);return f.setFullYear(c,0,a),f.setHours(0,0,0,0),Ha(f,n)}function J2(r,n){const s=nn(r,n==null?void 0:n.in),a=+Ha(s,n)-+F2(s,n);return Math.round(a/Zg)+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"},F0={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=ny(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=Wg(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=J2(r,a);return n==="wo"?s.ordinalNumber(c,{unit:"week"}):$e(c,n.length)},I:function(r,n,s){const a=V2(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=G2(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 Q0(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 Q0(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"+J0(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"+J0(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 J0(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 Q0(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 I0=(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"})}},sy=(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"})}},Q2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],c=s[2];if(!c)return I0(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}}",I0(a,n)).replace("{{time}}",sy(c,n))},I2={p:sy,P:Q2},X2=/^D+$/,K2=/^Y+$/,Z2=["D","DD","YY","YYYY"];function W2(r){return X2.test(r)}function eS(r){return K2.test(r)}function tS(r,n,s){const a=nS(r,n,s);if(console.warn(a),Z2.includes(r))throw new RangeError(a)}function nS(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 sS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,iS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,rS=/^'([^]*?)'?$/,aS=/''/g,lS=/[a-zA-Z]/;function iy(r,n,s){var A,S,j,z;const a=$a(),c=a.locale??ty,f=a.firstWeekContainsDate??((S=(A=a.locale)==null?void 0:A.options)==null?void 0:S.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(!o2(d))throw new RangeError("Invalid time value");let g=n.match(iS).map(k=>{const H=k[0];if(H==="p"||H==="P"){const ee=I2[H];return ee(k,c.formatLong)}return k}).join("").match(sS).map(k=>{if(k==="''")return{isToken:!1,value:"'"};const H=k[0];if(H==="'")return{isToken:!1,value:cS(k)};if(F0[H])return{isToken:!0,value:k};if(H.match(lS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+H+"`");return{isToken:!1,value:k}});c.localize.preprocessor&&(g=c.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:c};return g.map(k=>{if(!k.isToken)return k.value;const H=k.value;(eS(H)||W2(H))&&tS(H,n,String(r));const ee=F0[H[0]];return ee(d,H,c.localize,y)}).join("")}function cS(r){const n=r.match(rS);return n?n[1].replace(aS,"'"):r}function oS(r,n,s){const a=$a(),c=(s==null?void 0:s.locale)??a.locale??ty,f=a2(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]=ey(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=u2((s==null?void 0:s.roundingMethod)??"round"),A=g.getTime()-d.getTime(),S=A/H0,j=Uc(g)-Uc(d),z=(A-j)/H0,k=s==null?void 0:s.unit;let H;if(k?H=k:S<1?H="second":S<60?H="minute":S<$0?H="hour":z<Y0?H="day":z<P0?H="month":H="year",H==="second"){const ee=y(A/1e3);return c.formatDistance("xSeconds",ee,h)}else if(H==="minute"){const ee=y(S);return c.formatDistance("xMinutes",ee,h)}else if(H==="hour"){const ee=y(S/60);return c.formatDistance("xHours",ee,h)}else if(H==="day"){const ee=y(z/$0);return c.formatDistance("xDays",ee,h)}else if(H==="month"){const ee=y(z/Y0);return ee===12&&k!=="month"?c.formatDistance("xYears",1,h):c.formatDistance("xMonths",ee,h)}else{const ee=y(z/P0);return c.formatDistance("xYears",ee,h)}}function uS(r,n){return oS(r,l2(r),n)}function fS(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":uS(n,{addSuffix:!0})}function kE(r){return r<=0?"Expired":hh(r)}function hS(r){return r==null?"--":hh(r)}function hh(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 ME(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return hh(a-s)}function ry({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),S=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})},[]),k=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(S.current),z(),c(!0)},[z]),ee=N.useCallback(()=>{S.current=setTimeout(()=>c(!1),150)},[]);return N.useEffect(()=>()=>{clearTimeout(A.current),clearTimeout(S.current)},[]),p.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:H,onMouseLeave:ee,children:[n,a&&d&&sg.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(),k(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 dS(r,n){const s=new Date(r);switch(n){case"relative":return fS(r);case"datetime":return iy(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function mS(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:iy(n,"MMM d, yyyy h:mm:ss a")}]}function pS({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(()=>mS(r),[r]);return p.jsx(ry,{options:c,children:p.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:dS(r,n)})})}function gS({ms:r,className:n=""}){const s=hS(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(ry,{options:a,children:p.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const yS=["sm","md","lg","full"],X0={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"},K0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function bS({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 xS({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(Ca,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function vS({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(pS,{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(gS,{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(Ca,{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(Gx,{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 _S(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:c,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Kg(),[g,y]=N.useState(""),[A,S]=N.useState("md"),[j,z]=N.useState(!0),k=N.useRef(null),H=N.useRef(null);if(N.useEffect(()=>{k.current&&(k.current.scrollTop=k.current.scrollHeight)},[s]),N.useEffect(()=>{r&&H.current&&H.current.focus()},[r]),N.useEffect(()=>{if(!r)return;const M=X=>{X.key==="Escape"&&(A==="full"?S("lg"):A==="lg"?S("md"):A==="md"?S("sm"):n(!1))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[r,A,n]),!r)return null;const ee=()=>{const M=g.trim();!M||f||(a(M),y(""),H.current&&(H.current.style.height="auto"))},ne=M=>{M.key==="Enter"&&!M.shiftKey&&(M.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?X0.full:`right-6 ${X0[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:yS.map(M=>p.jsx("button",{onClick:()=>S(M),className:`p-1 rounded transition-colors ${M===A?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":M===A,"aria-label":K0[M],title:K0[M],children:p.jsx(bS,{which:M})},M))}),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(Vx,{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(Qf,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),p.jsxs("div",{ref:k,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(M=>p.jsxs("div",{className:`text-xs leading-relaxed ${M.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 ${M.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:M.pending?p.jsx(xS,{msg:M}):M.role==="assistant"?p.jsx(fh,{content:M.content}):M.content}),!M.pending&&p.jsx("div",{className:"mt-0.5",children:p.jsx(vS,{msg:M,compileMessage:d})})]},M.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:M=>{y(M.target.value);const X=M.target;X.style.height="auto",X.style.height=`${Math.min(X.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(Fx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function wS(){var z;const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Ai(),{data:a}=cw(),c=!!((z=a==null?void 0:a.ai)!=null&&z.enabled),{collapsed:f,toggle:h}=Jg(),[d,g]=N.useState(!1),[y,A]=N.useState(()=>window.location.hash.startsWith("#docs")),S=Ei(),j=N.useRef(null);return N.useEffect(()=>{const k=j.current;k&&(k.classList.remove("animate-page-in"),k.offsetWidth,k.classList.add("animate-page-in"))},[S.pathname]),N.useEffect(()=>{const k=()=>{window.location.hash.startsWith("#docs")&&A(!0)};return window.addEventListener("hashchange",k),()=>window.removeEventListener("hashchange",k)},[]),p.jsxs("div",{className:"h-screen bg-surface flex flex-col",style:{"--feed-height":d?"224px":"32px"},children:[p.jsx(mw,{onToggleEventFeed:()=>g(k=>!k),onToggleDocs:()=>A(k=>!k)}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsxs("aside",{className:`${f?"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(xw,{aiEnabled:c}),(r||n("admin")||s("engineer"))&&p.jsx(vw,{aiEnabled:c}),(r||n("admin")||s("engineer"))&&p.jsx(ww,{}),(r||n("admin"))&&p.jsx(Ew,{})]}),p.jsx("button",{onClick:h,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${f?"flex justify-center":"flex items-center px-7"}`,"aria-label":f?"Expand sidebar":"Collapse sidebar",children:f?p.jsx(Jx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):p.jsx(Qx,{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:j,className:`max-w-dashboard mx-auto px-10 py-10 animate-page-in ${d?"pb-60":"pb-16"}`,children:p.jsx(xc,{})})})]}),p.jsx(Hw,{open:d,onToggle:()=>g(k=>!k)}),p.jsx(Xw,{open:y,onClose:()=>{A(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),c&&p.jsx(t2,{}),c&&p.jsx(_S,{})]})}function SS(){const{isAuthenticated:r}=Ai(),n=Ei();return r?p.jsx(uw,{children:p.jsx(e2,{children:p.jsx(wS,{})})}):p.jsx(Vs,{to:"/login",state:{from:n.pathname},replace:!0})}function ay({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 ES(){return Xe("/auth/oauth/providers")}async function AS(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Xe(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function RE(){return Ln({queryKey:["oauth-connections"],queryFn:()=>Xe("/auth/oauth/connections")})}function DE(){const r=Nn();return Hn({mutationFn:({provider:n,label:s})=>AS(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function OS(){var X;const{login:r,isAuthenticated:n}=Ai(),s=ig(),a=Ei(),c=new URLSearchParams(a.search),f=c.get("token"),h=c.get("error"),d=((X=a.state)==null?void 0:X.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(""),[S,j]=N.useState(""),[z,k]=N.useState(h||""),[H,ee]=N.useState(!1),[ne,W]=N.useState(!!f),[me,be]=N.useState([]);if(N.useEffect(()=>{f||ES().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 M=async ie=>{var Z,Q;if(ie.preventDefault(),k(""),!y.trim()||!S){k("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:S})}),ae=await K.json();if(!K.ok){k(ae.error||"Login failed");return}W(!0),r(ae.token,{username:y.trim(),password:S},{displayName:(Z=ae.user)==null?void 0:Z.display_name,username:(Q=ae.user)==null?void 0:Q.external_id})}catch{k("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(oh,{size:"lg",hideLabel:ne})}),p.jsxs("form",{onSubmit:M,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:S,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(ay,{provider:ie.provider}),"Sign in with ",ie.name]},ie.provider))})]})]})]})})}function Z0(){const{isAuthenticated:r}=Ai(),n=ig(),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(""),[S,j]=N.useState(!1),z=f.trim().startsWith("sk-ant-oat"),k=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(oh,{size:"lg"})}),p.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[p.jsx(ay,{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)"}),k&&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:S,children:S?"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 wf({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:c,hasRoleType:f}=Ai();return a?p.jsx(xc,{}):r&&r.some(h=>f(h))?p.jsx(xc,{}):n&&n.some(h=>c(h))?p.jsx(xc,{}):p.jsx(Vs,{to:s,replace:!0})}const jS=N.lazy(()=>Ae(()=>import("./ProcessesListPage-MnLMnxAa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(r=>({default:r.ProcessesListPage}))),TS=N.lazy(()=>Ae(()=>import("./ProcessDetailPage-s_iV8ICg.js"),__vite__mapDeps([16,1,2,4,17,13,18,15,9,6,19,20,21])).then(r=>({default:r.ProcessDetailPage}))),NS=N.lazy(()=>Ae(()=>import("./McpOverview-BpYk21es.js"),__vite__mapDeps([22,1,23,24,25,26,12,13,27,6])).then(r=>({default:r.McpOverview}))),CS=N.lazy(()=>Ae(()=>import("./McpRunsPage-BlgcGN3k.js"),__vite__mapDeps([28,1,24,25,26,5,6,7,8,15,13,9,29,12,11,10,14,30])).then(r=>({default:r.McpRunsPage}))),kS=N.lazy(()=>Ae(()=>import("./McpRunDetailPage-Cra0nQSw.js"),__vite__mapDeps([31,1,24,18,12,13,32,6,33,34,14,35,36,11])).then(r=>({default:r.McpRunDetailPage}))),MS=N.lazy(()=>Ae(()=>import("./McpQueryPage-COfPssO7.js"),__vite__mapDeps([37,1,12,13,7,8,11,10,14,9,29,15,30,5,6,4,38])).then(r=>({default:r.McpQueryPage}))),RS=N.lazy(()=>Ae(()=>import("./McpQueryDetailPage-DlrZiSuL.js"),__vite__mapDeps([39,1,12,13,18,38,40,6,25,4,41,33,24,3,2,42,43,44,45,32,46,35])).then(r=>({default:r.McpQueryDetailPage}))),DS=N.lazy(()=>Ae(()=>import("./EscalationsOverview-Bcrb44xJ.js"),__vite__mapDeps([47,1,4,12,13,27,6])).then(r=>({default:r.EscalationsOverview}))),zS=N.lazy(()=>Ae(()=>import("./AvailableEscalationsPage-hOcjAAIj.js"),__vite__mapDeps([48,1,4,49,5,6,7,8,10,12,13,50,51,52,21,53,11,54,19,15,9,55,30,14])).then(r=>({default:r.AvailableEscalationsPage}))),qS=N.lazy(()=>Ae(()=>import("./OperatorDashboard-BbO6cWzb.js"),__vite__mapDeps([56,1,4,49,5,6,7,8,12,13,10,30,53,11,54,19,15,9,55,14])).then(r=>({default:r.OperatorDashboard}))),US=N.lazy(()=>Ae(()=>import("./index-DPW_i3fH.js"),__vite__mapDeps([57,1,34,49,12,13,55,3,4,20,21,51,50,18,19,32,6,33])).then(r=>({default:r.EscalationDetailPage}))),BS=N.lazy(()=>Ae(()=>import("./WorkflowsOverview-BcUgBvjD.js"),__vite__mapDeps([58,1,3,4,12,13,27,6])).then(r=>({default:r.WorkflowsOverview}))),LS=N.lazy(()=>Ae(()=>import("./index-Ck2QdJXT.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18])).then(r=>({default:r.StartWorkflowPage}))),HS=N.lazy(()=>Ae(()=>import("./index-Ck2QdJXT.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18])).then(r=>({default:r.DurableInvokePage}))),PS=N.lazy(()=>Ae(()=>import("./WorkflowsDashboard-BzH7jMRu.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30])).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),YS=N.lazy(()=>Ae(()=>import("./WorkflowsDashboard-BzH7jMRu.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30])).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),$S=N.lazy(()=>Ae(()=>import("./YamlWorkflowsPage-OhpCQJ0l.js"),__vite__mapDeps([62,1,25,40,5,6,63,12,13,11,8,43,44,45,42,60,46,18,64])).then(r=>({default:r.YamlWorkflowsPage}))),GS=N.lazy(()=>Ae(()=>import("./TasksListPage-BYj3OqUi.js"),__vite__mapDeps([65,1,2,3,5,6,7,8,18,54,46,10,11,12,13,15])).then(r=>({default:r.TasksListPage}))),VS=N.lazy(()=>Ae(()=>import("./TaskDetailPage-DPV4ySd9.js"),__vite__mapDeps([66,1,2,18,54,12,13,6])).then(r=>({default:r.TaskDetailPage}))),W0=N.lazy(()=>Ae(()=>import("./WorkflowExecutionPage-BGmJnXnk.js"),__vite__mapDeps([67,1,3,4,34,2,12,13,33,14,18,32,6,35,36,11])).then(r=>({default:r.WorkflowExecutionPage}))),FS=N.lazy(()=>Ae(()=>import("./AdminDashboard-DISq0Tz8.js"),__vite__mapDeps([68,1,2,4,23,17,13,6])).then(r=>({default:r.AdminDashboard}))),JS=N.lazy(()=>Ae(()=>import("./index-DNmlrCAp.js"),__vite__mapDeps([69,1,3,7,8,11,30,5,6,12,13,70,15])).then(r=>({default:r.WorkersPage}))),QS=N.lazy(()=>Ae(()=>import("./index-D_wqdvG_.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45])).then(r=>({default:r.WorkflowConfigsPage}))),eg=N.lazy(()=>Ae(()=>import("./index-D_wqdvG_.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45])).then(r=>({default:r.WorkflowConfigDetailPage}))),IS=N.lazy(()=>Ae(()=>import("./index-f-0Duls3.js"),__vite__mapDeps([74,1,23,8,72,52,6,12,13,11,10,5,63,75,43,44,45,42,64,30,18])).then(r=>({default:r.McpServersPage}))),tg=N.lazy(()=>Ae(()=>import("./index-BxOuF0hm.js"),__vite__mapDeps([76,1,23,73,12,13,41,6])).then(r=>({default:r.McpServerDetailPage}))),XS=N.lazy(()=>Ae(()=>import("./index-H5TlloTk.js"),__vite__mapDeps([77,1,21,5,6,7,8,10,11,9,72,52,30,12,13,19,45,49,46])).then(r=>({default:r.UsersPage}))),KS=N.lazy(()=>Ae(()=>import("./RolesPage-BH7KASM7.js"),__vite__mapDeps([78,1,49,7,8,72,52,6,12,13,19,30])).then(r=>({default:r.RolesPage}))),ZS=N.lazy(()=>Ae(()=>import("./index-qNuxC8kX.js"),__vite__mapDeps([79,1,12,13,52,6,50])).then(r=>({default:r.MaintenancePage}))),WS=N.lazy(()=>Ae(()=>import("./index-pIMl0mYp.js"),__vite__mapDeps([80,1,17,13,11,5,6,81,52,33,70,7,8,30])).then(r=>({default:r.ControlPlanePage}))),eE=N.lazy(()=>Ae(()=>import("./index-Bl9wzQ8Q.js"),__vite__mapDeps([82,1,6,81,5,7,8,10,11,9,12,13,14])).then(r=>({default:r.StreamMessagesPage}))),tE=N.lazy(()=>Ae(()=>import("./CredentialsPage-CqedUU7b.js"),__vite__mapDeps([83,1,12,13,46,72,52,6])).then(r=>({default:r.CredentialsPage}))),nE=N.lazy(()=>Ae(()=>import("./index-DnsVYMMg.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,46])).then(r=>({default:r.FilesPage}))),sE=N.lazy(()=>Ae(()=>import("./index-30-pN97P.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,46,87,41,6])).then(r=>({default:r.KnowledgePage}))),iE=N.lazy(()=>Ae(()=>import("./HomePage-BIzUcGW9.js"),__vite__mapDeps([88,1,3,24,81,2,4,19,13,15,14,89,6])).then(r=>({default:r.HomePage}))),rE=N.lazy(()=>Ae(()=>import("./AgentsPage-CLcxJWjC.js"),__vite__mapDeps([90,1,91,4,5,6,7,8,10,11,12,13,14])).then(r=>({default:r.AgentsPage}))),aE=N.lazy(()=>Ae(()=>import("./AgentDetailPage-BPzPk2GC.js"),__vite__mapDeps([92,1,91,93,13,4,89,15,6])).then(r=>({default:r.AgentDetailPage}))),ng=N.lazy(()=>Ae(()=>import("./AgentConfigPage-DqaJpB3K.js"),__vite__mapDeps([94,1,91,93,13,12,87,43,44,45,3,25,95,96,89,15,6])).then(r=>({default:r.AgentConfigPage}))),lE=N.lazy(()=>Ae(()=>import("./CapabilitiesPage-PRel6TXd.js"),__vite__mapDeps([97,1,95,75,23,43,44,45,13,42,64,6,12])).then(r=>({default:r.CapabilitiesPage}))),cE=N.lazy(()=>Ae(()=>import("./TopicsPage-BfsJEC1p.js"),__vite__mapDeps([98,1,96,5,6,7,8,10,11,12,13,14])).then(r=>({default:r.TopicsPage}))),oE=N.lazy(()=>Ae(()=>import("./TopicDetailPage-CjaZn4WP.js"),__vite__mapDeps([99,1,96,14,13,6])).then(r=>({default:r.TopicDetailPage})));function uE(){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(uE,{}),children:p.jsx("div",{className:"animate-page-enter",children:r})})}const ly=new bx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{ly.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 fE=_x([{path:"/login",element:p.jsx(OS,{})},{path:"/connect/anthropic",element:p.jsx(Z0,{})},{path:"/connect/:provider",element:p.jsx(Z0,{})},{path:"/",element:p.jsx(SS,{}),children:[{index:!0,element:p.jsx(xe,{children:p.jsx(iE,{})})},{path:"processes/all",element:p.jsx(xe,{children:p.jsx(jS,{})})},{path:"processes/detail/:originId",element:p.jsx(xe,{children:p.jsx(TS,{})})},{path:"credentials",element:p.jsx(xe,{children:p.jsx(tE,{})})},{path:"connections",element:p.jsx(Vs,{to:"/credentials",replace:!0})},{path:"escalations",element:p.jsx(xe,{children:p.jsx(DS,{})})},{path:"escalations/available",element:p.jsx(xe,{children:p.jsx(zS,{})})},{path:"escalations/queue",element:p.jsx(xe,{children:p.jsx(qS,{})})},{path:"escalations/detail/:id",element:p.jsx(xe,{children:p.jsx(US,{})})},{path:"capabilities",element:p.jsx(xe,{children:p.jsx(lE,{})})},{path:"agents",element:p.jsx(xe,{children:p.jsx(rE,{})})},{path:"agents/new",element:p.jsx(xe,{children:p.jsx(ng,{})})},{path:"agents/:id",element:p.jsx(xe,{children:p.jsx(aE,{})})},{path:"agents/:id/edit",element:p.jsx(xe,{children:p.jsx(ng,{})})},{path:"topics",element:p.jsx(xe,{children:p.jsx(cE,{})})},{path:"topics/:topic",element:p.jsx(xe,{children:p.jsx(oE,{})})},{element:p.jsx(wf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:p.jsx(xe,{children:p.jsx(BS,{})})},{path:"workflows/executions",element:p.jsx(xe,{children:p.jsx(YS,{})})},{path:"workflows/durable/executions",element:p.jsx(xe,{children:p.jsx(PS,{})})},{path:"workflows/durable/executions/:workflowId",element:p.jsx(xe,{children:p.jsx(W0,{})})},{path:"workflows/tasks",element:p.jsx(xe,{children:p.jsx(GS,{})})},{path:"workflows/tasks/detail/:id",element:p.jsx(xe,{children:p.jsx(VS,{})})},{path:"workflows/executions/:workflowId",element:p.jsx(xe,{children:p.jsx(W0,{})})},{path:"workflows/start",element:p.jsx(xe,{children:p.jsx(LS,{})})},{path:"workflows/durable/invoke",element:p.jsx(xe,{children:p.jsx(HS,{})})},{path:"workflows/cron",element:p.jsx(Vs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:p.jsx(xe,{children:p.jsx(JS,{})})},{path:"workflows/registry",element:p.jsx(xe,{children:p.jsx(QS,{})})},{path:"workflows/registry/new",element:p.jsx(xe,{children:p.jsx(eg,{})})},{path:"workflows/registry/:workflowType",element:p.jsx(xe,{children:p.jsx(eg,{})})}]},{element:p.jsx(wf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:p.jsx(xe,{children:p.jsx(NS,{})})},{path:"mcp/queries",element:p.jsx(xe,{children:p.jsx(MS,{})})},{path:"mcp/queries/:workflowId",element:p.jsx(xe,{children:p.jsx(RS,{})})},{path:"mcp/tools",element:p.jsx(Vs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:p.jsx(xe,{children:p.jsx(IS,{})})},{path:"mcp/servers/new",element:p.jsx(xe,{children:p.jsx(tg,{})})},{path:"mcp/servers/:serverId",element:p.jsx(xe,{children:p.jsx(tg,{})})},{path:"mcp/workflows",element:p.jsx(xe,{children:p.jsx($S,{})})},{path:"mcp/executions",element:p.jsx(xe,{children:p.jsx(CS,{})})},{path:"mcp/executions/:jobId",element:p.jsx(xe,{children:p.jsx(kS,{})})},{path:"files",element:p.jsx(xe,{children:p.jsx(nE,{})})},{path:"knowledge",element:p.jsx(xe,{children:p.jsx(sE,{})})}]},{element:p.jsx(wf,{roleTypes:["admin","superadmin"]}),children:[{path:"admin",element:p.jsx(xe,{children:p.jsx(FS,{})})},{path:"admin/users",element:p.jsx(xe,{children:p.jsx(XS,{})})},{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(KS,{})})},{path:"admin/maintenance",element:p.jsx(xe,{children:p.jsx(ZS,{})})},{path:"admin/controlplane",element:p.jsx(xe,{children:p.jsx(WS,{})})},{path:"admin/streams",element:p.jsx(xe,{children:p.jsx(eE,{})})}]}]}]);function hE(){return p.jsx(xx,{client:ly,children:p.jsx(sv,{children:p.jsx(aw,{children:p.jsx(wx,{router:fE})})})})}Wx.createRoot(document.getElementById("root")).render(p.jsx(N.StrictMode,{children:p.jsx(hE,{})}));export{RE as A,DE as B,uh as C,gS as D,hg as E,Qg as F,Uw as J,a_ as N,ay as O,Aw as S,ME as a,Xe as b,Mg as c,pS as d,vE as e,hS as f,wE as g,EE as h,bE as i,Ai as j,OE as k,jE as l,TE as m,NE as n,CE as o,xE as p,hw as q,fw as r,SE as s,_E as t,cw as u,AE as v,iy as w,ry as x,kE as y,hh as z};
63
- //# sourceMappingURL=index-DZX-E_3q.js.map