@hotmeshio/long-tail 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/README.md +41 -1
  2. package/build/adapters/express.d.ts +1 -0
  3. package/build/adapters/express.js +4 -0
  4. package/build/api/yaml-workflows/crud.d.ts +1 -0
  5. package/build/api/yaml-workflows/crud.js +2 -2
  6. package/build/routes/mcp-endpoint.js +3 -5
  7. package/build/services/topics/system-topics.js +27 -27
  8. package/build/services/yaml-workflow/invoke.js +77 -6
  9. package/build/start/graph-workflows.d.ts +14 -0
  10. package/build/start/graph-workflows.js +126 -0
  11. package/build/start/workers.js +14 -0
  12. package/build/system/mcp-servers/admin/schemas.d.ts +2 -2
  13. package/build/tsconfig.tsbuildinfo +1 -1
  14. package/build/types/startup.d.ts +28 -0
  15. package/dashboard/dist/assets/{AdminDashboard-CgJC8ZZF.js → AdminDashboard-CMzR4d-w.js} +2 -2
  16. package/dashboard/dist/assets/{AdminDashboard-CgJC8ZZF.js.map → AdminDashboard-CMzR4d-w.js.map} +1 -1
  17. package/dashboard/dist/assets/{AgentConfigPage-Bjl2Lsvo.js → AgentConfigPage-DHCpN4xk.js} +6 -6
  18. package/dashboard/dist/assets/{AgentConfigPage-Bjl2Lsvo.js.map → AgentConfigPage-DHCpN4xk.js.map} +1 -1
  19. package/dashboard/dist/assets/{AgentDetailPage-D5dHrfaM.js → AgentDetailPage-CSrejvSl.js} +3 -3
  20. package/dashboard/dist/assets/{AgentDetailPage-D5dHrfaM.js.map → AgentDetailPage-CSrejvSl.js.map} +1 -1
  21. package/dashboard/dist/assets/{AgentsPage-Mom3N1Av.js → AgentsPage-ntuzWHCD.js} +2 -2
  22. package/dashboard/dist/assets/{AgentsPage-Mom3N1Av.js.map → AgentsPage-ntuzWHCD.js.map} +1 -1
  23. package/dashboard/dist/assets/{AvailableEscalationsPage-B2ZAb41C.js → AvailableEscalationsPage-Ci24fdxC.js} +2 -2
  24. package/dashboard/dist/assets/{AvailableEscalationsPage-B2ZAb41C.js.map → AvailableEscalationsPage-Ci24fdxC.js.map} +1 -1
  25. package/dashboard/dist/assets/{BotPicker-dCvnjynP.js → BotPicker-lj42d48P.js} +2 -2
  26. package/dashboard/dist/assets/{BotPicker-dCvnjynP.js.map → BotPicker-lj42d48P.js.map} +1 -1
  27. package/dashboard/dist/assets/CapabilitiesPage-Bea9yLmU.js +2 -0
  28. package/dashboard/dist/assets/CapabilitiesPage-Bea9yLmU.js.map +1 -0
  29. package/dashboard/dist/assets/{CollapsibleSection-bW0UZN9b.js → CollapsibleSection-BeBsI1M4.js} +2 -2
  30. package/dashboard/dist/assets/{CollapsibleSection-bW0UZN9b.js.map → CollapsibleSection-BeBsI1M4.js.map} +1 -1
  31. package/dashboard/dist/assets/{CredentialsPage-DVOK3aaR.js → CredentialsPage-BDzFa3HV.js} +2 -2
  32. package/dashboard/dist/assets/{CredentialsPage-DVOK3aaR.js.map → CredentialsPage-BDzFa3HV.js.map} +1 -1
  33. package/dashboard/dist/assets/{CronLabel-Cv5em7OP.js → CronLabel-DeNm1I4r.js} +2 -2
  34. package/dashboard/dist/assets/{CronLabel-Cv5em7OP.js.map → CronLabel-DeNm1I4r.js.map} +1 -1
  35. package/dashboard/dist/assets/{CustomDurationPicker-Dy4NBqhZ.js → CustomDurationPicker-C2OH9YcV.js} +2 -2
  36. package/dashboard/dist/assets/{CustomDurationPicker-Dy4NBqhZ.js.map → CustomDurationPicker-C2OH9YcV.js.map} +1 -1
  37. package/dashboard/dist/assets/{DropZone-CptiQ0wc.js → DropZone-Dwpgbueb.js} +2 -2
  38. package/dashboard/dist/assets/{DropZone-CptiQ0wc.js.map → DropZone-Dwpgbueb.js.map} +1 -1
  39. package/dashboard/dist/assets/{ElapsedCell-TQqWaVRq.js → ElapsedCell-WdzqA0dR.js} +2 -2
  40. package/dashboard/dist/assets/{ElapsedCell-TQqWaVRq.js.map → ElapsedCell-WdzqA0dR.js.map} +1 -1
  41. package/dashboard/dist/assets/{EscalationsOverview-Cv5UvuHI.js → EscalationsOverview-BIEeflEV.js} +2 -2
  42. package/dashboard/dist/assets/{EscalationsOverview-Cv5UvuHI.js.map → EscalationsOverview-BIEeflEV.js.map} +1 -1
  43. package/dashboard/dist/assets/{EventTable-Doky6fCO.js → EventTable-NIhWP__B.js} +2 -2
  44. package/dashboard/dist/assets/{EventTable-Doky6fCO.js.map → EventTable-NIhWP__B.js.map} +1 -1
  45. package/dashboard/dist/assets/GraphInvokePage-DtAW8ilc.js +2 -0
  46. package/dashboard/dist/assets/GraphInvokePage-DtAW8ilc.js.map +1 -0
  47. package/dashboard/dist/assets/HomePage-HsO-M8ub.js +2 -0
  48. package/dashboard/dist/assets/{HomePage-CzvVyTq4.js.map → HomePage-HsO-M8ub.js.map} +1 -1
  49. package/dashboard/dist/assets/{ListToolbar-Cfec9gz_.js → ListToolbar-DqaRlXrF.js} +2 -2
  50. package/dashboard/dist/assets/{ListToolbar-Cfec9gz_.js.map → ListToolbar-DqaRlXrF.js.map} +1 -1
  51. package/dashboard/dist/assets/{McpOverview-BN4GsBGI.js → McpOverview-B4GsHxij.js} +2 -2
  52. package/dashboard/dist/assets/{McpOverview-BN4GsBGI.js.map → McpOverview-B4GsHxij.js.map} +1 -1
  53. package/dashboard/dist/assets/McpQueryDetailPage-DZKpzWST.js +5 -0
  54. package/dashboard/dist/assets/McpQueryDetailPage-DZKpzWST.js.map +1 -0
  55. package/dashboard/dist/assets/{McpQueryPage-BK5L2PqJ.js → McpQueryPage-B-8WR3GV.js} +2 -2
  56. package/dashboard/dist/assets/{McpQueryPage-BK5L2PqJ.js.map → McpQueryPage-B-8WR3GV.js.map} +1 -1
  57. package/dashboard/dist/assets/McpRunDetailPage-Dt7Ai3qB.js +2 -0
  58. package/dashboard/dist/assets/McpRunDetailPage-Dt7Ai3qB.js.map +1 -0
  59. package/dashboard/dist/assets/{McpRunsPage-QsXid9Xe.js → McpRunsPage-Bdke-HoQ.js} +2 -2
  60. package/dashboard/dist/assets/{McpRunsPage-QsXid9Xe.js.map → McpRunsPage-Bdke-HoQ.js.map} +1 -1
  61. package/dashboard/dist/assets/NamespacePill-DnJl4Lre.js +2 -0
  62. package/dashboard/dist/assets/NamespacePill-DnJl4Lre.js.map +1 -0
  63. package/dashboard/dist/assets/{OperatorDashboard-CZQSINho.js → OperatorDashboard-VZ97mufd.js} +2 -2
  64. package/dashboard/dist/assets/{OperatorDashboard-CZQSINho.js.map → OperatorDashboard-VZ97mufd.js.map} +1 -1
  65. package/dashboard/dist/assets/{PageHeader-BuJpMxyu.js → PageHeader-Bnt2iQQa.js} +2 -2
  66. package/dashboard/dist/assets/{PageHeader-BuJpMxyu.js.map → PageHeader-Bnt2iQQa.js.map} +1 -1
  67. package/dashboard/dist/assets/{PageHeaderWithStats-yD_PTbOl.js → PageHeaderWithStats-BuKc9MKt.js} +2 -2
  68. package/dashboard/dist/assets/{PageHeaderWithStats-yD_PTbOl.js.map → PageHeaderWithStats-BuKc9MKt.js.map} +1 -1
  69. package/dashboard/dist/assets/{ProcessDetailPage-DUCOOvOK.js → ProcessDetailPage-BLfLfmWX.js} +2 -2
  70. package/dashboard/dist/assets/{ProcessDetailPage-DUCOOvOK.js.map → ProcessDetailPage-BLfLfmWX.js.map} +1 -1
  71. package/dashboard/dist/assets/{ProcessesListPage-CXvSLTIM.js → ProcessesListPage-DG54t-Nd.js} +2 -2
  72. package/dashboard/dist/assets/{ProcessesListPage-CXvSLTIM.js.map → ProcessesListPage-DG54t-Nd.js.map} +1 -1
  73. package/dashboard/dist/assets/{RolePill-SasQKc_B.js → RolePill-DQTT1s9v.js} +2 -2
  74. package/dashboard/dist/assets/{RolePill-SasQKc_B.js.map → RolePill-DQTT1s9v.js.map} +1 -1
  75. package/dashboard/dist/assets/{RolesPage-DlQR0Iz_.js → RolesPage-Bdlv3DdW.js} +2 -2
  76. package/dashboard/dist/assets/{RolesPage-DlQR0Iz_.js.map → RolesPage-Bdlv3DdW.js.map} +1 -1
  77. package/dashboard/dist/assets/{RunAsSelector-DP-jxsv6.js → RunAsSelector-BFxxMvL3.js} +2 -2
  78. package/dashboard/dist/assets/{RunAsSelector-DP-jxsv6.js.map → RunAsSelector-BFxxMvL3.js.map} +1 -1
  79. package/dashboard/dist/assets/{SwimlaneTimeline-BmASA0nN.js → SwimlaneTimeline-BZmad7WQ.js} +2 -2
  80. package/dashboard/dist/assets/{SwimlaneTimeline-BmASA0nN.js.map → SwimlaneTimeline-BZmad7WQ.js.map} +1 -1
  81. package/dashboard/dist/assets/{TagInput-DvF3j8MA.js → TagInput-B00uqhjX.js} +2 -2
  82. package/dashboard/dist/assets/{TagInput-DvF3j8MA.js.map → TagInput-B00uqhjX.js.map} +1 -1
  83. package/dashboard/dist/assets/{TaskDetailPage-CRowpkeZ.js → TaskDetailPage-CLl2mgBC.js} +2 -2
  84. package/dashboard/dist/assets/{TaskDetailPage-CRowpkeZ.js.map → TaskDetailPage-CLl2mgBC.js.map} +1 -1
  85. package/dashboard/dist/assets/{TaskQueuePill-BCQrS2oK.js → TaskQueuePill-CUsofm0X.js} +2 -2
  86. package/dashboard/dist/assets/{TaskQueuePill-BCQrS2oK.js.map → TaskQueuePill-CUsofm0X.js.map} +1 -1
  87. package/dashboard/dist/assets/{TasksListPage-uJ6z37J-.js → TasksListPage-DoHXxZF-.js} +2 -2
  88. package/dashboard/dist/assets/{TasksListPage-uJ6z37J-.js.map → TasksListPage-DoHXxZF-.js.map} +1 -1
  89. package/dashboard/dist/assets/{TimeAgo-BxwngK1D.js → TimeAgo-DZF9w8Rl.js} +2 -2
  90. package/dashboard/dist/assets/{TimeAgo-BxwngK1D.js.map → TimeAgo-DZF9w8Rl.js.map} +1 -1
  91. package/dashboard/dist/assets/{TimestampCell-CDmichOM.js → TimestampCell-DPpoTdrw.js} +2 -2
  92. package/dashboard/dist/assets/{TimestampCell-CDmichOM.js.map → TimestampCell-DPpoTdrw.js.map} +1 -1
  93. package/dashboard/dist/assets/ToolPill-DjvedZSn.js +2 -0
  94. package/dashboard/dist/assets/ToolPill-DjvedZSn.js.map +1 -0
  95. package/dashboard/dist/assets/ToolTestPanel-DtAgJQfr.js +2 -0
  96. package/dashboard/dist/assets/ToolTestPanel-DtAgJQfr.js.map +1 -0
  97. package/dashboard/dist/assets/TopicDetailPage-W9RKkNNp.js +9 -0
  98. package/dashboard/dist/assets/TopicDetailPage-W9RKkNNp.js.map +1 -0
  99. package/dashboard/dist/assets/{TopicsPage-letISGGD.js → TopicsPage-Bc-4ne6V.js} +2 -2
  100. package/dashboard/dist/assets/{TopicsPage-letISGGD.js.map → TopicsPage-Bc-4ne6V.js.map} +1 -1
  101. package/dashboard/dist/assets/{UserName-W6_Iz2Qb.js → UserName-O2Q4-E6E.js} +2 -2
  102. package/dashboard/dist/assets/{UserName-W6_Iz2Qb.js.map → UserName-O2Q4-E6E.js.map} +1 -1
  103. package/dashboard/dist/assets/{WorkflowExecutionPage-Cfx-xlRT.js → WorkflowExecutionPage-DEDsBmn1.js} +2 -2
  104. package/dashboard/dist/assets/{WorkflowExecutionPage-Cfx-xlRT.js.map → WorkflowExecutionPage-DEDsBmn1.js.map} +1 -1
  105. package/dashboard/dist/assets/{WorkflowPill-Z-zHRKOK.js → WorkflowPill-F1oKUzmc.js} +2 -2
  106. package/dashboard/dist/assets/{WorkflowPill-Z-zHRKOK.js.map → WorkflowPill-F1oKUzmc.js.map} +1 -1
  107. package/dashboard/dist/assets/{WorkflowsDashboard-DC4XHMWt.js → WorkflowsDashboard-Bcf17vCt.js} +2 -2
  108. package/dashboard/dist/assets/{WorkflowsDashboard-DC4XHMWt.js.map → WorkflowsDashboard-Bcf17vCt.js.map} +1 -1
  109. package/dashboard/dist/assets/{WorkflowsOverview-GefO_yn0.js → WorkflowsOverview-Cwo2rqGT.js} +2 -2
  110. package/dashboard/dist/assets/{WorkflowsOverview-GefO_yn0.js.map → WorkflowsOverview-Cwo2rqGT.js.map} +1 -1
  111. package/dashboard/dist/assets/YamlWorkflowDetailPage-Bv8ZFwO-.js +33 -0
  112. package/dashboard/dist/assets/YamlWorkflowDetailPage-Bv8ZFwO-.js.map +1 -0
  113. package/dashboard/dist/assets/YamlWorkflowsPage-DOiEQDOq.js +2 -0
  114. package/dashboard/dist/assets/YamlWorkflowsPage-DOiEQDOq.js.map +1 -0
  115. package/dashboard/dist/assets/{agents-BI5OeN84.js → agents-D09G0HCv.js} +2 -2
  116. package/dashboard/dist/assets/{agents-BI5OeN84.js.map → agents-D09G0HCv.js.map} +1 -1
  117. package/dashboard/dist/assets/{bots-1UzUCsrR.js → bots-D0LhyZZM.js} +2 -2
  118. package/dashboard/dist/assets/{bots-1UzUCsrR.js.map → bots-D0LhyZZM.js.map} +1 -1
  119. package/dashboard/dist/assets/{capabilities-BUbl-ojp.js → capabilities-DON4-NXs.js} +2 -2
  120. package/dashboard/dist/assets/{capabilities-BUbl-ojp.js.map → capabilities-DON4-NXs.js.map} +1 -1
  121. package/dashboard/dist/assets/{controlplane-DTFrH_vN.js → controlplane-Bihd1kXf.js} +2 -2
  122. package/dashboard/dist/assets/{controlplane-DTFrH_vN.js.map → controlplane-Bihd1kXf.js.map} +1 -1
  123. package/dashboard/dist/assets/{escalation-BQhCt4W0.js → escalation-CP2XbdXK.js} +2 -2
  124. package/dashboard/dist/assets/{escalation-BQhCt4W0.js.map → escalation-CP2XbdXK.js.map} +1 -1
  125. package/dashboard/dist/assets/{escalation-columns-J20k5CcY.js → escalation-columns-9aw8Y4qq.js} +2 -2
  126. package/dashboard/dist/assets/{escalation-columns-J20k5CcY.js.map → escalation-columns-9aw8Y4qq.js.map} +1 -1
  127. package/dashboard/dist/assets/helpers-DzO-OGPe.js +2 -0
  128. package/dashboard/dist/assets/helpers-DzO-OGPe.js.map +1 -0
  129. package/dashboard/dist/assets/{index-CVGgSoda.js → index-B-BK3vtk.js} +2 -2
  130. package/dashboard/dist/assets/{index-CVGgSoda.js.map → index-B-BK3vtk.js.map} +1 -1
  131. package/dashboard/dist/assets/{index-CWEOhAiK.js → index-B7lEd0cY.js} +25 -25
  132. package/dashboard/dist/assets/index-B7lEd0cY.js.map +1 -0
  133. package/dashboard/dist/assets/index-BBBGETMs.js +6 -0
  134. package/dashboard/dist/assets/index-BBBGETMs.js.map +1 -0
  135. package/dashboard/dist/assets/index-BFyzZGtv.css +1 -0
  136. package/dashboard/dist/assets/{index-vgxjge70.js → index-BInTEEIX.js} +2 -2
  137. package/dashboard/dist/assets/{index-vgxjge70.js.map → index-BInTEEIX.js.map} +1 -1
  138. package/dashboard/dist/assets/index-BTp73vYK.js +2 -0
  139. package/dashboard/dist/assets/index-BTp73vYK.js.map +1 -0
  140. package/dashboard/dist/assets/index-CCup2uaP.js +2 -0
  141. package/dashboard/dist/assets/{index-C9ClHiiW.js.map → index-CCup2uaP.js.map} +1 -1
  142. package/dashboard/dist/assets/index-CMRW_PE-.js +9 -0
  143. package/dashboard/dist/assets/index-CMRW_PE-.js.map +1 -0
  144. package/dashboard/dist/assets/index-Cb7aSzox.js +2 -0
  145. package/dashboard/dist/assets/{index-si70YcIP.js.map → index-Cb7aSzox.js.map} +1 -1
  146. package/dashboard/dist/assets/index-Cjb8ulHm.js +2 -0
  147. package/dashboard/dist/assets/{index-WQQJ_cp7.js.map → index-Cjb8ulHm.js.map} +1 -1
  148. package/dashboard/dist/assets/index-DgLZ8Ix5.js +2 -0
  149. package/dashboard/dist/assets/{index-DasoTRjT.js.map → index-DgLZ8Ix5.js.map} +1 -1
  150. package/dashboard/dist/assets/index-H5Yb8CY2.js +2 -0
  151. package/dashboard/dist/assets/index-H5Yb8CY2.js.map +1 -0
  152. package/dashboard/dist/assets/{index-CLUYzdwz.js → index-_JsRJPds.js} +2 -2
  153. package/dashboard/dist/assets/{index-CLUYzdwz.js.map → index-_JsRJPds.js.map} +1 -1
  154. package/dashboard/dist/assets/{index-C-mbURj-.js → index-rbuNUyAh.js} +2 -2
  155. package/dashboard/dist/assets/{index-C-mbURj-.js.map → index-rbuNUyAh.js.map} +1 -1
  156. package/dashboard/dist/assets/{knowledge-D9Tuh-o-.js → knowledge-Bl_KaoKJ.js} +2 -2
  157. package/dashboard/dist/assets/{knowledge-D9Tuh-o-.js.map → knowledge-Bl_KaoKJ.js.map} +1 -1
  158. package/dashboard/dist/assets/{mcp-BO8QnWyk.js → mcp-DXbFGoA8.js} +2 -2
  159. package/dashboard/dist/assets/{mcp-BO8QnWyk.js.map → mcp-DXbFGoA8.js.map} +1 -1
  160. package/dashboard/dist/assets/{mcp-query-WLtQtr51.js → mcp-query-Bg69DF2x.js} +2 -2
  161. package/dashboard/dist/assets/{mcp-query-WLtQtr51.js.map → mcp-query-Bg69DF2x.js.map} +1 -1
  162. package/dashboard/dist/assets/{pipelines-BAVf9xud.js → pipelines-DK9LTg9F.js} +2 -2
  163. package/dashboard/dist/assets/{pipelines-BAVf9xud.js.map → pipelines-DK9LTg9F.js.map} +1 -1
  164. package/dashboard/dist/assets/{roles-mGO2-2hA.js → roles-BrsBN4hO.js} +2 -2
  165. package/dashboard/dist/assets/{roles-mGO2-2hA.js.map → roles-BrsBN4hO.js.map} +1 -1
  166. package/dashboard/dist/assets/{tasks-JVRVCx0f.js → tasks-CwjvPECN.js} +2 -2
  167. package/dashboard/dist/assets/{tasks-JVRVCx0f.js.map → tasks-CwjvPECN.js.map} +1 -1
  168. package/dashboard/dist/assets/{topics-BLVnahd7.js → topics-BrwkmaFR.js} +2 -2
  169. package/dashboard/dist/assets/{topics-BLVnahd7.js.map → topics-BrwkmaFR.js.map} +1 -1
  170. package/dashboard/dist/assets/{useEventHooks-BwjAi0Qq.js → useEventHooks-Cd1GM1NG.js} +2 -2
  171. package/dashboard/dist/assets/{useEventHooks-BwjAi0Qq.js.map → useEventHooks-Cd1GM1NG.js.map} +1 -1
  172. package/dashboard/dist/assets/{useNamespace-DkHmXddZ.js → useNamespace-D9lghZ25.js} +2 -2
  173. package/dashboard/dist/assets/{useNamespace-DkHmXddZ.js.map → useNamespace-D9lghZ25.js.map} +1 -1
  174. package/dashboard/dist/assets/useYamlActivityEvents-vOhAwmKO.js +2 -0
  175. package/dashboard/dist/assets/useYamlActivityEvents-vOhAwmKO.js.map +1 -0
  176. package/dashboard/dist/assets/{users-BvizpAkV.js → users-ChQ7soaq.js} +2 -2
  177. package/dashboard/dist/assets/{users-BvizpAkV.js.map → users-ChQ7soaq.js.map} +1 -1
  178. package/dashboard/dist/assets/{vendor-icons-Doy0g69_.js → vendor-icons-Dj2F0Jrb.js} +38 -38
  179. package/dashboard/dist/assets/vendor-icons-Dj2F0Jrb.js.map +1 -0
  180. package/dashboard/dist/assets/workflows-BLKji1_1.js +2 -0
  181. package/dashboard/dist/assets/{workflows-CyEYa01a.js.map → workflows-BLKji1_1.js.map} +1 -1
  182. package/dashboard/dist/assets/yaml-workflows-BUhMfdaw.js +2 -0
  183. package/dashboard/dist/assets/{yaml-workflows-i3GzrEme.js.map → yaml-workflows-BUhMfdaw.js.map} +1 -1
  184. package/dashboard/dist/index.html +3 -3
  185. package/docs/story.md +13 -9
  186. package/package.json +1 -1
  187. package/dashboard/dist/assets/CapabilitiesPage-CK2fJ9Sy.js +0 -2
  188. package/dashboard/dist/assets/CapabilitiesPage-CK2fJ9Sy.js.map +0 -1
  189. package/dashboard/dist/assets/HomePage-CzvVyTq4.js +0 -2
  190. package/dashboard/dist/assets/McpQueryDetailPage-lCW668WQ.js +0 -5
  191. package/dashboard/dist/assets/McpQueryDetailPage-lCW668WQ.js.map +0 -1
  192. package/dashboard/dist/assets/McpRunDetailPage-CQOeYqxa.js +0 -2
  193. package/dashboard/dist/assets/McpRunDetailPage-CQOeYqxa.js.map +0 -1
  194. package/dashboard/dist/assets/ServerName-CHspudaC.js +0 -2
  195. package/dashboard/dist/assets/ServerName-CHspudaC.js.map +0 -1
  196. package/dashboard/dist/assets/StepIndicator-CuUIGxKk.js +0 -2
  197. package/dashboard/dist/assets/StepIndicator-CuUIGxKk.js.map +0 -1
  198. package/dashboard/dist/assets/ToolPill-1aTqYtzp.js +0 -2
  199. package/dashboard/dist/assets/ToolPill-1aTqYtzp.js.map +0 -1
  200. package/dashboard/dist/assets/ToolTestPanel-xjTn8sU8.js +0 -2
  201. package/dashboard/dist/assets/ToolTestPanel-xjTn8sU8.js.map +0 -1
  202. package/dashboard/dist/assets/TopicDetailPage-Dm0hDlS8.js +0 -9
  203. package/dashboard/dist/assets/TopicDetailPage-Dm0hDlS8.js.map +0 -1
  204. package/dashboard/dist/assets/YamlWorkflowsPage-CMsrFooO.js +0 -2
  205. package/dashboard/dist/assets/YamlWorkflowsPage-CMsrFooO.js.map +0 -1
  206. package/dashboard/dist/assets/helpers-ge6Eu90Y.js +0 -2
  207. package/dashboard/dist/assets/helpers-ge6Eu90Y.js.map +0 -1
  208. package/dashboard/dist/assets/index-C--SEsU7.css +0 -1
  209. package/dashboard/dist/assets/index-C45DvtAZ.js +0 -15
  210. package/dashboard/dist/assets/index-C45DvtAZ.js.map +0 -1
  211. package/dashboard/dist/assets/index-C9ClHiiW.js +0 -2
  212. package/dashboard/dist/assets/index-CWEOhAiK.js.map +0 -1
  213. package/dashboard/dist/assets/index-CWlP6vHG.js +0 -6
  214. package/dashboard/dist/assets/index-CWlP6vHG.js.map +0 -1
  215. package/dashboard/dist/assets/index-DasoTRjT.js +0 -2
  216. package/dashboard/dist/assets/index-FhasoOjO.js +0 -2
  217. package/dashboard/dist/assets/index-FhasoOjO.js.map +0 -1
  218. package/dashboard/dist/assets/index-WQQJ_cp7.js +0 -2
  219. package/dashboard/dist/assets/index-hAZiac0C.js +0 -2
  220. package/dashboard/dist/assets/index-hAZiac0C.js.map +0 -1
  221. package/dashboard/dist/assets/index-si70YcIP.js +0 -2
  222. package/dashboard/dist/assets/useExpandedRows-CkcEntB-.js +0 -2
  223. package/dashboard/dist/assets/useExpandedRows-CkcEntB-.js.map +0 -1
  224. package/dashboard/dist/assets/useYamlActivityEvents-CsaR5dWj.js +0 -2
  225. package/dashboard/dist/assets/useYamlActivityEvents-CsaR5dWj.js.map +0 -1
  226. package/dashboard/dist/assets/vendor-icons-Doy0g69_.js.map +0 -1
  227. package/dashboard/dist/assets/workflows-CyEYa01a.js +0 -2
  228. package/dashboard/dist/assets/yaml-workflows-i3GzrEme.js +0 -2
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CXvSLTIM.js","./vendor-query-B2UbickB.js","./tasks-JVRVCx0f.js","./workflows-CyEYa01a.js","./useEventHooks-BwjAi0Qq.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./DataTable-D9yuBv0w.js","./EmptyState-BcsfPq9T.js","./TimestampCell-CDmichOM.js","./StickyPagination-BWhFSr2d.js","./FilterBar-Ck4K4rzu.js","./PageHeader-BuJpMxyu.js","./vendor-icons-Doy0g69_.js","./ListToolbar-Cfec9gz_.js","./WorkflowPill-Z-zHRKOK.js","./ProcessDetailPage-DUCOOvOK.js","./PageHeaderWithStats-yD_PTbOl.js","./StatusBadge-XQlNFwmH.js","./RolePill-SasQKc_B.js","./UserName-W6_Iz2Qb.js","./users-BvizpAkV.js","./McpOverview-BN4GsBGI.js","./mcp-BO8QnWyk.js","./pipelines-BAVf9xud.js","./yaml-workflows-i3GzrEme.js","./controlplane-DTFrH_vN.js","./StatCard-DlgF0CJC.js","./McpRunsPage-QsXid9Xe.js","./useNamespace-DkHmXddZ.js","./ElapsedCell-TQqWaVRq.js","./RowActions-Dg-Fsm5O.js","./McpRunDetailPage-CQOeYqxa.js","./CopyableId-DaT0ZRHg.js","./CollapsibleSection-bW0UZN9b.js","./useCollapsedSections-BU5HULGs.js","./SwimlaneTimeline-BmASA0nN.js","./EventTable-Doky6fCO.js","./McpQueryPage-BK5L2PqJ.js","./mcp-query-WLtQtr51.js","./McpQueryDetailPage-lCW668WQ.js","./useYamlActivityEvents-CsaR5dWj.js","./TagInput-DvF3j8MA.js","./ToolPill-1aTqYtzp.js","./RunAsSelector-DP-jxsv6.js","./BotPicker-dCvnjynP.js","./bots-1UzUCsrR.js","./TimeAgo-BxwngK1D.js","./EscalationsOverview-Cv5UvuHI.js","./AvailableEscalationsPage-B2ZAb41C.js","./roles-mGO2-2hA.js","./constants-BHkpVaqx.js","./CustomDurationPicker-Dy4NBqhZ.js","./Modal-CSrxpXeM.js","./escalation-columns-J20k5CcY.js","./PriorityBadge-DfQY9St9.js","./escalation-BQhCt4W0.js","./OperatorDashboard-CZQSINho.js","./index-CVGgSoda.js","./WorkflowsOverview-GefO_yn0.js","./index-CWlP6vHG.js","./helpers-ge6Eu90Y.js","./WorkflowsDashboard-DC4XHMWt.js","./YamlWorkflowsPage-CMsrFooO.js","./useExpandedRows-CkcEntB-.js","./ServerName-CHspudaC.js","./TasksListPage-uJ6z37J-.js","./TaskDetailPage-CRowpkeZ.js","./WorkflowExecutionPage-Cfx-xlRT.js","./AdminDashboard-CgJC8ZZF.js","./index-si70YcIP.js","./TaskQueuePill-BCQrS2oK.js","./index-C45DvtAZ.js","./ConfirmDeleteModal-D9_1b4MW.js","./StepIndicator-CuUIGxKk.js","./index-hAZiac0C.js","./ToolTestPanel-xjTn8sU8.js","./index-FhasoOjO.js","./index-WQQJ_cp7.js","./RolesPage-DlQR0Iz_.js","./index-CLUYzdwz.js","./index-DasoTRjT.js","./index-C-mbURj-.js","./CredentialsPage-DVOK3aaR.js","./index-C9ClHiiW.js","./DropZone-CptiQ0wc.js","./index-vgxjge70.js","./knowledge-D9Tuh-o-.js","./HomePage-CzvVyTq4.js","./AgentsPage-Mom3N1Av.js","./agents-BI5OeN84.js","./AgentDetailPage-D5dHrfaM.js","./CronLabel-Cv5em7OP.js","./AgentConfigPage-Bjl2Lsvo.js","./capabilities-BUbl-ojp.js","./topics-BLVnahd7.js","./CapabilitiesPage-CK2fJ9Sy.js","./TopicsPage-letISGGD.js","./TopicDetailPage-Dm0hDlS8.js"])))=>i.map(i=>d[i]);
2
- var yx=Object.defineProperty;var bx=(r,n,s)=>n in r?yx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>bx(r,typeof n!="symbol"?n+"":n,s);import{r as xx,a as T,j as m,u as Hn,b as Cn,c as Pn,Q as vx,d as _x}from"./vendor-query-B2UbickB.js";import{r as wx,L as gr,u as Ws,N as Co,a as ig,b as Fs,O as So,c as rg,d as Sx,R as Ex}from"./vendor-react-CXumBFUA.js";import{I as Zp,R as ag,B as lg,U as Ax,A as Ox,Z as jx,a as Tx,S as Nx,P as Cx,C as kx,b as Mx,G as Rx,L as Dx,W as zx,c as qx,d as Ux,F as Bx,e as Lx,f as Hx,T as Px,g as $x,N as Yx,h as Gx,D as Vx,i as Fx,M as og,j as cg,k as Jx,l as Qx,m as Ix,E as Xx,X as $o,n as Kx,o as Zx,p as Wx,q as Wp,r as ug,s as ev,t as tv,u as nv,v as sv,w as iv}from"./vendor-icons-Doy0g69_.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)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(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var af={exports:{}},wa={},lf={exports:{}},of={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-DG54t-Nd.js","./vendor-query-B2UbickB.js","./tasks-CwjvPECN.js","./workflows-BLKji1_1.js","./useEventHooks-Cd1GM1NG.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./DataTable-D9yuBv0w.js","./EmptyState-BcsfPq9T.js","./TimestampCell-DPpoTdrw.js","./StickyPagination-BWhFSr2d.js","./FilterBar-Ck4K4rzu.js","./PageHeader-Bnt2iQQa.js","./vendor-icons-Dj2F0Jrb.js","./ListToolbar-DqaRlXrF.js","./WorkflowPill-F1oKUzmc.js","./ProcessDetailPage-BLfLfmWX.js","./PageHeaderWithStats-BuKc9MKt.js","./StatusBadge-XQlNFwmH.js","./RolePill-DQTT1s9v.js","./UserName-O2Q4-E6E.js","./users-ChQ7soaq.js","./McpOverview-B4GsHxij.js","./mcp-DXbFGoA8.js","./pipelines-DK9LTg9F.js","./yaml-workflows-BUhMfdaw.js","./controlplane-Bihd1kXf.js","./StatCard-DlgF0CJC.js","./McpRunsPage-Bdke-HoQ.js","./useNamespace-D9lghZ25.js","./ElapsedCell-WdzqA0dR.js","./RowActions-Dg-Fsm5O.js","./McpRunDetailPage-Dt7Ai3qB.js","./CopyableId-DaT0ZRHg.js","./CollapsibleSection-BeBsI1M4.js","./useCollapsedSections-BU5HULGs.js","./SwimlaneTimeline-BZmad7WQ.js","./EventTable-NIhWP__B.js","./McpQueryPage-B-8WR3GV.js","./mcp-query-Bg69DF2x.js","./McpQueryDetailPage-DZKpzWST.js","./TagInput-B00uqhjX.js","./useYamlActivityEvents-vOhAwmKO.js","./helpers-DzO-OGPe.js","./RunAsSelector-BFxxMvL3.js","./BotPicker-lj42d48P.js","./bots-D0LhyZZM.js","./ToolPill-DjvedZSn.js","./TimeAgo-DZF9w8Rl.js","./EscalationsOverview-BIEeflEV.js","./AvailableEscalationsPage-Ci24fdxC.js","./roles-BrsBN4hO.js","./constants-BHkpVaqx.js","./CustomDurationPicker-C2OH9YcV.js","./Modal-CSrxpXeM.js","./escalation-columns-9aw8Y4qq.js","./PriorityBadge-DfQY9St9.js","./escalation-CP2XbdXK.js","./OperatorDashboard-VZ97mufd.js","./index-B-BK3vtk.js","./WorkflowsOverview-Cwo2rqGT.js","./index-BBBGETMs.js","./NamespacePill-DnJl4Lre.js","./WorkflowsDashboard-Bcf17vCt.js","./YamlWorkflowsPage-DOiEQDOq.js","./GraphInvokePage-DtAW8ilc.js","./YamlWorkflowDetailPage-Bv8ZFwO-.js","./TasksListPage-DoHXxZF-.js","./TaskDetailPage-CLl2mgBC.js","./WorkflowExecutionPage-DEDsBmn1.js","./AdminDashboard-CMzR4d-w.js","./index-Cb7aSzox.js","./TaskQueuePill-CUsofm0X.js","./index-CMRW_PE-.js","./ConfirmDeleteModal-D9_1b4MW.js","./index-BTp73vYK.js","./ToolTestPanel-DtAgJQfr.js","./index-H5Yb8CY2.js","./index-Cjb8ulHm.js","./RolesPage-Bdlv3DdW.js","./index-_JsRJPds.js","./index-DgLZ8Ix5.js","./index-rbuNUyAh.js","./CredentialsPage-BDzFa3HV.js","./index-CCup2uaP.js","./DropZone-Dwpgbueb.js","./index-BInTEEIX.js","./knowledge-Bl_KaoKJ.js","./HomePage-HsO-M8ub.js","./AgentsPage-ntuzWHCD.js","./agents-D09G0HCv.js","./AgentDetailPage-CSrejvSl.js","./CronLabel-DeNm1I4r.js","./AgentConfigPage-DHCpN4xk.js","./capabilities-DON4-NXs.js","./topics-BrwkmaFR.js","./CapabilitiesPage-Bea9yLmU.js","./TopicsPage-Bc-4ne6V.js","./TopicDetailPage-W9RKkNNp.js"])))=>i.map(i=>d[i]);
2
+ var _x=Object.defineProperty;var wx=(r,n,s)=>n in r?_x(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>wx(r,typeof n!="symbol"?n+"":n,s);import{r as Sx,a as T,j as m,u as Hn,b as Cn,c as Pn,Q as Ex,d as Ax}from"./vendor-query-B2UbickB.js";import{r as jx,L as gr,u as Ws,N as Co,a as og,b as cs,O as Ma,c as cg,d as Ox,R as Tx}from"./vendor-react-CXumBFUA.js";import{I as Sf,R as ug,B as fg,U as Nx,L as Ef,a as Cx,Z as kx,S as t0,P as n0,C as Mx,W as Xf,b as Rx,c as Dx,F as zx,d as qx,e as Ux,T as Bx,f as Lx,N as Hx,g as Px,D as $x,h as Yx,M as hg,i as dg,j as Gx,k as Vx,l as Fx,E as Jx,X as $o,m as Ix,n as Qx,o as Xx,p as s0,G as Kx,q as Zx,r as Wx,s as ev,t as tv}from"./vendor-icons-Dj2F0Jrb.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)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(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var af={exports:{}},Sa={},lf={exports:{}},of={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -7,7 +7,7 @@ var yx=Object.defineProperty;var bx=(r,n,s)=>n in r?yx(r,n,{enumerable:!0,config
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var e0;function rv(){return e0||(e0=1,(function(r){function n($,te){var de=$.length;$.push(te);e:for(;0<de;){var ve=de-1>>>1,be=$[ve];if(0<o(be,te))$[ve]=te,$[de]=be,de=ve;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var te=$[0],de=$.pop();if(de!==te){$[0]=de;e:for(var ve=0,be=$.length,je=be>>>1;ve<je;){var _e=2*(ve+1)-1,Te=$[_e],lt=_e+1,Pt=$[lt];if(0>o(Te,de))lt<be&&0>o(Pt,Te)?($[ve]=Pt,$[lt]=de,ve=lt):($[ve]=Te,$[_e]=de,ve=_e);else if(lt<be&&0>o(Pt,de))$[ve]=Pt,$[lt]=de,ve=lt;else break e}}return te}function o($,te){var de=$.sortIndex-te.sortIndex;return de!==0?de:$.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=[],E=1,w=null,j=3,q=!1,M=!1,D=!1,W=!1,se=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;function re($){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=$)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function C($){if(D=!1,re($),!M)if(s(g)!==null)M=!0,X||(X=!0,ne());else{var te=s(y);te!==null&&Me(C,te.startTime-$)}}var X=!1,ce=-1,V=5,G=-1;function K(){return W?!0:!(r.unstable_now()-G<V)}function ae(){if(W=!1,X){var $=r.unstable_now();G=$;var te=!0;try{e:{M=!1,D&&(D=!1,ee(ce),ce=-1),q=!0;var de=j;try{t:{for(re($),w=s(g);w!==null&&!(w.expirationTime>$&&K());){var ve=w.callback;if(typeof ve=="function"){w.callback=null,j=w.priorityLevel;var be=ve(w.expirationTime<=$);if($=r.unstable_now(),typeof be=="function"){w.callback=be,re($),te=!0;break t}w===s(g)&&a(g),re($)}else a(g);w=s(g)}if(w!==null)te=!0;else{var je=s(y);je!==null&&Me(C,je.startTime-$),te=!1}}break e}finally{w=null,j=de,q=!1}te=void 0}}finally{te?ne():X=!1}}}var ne;if(typeof me=="function")ne=function(){me(ae)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,He=ke.port2;ke.port1.onmessage=ae,ne=function(){He.postMessage(null)}}else ne=function(){se(ae,0)};function Me($,te){ce=se(function(){$(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($){$.callback=null},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return j},r.unstable_next=function($){switch(j){case 1:case 2:case 3:var te=3;break;default:te=j}var de=j;j=te;try{return $()}finally{j=de}},r.unstable_requestPaint=function(){W=!0},r.unstable_runWithPriority=function($,te){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var de=j;j=$;try{return te()}finally{j=de}},r.unstable_scheduleCallback=function($,te,de){var ve=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?ve+de:ve):de=ve,$){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=de+be,$={id:E++,callback:te,priorityLevel:$,startTime:de,expirationTime:be,sortIndex:-1},de>ve?($.sortIndex=de,n(y,$),s(g)===null&&$===s(y)&&(D?(ee(ce),ce=-1):D=!0,Me(C,de-ve))):($.sortIndex=be,n(g,$),M||q||(M=!0,X||(X=!0,ne()))),$},r.unstable_shouldYield=K,r.unstable_wrapCallback=function($){var te=j;return function(){var de=j;j=te;try{return $.apply(this,arguments)}finally{j=de}}}})(of)),of}var t0;function av(){return t0||(t0=1,lf.exports=rv()),lf.exports}/**
10
+ */var i0;function nv(){return i0||(i0=1,(function(r){function n($,te){var de=$.length;$.push(te);e:for(;0<de;){var ve=de-1>>>1,be=$[ve];if(0<o(be,te))$[ve]=te,$[de]=be,de=ve;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var te=$[0],de=$.pop();if(de!==te){$[0]=de;e:for(var ve=0,be=$.length,Oe=be>>>1;ve<Oe;){var we=2*(ve+1)-1,Te=$[we],lt=we+1,Pt=$[lt];if(0>o(Te,de))lt<be&&0>o(Pt,Te)?($[ve]=Pt,$[lt]=de,ve=lt):($[ve]=Te,$[we]=de,ve=we);else if(lt<be&&0>o(Pt,de))$[ve]=Pt,$[lt]=de,ve=lt;else break e}}return te}function o($,te){var de=$.sortIndex-te.sortIndex;return de!==0?de:$.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=[],E=1,w=null,O=3,q=!1,M=!1,D=!1,W=!1,se=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;function re($){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=$)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function C($){if(D=!1,re($),!M)if(s(g)!==null)M=!0,X||(X=!0,ne());else{var te=s(y);te!==null&&Me(C,te.startTime-$)}}var X=!1,ce=-1,V=5,G=-1;function K(){return W?!0:!(r.unstable_now()-G<V)}function ae(){if(W=!1,X){var $=r.unstable_now();G=$;var te=!0;try{e:{M=!1,D&&(D=!1,ee(ce),ce=-1),q=!0;var de=O;try{t:{for(re($),w=s(g);w!==null&&!(w.expirationTime>$&&K());){var ve=w.callback;if(typeof ve=="function"){w.callback=null,O=w.priorityLevel;var be=ve(w.expirationTime<=$);if($=r.unstable_now(),typeof be=="function"){w.callback=be,re($),te=!0;break t}w===s(g)&&a(g),re($)}else a(g);w=s(g)}if(w!==null)te=!0;else{var Oe=s(y);Oe!==null&&Me(C,Oe.startTime-$),te=!1}}break e}finally{w=null,O=de,q=!1}te=void 0}}finally{te?ne():X=!1}}}var ne;if(typeof me=="function")ne=function(){me(ae)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,He=ke.port2;ke.port1.onmessage=ae,ne=function(){He.postMessage(null)}}else ne=function(){se(ae,0)};function Me($,te){ce=se(function(){$(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($){$.callback=null},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return O},r.unstable_next=function($){switch(O){case 1:case 2:case 3:var te=3;break;default:te=O}var de=O;O=te;try{return $()}finally{O=de}},r.unstable_requestPaint=function(){W=!0},r.unstable_runWithPriority=function($,te){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var de=O;O=$;try{return te()}finally{O=de}},r.unstable_scheduleCallback=function($,te,de){var ve=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?ve+de:ve):de=ve,$){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=de+be,$={id:E++,callback:te,priorityLevel:$,startTime:de,expirationTime:be,sortIndex:-1},de>ve?($.sortIndex=de,n(y,$),s(g)===null&&$===s(y)&&(D?(ee(ce),ce=-1):D=!0,Me(C,de-ve))):($.sortIndex=be,n(g,$),M||q||(M=!0,X||(X=!0,ne()))),$},r.unstable_shouldYield=K,r.unstable_wrapCallback=function($){var te=O;return function(){var de=O;O=te;try{return $.apply(this,arguments)}finally{O=de}}}})(of)),of}var r0;function sv(){return r0||(r0=1,lf.exports=nv()),lf.exports}/**
11
11
  * @license React
12
12
  * react-dom-client.production.js
13
13
  *
@@ -15,28 +15,28 @@ var yx=Object.defineProperty;var bx=(r,n,s)=>n in r?yx(r,n,{enumerable:!0,config
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var n0;function lv(){if(n0)return wa;n0=1;var r=av(),n=xx(),s=wx();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 o(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 c=i.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===i)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===i){p=!0,i=c,l=u;break}if(b===l){p=!0,l=c,i=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===i){p=!0,i=u,l=c;break}if(b===l){p=!0,l=u,i=c;break}b=b.sibling}if(!p)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 E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,j=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),se=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),me=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function ne(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var ke=Symbol.for("react.client.reference");function He(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ke?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case se:return"Profiler";case W:return"StrictMode";case C:return"Suspense";case X:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case me:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case re:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return t=e.displayName||null,t!==null?t:He(e.type)||"Memo";case V:t=e._payload,e=e._init;try{return He(e(t))}catch{}}return null}var Me=Array.isArray,$=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,de={pending:!1,data:null,method:null,action:null},ve=[],be=-1;function je(e){return{current:e}}function _e(e){0>be||(e.current=ve[be],ve[be]=null,be--)}function Te(e,t){be++,ve[be]=e.current,e.current=t}var lt=je(null),Pt=je(null),rn=je(null),Ot=je(null);function jt(e,t){switch(Te(rn,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(rn)}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 ei(e){Pt.current===e&&(_e(lt),_e(Pt)),Ot.current===e&&(_e(Ot),ba._currentValue=de)}var Ti,ti;function an(e){if(Ti===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ti=t&&t[1]||"",ti=-1<i.stack.indexOf(`
18
+ */var a0;function iv(){if(a0)return Sa;a0=1;var r=sv(),n=Sx(),s=jx();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 o(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 c=i.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===i)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===i){p=!0,i=c,l=u;break}if(b===l){p=!0,l=c,i=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===i){p=!0,i=u,l=c;break}if(b===l){p=!0,l=u,i=c;break}b=b.sibling}if(!p)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 E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,O=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),se=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),me=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function ne(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var ke=Symbol.for("react.client.reference");function He(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ke?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case se:return"Profiler";case W:return"StrictMode";case C:return"Suspense";case X:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case me:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case re:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return t=e.displayName||null,t!==null?t:He(e.type)||"Memo";case V:t=e._payload,e=e._init;try{return He(e(t))}catch{}}return null}var Me=Array.isArray,$=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,de={pending:!1,data:null,method:null,action:null},ve=[],be=-1;function Oe(e){return{current:e}}function we(e){0>be||(e.current=ve[be],ve[be]=null,be--)}function Te(e,t){be++,ve[be]=e.current,e.current=t}var lt=Oe(null),Pt=Oe(null),rn=Oe(null),jt=Oe(null);function Ot(e,t){switch(Te(rn,t),Te(Pt,e),Te(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ep(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ep(t),e=Ap(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}we(lt),Te(lt,e)}function Se(){we(lt),we(Pt),we(rn)}function Tt(e){e.memoizedState!==null&&Te(jt,e);var t=lt.current,i=Ap(t,e.type);t!==i&&(Te(Pt,e),Te(lt,i))}function ei(e){Pt.current===e&&(we(lt),we(Pt)),jt.current===e&&(we(jt),xa._currentValue=de)}var Ti,ti;function an(e){if(Ti===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ti=t&&t[1]||"",ti=-1<i.stack.indexOf(`
19
19
  at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+Ti+e+ti}var Ni=!1;function ds(e,t){if(!e||Ni)return"";Ni=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(P){var L=P}Reflect.construct(e,[],I)}else{try{I.call()}catch(P){L=P}e.call(I.prototype)}}else{try{throw Error()}catch(P){L=P}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(P){if(P&&L&&typeof P.stack=="string")return[P.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var O=p.split(`
20
+ `+Ti+e+ti}var Ni=!1;function ms(e,t){if(!e||Ni)return"";Ni=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(P){var L=P}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(P){L=P}e.call(Q.prototype)}}else{try{throw Error()}catch(P){L=P}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(P){if(P&&L&&typeof P.stack=="string")return[P.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var j=p.split(`
21
21
  `),B=b.split(`
22
- `);for(c=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;if(l===O.length||c===B.length)for(l=O.length-1,c=B.length-1;1<=l&&0<=c&&O[l]!==B[c];)c--;for(;1<=l&&0<=c;l--,c--)if(O[l]!==B[c]){if(l!==1||c!==1)do if(l--,c--,0>c||O[l]!==B[c]){var Y=`
23
- `+O[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=c);break}}}finally{Ni=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?an(i):""}function Fa(e,t){switch(e.tag){case 26:case 27:case 5:return an(e.type);case 16:return an("Lazy");case 13:return e.child!==t&&t!==null?an("Suspense Fallback"):an("Suspense");case 19:return an("SuspenseList");case 0:case 15:return ds(e.type,!1);case 11:return ds(e.type.render,!1);case 1:return ds(e.type,!0);case 31:return an("Activity");default:return""}}function Ja(e){try{var t="",i=null;do t+=Fa(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
22
+ `);for(c=l=0;l<j.length&&!j[l].includes("DetermineComponentFrameRoot");)l++;for(;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;if(l===j.length||c===B.length)for(l=j.length-1,c=B.length-1;1<=l&&0<=c&&j[l]!==B[c];)c--;for(;1<=l&&0<=c;l--,c--)if(j[l]!==B[c]){if(l!==1||c!==1)do if(l--,c--,0>c||j[l]!==B[c]){var Y=`
23
+ `+j[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=c);break}}}finally{Ni=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?an(i):""}function Ja(e,t){switch(e.tag){case 26:case 27:case 5:return an(e.type);case 16:return an("Lazy");case 13:return e.child!==t&&t!==null?an("Suspense Fallback"):an("Suspense");case 19:return an("SuspenseList");case 0:case 15:return ms(e.type,!1);case 11:return ms(e.type.render,!1);case 1:return ms(e.type,!0);case 31:return an("Activity");default:return""}}function Ia(e){try{var t="",i=null;do t+=Ja(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
24
24
  Error generating stack: `+l.message+`
25
- `+l.stack}}var Tr=Object.prototype.hasOwnProperty,Nr=r.unstable_scheduleCallback,$n=r.unstable_cancelCallback,Qa=r.unstable_shouldYield,Ci=r.unstable_requestPaint,et=r.unstable_now,Io=r.unstable_getCurrentPriorityLevel,Ia=r.unstable_ImmediatePriority,Xa=r.unstable_UserBlockingPriority,ki=r.unstable_NormalPriority,Xo=r.unstable_LowPriority,Ka=r.unstable_IdlePriority,Ko=r.log,Za=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Ko=="function"&&Za(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Mi,Cr=Math.log,kr=Math.LN2;function Mi(e){return e>>>=0,e===0?32:31-(Cr(e)/kr|0)|0}var ms=256,Yn=262144,ps=4194304;function vn(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 si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=vn(l):(p&=b,p!==0?c=vn(p):i||(i=b&~e,i!==0&&(c=vn(i))))):(b=l&~u,b!==0?c=vn(b):p!==0?c=vn(p):i||(i=l&~e,i!==0&&(c=vn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Mr(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 Ri(){var e=ps;return ps<<=1,(ps&62914560)===0&&(ps=4194304),e}function gs(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function _n(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ys(e,t,i,l,c,u){var p=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,B=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),I=1<<Y;b[Y]=0,O[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~I}l!==0&&bs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function bs(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 ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function xs(e,t){var i=t&-t;return i=(i&42)!==0?1:Gn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gn(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 ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Vp(e.type))}function Wa(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var kn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+kn,it="__reactProps$"+kn,Yt="__reactContainer$"+kn,li="__reactEvents$"+kn,Dr="__reactListeners$"+kn,el="__reactHandles$"+kn,tl="__reactResources$"+kn,yt="__reactMarker$"+kn;function Di(e){delete e[Qe],delete e[it],delete e[li],delete e[Dr],delete e[el]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||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 S(e){if(e=e[Qe]||e[Yt]){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 A(e){var t=e[tl];return t||(t=e[tl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var z=new Set,Q={};function Z(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(Q[e]=t,e=0;e<t.length;e++)z.add(t[e])}var J=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]*$"),fe={},Oe={};function Ke(e){return Tr.call(Oe,e)?!0:Tr.call(fe,e)?!1:J.test(e)?Oe[e]=!0:(fe[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 wn(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 Vn(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 ln(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 uy(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 c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zo(e){if(!e._valueTracker){var t=dh(e)?"checked":"value";e._valueTracker=uy(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 nl(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 fy=/[\n"\\]/g;function on(e){return e.replace(fy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Wo(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ln(t)):e.value!==""+ln(t)&&(e.value=""+ln(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?ec(e,p,ln(t)):i!=null?ec(e,p,ln(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+ln(b):e.removeAttribute("name")}function ph(e,t,i,l,c,u,p,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)){Zo(e);return}i=i!=null?""+ln(i):"",t=t!=null?""+ln(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Zo(e)}function ec(e,t,i){t==="number"&&nl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function zi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+ln(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function gh(e,t,i){if(t!=null&&(t=""+ln(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+ln(i):""}function yh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Me(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=ln(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Zo(e)}function qi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var hy=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||hy.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 c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&bh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&bh(e,u,t[u])}function tc(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 dy=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"]]),my=/^[\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 sl(e){return my.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var nc=null;function sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Bi=null;function vh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Wo(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="'+on(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));Wo(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.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&&zi(e,!!i.multiple,t,!1)}}}var ic=!1;function _h(e,t,i){if(ic)return e(t,i);ic=!0;try{var l=e(t);return l}finally{if(ic=!1,(Ui!==null||Bi!==null)&&(Gl(),Ui&&(t=Ui,e=Bi,Bi=Ui=null,vh(t),e)))for(t=0;t<e.length;t++)vh(e[t])}}function zr(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 Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rc=!1;if(Jn)try{var qr={};Object.defineProperty(qr,"passive",{get:function(){rc=!0}}),window.addEventListener("test",qr,qr),window.removeEventListener("test",qr,qr)}catch{rc=!1}var vs=null,ac=null,il=null;function wh(){if(il)return il;var e,t=ac,i=t.length,l,c="value"in vs?vs.value:vs.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return il=c.slice(e,1<l?1-l:void 0)}function rl(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 al(){return!0}function Sh(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,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)?al:Sh,this.isPropagationStopped=Sh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=al)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=al)},persist:function(){},isPersistent:al}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ll=zt(oi),Ur=w({},oi,{view:0,detail:0}),py=zt(Ur),lc,oc,Br,ol=w({},Ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uc,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!==Br&&(Br&&e.type==="mousemove"?(lc=e.screenX-Br.screenX,oc=e.screenY-Br.screenY):oc=lc=0,Br=e),lc)},movementY:function(e){return"movementY"in e?e.movementY:oc}}),Eh=zt(ol),gy=w({},ol,{dataTransfer:0}),yy=zt(gy),by=w({},Ur,{relatedTarget:0}),cc=zt(by),xy=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),vy=zt(xy),_y=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wy=zt(_y),Sy=w({},oi,{data:0}),Ah=zt(Sy),Ey={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ay={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"},Oy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Oy[e])?!!t[e]:!1}function uc(){return jy}var Ty=w({},Ur,{key:function(e){if(e.key){var t=Ey[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=rl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ay[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uc,charCode:function(e){return e.type==="keypress"?rl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?rl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ny=zt(Ty),Cy=w({},ol,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oh=zt(Cy),ky=w({},Ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uc}),My=zt(ky),Ry=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dy=zt(Ry),zy=w({},ol,{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}),qy=zt(zy),Uy=w({},oi,{newState:0,oldState:0}),By=zt(Uy),Ly=[9,13,27,32],fc=Jn&&"CompositionEvent"in window,Lr=null;Jn&&"documentMode"in document&&(Lr=document.documentMode);var Hy=Jn&&"TextEvent"in window&&!Lr,jh=Jn&&(!fc||Lr&&8<Lr&&11>=Lr),Th=" ",Nh=!1;function Ch(e,t){switch(e){case"keyup":return Ly.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 Li=!1;function Py(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 $y(e,t){if(Li)return e==="compositionend"||!fc&&Ch(e,t)?(e=wh(),il=ac=vs=null,Li=!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 Yy={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"?!!Yy[e.type]:t==="textarea"}function Rh(e,t,i,l){Ui?Bi?Bi.push(l):Bi=[l]:Ui=l,t=Kl(t,"onChange"),0<t.length&&(i=new ll("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Hr=null,Pr=null;function Gy(e){pp(e,0)}function cl(e){var t=_(e);if(mh(t))return e}function Dh(e,t){if(e==="change")return t}var zh=!1;if(Jn){var hc;if(Jn){var dc="oninput"in document;if(!dc){var qh=document.createElement("div");qh.setAttribute("oninput","return;"),dc=typeof qh.oninput=="function"}hc=dc}else hc=!1;zh=hc&&(!document.documentMode||9<document.documentMode)}function Uh(){Hr&&(Hr.detachEvent("onpropertychange",Bh),Pr=Hr=null)}function Bh(e){if(e.propertyName==="value"&&cl(Pr)){var t=[];Rh(t,Pr,e,sc(e)),_h(Gy,t)}}function Vy(e,t,i){e==="focusin"?(Uh(),Hr=t,Pr=i,Hr.attachEvent("onpropertychange",Bh)):e==="focusout"&&Uh()}function Fy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cl(Pr)}function Jy(e,t){if(e==="click")return cl(t)}function Qy(e,t){if(e==="input"||e==="change")return cl(t)}function Iy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Iy;function $r(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 c=i[l];if(!Tr.call(t,c)||!Gt(e[c],t[c]))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 $h(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=nl(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=nl(e.document)}return t}function mc(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 Xy=Jn&&"documentMode"in document&&11>=document.documentMode,Hi=null,pc=null,Yr=null,gc=!1;function Yh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;gc||Hi==null||Hi!==nl(l)||(l=Hi,"selectionStart"in l&&mc(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&&$r(Yr,l)||(Yr=l,l=Kl(pc,"onSelect"),0<l.length&&(t=new ll("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Hi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Pi={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},yc={},Gh={};Jn&&(Gh=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function ui(e){if(yc[e])return yc[e];if(!Pi[e])return e;var t=Pi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Gh)return yc[e]=t[i];return e}var Vh=ui("animationend"),Fh=ui("animationiteration"),Jh=ui("animationstart"),Ky=ui("transitionrun"),Zy=ui("transitionstart"),Wy=ui("transitioncancel"),Qh=ui("transitionend"),Ih=new Map,bc="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(" ");bc.push("scrollEnd");function Sn(e,t){Ih.set(e,t),Z(t,[e])}var ul=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=[],$i=0,xc=0;function fl(){for(var e=$i,t=xc=$i=0;t<e;){var i=cn[t];cn[t++]=null;var l=cn[t];cn[t++]=null;var c=cn[t];cn[t++]=null;var u=cn[t];if(cn[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&Xh(i,c,u)}}function hl(e,t,i,l){cn[$i++]=e,cn[$i++]=t,cn[$i++]=i,cn[$i++]=l,xc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function vc(e,t,i,l){return hl(e,t,i,l),dl(e)}function fi(e,t){return hl(e,null,null,t),dl(e)}function Xh(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!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||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function dl(e){if(50<fa)throw fa=0,Nu=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 eb(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 eb(e,t,i,l)}function _c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(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 ml(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")_c(e)&&(p=1);else if(typeof e=="string")p=rx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Vt(31,i,t,c),e.elementType=G,e.lanes=u,e;case D:return hi(i.children,c,u,t);case W:p=8,c|=24;break;case se:return e=Vt(12,i,t,c|2),e.elementType=se,e.lanes=u,e;case C:return e=Vt(13,i,t,c),e.elementType=C,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:p=10;break e;case ee:p=9;break e;case re:p=11;break e;case ce:p=14;break e;case V:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function wc(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 Sc(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 un(e,t){if(typeof e=="object"&&e!==null){var i=Wh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ja(t)},Wh.set(e,t),t)}return{value:e,source:t,stack:Ja(t)}}var Gi=[],Vi=0,pl=null,Gr=0,fn=[],hn=0,_s=null,Mn=1,Rn="";function In(e,t){Gi[Vi++]=Gr,Gi[Vi++]=pl,pl=e,Gr=t}function ed(e,t,i){fn[hn++]=Mn,fn[hn++]=Rn,fn[hn++]=_s,_s=e;var l=Mn;e=Rn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Mn=1<<32-Nt(t)+c|i<<c|l,Rn=u+e}else Mn=1<<u|i<<c|l,Rn=e}function Ec(e){e.return!==null&&(In(e,1),ed(e,1,0))}function Ac(e){for(;e===pl;)pl=Gi[--Vi],Gi[Vi]=null,Gr=Gi[--Vi],Gi[Vi]=null;for(;e===_s;)_s=fn[--hn],fn[hn]=null,Rn=fn[--hn],fn[hn]=null,Mn=fn[--hn],fn[hn]=null}function td(e,t){fn[hn++]=Mn,fn[hn++]=Rn,fn[hn++]=_s,Mn=t.id,Rn=t.overflow,_s=e}var wt=null,Ze=null,ze=!1,ws=null,dn=!1,Oc=Error(a(519));function Ss(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vr(un(t,e)),Oc}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<da.length;i++)Ce(da[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=Fn),t=!0):t=!1,t||Ss(e,!0)}function sd(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:dn=!1;return;case 27:case 3:dn=!0;return;default:wt=wt.return}}function Fi(e){if(e!==wt)return!1;if(!ze)return sd(e),ze=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Gu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Ss(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,Us(e.type)?(e=Iu,Iu=null,Ze=e):Ze=t):Ze=wt?pn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,ze=!1}function jc(){var e=ws;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),ws=null),e}function Vr(e){ws===null?ws=[e]:ws.push(e)}var Tc=je(null),mi=null,Xn=null;function Es(e,t,i){Te(Tc,t._currentValue),t._currentValue=i}function Kn(e){e._currentValue=Tc.current,_e(Tc)}function Nc(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 Cc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Nc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Nc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ji(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===Ot.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ba):e=[ba])}c=c.return}e!==null&&Cc(t,e,i,l),t.flags|=262144}function gl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Xn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return id(mi,e)}function yl(e,t){return mi===null&&pi(e),id(e,t)}function id(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Xn===null){if(e===null)throw Error(a(308));Xn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xn=Xn.next=t;return i}var tb=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()})}},nb=r.unstable_scheduleCallback,sb=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kc(){return{controller:new tb,data:new Map,refCount:0}}function Fr(e){e.refCount--,e.refCount===0&&nb(sb,function(){e.controller.abort()})}var Jr=null,Mc=0,Qi=0,Ii=null;function ib(e,t){if(Jr===null){var i=Jr=[];Mc=0,Qi=zu(),Ii={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Mc++,t.then(rd,rd),t}function rd(){if(--Mc===0&&Jr!==null){Ii!==null&&(Ii.status="fulfilled");var e=Jr;Jr=null,Qi=0,Ii=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function rb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var ad=$.S;$.S=function(e,t){Ym=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ib(e,t),ad!==null&&ad(e,t)};var gi=je(null);function Rc(){var e=gi.current;return e!==null?e:Ie.pooledCache}function bl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function ld(){var e=Rc();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Dc=Error(a(474)),xl=Error(a(542)),vl={then:function(){}};function od(e){return e=e.status,e==="fulfilled"||e==="rejected"}function cd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Fn,Fn),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(Fn,Fn);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 c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fd(e),e}throw bi=t,Xi}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Xi):i}}var bi=null;function ud(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function fd(e){if(e===Xi||e===xl)throw Error(a(483))}var Ki=null,Qr=0;function _l(e){var t=Qr;return Qr+=1,Ki===null&&(Ki=[]),cd(Ki,e,t)}function Ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wl(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,k){if(e){var U=R.deletions;U===null?(R.deletions=[k],R.flags|=16):U.push(k)}}function i(R,k){if(!e)return null;for(;k!==null;)t(R,k),k=k.sibling;return null}function l(R){for(var k=new Map;R!==null;)R.key!==null?k.set(R.key,R):k.set(R.index,R),R=R.sibling;return k}function c(R,k){return R=Qn(R,k),R.index=0,R.sibling=null,R}function u(R,k,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<k?(R.flags|=67108866,k):U):(R.flags|=67108866,k)):(R.flags|=1048576,k)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,k,U,F){return k===null||k.tag!==6?(k=wc(U,R.mode,F),k.return=R,k):(k=c(k,U),k.return=R,k)}function O(R,k,U,F){var ge=U.type;return ge===D?Y(R,k,U.props.children,F,U.key):k!==null&&(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type)?(k=c(k,U.props),Ir(k,U),k.return=R,k):(k=ml(U.type,U.key,U.props,null,R.mode,F),Ir(k,U),k.return=R,k)}function B(R,k,U,F){return k===null||k.tag!==4||k.stateNode.containerInfo!==U.containerInfo||k.stateNode.implementation!==U.implementation?(k=Sc(U,R.mode,F),k.return=R,k):(k=c(k,U.children||[]),k.return=R,k)}function Y(R,k,U,F,ge){return k===null||k.tag!==7?(k=hi(U,R.mode,F,ge),k.return=R,k):(k=c(k,U),k.return=R,k)}function I(R,k,U){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=wc(""+k,R.mode,U),k.return=R,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case q:return U=ml(k.type,k.key,k.props,null,R.mode,U),Ir(U,k),U.return=R,U;case M:return k=Sc(k,R.mode,U),k.return=R,k;case V:return k=yi(k),I(R,k,U)}if(Me(k)||ne(k))return k=hi(k,R.mode,U,null),k.return=R,k;if(typeof k.then=="function")return I(R,_l(k),U);if(k.$$typeof===me)return I(R,yl(R,k),U);wl(R,k)}return null}function L(R,k,U,F){var ge=k!==null?k.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:b(R,k,""+U,F);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case q:return U.key===ge?O(R,k,U,F):null;case M:return U.key===ge?B(R,k,U,F):null;case V:return U=yi(U),L(R,k,U,F)}if(Me(U)||ne(U))return ge!==null?null:Y(R,k,U,F,null);if(typeof U.then=="function")return L(R,k,_l(U),F);if(U.$$typeof===me)return L(R,k,yl(R,U),F);wl(R,U)}return null}function P(R,k,U,F,ge){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return R=R.get(U)||null,b(k,R,""+F,ge);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case q:return R=R.get(F.key===null?U:F.key)||null,O(k,R,F,ge);case M:return R=R.get(F.key===null?U:F.key)||null,B(k,R,F,ge);case V:return F=yi(F),P(R,k,U,F,ge)}if(Me(F)||ne(F))return R=R.get(U)||null,Y(k,R,F,ge,null);if(typeof F.then=="function")return P(R,k,U,_l(F),ge);if(F.$$typeof===me)return P(R,k,U,yl(k,F),ge);wl(k,F)}return null}function he(R,k,U,F){for(var ge=null,Be=null,pe=k,Ee=k=0,De=null;pe!==null&&Ee<U.length;Ee++){pe.index>Ee?(De=pe,pe=null):De=pe.sibling;var Le=L(R,pe,U[Ee],F);if(Le===null){pe===null&&(pe=De);break}e&&pe&&Le.alternate===null&&t(R,pe),k=u(Le,k,Ee),Be===null?ge=Le:Be.sibling=Le,Be=Le,pe=De}if(Ee===U.length)return i(R,pe),ze&&In(R,Ee),ge;if(pe===null){for(;Ee<U.length;Ee++)pe=I(R,U[Ee],F),pe!==null&&(k=u(pe,k,Ee),Be===null?ge=pe:Be.sibling=pe,Be=pe);return ze&&In(R,Ee),ge}for(pe=l(pe);Ee<U.length;Ee++)De=P(pe,R,Ee,U[Ee],F),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?Ee:De.key),k=u(De,k,Ee),Be===null?ge=De:Be.sibling=De,Be=De);return e&&pe.forEach(function($s){return t(R,$s)}),ze&&In(R,Ee),ge}function ye(R,k,U,F){if(U==null)throw Error(a(151));for(var ge=null,Be=null,pe=k,Ee=k=0,De=null,Le=U.next();pe!==null&&!Le.done;Ee++,Le=U.next()){pe.index>Ee?(De=pe,pe=null):De=pe.sibling;var $s=L(R,pe,Le.value,F);if($s===null){pe===null&&(pe=De);break}e&&pe&&$s.alternate===null&&t(R,pe),k=u($s,k,Ee),Be===null?ge=$s:Be.sibling=$s,Be=$s,pe=De}if(Le.done)return i(R,pe),ze&&In(R,Ee),ge;if(pe===null){for(;!Le.done;Ee++,Le=U.next())Le=I(R,Le.value,F),Le!==null&&(k=u(Le,k,Ee),Be===null?ge=Le:Be.sibling=Le,Be=Le);return ze&&In(R,Ee),ge}for(pe=l(pe);!Le.done;Ee++,Le=U.next())Le=P(pe,R,Ee,Le.value,F),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ee:Le.key),k=u(Le,k,Ee),Be===null?ge=Le:Be.sibling=Le,Be=Le);return e&&pe.forEach(function(gx){return t(R,gx)}),ze&&In(R,Ee),ge}function Je(R,k,U,F){if(typeof U=="object"&&U!==null&&U.type===D&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case q:e:{for(var ge=U.key;k!==null;){if(k.key===ge){if(ge=U.type,ge===D){if(k.tag===7){i(R,k.sibling),F=c(k,U.props.children),F.return=R,R=F;break e}}else if(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type){i(R,k.sibling),F=c(k,U.props),Ir(F,U),F.return=R,R=F;break e}i(R,k);break}else t(R,k);k=k.sibling}U.type===D?(F=hi(U.props.children,R.mode,F,U.key),F.return=R,R=F):(F=ml(U.type,U.key,U.props,null,R.mode,F),Ir(F,U),F.return=R,R=F)}return p(R);case M:e:{for(ge=U.key;k!==null;){if(k.key===ge)if(k.tag===4&&k.stateNode.containerInfo===U.containerInfo&&k.stateNode.implementation===U.implementation){i(R,k.sibling),F=c(k,U.children||[]),F.return=R,R=F;break e}else{i(R,k);break}else t(R,k);k=k.sibling}F=Sc(U,R.mode,F),F.return=R,R=F}return p(R);case V:return U=yi(U),Je(R,k,U,F)}if(Me(U))return he(R,k,U,F);if(ne(U)){if(ge=ne(U),typeof ge!="function")throw Error(a(150));return U=ge.call(U),ye(R,k,U,F)}if(typeof U.then=="function")return Je(R,k,_l(U),F);if(U.$$typeof===me)return Je(R,k,yl(R,U),F);wl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,k!==null&&k.tag===6?(i(R,k.sibling),F=c(k,U),F.return=R,R=F):(i(R,k),F=wc(U,R.mode,F),F.return=R,R=F),p(R)):i(R,k)}return function(R,k,U,F){try{Qr=0;var ge=Je(R,k,U,F);return Ki=null,ge}catch(pe){if(pe===Xi||pe===xl)throw pe;var Be=Vt(29,pe,null,R.mode);return Be.lanes=F,Be.return=R,Be}finally{}}}var xi=hd(!0),dd=hd(!1),As=!1;function zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(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 Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function js(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Pe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=dl(e),Xh(e,null,i),t}return hl(e,l,t,i),dl(e)}function Xr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}function Uc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,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 Bc=!1;function Kr(){if(Bc){var e=Ii;if(e!==null)throw e}}function Zr(e,t,i,l){Bc=!1;var c=e.updateQueue;As=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var O=b,B=O.next;O.next=null,p===null?u=B:p.next=B,p=O;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=B:b.next=B,Y.lastBaseUpdate=O))}if(u!==null){var I=c.baseState;p=0,Y=B=O=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(Re&L)===L:(l&L)===L){L!==0&&L===Qi&&(Bc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Je=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){I=he.call(Je,I,L);break e}I=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Je,I,L):he,L==null)break e;I=w({},I,L);break e;case 2:As=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(B=Y=P,O=I):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(O=I),c.baseState=O,c.firstBaseUpdate=B,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Ms|=p,e.lanes=p,e.memoizedState=I}}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 Zi=je(null),Sl=je(0);function gd(e,t){e=as,Te(Sl,e),Te(Zi,t),as=e|t.baseLanes}function Lc(){Te(Sl,as),Te(Zi,Zi.current)}function Hc(){as=Sl.current,_e(Zi),_e(Sl)}var Ft=je(null),mn=null;function Ts(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),mn===null&&(t===null||Zi.current!==null||t.memoizedState!==null)&&(mn=e)}function Pc(e){Te(ct,ct.current),Te(Ft,e),mn===null&&(mn=e)}function yd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),mn===null&&(mn=e)):Ns()}function Ns(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){_e(Ft),mn===e&&(mn=null),_e(ct)}var ct=je(0);function El(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Ju(i)||Qu(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 Zn=0,Se=null,Ve=null,dt=null,Al=!1,Wi=!1,vi=!1,Ol=0,Wr=0,er=null,ab=0;function rt(){throw Error(a(321))}function $c(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 Yc(e,t,i,l,c,u){return Zn=u,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?em:iu,vi=!1,u=i(l,c),vi=!1,Wi&&(u=xd(t,i,l,c)),bd(e),u}function bd(e){$.H=na;var t=Ve!==null&&Ve.next!==null;if(Zn=0,dt=Ve=Se=null,Al=!1,Wr=0,er=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&gl(e)&&(mt=!0))}function xd(e,t,i,l){Se=e;var c=0;do{if(Wi&&(er=null),Wr=0,Wi=!1,25<=c)throw Error(a(301));if(c+=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)}$.H=tm,u=t(i,l)}while(Wi);return u}function lb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ea(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(Se.flags|=1024),t}function Gc(){var e=Ol!==0;return Ol=0,e}function Vc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Fc(e){if(Al){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Al=!1}Zn=0,dt=Ve=Se=null,Wi=!1,Wr=Ol=0,er=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 jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ea(e){var t=Wr;return Wr+=1,er===null&&(er=[]),e=cd(er,e,t),t=Se,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?em:iu),e}function Tl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ea(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Jc(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(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=jl(),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 Wn(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=ut();return Qc(t,Ve,e)}function Qc(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,O=null,B=t,Y=!1;do{var I=B.lane&-536870913;if(I!==B.lane?(Re&I)===I:(Zn&I)===I){var L=B.revertLane;if(L===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),I===Qi&&(Y=!0);else if((Zn&L)===L){B=B.next,L===Qi&&(Y=!0);continue}else I={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=I,p=u):O=O.next=I,Se.lanes|=L,Ms|=L;I=B.action,vi&&i(u,I),u=B.hasEagerState?B.eagerState:i(u,I)}else L={lane:I,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=L,p=u):O=O.next=L,Se.lanes|=I,Ms|=I;B=B.next}while(B!==null&&B!==t);if(O===null?p=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Ii,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=O,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ic(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);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,c=ut(),u=ze;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Ve||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Zc(Sd.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,tr(9,{destroy:void 0},wd.bind(null,l,c,i,t),null),Ie===null)throw Error(a(349));u||(Zn&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=jl(),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=fi(e,2);t!==null&&Ht(t,e,2)}function Xc(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:e},t}function Od(e,t,i,l){return e.baseState=i,Qc(e,Ve,typeof l=="function"?l:Wn)}function ob(e,t,i,l,c){if(Ml(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.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,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),O=$.S;O!==null&&O(p,b),Td(e,t,b)}catch(B){Kc(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),Td(e,t,u)}catch(B){Kc(e,t,B)}}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 Kc(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 Kc(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(ze){var i=Ie.formState;if(i!==null){e:{var l=Se;if(ze){if(Ze){t:{for(var c=Ze,u=dn;c.nodeType!==8;){if(!u){c=null;break t}if(c=pn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=pn(c.nextSibling),l=c.data==="F!";break e}}Ss(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=Xc(!1),u=su.bind(null,Se,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=ob.bind(null,Se,c,u,i),c.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=Qc(e,t,kd)[0],e=Nl(Wn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ea(t)}catch(p){throw p===Xi?xl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Se.flags|=2048,tr(9,{destroy:void 0},cb.bind(null,c,i),null)),[l,u,e]}function cb(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 tr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Se.updateQueue,t===null&&(t=jl(),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 Cl(e,t,i,l){var c=kt();Se.flags|=e,c.memoizedState=tr(1|t,{destroy:void 0},i,l===void 0?null:l)}function kl(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Ve!==null&&l!==null&&$c(l,Ve.memoizedState.deps)?c.memoizedState=tr(t,u,i,l):(Se.flags|=e,c.memoizedState=tr(1|t,u,i,l))}function Ud(e,t){Cl(8390656,8,e,t)}function Zc(e,t){kl(2048,8,e,t)}function ub(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=jl(),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 ub({ref:t,nextImpl:e}),function(){if((Pe&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Ld(e,t){return kl(4,2,e,t)}function Hd(e,t){return kl(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 $d(e,t,i){i=i!=null?i.concat([e]):null,kl(4,4,Pd.bind(null,t,e),i)}function Wc(){}function Yd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&$c(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&&$c(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function eu(e,t,i){return i===void 0||(Zn&1073741824)!==0&&(Re&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Vm(),Se.lanes|=e,Ms|=e,i)}function Vd(e,t,i,l){return Gt(i,t)?i:Zi.current!==null?(e=eu(e,i,l),Gt(e,t)||(mt=!0),e):(Zn&42)===0||(Zn&1073741824)!==0&&(Re&261930)===0?(mt=!0,e.memoizedState=i):(e=Vm(),Se.lanes|=e,Ms|=e,t)}function Fd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,su(e,!1,t,i);try{var O=c(),B=$.S;if(B!==null&&B(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=rb(O,l);ta(e,t,Y,Xt(e))}else ta(e,t,l,Xt(e))}catch(I){ta(e,t,{then:function(){},status:"rejected",reason:I},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function fb(){}function tu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Jd(e).queue;Fd(e,c,t,de,i===null?fb:function(){return Qd(e),i(l)})}function Jd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,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),ta(e,t.next.queue,{},Xt())}function nu(){return St(ba)}function Id(){return ut().memoizedState}function Xd(){return ut().memoizedState}function hb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=js(t,e,i);l!==null&&(Ht(l,t,i),Xr(l,t,i)),t={cache:kc()},e.payload=t;return}t=t.return}}function db(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ml(e)?Zd(t,i):(i=vc(e,t,i,l),i!==null&&(Ht(i,e,l),Wd(i,t,l)))}function Kd(e,t,i){var l=Xt();ta(e,t,i,l)}function ta(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Ml(e))Zd(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return hl(e,t,c,0),Ie===null&&fl(),!1}catch{}finally{}if(i=vc(e,t,c,l),i!==null)return Ht(i,e,l),Wd(i,t,l),!0}return!1}function su(e,t,i,l){if(l={lane:2,revertLane:zu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ml(e)){if(t)throw Error(a(479))}else t=vc(e,i,l,2),t!==null&&Ht(t,e,2)}function Ml(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Zd(e,t){Wi=Al=!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,ri(e,i)}}var na={readContext:St,use:Tl,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};na.useEffectEvent=rt;var em={readContext:St,use:Tl,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,Cl(4194308,4,Pd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){Cl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=db.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Xc(e);var t=e.queue,i=Kd.bind(null,Se,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Wc,useDeferredValue:function(e,t){var i=kt();return eu(i,e,t)},useTransition:function(){var e=Xc(!1);return e=Fd.bind(null,Se,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Se,c=kt();if(ze){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Ie===null)throw Error(a(349));(Re&127)!==0||_d(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,Ud(Sd.bind(null,l,u,e),[e]),l.flags|=2048,tr(9,{destroy:void 0},wd.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Ie.identifierPrefix;if(ze){var i=Rn,l=Mn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ol++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=ab++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nu,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=su.bind(null,Se,!0,i),i.dispatch=t,[e,t]},useMemoCache:Jc,useCacheRefresh:function(){return kt().memoizedState=hb.bind(null,Se)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((Pe&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},iu={readContext:St,use:Tl,useCallback:Yd,useContext:St,useEffect:Zc,useImperativeHandle:$d,useInsertionEffect:Ld,useLayoutEffect:Hd,useMemo:Gd,useReducer:Nl,useRef:qd,useState:function(){return Nl(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Vd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Nl(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:vd,useId:Id,useHostTransitionStatus:nu,useFormState:Rd,useActionState:Rd,useOptimistic:function(e,t){var i=ut();return Od(i,Ve,e,t)},useMemoCache:Jc,useCacheRefresh:Xd};iu.useEffectEvent=Bd;var tm={readContext:St,use:Tl,useCallback:Yd,useContext:St,useEffect:Zc,useImperativeHandle:$d,useInsertionEffect:Ld,useLayoutEffect:Hd,useMemo:Gd,useReducer:Ic,useRef:qd,useState:function(){return Ic(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Ve===null?eu(i,e,t):Vd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Ic(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:vd,useId:Id,useHostTransitionStatus:nu,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:Jc,useCacheRefresh:Xd};tm.useEffectEvent=Bd;function ru(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var au={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=js(e,l,i),t!==null&&(Ht(t,e,i),Xr(t,e,i))}};function nm(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!$r(i,l)||!$r(c,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&&au.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function im(e){ul(e)}function rm(e){console.error(e)}function am(e){ul(e)}function Rl(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(c){setTimeout(function(){throw c})}}function lu(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){Rl(e,t)},i}function om(e){return e=Os(e),e.tag=3,e}function cm(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){lm(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){lm(t,i,l),typeof c!="function"&&(Rs===null?Rs=new Set([this]):Rs.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function mb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ji(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return mn===null?Vl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Mu(e,l,c)),!1;case 22:return i.flags|=65536,l===vl?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)),Mu(e,l,c)),!1}throw Error(a(435,i.tag))}return Mu(e,l,c),Vl(),!1}if(ze)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Oc&&(e=Error(a(422),{cause:l}),Vr(un(e,i)))):(l!==Oc&&(t=Error(a(423),{cause:l}),Vr(un(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=un(l,i),c=lu(e.stateNode,l,c),Uc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=un(u,i),ua===null?ua=[u]:ua.push(u),at!==4&&(at=2),t===null)return!0;l=un(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=lu(i.stateNode,l,e),Uc(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"&&(Rs===null||!Rs.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=om(c),cm(c,e,i,l),Uc(i,c),!1}i=i.return}while(i!==null);return!1}var ou=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?dd(t,null,i,l):xi(t,e.child,i,l)}function um(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=Yc(e,t,i,p,u,c),b=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(ze&&b&&Ec(t),t.flags|=1,Et(e,t,l,c),t.child)}function fm(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!_c(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,hm(e,t,u,l,c)):(e=ml(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!gu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:$r,i(p,l)&&e.ref===t.ref)return es(e,t,c)}return t.flags|=1,e=Qn(u,l),e.ref=t.ref,e.return=t,t.child=e}function hm(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if($r(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,gu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,es(e,t,c)}return cu(e,t,i,l,c)}function dm(e,t,i,l){var c=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,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~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&&bl(t,u!==null?u.cachePool:null),u!==null?gd(t,u):Lc(),yd(t);else return l=t.lanes=536870912,mm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(bl(t,u.cachePool),gd(t,u),Ns(),t.memoizedState=null):(e!==null&&bl(t,null),Lc(),Ns());return Et(e,t,c,i),t.child}function sa(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,c){var u=Rc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&bl(t,null),Lc(),yd(t),e!==null&&Ji(e,t,l,!0),t.childLanes=c,null}function Dl(e,t){return t=ql({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 xi(t,e.child,null,i),e=Dl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function pb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=Dl(t,l),t.lanes=536870912,sa(null,e);if(Pc(t),(e=Ze)?(e=jp(e,dn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:Mn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},i=Zh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return t.lanes=536870912,null}return Dl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Pc(t),c)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||Ji(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Ie,l!==null&&(p=xs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),ou;Vl(),t=pm(e,t,i)}else e=u.treeContext,Ze=pn(p.nextSibling),wt=t,ze=!0,ws=null,dn=!1,e!==null&&td(t,e),t=Dl(t,l),t.flags|=4096;return t}return e=Qn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zl(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 cu(e,t,i,l,c){return pi(t),i=Yc(e,t,i,l,void 0,c),l=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(ze&&l&&Ec(t),t.flags|=1,Et(e,t,i,c),t.child)}function gm(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=xd(t,l,i,c),bd(e),l=Gc(),e!==null&&!mt?(Vc(e,t,u),es(e,t,u)):(ze&&l&&Ec(t),t.flags|=1,Et(e,t,i,u),t.child)}function ym(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Yi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=au,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},zc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Yi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(ru(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&au.enqueueReplaceState(u,u.state,null),Zr(t,l,u,c),Kr(),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=_i(i,b);u.props=O;var B=u.context,Y=i.contextType;p=Yi,typeof Y=="object"&&Y!==null&&(p=St(Y));var I=i.getDerivedStateFromProps;Y=typeof I=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&sm(t,u,l,p),As=!1;var L=t.memoizedState;u.state=L,Zr(t,l,u,c),Kr(),B=t.memoizedState,b||L!==B||As?(typeof I=="function"&&(ru(t,i,I,l),B=t.memoizedState),(O=As||nm(t,i,O,l,L,B,p))?(Y||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=B),u.props=l,u.state=B,u.context=p,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,qc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,I=t.pendingProps,L=u.context,B=i.contextType,O=Yi,typeof B=="object"&&B!==null&&(O=St(B)),b=i.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==I||L!==O)&&sm(t,u,l,O),As=!1,L=t.memoizedState,u.state=L,Zr(t,l,u,c),Kr();var P=t.memoizedState;p!==I||L!==P||As||e!==null&&e.dependencies!==null&&gl(e.dependencies)?(typeof b=="function"&&(ru(t,i,b,l),P=t.memoizedState),(Y=As||nm(t,i,Y,l,L,P,O)||e!==null&&e.dependencies!==null&&gl(e.dependencies))?(B||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"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,zl(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=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=es(e,t,c),e}function bm(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var uu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:ld()}}function hu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=It),e}function xm(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(c?Ts(t):Ns(),(e=Ze)?(e=jp(e,dn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:Mn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},i=Zh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return Qu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Ns(),c=t.mode,b=ql({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,sa(null,l)):(Ts(t),du(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(Ts(t),t.flags&=-257,t=mu(e,t,i)):t.memoizedState!==null?(Ns(),t.child=e.child,t.flags|=128,t=null):(Ns(),b=l.fallback,c=t.mode,l=ql({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,t=sa(null,l));else if(Ts(t),Qu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,Vr({value:l,source:null,stack:null}),t=mu(e,t,i)}else if(mt||Ji(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Ie,p!==null&&(l=xs(p,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,fi(e,l),Ht(p,e,l),ou;Ju(b)||Vl(),t=mu(e,t,i)}else Ju(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=pn(b.nextSibling),wt=t,ze=!0,ws=null,dn=!1,e!==null&&td(t,e),t=du(t,l.children),t.flags|=4096);return t}return c?(Ns(),b=l.fallback,c=t.mode,O=e.child,B=O.sibling,l=Qn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,B!==null?b=Qn(B,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,sa(null,l),l=t.child,b=e.child.memoizedState,b===null?b=fu(i):(c=b.cachePool,c!==null?(O=ht._currentValue,c=c.parent!==O?{parent:O,pool:O}:c):c=ld(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=hu(e,p,i),t.memoizedState=uu,sa(e.child,l)):(Ts(t),i=e.child,e=i.sibling,i=Qn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function du(e,t){return t=ql({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ql(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function mu(e,t,i){return xi(t,e.child,null,i),e=du(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),Nc(e.return,t,i)}function pu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function _m(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=ze?Gr: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(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&El(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),pu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&El(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}pu(t,!0,i,null,u,l);break;case"together":pu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function es(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Ms|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ji(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=Qn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Qn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function gu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gl(e)))}function gb(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),Es(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:Es(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Pc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ts(t),t.flags|=128,null):(i&t.child.childLanes)!==0?xm(e,t,i):(Ts(t),e=es(e,t,i),e!==null?e.sibling:null);Ts(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ji(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return _m(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,dm(e,t,i,t.pendingProps);case 24:Es(t,ht,e.memoizedState.cache)}return es(e,t,i)}function wm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!gu(e,i)&&(t.flags&128)===0)return mt=!1,gb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,ze&&(t.flags&1048576)!==0&&ed(t,Gr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")_c(e)?(l=_i(e,l),t.tag=1,t=ym(null,t,e,l,i)):(t.tag=0,t=cu(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===re){t.tag=11,t=um(null,t,e,l,i);break e}else if(c===ce){t.tag=14,t=fm(null,t,e,l,i);break e}}throw t=He(e)||e,Error(a(306,t,""))}}return t;case 0:return cu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),ym(e,t,l,c,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,qc(e,t),Zr(t,l,null,i);var p=t.memoizedState;if(l=p.cache,Es(t,ht,l),l!==u.cache&&Cc(t,[ht],i,!0),Kr(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=bm(e,t,l,i);break e}else if(l!==c){c=un(Error(a(424)),t),Vr(c),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=pn(e.firstChild),wt=t,ze=!0,ws=null,dn=!0,i=dd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=es(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return zl(e,t),e===null?(i=Rp(t.type,null,t.pendingProps,null))?t.memoizedState=i:ze||(i=t.type,e=t.pendingProps,l=Zl(rn.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=Rp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ze&&(l=t.stateNode=Cp(t.type,t.pendingProps,rn.current),wt=t,dn=!0,c=Ze,Us(t.type)?(Iu=c,Ze=pn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),zl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((c=l=Ze)&&(l=Fb(l,t.type,t.pendingProps,dn),l!==null?(t.stateNode=l,wt=t,Ze=pn(l.firstChild),dn=!1,c=!0):c=!1),c||Ss(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Gu(c,u)?l=null:p!==null&&Gu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Yc(e,t,lb,null,null,i),ba._currentValue=c),zl(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&ze&&((e=i=Ze)&&(i=Jb(i,t.pendingProps,dn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Ss(t)),null;case 13:return xm(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(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,Es(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),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 pb(e,t,i);case 22:return dm(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Rc(),c===null&&(c=Ie,u=kc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},zc(t),Es(t,ht,c)):((e.lanes&i)!==0&&(qc(e,t),Zr(t,null,null,i),Kr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Es(t,ht,l)):(l=u.cache,Es(t,ht,l),l!==c.cache&&Cc(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 ts(e){e.flags|=4}function yu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Im())e.flags|=8192;else throw bi=vl,Dc}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 bi=vl,Dc}function Ul(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ri():536870912,e.lanes|=t,rr|=t)}function ia(e,t){if(!ze)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 c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function yb(e,t,i){var l=t.pendingProps;switch(Ac(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),Kn(ht),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?ts(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,jc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ts(t),u!==null?(We(t),Sm(t,u)):(We(t),yu(t,c,null,l,i))):u?u!==e.memoizedState?(ts(t),We(t),Sm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ts(t),We(t),yu(t,c,e,l,i)),null;case 27:if(ei(t),i=rn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Fi(t)?nd(t):(e=Cp(c,l,i),t.stateNode=e,ts(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Fi(t))nd(t);else{var p=Zl(rn.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Qe]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ts(t)}}return We(t),yu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=rn.current,Fi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||xp(e.nodeValue,i)),e||Ss(t,!0)}else e=Zl(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=Fi(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 di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=jc(),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(c=Fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)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,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Ul(t,t.updateQueue),We(t),null);case 4:return we(),e===null&&Lu(t.stateNode.containerInfo),We(t),null;case 10:return Kn(t.type),We(t),null;case 19:if(_e(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ia(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=El(e),u!==null){for(t.flags|=128,ia(l,!1),e=u.updateQueue,t.updateQueue=e,Ul(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Kh(i,e),i=i.sibling;return Te(ct,ct.current&1|2),ze&&In(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>$l&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304)}else{if(!c)if(e=El(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Ul(t,e),ia(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!ze)return We(t),null}else 2*et()-l.renderingStartTime>$l&&i!==536870912&&(t.flags|=128,c=!0,ia(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=ct.current,Te(ct,c?i&1|2:i&1),ze&&In(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Hc(),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&&Ul(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(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Kn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function bb(e,t){switch(Ac(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(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 ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}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));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(ct),null;case 4:return we(),null;case 10:return Kn(t.type),null;case 22:case 23:return Jt(t),Hc(),e!==null&&_e(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kn(ht),null;case 25:return null;default:return null}}function Em(e,t){switch(Ac(t),t.tag){case 3:Kn(ht),we();break;case 26:case 27:case 5:ei(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:_e(ct);break;case 10:Kn(t.type);break;case 22:case 23:Jt(t),Hc(),e!==null&&_e(gi);break;case 24:Kn(ht)}}function ra(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){Ye(t,t.return,b)}}function Cs(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var O=i,B=b;try{B()}catch(Y){Ye(c,O,Y)}}}l=l.next}while(l!==u)}}catch(Y){Ye(t,t.return,Y)}}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=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ye(e,t,l)}}function aa(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(c){Ye(e,t,c)}}function Dn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){Ye(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){Ye(e,t,c)}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(c){Ye(e,e.return,c)}}function bu(e,t,i){try{var l=e.stateNode;Hb(l,e.type,i,t),l[it]=t}catch(c){Ye(e,e.return,c)}}function Tm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Us(e.type)||e.tag===4}function xu(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&&Us(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 vu(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=Fn));else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(vu(e,t,i),e=e.sibling;e!==null;)vu(e,t,i),e=e.sibling}function Bl(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&&Us(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Bl(e,t,i),e=e.sibling;e!==null;)Bl(e,t,i),e=e.sibling}function Nm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){Ye(e,e.return,u)}}var ns=!1,pt=!1,_u=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function xb(e,t){if(e=e.containerInfo,$u=ro,e=$h(e),mc(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 c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,O=-1,B=0,Y=0,I=e,L=null;t:for(;;){for(var P;I!==i||c!==0&&I.nodeType!==3||(b=p+c),I!==u||l!==0&&I.nodeType!==3||(O=p+l),I.nodeType===3&&(p+=I.nodeValue.length),(P=I.firstChild)!==null;)L=I,I=P;for(;;){if(I===e)break t;if(L===i&&++B===c&&(b=p),L===u&&++Y===l&&(O=p),(P=I.nextSibling)!==null)break;I=L,L=I.parentNode}I=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Yu={focusedElem:e,selectionRange:i},ro=!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++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ye(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Fu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(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:is(e,i),l&4&&ra(5,i);break;case 1:if(is(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){Ye(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ye(i,i.return,p)}}l&64&&Am(i),l&512&&aa(i,i.return);break;case 3:if(is(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(p){Ye(i,i.return,p)}}break;case 27:t===null&&l&4&&Nm(i);case 26:case 5:is(e,i),t===null&&l&4&&jm(i),l&512&&aa(i,i.return);break;case 12:is(e,i);break;case 31:is(e,i),l&4&&Dm(e,i);break;case 13:is(e,i),l&4&&zm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Tb.bind(null,i),Qb(e,i))));break;case 22:if(l=i.memoizedState!==null||ns,!l){t=t!==null&&t.memoizedState!==null||pt,c=ns;var u=pt;ns=l,(pt=t)&&!u?rs(e,i,(i.subtreeFlags&8772)!==0):is(e,i),ns=c,pt=u}break;case 30:break;default:is(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&&Di(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 ss(e,t,i){for(i=i.child;i!==null;)Rm(e,t,i),i=i.sibling}function Rm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||Dn(i,t),ss(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Dn(i,t);var l=tt,c=qt;Us(i.type)&&(tt=i.stateNode,qt=!1),ss(e,t,i),pa(i.stateNode),tt=l,qt=c;break;case 5:pt||Dn(i,t);case 6:if(l=tt,c=qt,tt=null,ss(e,t,i),tt=l,qt=c,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),dr(e)):Ap(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,ss(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:Cs(2,i,t),pt||Cs(4,i,t),ss(e,t,i);break;case 1:pt||(Dn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Om(i,t,l)),ss(e,t,i);break;case 21:ss(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ss(e,t,i),pt=l;break;default:ss(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{dr(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{dr(e)}catch(i){Ye(t,t.return,i)}}function vb(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 Ll(e,t){var i=vb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Nb.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Us(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,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)qm(t,e),t=t.sibling}var En=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&&(Cs(3,e,e.return),ra(3,e),Cs(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),l&64&&ns&&(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 c=En;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(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,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Qe]=e,N(u),l=u;break e;case"link":var p=qp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[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)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=qp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[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)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,N(u),l=u}e.stateNode=l}else Up(c,e.type,e.stateNode);else e.stateNode=zp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Up(c,e.type,e.stateNode):zp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&bu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),i!==null&&l&4&&bu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),e.flags&32){c=e.stateNode;try{qi(c,"")}catch(he){Ye(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,bu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(_u=!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(he){Ye(e,e.return,he)}}break;case 3:if(to=null,c=En,En=Wl(t.containerInfo),Ut(t,e),En=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{dr(t.containerInfo)}catch(he){Ye(e,e.return,he)}_u&&(_u=!1,Um(e));break;case 4:l=En,En=Wl(e.stateNode.containerInfo),Ut(t,e),Bt(e),En=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,Ll(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Pl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 22:c=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,B=ns,Y=pt;if(ns=B||c,pt=Y||O,Ut(t,e),pt=Y,ns=B,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||O||ns||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=O.stateNode;var I=O.memoizedProps.style,L=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){Ye(O,O.return,he)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(he){Ye(O,O.return,he)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;c?Op(P,!0):Op(O.stateNode,!1)}catch(he){Ye(O,O.return,he)}}}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,Ll(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(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 c=i.stateNode,u=xu(e);Bl(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(qi(p,""),i.flags&=-33);var b=xu(e);Bl(e,b,p);break;case 3:case 4:var O=i.stateNode.containerInfo,B=xu(e);vu(e,B,O);break;default:throw Error(a(161))}}catch(Y){Ye(e,e.return,Y)}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 is(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)km(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Cs(4,t,t.return),wi(t);break;case 1:Dn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Om(t,t.return,i),wi(t);break;case 27:pa(t.stateNode);case 26:case 5:Dn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function rs(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:rs(c,u,i),ra(4,u);break;case 1:if(rs(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ye(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)md(O[c],b)}catch(B){Ye(l,l.return,B)}}i&&p&64&&Am(u),aa(u,u.return);break;case 27:Nm(u);case 26:case 5:rs(c,u,i),i&&l===null&&p&4&&jm(u),aa(u,u.return);break;case 12:rs(c,u,i);break;case 31:rs(c,u,i),i&&p&4&&Dm(c,u);break;case 13:rs(c,u,i),i&&p&4&&zm(c,u);break;case 22:u.memoizedState===null&&rs(c,u,i),aa(u,u.return);break;case 30:break;default:rs(c,u,i)}t=t.sibling}}function wu(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&&Fr(i))}function Su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e))}function An(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 c=t.flags;switch(t.tag){case 0:case 11:case 15:An(e,t,i,l),c&2048&&ra(9,t);break;case 1:An(e,t,i,l);break;case 3:An(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e)));break;case 12:if(c&2048){An(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Ye(t,t.return,O)}}else An(e,t,i,l);break;case 31:An(e,t,i,l);break;case 13:An(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?An(e,t,i,l):la(e,t):u._visibility&2?An(e,t,i,l):(u._visibility|=2,nr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&wu(p,t);break;case 24:An(e,t,i,l),c&2048&&Su(t.alternate,t);break;default:An(e,t,i,l)}}function nr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,O=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:nr(u,p,b,O,c),ra(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?nr(u,p,b,O,c):la(u,p):(Y._visibility|=2,nr(u,p,b,O,c)),c&&B&2048&&wu(p.alternate,p);break;case 24:nr(u,p,b,O,c),c&&B&2048&&Su(p.alternate,p);break;default:nr(u,p,b,O,c)}t=t.sibling}}function la(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:la(i,l),c&2048&&wu(l.alternate,l);break;case 24:la(i,l),c&2048&&Su(l.alternate,l);break;default:la(i,l)}t=t.sibling}}var oa=8192;function sr(e,t,i){if(e.subtreeFlags&oa)for(e=e.child;e!==null;)Lm(e,t,i),e=e.sibling}function Lm(e,t,i){switch(e.tag){case 26:sr(e,t,i),e.flags&oa&&e.memoizedState!==null&&ax(i,En,e.memoizedState,e.memoizedProps);break;case 5:sr(e,t,i);break;case 3:case 4:var l=En;En=Wl(e.stateNode.containerInfo),sr(e,t,i),En=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=oa,oa=16777216,sr(e,t,i),oa=l):sr(e,t,i));break;default:sr(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,$m(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&&Cs(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,Hl(e)):ca(e);break;default:ca(e)}}function Hl(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,$m(l,e)}Hm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cs(8,t,t.return),Hl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function $m(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:Cs(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:Fr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(Mm(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var _b={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}},wb=typeof WeakMap=="function"?WeakMap:Map,Pe=0,Ie=null,Ne=null,Re=0,$e=0,Qt=null,ks=!1,ir=!1,Eu=!1,as=0,at=0,Ms=0,Si=0,Au=0,It=0,rr=0,ua=null,Lt=null,Ou=!1,Pl=0,Ym=0,$l=1/0,Yl=null,Rs=null,bt=0,Ds=null,ar=null,ls=0,ju=0,Tu=null,Gm=null,fa=0,Nu=null;function Xt(){return(Pe&2)!==0&&Re!==0?Re&-Re:$.T!==null?zu():Rr()}function Vm(){if(It===0)if((Re&536870912)===0||ze){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&&($e===2||$e===9)||e.cancelPendingCommit!==null)&&(lr(e,0),zs(e,Re,It,!1)),_n(e,i),((Pe&2)===0||e!==Ie)&&(e===Ie&&((Pe&2)===0&&(Si|=i),at===4&&zs(e,Re,It,!1)),zn(e))}function Fm(e,t,i){if((Pe&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?Ab(e,t):ku(e,t,!0),u=l;do{if(c===0){ir&&!l&&zs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!Sb(i)){c=ku(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=ua;var O=b.current.memoizedState.isDehydrated;if(O&&(lr(b,p).flags|=256),p=ku(b,p,!1),p!==2){if(Eu&&!O){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){lr(e,0),zs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:zs(l,t,It,!ks);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Pl+300-et(),10<c)){if(zs(l,t,It,!ks),si(l,0,!0)!==0)break e;ls=t,l.timeoutHandle=Sp(Jm.bind(null,l,i,Lt,Yl,Ou,t,It,Si,rr,ks,u,"Throttled",-0,0),c);break e}Jm(l,i,Lt,Yl,Ou,t,It,Si,rr,ks,u,null,-0,0)}}break}while(!0);zn(e)}function Jm(e,t,i,l,c,u,p,b,O,B,Y,I,L,P){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn},Lm(t,u,I);var he=(u&62914560)===u?Pl-et():(u&4194048)===u?Ym-et():0;if(he=lx(I,he),he!==null){ls=u,e.cancelPendingCommit=he(tp.bind(null,e,t,u,i,l,c,p,b,O,Y,I,null,L,P)),zs(e,u,p,!B);return}}tp(e,t,u,i,l,c,p,b,O)}function Sb(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 c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))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 zs(e,t,i,l){t&=~Au,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&bs(e,i,t)}function Gl(){return(Pe&6)===0?(ha(0),!1):!0}function Cu(){if(Ne!==null){if($e===0)var e=Ne.return;else e=Ne,Xn=mi=null,Fc(e),Ki=null,Qr=0,e=Ne;for(;e!==null;)Em(e.alternate,e),e=e.return;Ne=null}}function lr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Yb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ls=0,Cu(),Ie=e,Ne=i=Qn(e.current,null),Re=t,$e=0,Qt=null,ks=!1,ir=ii(e,t),Eu=!1,rr=It=Au=Si=Ms=at=0,Lt=ua=null,Ou=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return as=t,fl(),i}function Qm(e,t){Se=null,$.H=na,t===Xi||t===xl?(t=ud(),$e=3):t===Dc?(t=ud(),$e=4):$e=t===ou?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Rl(e,un(t,e.current)))}function Im(){var e=Ft.current;return e===null?!0:(Re&4194048)===Re?mn===null:(Re&62914560)===Re||(Re&536870912)!==0?e===mn:!1}function Xm(){var e=$.H;return $.H=na,e===null?na:e}function Km(){var e=$.A;return $.A=_b,e}function Vl(){at=4,ks||(Re&4194048)!==Re&&Ft.current!==null||(ir=!0),(Ms&134217727)===0&&(Si&134217727)===0||Ie===null||zs(Ie,Re,It,!1)}function ku(e,t,i){var l=Pe;Pe|=2;var c=Xm(),u=Km();(Ie!==e||Re!==t)&&(Yl=null,lr(e,t)),t=!1;var p=at;e:do try{if($e!==0&&Ne!==null){var b=Ne,O=Qt;switch($e){case 8:Cu(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var B=$e;if($e=0,Qt=null,or(e,b,O,B),i&&ir){p=0;break e}break;default:B=$e,$e=0,Qt=null,or(e,b,O,B)}}Eb(),p=at;break}catch(Y){Qm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Xn=mi=null,Pe=l,$.H=c,$.A=u,Ne===null&&(Ie=null,Re=0,fl()),p}function Eb(){for(;Ne!==null;)Zm(Ne)}function Ab(e,t){var i=Pe;Pe|=2;var l=Xm(),c=Km();Ie!==e||Re!==t?(Yl=null,$l=et()+500,lr(e,t)):ir=ii(e,t);e:do try{if($e!==0&&Ne!==null){t=Ne;var u=Qt;t:switch($e){case 1:$e=0,Qt=null,or(e,t,u,1);break;case 2:case 9:if(od(u)){$e=0,Qt=null,Wm(t);break}t=function(){$e!==2&&$e!==9||Ie!==e||($e=7),zn(e)},u.then(t,t);break e;case 3:$e=7;break e;case 4:$e=5;break e;case 7:od(u)?($e=0,Qt=null,Wm(t)):($e=0,Qt=null,or(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Bp(p):b.stateNode.complete){$e=0,Qt=null;var O=b.sibling;if(O!==null)Ne=O;else{var B=b.return;B!==null?(Ne=B,Fl(B)):Ne=null}break t}}$e=0,Qt=null,or(e,t,u,5);break;case 6:$e=0,Qt=null,or(e,t,u,6);break;case 8:Cu(),at=6;break e;default:throw Error(a(462))}}Ob();break}catch(Y){Qm(e,Y)}while(!0);return Xn=mi=null,$.H=l,$.A=c,Pe=i,Ne!==null?0:(Ie=null,Re=0,fl(),at)}function Ob(){for(;Ne!==null&&!Qa();)Zm(Ne)}function Zm(e){var t=wm(e.alternate,e,as);e.memoizedProps=e.pendingProps,t===null?Fl(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,Re);break;case 11:t=gm(i,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:Fc(t);default:Em(i,t),t=Ne=Kh(t,as),t=wm(i,t,as)}e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function or(e,t,i,l){Xn=mi=null,Fc(t),Ki=null,Qr=0;var c=t.return;try{if(mb(e,c,t,i,Re)){at=1,Rl(e,un(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Rl(e,un(i,e.current)),Ne=null;return}t.flags&32768?(ze||l===1?e=!0:ir||(Re&536870912)!==0?e=!1:(ks=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),ep(t,e)):Fl(t)}function Fl(e){var t=e;do{if((t.flags&32768)!==0){ep(t,ks);return}e=t.return;var i=yb(t.alternate,t,as);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=bb(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,c,u,p,b,O){e.cancelPendingCommit=null;do Jl();while(bt!==0);if((Pe&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=xc,ys(e,i,u,p,b,O),e===Ie&&(Ne=Ie=null,Re=0),ar=t,Ds=e,ls=i,ju=u,Tu=c,Gm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cb(ki,function(){return ap(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=Pe,Pe|=4;try{xb(e,t,i)}finally{Pe=p,te.p=c,$.T=l}}bt=1,np(),sp(),ip()}}function np(){if(bt===1){bt=0;var e=Ds,t=ar,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{qm(t,e);var u=Yu,p=$h(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Ph(b.ownerDocument.documentElement,b)){if(O!==null&&mc(b)){var B=O.start,Y=O.end;if(Y===void 0&&(Y=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(Y,b.value.length);else{var I=b.ownerDocument||document,L=I&&I.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(O.start,he),Je=O.end===void 0?ye:Math.min(O.end,he);!P.extend&&ye>Je&&(p=Je,Je=ye,ye=p);var R=Hh(b,ye),k=Hh(b,Je);if(R&&k&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==k.node||P.focusOffset!==k.offset)){var U=I.createRange();U.setStart(R.node,R.offset),P.removeAllRanges(),ye>Je?(P.addRange(U),P.extend(k.node,k.offset)):(U.setEnd(k.node,k.offset),P.addRange(U))}}}}for(I=[],P=b;P=P.parentNode;)P.nodeType===1&&I.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var F=I[b];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}ro=!!$u,Yu=$u=null}finally{Pe=c,te.p=l,$.T=i}}e.current=t,bt=2}}function sp(){if(bt===2){bt=0;var e=Ds,t=ar,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{km(e,t.alternate,t)}finally{Pe=c,te.p=l,$.T=i}}bt=3}}function ip(){if(bt===4||bt===3){bt=0,Ci();var e=Ds,t=ar,i=ls,l=Gm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,ar=Ds=null,rp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Rs=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(ls&3)!==0&&Jl(),zn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Nu?fa++:(fa=0,Nu=e):fa=0,ha(0)}}function rp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Fr(t)))}function Jl(){return np(),sp(),ip(),ap()}function ap(){if(bt!==5)return!1;var e=Ds,t=ju;ju=0;var i=ai(ls),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=Tu,Tu=null;var u=Ds,p=ls;if(bt=0,ar=Ds=null,ls=0,(Pe&6)!==0)throw Error(a(331));var b=Pe;if(Pe|=4,Pm(u.current),Bm(u,u.current,p,i),Pe=b,ha(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,rp(e,t)}}function lp(e,t,i){t=un(i,t),t=lu(e.stateNode,t,2),e=js(e,t,2),e!==null&&(_n(e,2),zn(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"&&(Rs===null||!Rs.has(l))){e=un(i,e),i=om(2),l=js(t,i,2),l!==null&&(cm(i,l,t,e),_n(l,2),zn(l));break}}t=t.return}}function Mu(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new wb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Eu=!0,c.add(i),e=jb.bind(null,e,t,i),t.then(e,e))}function jb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ie===e&&(Re&i)===i&&(at===4||at===3&&(Re&62914560)===Re&&300>et()-Pl?(Pe&2)===0&&lr(e,0):Au|=i,rr===Re&&(rr=0)),zn(e)}function op(e,t){t===0&&(t=Ri()),e=fi(e,t),e!==null&&(_n(e,t),zn(e))}function Tb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),op(e,i)}function Nb(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.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),op(e,i)}function Cb(e,t){return Nr(e,t)}var Ql=null,cr=null,Ru=!1,Il=!1,Du=!1,qs=0;function zn(e){e!==cr&&e.next===null&&(cr===null?Ql=cr=e:cr=cr.next=e),Il=!0,Ru||(Ru=!0,Mb())}function ha(e,t){if(!Du&&Il){Du=!0;do for(var i=!1,l=Ql;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,hp(l,u))}else u=Re,u=si(l,l===Ie?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,hp(l,u));l=l.next}while(i);Du=!1}}function kb(){cp()}function cp(){Il=Ru=!1;var e=0;qs!==0&&$b()&&(e=qs);for(var t=et(),i=null,l=Ql;l!==null;){var c=l.next,u=up(l,t);u===0?(l.next=null,i===null?Ql=c:i.next=c,c===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Il=!0)),l=c}bt!==0&&bt!==5||ha(e),qs!==0&&(qs=0)}function up(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,O=c[p];O===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Mr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Ie,i=Re,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&($e===2||$e===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$n(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&$n(l),ai(i)){case 2:case 8:i=Xa;break;case 32:i=ki;break;case 268435456:i=Ka;break;default:i=ki}return l=fp.bind(null,e),i=Nr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&$n(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(Jl()&&e.callbackNode!==i)return null;var l=Re;return l=si(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(Jl())return null;Fm(e,t,!0)}function Mb(){Gb(function(){(Pe&6)!==0?Nr(Ia,kb):cp()})}function zu(){if(qs===0){var e=Qi;e===0&&(e=ms,ms<<=1,(ms&261888)===0&&(ms=256)),qs=e}return qs}function dp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:sl(""+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 Rb(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=dp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?dp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ll("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(qs!==0){var O=p?mp(c,p):new FormData(c);tu(i,{pending:!0,data:O,method:c.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=p?mp(c,p):new FormData(c),tu(i,{pending:!0,data:O,method:c.method,action:u},u,O))},currentTarget:c}]})}}for(var qu=0;qu<bc.length;qu++){var Uu=bc[qu],Db=Uu.toLowerCase(),zb=Uu[0].toUpperCase()+Uu.slice(1);Sn(Db,"on"+zb)}Sn(Vh,"onAnimationEnd"),Sn(Fh,"onAnimationIteration"),Sn(Jh,"onAnimationStart"),Sn("dblclick","onDoubleClick"),Sn("focusin","onFocus"),Sn("focusout","onBlur"),Sn(Ky,"onTransitionRun"),Sn(Zy,"onTransitionStart"),Sn(Wy,"onTransitionCancel"),Sn(Qh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),Z("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Z("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Z("onBeforeInput",["compositionend","keypress","textInput","paste"]),Z("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var da="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(" "),qb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(da));function pp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],O=b.instance,B=b.currentTarget;if(b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}else for(p=0;p<l.length;p++){if(b=l[p],O=b.instance,B=b.currentTarget,b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(gp(t,e,2,!1),i.add(l))}function Bu(e,t,i){var l=0;t&&(l|=4),gp(i,e,l,t)}var Xl="_reactListening"+Math.random().toString(36).slice(2);function Lu(e){if(!e[Xl]){e[Xl]=!0,z.forEach(function(i){i!=="selectionchange"&&(qb.has(i)||Bu(i,!1,e),Bu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xl]||(t[Xl]=!0,Bu("selectionchange",!1,t))}}function gp(e,t,i,l){switch(Vp(t)){case 2:var c=ux;break;case 8:c=fx;break;default:c=ef}i=c.bind(null,t,i,e),c=void 0,!rc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Hu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var O=p.tag;if((O===3||O===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(O=p.tag,O===5||O===6||O===26||O===27){l=u=p;continue e}b=b.parentNode}}l=l.return}_h(function(){var B=u,Y=sc(i),I=[];e:{var L=Ih.get(e);if(L!==void 0){var P=ll,he=e;switch(e){case"keypress":if(rl(i)===0)break e;case"keydown":case"keyup":P=Ny;break;case"focusin":he="focus",P=cc;break;case"focusout":he="blur",P=cc;break;case"beforeblur":case"afterblur":P=cc;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=yy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=My;break;case Vh:case Fh:case Jh:P=vy;break;case Qh:P=Dy;break;case"scroll":case"scrollend":P=py;break;case"wheel":P=qy;break;case"copy":case"cut":case"paste":P=wy;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=By}var ye=(t&4)!==0,Je=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var k=B,U;k!==null;){var F=k;if(U=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||U===null||R===null||(F=zr(k,R),F!=null&&ye.push(ma(k,F,U))),Je)break;k=k.return}0<ye.length&&(L=new P(L,he,null,i,Y),I.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==nc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=B,he=he?x(he):null,he!==null&&(Je=f(he),ye=he.tag,he!==Je||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=B),P!==he)){if(ye=Eh,F="onMouseLeave",R="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Oh,F="onPointerLeave",R="onPointerEnter",k="pointer"),Je=P==null?L:_(P),U=he==null?L:_(he),L=new ye(F,k+"leave",P,i,Y),L.target=Je,L.relatedTarget=U,F=null,x(Y)===B&&(ye=new ye(R,k+"enter",he,i,Y),ye.target=U,ye.relatedTarget=Je,F=ye),Je=F,P&&he)t:{for(ye=Ub,R=P,k=he,U=0,F=R;F;F=ye(F))U++;F=0;for(var ge=k;ge;ge=ye(ge))F++;for(;0<U-F;)R=ye(R),U--;for(;0<F-U;)k=ye(k),F--;for(;U--;){if(R===k||k!==null&&R===k.alternate){ye=R;break t}R=ye(R),k=ye(k)}ye=null}else ye=null;P!==null&&yp(I,L,P,ye,!1),he!==null&&Je!==null&&yp(I,Je,he,ye,!0)}}e:{if(L=B?_(B):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Be=Dh;else if(Mh(L))if(zh)Be=Qy;else{Be=Fy;var pe=Vy}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&tc(B.elementType)&&(Be=Dh):Be=Jy;if(Be&&(Be=Be(e,B))){Rh(I,Be,i,Y);break e}pe&&pe(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&ec(L,"number",L.value)}switch(pe=B?_(B):window,e){case"focusin":(Mh(pe)||pe.contentEditable==="true")&&(Hi=pe,pc=B,Yr=null);break;case"focusout":Yr=pc=Hi=null;break;case"mousedown":gc=!0;break;case"contextmenu":case"mouseup":case"dragend":gc=!1,Yh(I,i,Y);break;case"selectionchange":if(Xy)break;case"keydown":case"keyup":Yh(I,i,Y)}var Ee;if(fc)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else Li?Ch(e,i)&&(De="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(De="onCompositionStart");De&&(jh&&i.locale!=="ko"&&(Li||De!=="onCompositionStart"?De==="onCompositionEnd"&&Li&&(Ee=wh()):(vs=Y,ac="value"in vs?vs.value:vs.textContent,Li=!0)),pe=Kl(B,De),0<pe.length&&(De=new Ah(De,e,null,i,Y),I.push({event:De,listeners:pe}),Ee?De.data=Ee:(Ee=kh(i),Ee!==null&&(De.data=Ee)))),(Ee=Hy?Py(e,i):$y(e,i))&&(De=Kl(B,"onBeforeInput"),0<De.length&&(pe=new Ah("onBeforeInput","beforeinput",null,i,Y),I.push({event:pe,listeners:De}),pe.data=Ee)),Rb(I,e,B,i,Y)}pp(I,t)})}function ma(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Kl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=zr(e,i),c!=null&&l.unshift(ma(e,c,u)),c=zr(e,t),c!=null&&l.push(ma(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Ub(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,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,O=b.alternate,B=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||B===null||(O=B,c?(B=zr(i,u),B!=null&&p.unshift(ma(i,B,O))):c||(B=zr(i,u),B!=null&&p.push(ma(i,B,O)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var Bb=/\r\n?/g,Lb=/\u0000|\uFFFD/g;function bp(e){return(typeof e=="string"?e:""+e).replace(Bb,`
26
- `).replace(Lb,"")}function xp(e,t){return t=bp(t),bp(e)===t}function Fe(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&qi(e,""+l);break;case"className":wn(e,"class",l);break;case"tabIndex":wn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":wn(e,i,l);break;case"style":xh(e,l,u);break;case"data":if(t!=="object"){wn(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=sl(""+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",c.name,c,null),Fe(e,t,"formEncType",c.formEncType,c,null),Fe(e,t,"formMethod",c.formMethod,c,null),Fe(e,t,"formTarget",c.formTarget,c,null)):(Fe(e,t,"encType",c.encType,c,null),Fe(e,t,"method",c.method,c,null),Fe(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Fn);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(c.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=sl(""+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":Vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Vn(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=dy.get(i)||i,Ct(e,i,l))}}function Pu(e,t,i,l,c,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(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(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=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Q.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);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,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,p,i,null)}}c&&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=p=c=null,O=null,B=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":O=Y;break;case"defaultChecked":B=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Fe(e,t,l,Y,i,null)}}ph(e,u,b,O,B,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Fe(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?zi(e,!!l,t,!1):i!=null&&zi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,p,b,i,null)}yh(e,l,c,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<da.length;l++)Ce(da[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(B in i)if(i.hasOwnProperty(B)&&(l=i[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,B,l,i,null)}return;default:if(tc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&Pu(e,t,Y,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 Hb(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 c=null,u=null,p=null,b=null,O=null,B=null,Y=null;for(P in i){var I=i[P];if(i.hasOwnProperty(P)&&I!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=I;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,I)}}for(var L in l){var P=l[L];if(I=i[L],l.hasOwnProperty(L)&&(P!=null||I!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":B=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==I&&Fe(e,t,L,P,l,I)}}Wo(e,p,b,O,B,Y,u,c);return;case"select":P=p=b=L=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(c in l)if(u=l[c],O=i[c],l.hasOwnProperty(c)&&(u!=null||O!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==O&&Fe(e,t,c,u,l,O)}t=b,i=p,l=P,L!=null?zi(e,!!i,L,!1):!!l!=!!i&&(t!=null?zi(e,!!i,t,!0):zi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Fe(e,t,p,c,l,u)}gh(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Fe(e,t,he,null,l,L)}for(O in l)if(L=l[O],P=i[O],l.hasOwnProperty(O)&&L!==P&&(L!=null||P!=null))switch(O){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Fe(e,t,O,L,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 ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Fe(e,t,ye,null,l,L);for(B in l)if(L=l[B],P=i[B],l.hasOwnProperty(B)&&L!==P&&(L!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Fe(e,t,B,L,l,P)}return;default:if(tc(t)){for(var Je in i)L=i[Je],i.hasOwnProperty(Je)&&L!==void 0&&!l.hasOwnProperty(Je)&&Pu(e,t,Je,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||Pu(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Fe(e,t,R,null,l,L);for(I in l)L=l[I],P=i[I],!l.hasOwnProperty(I)||L===P||L==null&&P==null||Fe(e,t,I,L,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 Pb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&vp(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var O=i[l],B=O.startTime;if(B>b)break;var Y=O.transferSize,I=O.initiatorType;Y&&vp(I)&&(O=O.responseEnd,p+=Y*(O<b?1:(b-B)/(O-B)))}if(--l,t+=8*(u+p)/(c.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 $u=null,Yu=null;function Zl(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 Gu(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 Vu=null;function $b(){var e=window.event;return e&&e.type==="popstate"?e===Vu?!1:(Vu=e,!0):(Vu=null,!1)}var Sp=typeof setTimeout=="function"?setTimeout:void 0,Yb=typeof clearTimeout=="function"?clearTimeout:void 0,Ep=typeof Promise=="function"?Promise:void 0,Gb=typeof queueMicrotask=="function"?queueMicrotask:typeof Ep<"u"?function(e){return Ep.resolve(null).then(e).catch(Vb)}:Sp;function Vb(e){setTimeout(function(){throw e})}function Us(e){return e==="head"}function Ap(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),dr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")pa(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,pa(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&pa(e.ownerDocument.body);i=c}while(i);dr(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 Fu(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":Fu(i),Di(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Fb(e,t,i,l){for(;e.nodeType===1;){var c=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!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=pn(e.nextSibling),e===null)break}return null}function Jb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=pn(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=pn(e.nextSibling),e===null))return null;return e}function Ju(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Qb(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 pn(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 Iu=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 pn(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=Zl(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 pa(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Di(e)}var gn=new Map,kp=new Set;function Wl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var os=te.d;te.d={f:Ib,r:Xb,D:Kb,C:Zb,L:Wb,m:ex,X:nx,S:tx,M:sx};function Ib(){var e=os.f(),t=Gl();return e||t}function Xb(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Qd(t):os.r(e)}var ur=typeof document>"u"?null:document;function Mp(e,t,i){var l=ur;if(l&&typeof t=="string"&&t){var c=on(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),kp.has(c)||(kp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function Kb(e){os.D(e),Mp("dns-prefetch",e,null)}function Zb(e,t){os.C(e,t),Mp("preconnect",e,t)}function Wb(e,t,i){os.L(e,t,i);var l=ur;if(l&&e&&t){var c='link[rel="preload"][as="'+on(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+on(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+on(i.imageSizes)+'"]')):c+='[href="'+on(e)+'"]';var u=c;switch(t){case"style":u=fr(e);break;case"script":u=hr(e)}gn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),gn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ga(u))||t==="script"&&l.querySelector(ya(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function ex(e,t){os.m(e,t);var i=ur;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+on(l)+'"][href="'+on(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=hr(e)}if(!gn.has(u)&&(e=w({rel:"modulepreload",href:e},t),gn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ya(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function tx(e,t,i){os.S(e,t,i);var l=ur;if(l&&e){var c=A(l).hoistableStyles,u=fr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ga(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=gn.get(u))&&Xu(e,i);var O=p=l.createElement("link");N(O),At(O,"link",e),O._p=new Promise(function(B,Y){O.onload=B,O.onerror=Y}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,eo(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function nx(e,t){os.X(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0},t),(t=gn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function sx(e,t){os.M(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=gn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Rp(e,t,i,l){var c=(c=rn.current)?Wl(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=fr(i.href),i=A(c).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=fr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ga(e)))&&!u._p&&(p.instance=u,p.state.loading=5),gn.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},gn.set(e,i),u||ix(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}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=hr(i),i=A(c).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 fr(e){return'href="'+on(e)+'"'}function ga(e){return'link[rel="stylesheet"]['+e+"]"}function Dp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function ix(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),N(t),e.head.appendChild(t))}function hr(e){return'[src="'+on(e)+'"]'}function ya(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~="'+on(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),eo(l,i.precedence,e),t.instance=l;case"stylesheet":c=fr(i.href);var u=e.querySelector(ga(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Dp(i),(c=gn.get(c))&&Xu(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),t.state.loading|=4,eo(u,i.precedence,e),t.instance=u;case"script":return u=hr(i.src),(c=e.querySelector(ya(u)))?(t.instance=c,N(c),c):(l=i,(c=gn.get(u))&&(l=w({},i),Ku(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);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,eo(l,i.precedence,e));return t.instance}function eo(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var to=null;function qp(e,t,i){if(to===null){var l=new Map,c=to=new Map;c.set(i,l)}else c=to,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function Up(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function rx(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 ax(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 c=fr(l.href),u=t.querySelector(ga(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=no.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Dp(l),(c=gn.get(c))&&Xu(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,O){p.onload=b,p.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=no.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Zu=0;function lx(e,t){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Zu===0&&(Zu=62500*Pb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Zu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function no(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var so=null;function io(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,so=new Map,t.forEach(ox,e),so=null,no.call(e))}function ox(e,t){if(!(t.state.loading&4)){var i=so.get(e);if(i)var l=i.get(null);else{i=new Map,so.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=no.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ba={$$typeof:me,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function cx(e,t,i,l,c,u,p,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=gs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gs(0),this.hiddenUpdates=gs(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Lp(e,t,i,l,c,u,p,b,O,B,Y,I){return e=new cx(e,t,i,p,O,B,Y,I,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=kc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},zc(u),e}function Hp(e){return e?(e=Yi,e):Yi}function Pp(e,t,i,l,c,u){c=Hp(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=js(e,l,t),i!==null&&(Ht(i,e,t),Xr(i,e,t))}function $p(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Wu(e,t){$p(e,t),(e=e.alternate)&&$p(e,t)}function Yp(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),Wu(e,67108864)}}function Gp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Gn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),Wu(e,t)}}var ro=!0;function ux(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function fx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function ef(e,t,i,l){if(ro){var c=tf(l);if(c===null)Hu(e,t,l,ao,i),Fp(e,l);else if(dx(c,e,t,i,l))l.stopPropagation();else if(Fp(e,l),t&4&&-1<hx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=vn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var O=1<<31-Nt(p);b.entanglements[1]|=O,p&=~O}zn(u),(Pe&6)===0&&($l=et()+500,ha(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Gl(),Wu(u,2)}if(u=tf(l),u===null&&Hu(e,t,l,ao,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Hu(e,t,l,null,i)}}function tf(e){return e=sc(e),nf(e)}var ao=null;function nf(e){if(ao=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 ao=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(Io()){case Ia:return 2;case Xa:return 8;case ki:case Xo:return 32;case Ka:return 268435456;default:return 32}default:return 32}}var sf=!1,Bs=null,Ls=null,Hs=null,xa=new Map,va=new Map,Ps=[],hx="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":Bs=null;break;case"dragenter":case"dragleave":Ls=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":va.delete(t.pointerId)}}function _a(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&Yp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function dx(e,t,i,l,c){switch(t){case"focusin":return Bs=_a(Bs,e,t,i,l,c),!0;case"dragenter":return Ls=_a(Ls,e,t,i,l,c),!0;case"mouseover":return Hs=_a(Hs,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return xa.set(u,_a(xa.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,va.set(u,_a(va.get(u)||null,e,t,i,l,c)),!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,Wa(e.priority,function(){Gp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Wa(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 lo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=tf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);nc=l,i.target.dispatchEvent(l),nc=null}else return t=S(i),t!==null&&Yp(t),e.blockedOn=i,!1;t.shift()}return!0}function Qp(e,t,i){lo(e)&&i.delete(t)}function mx(){sf=!1,Bs!==null&&lo(Bs)&&(Bs=null),Ls!==null&&lo(Ls)&&(Ls=null),Hs!==null&&lo(Hs)&&(Hs=null),xa.forEach(Qp),va.forEach(Qp)}function oo(e,t){e.blockedOn===t&&(e.blockedOn=null,sf||(sf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,mx)))}var co=null;function Ip(e){co!==e&&(co=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){co===e&&(co=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(nf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,tu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function dr(e){function t(O){return oo(O,e)}Bs!==null&&oo(Bs,e),Ls!==null&&oo(Ls,e),Hs!==null&&oo(Hs,e),xa.forEach(t),va.forEach(t);for(var i=0;i<Ps.length;i++){var l=Ps[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ps.length&&(i=Ps[0],i.blockedOn===null);)Jp(i),i.blockedOn===null&&Ps.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||Ip(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(nf(c)!==null)continue}else b=p.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(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=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,c=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),c!==null&&(c(),c=null)}}}function rf(e){this._internalRoot=e}uo.prototype.render=rf.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)},uo.prototype.unmount=rf.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),Gl(),t[Yt]=null}};function uo(e){this._internalRoot=e}uo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Ps.length&&t!==0&&t<Ps[i].priority;i++);Ps.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?E(e):null,e=e===null?null:e.stateNode,e};var px={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fo.isDisabled&&fo.supportsFiber)try{ni=fo.inject(px),ot=fo}catch{}}return wa.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=im,u=rm,p=am;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Lp(e,1,!1,null,null,i,l,null,c,u,p,Xp),e[Yt]=t.current,Lu(e),new rf(t)},wa.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=im,p=rm,b=am,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=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,c,O,u,p,b,Xp),t.context=Hp(null),i=t.current,l=Xt(),l=Gn(l),c=Os(l),c.callback=null,js(i,c,l),i=l,t.current.lanes=i,_n(t,i),zn(t),e[Yt]=t.current,Lu(e),new uo(t)},wa.version="19.2.4",wa}var s0;function ov(){if(s0)return af.exports;s0=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=lv(),af.exports}var cv=ov();const uv="modulepreload",fv=function(r,n){return new URL(r,n).href},i0={},Ae=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(j=>({status:"fulfilled",value:j}),j=>({status:"rejected",reason:j}))))};const d=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(s.map(E=>{if(E=fv(E,a),E in i0)return;i0[E]=!0;const w=E.endsWith(".css"),j=w?'[rel="stylesheet"]':"";if(!!a)for(let D=d.length-1;D>=0;D--){const W=d[D];if(W.href===E&&(!w||W.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${j}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":uv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((D,W)=>{M.addEventListener("load",D),M.addEventListener("error",()=>W(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return o.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function Qf(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=Qf(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 Wt=window.__LT_BASE__??"",Sf=`${Wt}/api`;let Vs=null;function ho(r){Vs=r}function hg(){return Vs}async function r0(){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 o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Ys=null;async function Xe(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Vs){if(If(Vs)){Ys||(Ys=r0().finally(()=>{Ys=null}));const o=await Ys;if(o)Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Vs}`}let a=await fetch(`${Sf}${r}`,{...n,headers:s});if(a.status===401&&Vs){Ys||(Ys=r0().finally(()=>{Ys=null}));const o=await Ys;if(o&&(Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,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 o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const dg=T.createContext(null),hv=300;function cf(r,n){if(If(r))return null;const s=Qf(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):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 dv({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?If(w)?(sessionStorage.removeItem("lt_token"),null):(ho(w),cf(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const j=fg(w);if(!j)return;const q=(j-hv)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{try{const M=Qf(w);if(M!=null&&M.sso){const re=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const C=await re.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const D=sessionStorage.getItem("lt_credentials");if(!D)return;const{username:W,password:se}=JSON.parse(D),ee=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:W,password:se})});if(!ee.ok)return;const me=await ee.json();me.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:me.token}}))}catch{}},q))},[]),f=T.useCallback((w,j,q)=>{const M={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(j==null?void 0:j.username)??null},D=cf(w,M);D&&(ho(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(D),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");ho(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),w&&(window.location.href=w)},[]);T.useEffect(()=>{const w=()=>h(),j=q=>{var W;const M=(W=q.detail)==null?void 0:W.token;if(!M)return;const D=cf(M);D&&(ho(M),sessionStorage.setItem("lt_token",M),s(D),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",j)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return m.jsx(dg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=T.useContext(dg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const nn=new Uint8Array(0),ji=new TextEncoder,en=new TextDecoder;function mv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function ka(...r){const n=[];for(let s=0;s<r.length;s++)n.push(ji.encode(r[s]));return n.length===0?nn:n.length===1?n[0]:mv(...n)}function a0(r){return!r||r.length===0?"":en.decode(r)}const l0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",o0=36,pv=0xcfd41b9100000,c0=33,gv=333,u0=22;function yv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function bv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):yv(r)}class xv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(u0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*pv),this.inc=Math.floor(Math.random()*(gv-c0)+c0)}setPre(){const n=new Uint8Array(12);bv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=l0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=u0-1;s>=12;s--)this.buf[s]=l0.charCodeAt(n%o0),n=Math.floor(n/o0)}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 Ks=new xv;var cs;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(cs||(cs={}));var br;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(br||(br={}));var ie;(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"})(ie||(ie={}));function vv(r){return typeof r.code=="string"}class mg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return _v.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const _v=new mg;class ue extends Error{constructor(s,a,o){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=o}static errorForCode(s,a){const o=mg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.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 Tn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Tn||(Tn={}));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 ko="Nats-Service-Error",Mo="Nats-Service-Error-Code";class Ro extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Ro.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Mo))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(ko))||"";return new Ro(h,d.length?d:a)}return null}}function us(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}.${Ks.next()}`}const Ef="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function Yo(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function mo(r){return en.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Sr(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,d)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{d(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Or(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});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 wv(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 wv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Kf(r){return Math.floor(r/1e6)}function f0(r){let a=!0;const o=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 ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function fs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Qs(r,n)}const uf="NATS/1.0";class Qs{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 o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].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 Qs,o=en.decode(n).split(`\r
25
+ `+l.stack}}var Nr=Object.prototype.hasOwnProperty,Cr=r.unstable_scheduleCallback,$n=r.unstable_cancelCallback,Qa=r.unstable_shouldYield,Ci=r.unstable_requestPaint,et=r.unstable_now,Qo=r.unstable_getCurrentPriorityLevel,Xa=r.unstable_ImmediatePriority,Ka=r.unstable_UserBlockingPriority,ki=r.unstable_NormalPriority,Xo=r.unstable_LowPriority,Za=r.unstable_IdlePriority,Ko=r.log,Wa=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Ko=="function"&&Wa(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Mi,kr=Math.log,Mr=Math.LN2;function Mi(e){return e>>>=0,e===0?32:31-(kr(e)/Mr|0)|0}var ps=256,Yn=262144,gs=4194304;function vn(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 si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=vn(l):(p&=b,p!==0?c=vn(p):i||(i=b&~e,i!==0&&(c=vn(i))))):(b=l&~u,b!==0?c=vn(b):p!==0?c=vn(p):i||(i=l&~e,i!==0&&(c=vn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Rr(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 Ri(){var e=gs;return gs<<=1,(gs&62914560)===0&&(gs=4194304),e}function ys(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function _n(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bs(e,t,i,l,c,u){var p=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,j=e.expirationTimes,B=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),Q=1<<Y;b[Y]=0,j[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~Q}l!==0&&xs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function xs(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 ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function vs(e,t){var i=t&-t;return i=(i&42)!==0?1:Gn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gn(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 ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Dr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Ip(e.type))}function el(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var kn=Math.random().toString(36).slice(2),Ie="__reactFiber$"+kn,it="__reactProps$"+kn,Yt="__reactContainer$"+kn,li="__reactEvents$"+kn,zr="__reactListeners$"+kn,tl="__reactHandles$"+kn,nl="__reactResources$"+kn,yt="__reactMarker$"+kn;function Di(e){delete e[Ie],delete e[it],delete e[li],delete e[zr],delete e[tl]}function x(e){var t=e[Ie];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Ie]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Mp(e);e!==null;){if(i=e[Ie])return i;e=Mp(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Ie]||e[Yt]){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 A(e){var t=e[nl];return t||(t=e[nl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var z=new Set,I={};function Z(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(I[e]=t,e=0;e<t.length;e++)z.add(t[e])}var J=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]*$"),fe={},je={};function Ke(e){return Nr.call(je,e)?!0:Nr.call(fe,e)?!1:J.test(e)?je[e]=!0:(fe[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 wn(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 Vn(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 ln(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function my(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 c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zo(e){if(!e._valueTracker){var t=gh(e)?"checked":"value";e._valueTracker=my(e,t,""+e[t])}}function yh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=gh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function sl(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 py=/[\n"\\]/g;function on(e){return e.replace(py,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Wo(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ln(t)):e.value!==""+ln(t)&&(e.value=""+ln(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?ec(e,p,ln(t)):i!=null?ec(e,p,ln(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+ln(b):e.removeAttribute("name")}function bh(e,t,i,l,c,u,p,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)){Zo(e);return}i=i!=null?""+ln(i):"",t=t!=null?""+ln(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Zo(e)}function ec(e,t,i){t==="number"&&sl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function zi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+ln(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function xh(e,t,i){if(t!=null&&(t=""+ln(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+ln(i):""}function vh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Me(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=ln(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Zo(e)}function qi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var gy=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 _h(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||gy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function wh(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 c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&_h(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&_h(e,u,t[u])}function tc(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 yy=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"]]),by=/^[\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 il(e){return by.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var nc=null;function sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Bi=null;function Sh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Wo(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="'+on(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));Wo(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&yh(l)}break e;case"textarea":xh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&zi(e,!!i.multiple,t,!1)}}}var ic=!1;function Eh(e,t,i){if(ic)return e(t,i);ic=!0;try{var l=e(t);return l}finally{if(ic=!1,(Ui!==null||Bi!==null)&&(Vl(),Ui&&(t=Ui,e=Bi,Bi=Ui=null,Sh(t),e)))for(t=0;t<e.length;t++)Sh(e[t])}}function qr(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 Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rc=!1;if(Jn)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){rc=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{rc=!1}var _s=null,ac=null,rl=null;function Ah(){if(rl)return rl;var e,t=ac,i=t.length,l,c="value"in _s?_s.value:_s.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return rl=c.slice(e,1<l?1-l:void 0)}function al(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 ll(){return!0}function jh(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,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)?ll:jh,this.isPropagationStopped=jh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=ll)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=ll)},persist:function(){},isPersistent:ll}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ol=zt(oi),Br=w({},oi,{view:0,detail:0}),xy=zt(Br),lc,oc,Lr,cl=w({},Br,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uc,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!==Lr&&(Lr&&e.type==="mousemove"?(lc=e.screenX-Lr.screenX,oc=e.screenY-Lr.screenY):oc=lc=0,Lr=e),lc)},movementY:function(e){return"movementY"in e?e.movementY:oc}}),Oh=zt(cl),vy=w({},cl,{dataTransfer:0}),_y=zt(vy),wy=w({},Br,{relatedTarget:0}),cc=zt(wy),Sy=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),Ey=zt(Sy),Ay=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jy=zt(Ay),Oy=w({},oi,{data:0}),Th=zt(Oy),Ty={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ny={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"},Cy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ky(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cy[e])?!!t[e]:!1}function uc(){return ky}var My=w({},Br,{key:function(e){if(e.key){var t=Ty[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=al(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ny[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uc,charCode:function(e){return e.type==="keypress"?al(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?al(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ry=zt(My),Dy=w({},cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nh=zt(Dy),zy=w({},Br,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uc}),qy=zt(zy),Uy=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),By=zt(Uy),Ly=w({},cl,{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}),Hy=zt(Ly),Py=w({},oi,{newState:0,oldState:0}),$y=zt(Py),Yy=[9,13,27,32],fc=Jn&&"CompositionEvent"in window,Hr=null;Jn&&"documentMode"in document&&(Hr=document.documentMode);var Gy=Jn&&"TextEvent"in window&&!Hr,Ch=Jn&&(!fc||Hr&&8<Hr&&11>=Hr),kh=" ",Mh=!1;function Rh(e,t){switch(e){case"keyup":return Yy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Li=!1;function Vy(e,t){switch(e){case"compositionend":return Dh(t);case"keypress":return t.which!==32?null:(Mh=!0,kh);case"textInput":return e=t.data,e===kh&&Mh?null:e;default:return null}}function Fy(e,t){if(Li)return e==="compositionend"||!fc&&Rh(e,t)?(e=Ah(),rl=ac=_s=null,Li=!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 Ch&&t.locale!=="ko"?null:t.data;default:return null}}var Jy={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 zh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Jy[e.type]:t==="textarea"}function qh(e,t,i,l){Ui?Bi?Bi.push(l):Bi=[l]:Ui=l,t=Zl(t,"onChange"),0<t.length&&(i=new ol("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Pr=null,$r=null;function Iy(e){bp(e,0)}function ul(e){var t=_(e);if(yh(t))return e}function Uh(e,t){if(e==="change")return t}var Bh=!1;if(Jn){var hc;if(Jn){var dc="oninput"in document;if(!dc){var Lh=document.createElement("div");Lh.setAttribute("oninput","return;"),dc=typeof Lh.oninput=="function"}hc=dc}else hc=!1;Bh=hc&&(!document.documentMode||9<document.documentMode)}function Hh(){Pr&&(Pr.detachEvent("onpropertychange",Ph),$r=Pr=null)}function Ph(e){if(e.propertyName==="value"&&ul($r)){var t=[];qh(t,$r,e,sc(e)),Eh(Iy,t)}}function Qy(e,t,i){e==="focusin"?(Hh(),Pr=t,$r=i,Pr.attachEvent("onpropertychange",Ph)):e==="focusout"&&Hh()}function Xy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ul($r)}function Ky(e,t){if(e==="click")return ul(t)}function Zy(e,t){if(e==="input"||e==="change")return ul(t)}function Wy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Wy;function Yr(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 c=i[l];if(!Nr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function $h(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yh(e,t){var i=$h(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=$h(i)}}function Gh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Gh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Vh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=sl(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=sl(e.document)}return t}function mc(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 eb=Jn&&"documentMode"in document&&11>=document.documentMode,Hi=null,pc=null,Gr=null,gc=!1;function Fh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;gc||Hi==null||Hi!==sl(l)||(l=Hi,"selectionStart"in l&&mc(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}),Gr&&Yr(Gr,l)||(Gr=l,l=Zl(pc,"onSelect"),0<l.length&&(t=new ol("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Hi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Pi={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},yc={},Jh={};Jn&&(Jh=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function ui(e){if(yc[e])return yc[e];if(!Pi[e])return e;var t=Pi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Jh)return yc[e]=t[i];return e}var Ih=ui("animationend"),Qh=ui("animationiteration"),Xh=ui("animationstart"),tb=ui("transitionrun"),nb=ui("transitionstart"),sb=ui("transitioncancel"),Kh=ui("transitionend"),Zh=new Map,bc="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(" ");bc.push("scrollEnd");function Sn(e,t){Zh.set(e,t),Z(t,[e])}var fl=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=[],$i=0,xc=0;function hl(){for(var e=$i,t=xc=$i=0;t<e;){var i=cn[t];cn[t++]=null;var l=cn[t];cn[t++]=null;var c=cn[t];cn[t++]=null;var u=cn[t];if(cn[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&Wh(i,c,u)}}function dl(e,t,i,l){cn[$i++]=e,cn[$i++]=t,cn[$i++]=i,cn[$i++]=l,xc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function vc(e,t,i,l){return dl(e,t,i,l),ml(e)}function fi(e,t){return dl(e,null,null,t),ml(e)}function Wh(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!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||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function ml(e){if(50<ha)throw ha=0,Nu=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 ib(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 ib(e,t,i,l)}function _c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function In(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 ed(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 pl(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")_c(e)&&(p=1);else if(typeof e=="string")p=cx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Vt(31,i,t,c),e.elementType=G,e.lanes=u,e;case D:return hi(i.children,c,u,t);case W:p=8,c|=24;break;case se:return e=Vt(12,i,t,c|2),e.elementType=se,e.lanes=u,e;case C:return e=Vt(13,i,t,c),e.elementType=C,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:p=10;break e;case ee:p=9;break e;case re:p=11;break e;case ce:p=14;break e;case V:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function wc(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function td(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Sc(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 nd=new WeakMap;function un(e,t){if(typeof e=="object"&&e!==null){var i=nd.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ia(t)},nd.set(e,t),t)}return{value:e,source:t,stack:Ia(t)}}var Gi=[],Vi=0,gl=null,Vr=0,fn=[],hn=0,ws=null,Mn=1,Rn="";function Qn(e,t){Gi[Vi++]=Vr,Gi[Vi++]=gl,gl=e,Vr=t}function sd(e,t,i){fn[hn++]=Mn,fn[hn++]=Rn,fn[hn++]=ws,ws=e;var l=Mn;e=Rn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Mn=1<<32-Nt(t)+c|i<<c|l,Rn=u+e}else Mn=1<<u|i<<c|l,Rn=e}function Ec(e){e.return!==null&&(Qn(e,1),sd(e,1,0))}function Ac(e){for(;e===gl;)gl=Gi[--Vi],Gi[Vi]=null,Vr=Gi[--Vi],Gi[Vi]=null;for(;e===ws;)ws=fn[--hn],fn[hn]=null,Rn=fn[--hn],fn[hn]=null,Mn=fn[--hn],fn[hn]=null}function id(e,t){fn[hn++]=Mn,fn[hn++]=Rn,fn[hn++]=ws,Mn=t.id,Rn=t.overflow,ws=e}var wt=null,Ze=null,ze=!1,Ss=null,dn=!1,jc=Error(a(519));function Es(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fr(un(t,e)),jc}function rd(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Ie]=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<ma.length;i++)Ce(ma[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),bh(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),vh(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||wp(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=Fn),t=!0):t=!1,t||Es(e,!0)}function ad(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:dn=!1;return;case 27:case 3:dn=!0;return;default:wt=wt.return}}function Fi(e){if(e!==wt)return!1;if(!ze)return ad(e),ze=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Gu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Es(e),ad(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=kp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=kp(e)}else t===27?(t=Ze,Bs(e.type)?(e=Qu,Qu=null,Ze=e):Ze=t):Ze=wt?pn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,ze=!1}function Oc(){var e=Ss;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),Ss=null),e}function Fr(e){Ss===null?Ss=[e]:Ss.push(e)}var Tc=Oe(null),mi=null,Xn=null;function As(e,t,i){Te(Tc,t._currentValue),t._currentValue=i}function Kn(e){e._currentValue=Tc.current,we(Tc)}function Nc(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 Cc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var j=0;j<t.length;j++)if(b.context===t[j]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Nc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Nc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ji(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===jt.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(xa):e=[xa])}c=c.return}e!==null&&Cc(t,e,i,l),t.flags|=262144}function yl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Xn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ld(mi,e)}function bl(e,t){return mi===null&&pi(e),ld(e,t)}function ld(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Xn===null){if(e===null)throw Error(a(308));Xn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xn=Xn.next=t;return i}var rb=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()})}},ab=r.unstable_scheduleCallback,lb=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kc(){return{controller:new rb,data:new Map,refCount:0}}function Jr(e){e.refCount--,e.refCount===0&&ab(lb,function(){e.controller.abort()})}var Ir=null,Mc=0,Ii=0,Qi=null;function ob(e,t){if(Ir===null){var i=Ir=[];Mc=0,Ii=zu(),Qi={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Mc++,t.then(od,od),t}function od(){if(--Mc===0&&Ir!==null){Qi!==null&&(Qi.status="fulfilled");var e=Ir;Ir=null,Ii=0,Qi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function cb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var cd=$.S;$.S=function(e,t){Fm=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ob(e,t),cd!==null&&cd(e,t)};var gi=Oe(null);function Rc(){var e=gi.current;return e!==null?e:Qe.pooledCache}function xl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function ud(){var e=Rc();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Dc=Error(a(474)),vl=Error(a(542)),_l={then:function(){}};function fd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function hd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Fn,Fn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,md(e),e;default:if(typeof t.status=="string")t.then(Fn,Fn);else{if(e=Qe,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,md(e),e}throw bi=t,Xi}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Xi):i}}var bi=null;function dd(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function md(e){if(e===Xi||e===vl)throw Error(a(483))}var Ki=null,Qr=0;function wl(e){var t=Qr;return Qr+=1,Ki===null&&(Ki=[]),hd(Ki,e,t)}function Xr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Sl(e,t){throw t.$$typeof===O?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function pd(e){function t(R,k){if(e){var U=R.deletions;U===null?(R.deletions=[k],R.flags|=16):U.push(k)}}function i(R,k){if(!e)return null;for(;k!==null;)t(R,k),k=k.sibling;return null}function l(R){for(var k=new Map;R!==null;)R.key!==null?k.set(R.key,R):k.set(R.index,R),R=R.sibling;return k}function c(R,k){return R=In(R,k),R.index=0,R.sibling=null,R}function u(R,k,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<k?(R.flags|=67108866,k):U):(R.flags|=67108866,k)):(R.flags|=1048576,k)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,k,U,F){return k===null||k.tag!==6?(k=wc(U,R.mode,F),k.return=R,k):(k=c(k,U),k.return=R,k)}function j(R,k,U,F){var ge=U.type;return ge===D?Y(R,k,U.props.children,F,U.key):k!==null&&(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type)?(k=c(k,U.props),Xr(k,U),k.return=R,k):(k=pl(U.type,U.key,U.props,null,R.mode,F),Xr(k,U),k.return=R,k)}function B(R,k,U,F){return k===null||k.tag!==4||k.stateNode.containerInfo!==U.containerInfo||k.stateNode.implementation!==U.implementation?(k=Sc(U,R.mode,F),k.return=R,k):(k=c(k,U.children||[]),k.return=R,k)}function Y(R,k,U,F,ge){return k===null||k.tag!==7?(k=hi(U,R.mode,F,ge),k.return=R,k):(k=c(k,U),k.return=R,k)}function Q(R,k,U){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=wc(""+k,R.mode,U),k.return=R,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case q:return U=pl(k.type,k.key,k.props,null,R.mode,U),Xr(U,k),U.return=R,U;case M:return k=Sc(k,R.mode,U),k.return=R,k;case V:return k=yi(k),Q(R,k,U)}if(Me(k)||ne(k))return k=hi(k,R.mode,U,null),k.return=R,k;if(typeof k.then=="function")return Q(R,wl(k),U);if(k.$$typeof===me)return Q(R,bl(R,k),U);Sl(R,k)}return null}function L(R,k,U,F){var ge=k!==null?k.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:b(R,k,""+U,F);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case q:return U.key===ge?j(R,k,U,F):null;case M:return U.key===ge?B(R,k,U,F):null;case V:return U=yi(U),L(R,k,U,F)}if(Me(U)||ne(U))return ge!==null?null:Y(R,k,U,F,null);if(typeof U.then=="function")return L(R,k,wl(U),F);if(U.$$typeof===me)return L(R,k,bl(R,U),F);Sl(R,U)}return null}function P(R,k,U,F,ge){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return R=R.get(U)||null,b(k,R,""+F,ge);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case q:return R=R.get(F.key===null?U:F.key)||null,j(k,R,F,ge);case M:return R=R.get(F.key===null?U:F.key)||null,B(k,R,F,ge);case V:return F=yi(F),P(R,k,U,F,ge)}if(Me(F)||ne(F))return R=R.get(U)||null,Y(k,R,F,ge,null);if(typeof F.then=="function")return P(R,k,U,wl(F),ge);if(F.$$typeof===me)return P(R,k,U,bl(k,F),ge);Sl(k,F)}return null}function he(R,k,U,F){for(var ge=null,Be=null,pe=k,Ae=k=0,De=null;pe!==null&&Ae<U.length;Ae++){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Le=L(R,pe,U[Ae],F);if(Le===null){pe===null&&(pe=De);break}e&&pe&&Le.alternate===null&&t(R,pe),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le,pe=De}if(Ae===U.length)return i(R,pe),ze&&Qn(R,Ae),ge;if(pe===null){for(;Ae<U.length;Ae++)pe=Q(R,U[Ae],F),pe!==null&&(k=u(pe,k,Ae),Be===null?ge=pe:Be.sibling=pe,Be=pe);return ze&&Qn(R,Ae),ge}for(pe=l(pe);Ae<U.length;Ae++)De=P(pe,R,Ae,U[Ae],F),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?Ae:De.key),k=u(De,k,Ae),Be===null?ge=De:Be.sibling=De,Be=De);return e&&pe.forEach(function(Ys){return t(R,Ys)}),ze&&Qn(R,Ae),ge}function ye(R,k,U,F){if(U==null)throw Error(a(151));for(var ge=null,Be=null,pe=k,Ae=k=0,De=null,Le=U.next();pe!==null&&!Le.done;Ae++,Le=U.next()){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Ys=L(R,pe,Le.value,F);if(Ys===null){pe===null&&(pe=De);break}e&&pe&&Ys.alternate===null&&t(R,pe),k=u(Ys,k,Ae),Be===null?ge=Ys:Be.sibling=Ys,Be=Ys,pe=De}if(Le.done)return i(R,pe),ze&&Qn(R,Ae),ge;if(pe===null){for(;!Le.done;Ae++,Le=U.next())Le=Q(R,Le.value,F),Le!==null&&(k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return ze&&Qn(R,Ae),ge}for(pe=l(pe);!Le.done;Ae++,Le=U.next())Le=P(pe,R,Ae,Le.value,F),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ae:Le.key),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return e&&pe.forEach(function(vx){return t(R,vx)}),ze&&Qn(R,Ae),ge}function Je(R,k,U,F){if(typeof U=="object"&&U!==null&&U.type===D&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case q:e:{for(var ge=U.key;k!==null;){if(k.key===ge){if(ge=U.type,ge===D){if(k.tag===7){i(R,k.sibling),F=c(k,U.props.children),F.return=R,R=F;break e}}else if(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type){i(R,k.sibling),F=c(k,U.props),Xr(F,U),F.return=R,R=F;break e}i(R,k);break}else t(R,k);k=k.sibling}U.type===D?(F=hi(U.props.children,R.mode,F,U.key),F.return=R,R=F):(F=pl(U.type,U.key,U.props,null,R.mode,F),Xr(F,U),F.return=R,R=F)}return p(R);case M:e:{for(ge=U.key;k!==null;){if(k.key===ge)if(k.tag===4&&k.stateNode.containerInfo===U.containerInfo&&k.stateNode.implementation===U.implementation){i(R,k.sibling),F=c(k,U.children||[]),F.return=R,R=F;break e}else{i(R,k);break}else t(R,k);k=k.sibling}F=Sc(U,R.mode,F),F.return=R,R=F}return p(R);case V:return U=yi(U),Je(R,k,U,F)}if(Me(U))return he(R,k,U,F);if(ne(U)){if(ge=ne(U),typeof ge!="function")throw Error(a(150));return U=ge.call(U),ye(R,k,U,F)}if(typeof U.then=="function")return Je(R,k,wl(U),F);if(U.$$typeof===me)return Je(R,k,bl(R,U),F);Sl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,k!==null&&k.tag===6?(i(R,k.sibling),F=c(k,U),F.return=R,R=F):(i(R,k),F=wc(U,R.mode,F),F.return=R,R=F),p(R)):i(R,k)}return function(R,k,U,F){try{Qr=0;var ge=Je(R,k,U,F);return Ki=null,ge}catch(pe){if(pe===Xi||pe===vl)throw pe;var Be=Vt(29,pe,null,R.mode);return Be.lanes=F,Be.return=R,Be}finally{}}}var xi=pd(!0),gd=pd(!1),js=!1;function zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(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 Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ts(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Pe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=ml(e),Wh(e,null,i),t}return dl(e,l,t,i),ml(e)}function Kr(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,ri(e,i)}}function Uc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,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 Bc=!1;function Zr(){if(Bc){var e=Qi;if(e!==null)throw e}}function Wr(e,t,i,l){Bc=!1;var c=e.updateQueue;js=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var j=b,B=j.next;j.next=null,p===null?u=B:p.next=B,p=j;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=B:b.next=B,Y.lastBaseUpdate=j))}if(u!==null){var Q=c.baseState;p=0,Y=B=j=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(Re&L)===L:(l&L)===L){L!==0&&L===Ii&&(Bc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Je=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){Q=he.call(Je,Q,L);break e}Q=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Je,Q,L):he,L==null)break e;Q=w({},Q,L);break e;case 2:js=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(B=Y=P,j=Q):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(j=Q),c.baseState=j,c.firstBaseUpdate=B,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Rs|=p,e.lanes=p,e.memoizedState=Q}}function yd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function bd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)yd(i[e],t)}var Zi=Oe(null),El=Oe(0);function xd(e,t){e=as,Te(El,e),Te(Zi,t),as=e|t.baseLanes}function Lc(){Te(El,as),Te(Zi,Zi.current)}function Hc(){as=El.current,we(Zi),we(El)}var Ft=Oe(null),mn=null;function Ns(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),mn===null&&(t===null||Zi.current!==null||t.memoizedState!==null)&&(mn=e)}function Pc(e){Te(ct,ct.current),Te(Ft,e),mn===null&&(mn=e)}function vd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),mn===null&&(mn=e)):Cs()}function Cs(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){we(Ft),mn===e&&(mn=null),we(ct)}var ct=Oe(0);function Al(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Ju(i)||Iu(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 Zn=0,Ee=null,Ve=null,dt=null,jl=!1,Wi=!1,vi=!1,Ol=0,ea=0,er=null,ub=0;function rt(){throw Error(a(321))}function $c(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 Yc(e,t,i,l,c,u){return Zn=u,Ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?sm:iu,vi=!1,u=i(l,c),vi=!1,Wi&&(u=wd(t,i,l,c)),_d(e),u}function _d(e){$.H=sa;var t=Ve!==null&&Ve.next!==null;if(Zn=0,dt=Ve=Ee=null,jl=!1,ea=0,er=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&yl(e)&&(mt=!0))}function wd(e,t,i,l){Ee=e;var c=0;do{if(Wi&&(er=null),ea=0,Wi=!1,25<=c)throw Error(a(301));if(c+=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)}$.H=im,u=t(i,l)}while(Wi);return u}function fb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ta(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(Ee.flags|=1024),t}function Gc(){var e=Ol!==0;return Ol=0,e}function Vc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Fc(e){if(jl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}jl=!1}Zn=0,dt=Ve=Ee=null,Wi=!1,ea=Ol=0,er=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ee.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Ve===null){var e=Ee.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=dt===null?Ee.memoizedState:dt.next;if(t!==null)dt=t,Ve=e;else{if(e===null)throw Ee.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?Ee.memoizedState=dt=e:dt=dt.next=e}return dt}function Tl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ta(e){var t=ea;return ea+=1,er===null&&(er=[]),e=hd(er,e,t),t=Ee,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?sm:iu),e}function Nl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ta(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Jc(e){var t=null,i=Ee.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Ee.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=Tl(),Ee.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 Wn(e,t){return typeof t=="function"?t(e):t}function Cl(e){var t=ut();return Ic(t,Ve,e)}function Ic(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,j=null,B=t,Y=!1;do{var Q=B.lane&-536870913;if(Q!==B.lane?(Re&Q)===Q:(Zn&Q)===Q){var L=B.revertLane;if(L===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),Q===Ii&&(Y=!0);else if((Zn&L)===L){B=B.next,L===Ii&&(Y=!0);continue}else Q={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=Q,p=u):j=j.next=Q,Ee.lanes|=L,Rs|=L;Q=B.action,vi&&i(u,Q),u=B.hasEagerState?B.eagerState:i(u,Q)}else L={lane:Q,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=L,p=u):j=j.next=L,Ee.lanes|=Q,Rs|=Q;B=B.next}while(B!==null&&B!==t);if(j===null?p=u:j.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Qi,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=j,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Qc(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function Sd(e,t,i){var l=Ee,c=ut(),u=ze;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Ve||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Zc(jd.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,tr(9,{destroy:void 0},Ad.bind(null,l,c,i,t),null),Qe===null)throw Error(a(349));u||(Zn&127)!==0||Ed(l,t,i)}return i}function Ed(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Ee.updateQueue,t===null?(t=Tl(),Ee.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Ad(e,t,i,l){t.value=i,t.getSnapshot=l,Od(t)&&Td(e)}function jd(e,t,i){return i(function(){Od(t)&&Td(e)})}function Od(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Td(e){var t=fi(e,2);t!==null&&Ht(t,e,2)}function Xc(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:e},t}function Nd(e,t,i,l){return e.baseState=i,Ic(e,Ve,typeof l=="function"?l:Wn)}function hb(e,t,i,l,c){if(Rl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Cd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Cd(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),j=$.S;j!==null&&j(p,b),kd(e,t,b)}catch(B){Kc(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),kd(e,t,u)}catch(B){Kc(e,t,B)}}function kd(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Md(e,t,l)},function(l){return Kc(e,t,l)}):Md(e,t,i)}function Md(e,t,i){t.status="fulfilled",t.value=i,Rd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Cd(e,i)))}function Kc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Rd(t),t=t.next;while(t!==l)}e.action=null}function Rd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Dd(e,t){return t}function zd(e,t){if(ze){var i=Qe.formState;if(i!==null){e:{var l=Ee;if(ze){if(Ze){t:{for(var c=Ze,u=dn;c.nodeType!==8;){if(!u){c=null;break t}if(c=pn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=pn(c.nextSibling),l=c.data==="F!";break e}}Es(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dd,lastRenderedState:t},i.queue=l,i=em.bind(null,Ee,l),l.dispatch=i,l=Xc(!1),u=su.bind(null,Ee,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=hb.bind(null,Ee,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function qd(e){var t=ut();return Ud(t,Ve,e)}function Ud(e,t,i){if(t=Ic(e,t,Dd)[0],e=Cl(Wn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ta(t)}catch(p){throw p===Xi?vl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Ee.flags|=2048,tr(9,{destroy:void 0},db.bind(null,c,i),null)),[l,u,e]}function db(e,t){e.action=t}function Bd(e){var t=ut(),i=Ve;if(i!==null)return Ud(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function tr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Ee.updateQueue,t===null&&(t=Tl(),Ee.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 Ld(){return ut().memoizedState}function kl(e,t,i,l){var c=kt();Ee.flags|=e,c.memoizedState=tr(1|t,{destroy:void 0},i,l===void 0?null:l)}function Ml(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Ve!==null&&l!==null&&$c(l,Ve.memoizedState.deps)?c.memoizedState=tr(t,u,i,l):(Ee.flags|=e,c.memoizedState=tr(1|t,u,i,l))}function Hd(e,t){kl(8390656,8,e,t)}function Zc(e,t){Ml(2048,8,e,t)}function mb(e){Ee.flags|=4;var t=Ee.updateQueue;if(t===null)t=Tl(),Ee.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Pd(e){var t=ut().memoizedState;return mb({ref:t,nextImpl:e}),function(){if((Pe&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function $d(e,t){return Ml(4,2,e,t)}function Yd(e,t){return Ml(4,4,e,t)}function Gd(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 Vd(e,t,i){i=i!=null?i.concat([e]):null,Ml(4,4,Gd.bind(null,t,e),i)}function Wc(){}function Fd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&$c(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Jd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&$c(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function eu(e,t,i){return i===void 0||(Zn&1073741824)!==0&&(Re&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Im(),Ee.lanes|=e,Rs|=e,i)}function Id(e,t,i,l){return Gt(i,t)?i:Zi.current!==null?(e=eu(e,i,l),Gt(e,t)||(mt=!0),e):(Zn&42)===0||(Zn&1073741824)!==0&&(Re&261930)===0?(mt=!0,e.memoizedState=i):(e=Im(),Ee.lanes|=e,Rs|=e,t)}function Qd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,su(e,!1,t,i);try{var j=c(),B=$.S;if(B!==null&&B(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var Y=cb(j,l);na(e,t,Y,Xt(e))}else na(e,t,l,Xt(e))}catch(Q){na(e,t,{then:function(){},status:"rejected",reason:Q},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function pb(){}function tu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Xd(e).queue;Qd(e,c,t,de,i===null?pb:function(){return Kd(e),i(l)})}function Xd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Kd(e){var t=Xd(e);t.next===null&&(t=e.alternate.memoizedState),na(e,t.next.queue,{},Xt())}function nu(){return St(xa)}function Zd(){return ut().memoizedState}function Wd(){return ut().memoizedState}function gb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=Ts(t,e,i);l!==null&&(Ht(l,t,i),Kr(l,t,i)),t={cache:kc()},e.payload=t;return}t=t.return}}function yb(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Rl(e)?tm(t,i):(i=vc(e,t,i,l),i!==null&&(Ht(i,e,l),nm(i,t,l)))}function em(e,t,i){var l=Xt();na(e,t,i,l)}function na(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Rl(e))tm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return dl(e,t,c,0),Qe===null&&hl(),!1}catch{}finally{}if(i=vc(e,t,c,l),i!==null)return Ht(i,e,l),nm(i,t,l),!0}return!1}function su(e,t,i,l){if(l={lane:2,revertLane:zu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Rl(e)){if(t)throw Error(a(479))}else t=vc(e,i,l,2),t!==null&&Ht(t,e,2)}function Rl(e){var t=e.alternate;return e===Ee||t!==null&&t===Ee}function tm(e,t){Wi=jl=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function nm(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}var sa={readContext:St,use:Nl,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};sa.useEffectEvent=rt;var sm={readContext:St,use:Nl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Hd,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,kl(4194308,4,Gd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return kl(4194308,4,e,t)},useInsertionEffect:function(e,t){kl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=yb.bind(null,Ee,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Xc(e);var t=e.queue,i=em.bind(null,Ee,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Wc,useDeferredValue:function(e,t){var i=kt();return eu(i,e,t)},useTransition:function(){var e=Xc(!1);return e=Qd.bind(null,Ee,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Ee,c=kt();if(ze){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Qe===null)throw Error(a(349));(Re&127)!==0||Ed(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,Hd(jd.bind(null,l,u,e),[e]),l.flags|=2048,tr(9,{destroy:void 0},Ad.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Qe.identifierPrefix;if(ze){var i=Rn,l=Mn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ol++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=ub++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nu,useFormState:zd,useActionState:zd,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=su.bind(null,Ee,!0,i),i.dispatch=t,[e,t]},useMemoCache:Jc,useCacheRefresh:function(){return kt().memoizedState=gb.bind(null,Ee)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((Pe&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},iu={readContext:St,use:Nl,useCallback:Fd,useContext:St,useEffect:Zc,useImperativeHandle:Vd,useInsertionEffect:$d,useLayoutEffect:Yd,useMemo:Jd,useReducer:Cl,useRef:Ld,useState:function(){return Cl(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Id(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Cl(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ta(e),t]},useSyncExternalStore:Sd,useId:Zd,useHostTransitionStatus:nu,useFormState:qd,useActionState:qd,useOptimistic:function(e,t){var i=ut();return Nd(i,Ve,e,t)},useMemoCache:Jc,useCacheRefresh:Wd};iu.useEffectEvent=Pd;var im={readContext:St,use:Nl,useCallback:Fd,useContext:St,useEffect:Zc,useImperativeHandle:Vd,useInsertionEffect:$d,useLayoutEffect:Yd,useMemo:Jd,useReducer:Qc,useRef:Ld,useState:function(){return Qc(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Ve===null?eu(i,e,t):Id(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Qc(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ta(e),t]},useSyncExternalStore:Sd,useId:Zd,useHostTransitionStatus:nu,useFormState:Bd,useActionState:Bd,useOptimistic:function(e,t){var i=ut();return Ve!==null?Nd(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Jc,useCacheRefresh:Wd};im.useEffectEvent=Pd;function ru(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var au={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Kr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Kr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=Ts(e,l,i),t!==null&&(Ht(t,e,i),Kr(t,e,i))}};function rm(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Yr(i,l)||!Yr(c,u):!0}function am(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&&au.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function lm(e){fl(e)}function om(e){console.error(e)}function cm(e){fl(e)}function Dl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function um(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function lu(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){Dl(e,t)},i}function fm(e){return e=Os(e),e.tag=3,e}function hm(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){um(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){um(t,i,l),typeof c!="function"&&(Ds===null?Ds=new Set([this]):Ds.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function bb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ji(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return mn===null?Fl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===_l?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Mu(e,l,c)),!1;case 22:return i.flags|=65536,l===_l?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)),Mu(e,l,c)),!1}throw Error(a(435,i.tag))}return Mu(e,l,c),Fl(),!1}if(ze)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==jc&&(e=Error(a(422),{cause:l}),Fr(un(e,i)))):(l!==jc&&(t=Error(a(423),{cause:l}),Fr(un(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=un(l,i),c=lu(e.stateNode,l,c),Uc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=un(u,i),fa===null?fa=[u]:fa.push(u),at!==4&&(at=2),t===null)return!0;l=un(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=lu(i.stateNode,l,e),Uc(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"&&(Ds===null||!Ds.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=fm(c),hm(c,e,i,l),Uc(i,c),!1}i=i.return}while(i!==null);return!1}var ou=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?gd(t,null,i,l):xi(t,e.child,i,l)}function dm(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=Yc(e,t,i,p,u,c),b=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(ze&&b&&Ec(t),t.flags|=1,Et(e,t,l,c),t.child)}function mm(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!_c(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,pm(e,t,u,l,c)):(e=pl(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!gu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:Yr,i(p,l)&&e.ref===t.ref)return es(e,t,c)}return t.flags|=1,e=In(u,l),e.ref=t.ref,e.return=t,t.child=e}function pm(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if(Yr(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,gu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,es(e,t,c)}return cu(e,t,i,l,c)}function gm(e,t,i,l){var c=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,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return ym(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xl(t,u!==null?u.cachePool:null),u!==null?xd(t,u):Lc(),vd(t);else return l=t.lanes=536870912,ym(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(xl(t,u.cachePool),xd(t,u),Cs(),t.memoizedState=null):(e!==null&&xl(t,null),Lc(),Cs());return Et(e,t,c,i),t.child}function ia(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ym(e,t,i,l,c){var u=Rc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&xl(t,null),Lc(),vd(t),e!==null&&Ji(e,t,l,!0),t.childLanes=c,null}function zl(e,t){return t=Ul({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function bm(e,t,i){return xi(t,e.child,null,i),e=zl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function xb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=zl(t,l),t.lanes=536870912,ia(null,e);if(Pc(t),(e=Ze)?(e=Cp(e,dn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Mn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},i=td(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return t.lanes=536870912,null}return zl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Pc(t),c)if(t.flags&256)t.flags&=-257,t=bm(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||Ji(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Qe,l!==null&&(p=vs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),ou;Fl(),t=bm(e,t,i)}else e=u.treeContext,Ze=pn(p.nextSibling),wt=t,ze=!0,Ss=null,dn=!1,e!==null&&id(t,e),t=zl(t,l),t.flags|=4096;return t}return e=In(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ql(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 cu(e,t,i,l,c){return pi(t),i=Yc(e,t,i,l,void 0,c),l=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(ze&&l&&Ec(t),t.flags|=1,Et(e,t,i,c),t.child)}function xm(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=wd(t,l,i,c),_d(e),l=Gc(),e!==null&&!mt?(Vc(e,t,u),es(e,t,u)):(ze&&l&&Ec(t),t.flags|=1,Et(e,t,i,u),t.child)}function vm(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Yi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=au,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},zc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Yi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(ru(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&au.enqueueReplaceState(u,u.state,null),Wr(t,l,u,c),Zr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,j=_i(i,b);u.props=j;var B=u.context,Y=i.contextType;p=Yi,typeof Y=="object"&&Y!==null&&(p=St(Y));var Q=i.getDerivedStateFromProps;Y=typeof Q=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&am(t,u,l,p),js=!1;var L=t.memoizedState;u.state=L,Wr(t,l,u,c),Zr(),B=t.memoizedState,b||L!==B||js?(typeof Q=="function"&&(ru(t,i,Q,l),B=t.memoizedState),(j=js||rm(t,i,j,l,L,B,p))?(Y||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=B),u.props=l,u.state=B,u.context=p,l=j):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,qc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,Q=t.pendingProps,L=u.context,B=i.contextType,j=Yi,typeof B=="object"&&B!==null&&(j=St(B)),b=i.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==Q||L!==j)&&am(t,u,l,j),js=!1,L=t.memoizedState,u.state=L,Wr(t,l,u,c),Zr();var P=t.memoizedState;p!==Q||L!==P||js||e!==null&&e.dependencies!==null&&yl(e.dependencies)?(typeof b=="function"&&(ru(t,i,b,l),P=t.memoizedState),(Y=js||rm(t,i,Y,l,L,P,j)||e!==null&&e.dependencies!==null&&yl(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,j),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,j)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=j,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,ql(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=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=es(e,t,c),e}function _m(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var uu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:ud()}}function hu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=Qt),e}function wm(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(c?Ns(t):Cs(),(e=Ze)?(e=Cp(e,dn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Mn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},i=td(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return Iu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Cs(),c=t.mode,b=Ul({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,ia(null,l)):(Ns(t),du(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(u)t.flags&256?(Ns(t),t.flags&=-257,t=mu(e,t,i)):t.memoizedState!==null?(Cs(),t.child=e.child,t.flags|=128,t=null):(Cs(),b=l.fallback,c=t.mode,l=Ul({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,t=ia(null,l));else if(Ns(t),Iu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,Fr({value:l,source:null,stack:null}),t=mu(e,t,i)}else if(mt||Ji(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Qe,p!==null&&(l=vs(p,i),l!==0&&l!==j.retryLane))throw j.retryLane=l,fi(e,l),Ht(p,e,l),ou;Ju(b)||Fl(),t=mu(e,t,i)}else Ju(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,Ze=pn(b.nextSibling),wt=t,ze=!0,Ss=null,dn=!1,e!==null&&id(t,e),t=du(t,l.children),t.flags|=4096);return t}return c?(Cs(),b=l.fallback,c=t.mode,j=e.child,B=j.sibling,l=In(j,{mode:"hidden",children:l.children}),l.subtreeFlags=j.subtreeFlags&65011712,B!==null?b=In(B,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,ia(null,l),l=t.child,b=e.child.memoizedState,b===null?b=fu(i):(c=b.cachePool,c!==null?(j=ht._currentValue,c=c.parent!==j?{parent:j,pool:j}:c):c=ud(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=hu(e,p,i),t.memoizedState=uu,ia(e.child,l)):(Ns(t),i=e.child,e=i.sibling,i=In(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function du(e,t){return t=Ul({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ul(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function mu(e,t,i){return xi(t,e.child,null,i),e=du(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Nc(e.return,t,i)}function pu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function Em(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=ze?Vr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sm(e,i,t);else if(e.tag===19)Sm(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(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&Al(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),pu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Al(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}pu(t,!0,i,null,u,l);break;case"together":pu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function es(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Rs|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ji(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=In(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=In(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function gu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&yl(e)))}function vb(e,t,i){switch(t.tag){case 3:Ot(t,t.stateNode.containerInfo),As(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:Ot(t,t.stateNode.containerInfo);break;case 10:As(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Pc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ns(t),t.flags|=128,null):(i&t.child.childLanes)!==0?wm(e,t,i):(Ns(t),e=es(e,t,i),e!==null?e.sibling:null);Ns(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ji(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return Em(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,gm(e,t,i,t.pendingProps);case 24:As(t,ht,e.memoizedState.cache)}return es(e,t,i)}function Am(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!gu(e,i)&&(t.flags&128)===0)return mt=!1,vb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,ze&&(t.flags&1048576)!==0&&sd(t,Vr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")_c(e)?(l=_i(e,l),t.tag=1,t=vm(null,t,e,l,i)):(t.tag=0,t=cu(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===re){t.tag=11,t=dm(null,t,e,l,i);break e}else if(c===ce){t.tag=14,t=mm(null,t,e,l,i);break e}}throw t=He(e)||e,Error(a(306,t,""))}}return t;case 0:return cu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),vm(e,t,l,c,i);case 3:e:{if(Ot(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,qc(e,t),Wr(t,l,null,i);var p=t.memoizedState;if(l=p.cache,As(t,ht,l),l!==u.cache&&Cc(t,[ht],i,!0),Zr(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=_m(e,t,l,i);break e}else if(l!==c){c=un(Error(a(424)),t),Fr(c),t=_m(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=pn(e.firstChild),wt=t,ze=!0,Ss=null,dn=!0,i=gd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=es(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return ql(e,t),e===null?(i=qp(t.type,null,t.pendingProps,null))?t.memoizedState=i:ze||(i=t.type,e=t.pendingProps,l=Wl(rn.current).createElement(i),l[Ie]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=qp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ze&&(l=t.stateNode=Rp(t.type,t.pendingProps,rn.current),wt=t,dn=!0,c=Ze,Bs(t.type)?(Qu=c,Ze=pn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),ql(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((c=l=Ze)&&(l=Xb(l,t.type,t.pendingProps,dn),l!==null?(t.stateNode=l,wt=t,Ze=pn(l.firstChild),dn=!1,c=!0):c=!1),c||Es(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Gu(c,u)?l=null:p!==null&&Gu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Yc(e,t,fb,null,null,i),xa._currentValue=c),ql(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&ze&&((e=i=Ze)&&(i=Kb(i,t.pendingProps,dn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Es(t)),null;case 13:return wm(e,t,i);case 4:return Ot(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return dm(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,As(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return mm(e,t,t.type,t.pendingProps,i);case 15:return pm(e,t,t.type,t.pendingProps,i);case 19:return Em(e,t,i);case 31:return xb(e,t,i);case 22:return gm(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Rc(),c===null&&(c=Qe,u=kc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},zc(t),As(t,ht,c)):((e.lanes&i)!==0&&(qc(e,t),Wr(t,null,null,i),Zr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),As(t,ht,l)):(l=u.cache,As(t,ht,l),l!==c.cache&&Cc(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 ts(e){e.flags|=4}function yu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Zm())e.flags|=8192;else throw bi=_l,Dc}else e.flags&=-16777217}function jm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Pp(t))if(Zm())e.flags|=8192;else throw bi=_l,Dc}function Bl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ri():536870912,e.lanes|=t,rr|=t)}function ra(e,t){if(!ze)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 c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function _b(e,t,i){var l=t.pendingProps;switch(Ac(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),Kn(ht),Se(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?ts(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Oc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ts(t),u!==null?(We(t),jm(t,u)):(We(t),yu(t,c,null,l,i))):u?u!==e.memoizedState?(ts(t),We(t),jm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ts(t),We(t),yu(t,c,e,l,i)),null;case 27:if(ei(t),i=rn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Fi(t)?rd(t):(e=Rp(c,l,i),t.stateNode=e,ts(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Fi(t))rd(t);else{var p=Wl(rn.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Ie]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ts(t)}}return We(t),yu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=rn.current,Fi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Ie]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||wp(e.nodeValue,i)),e||Es(t,!0)}else e=Wl(e).createTextNode(l),e[Ie]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Fi(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[Ie]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Oc(),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(c=Fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Ie]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=Oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)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,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Bl(t,t.updateQueue),We(t),null);case 4:return Se(),e===null&&Lu(t.stateNode.containerInfo),We(t),null;case 10:return Kn(t.type),We(t),null;case 19:if(we(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ra(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Al(e),u!==null){for(t.flags|=128,ra(l,!1),e=u.updateQueue,t.updateQueue=e,Bl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)ed(i,e),i=i.sibling;return Te(ct,ct.current&1|2),ze&&Qn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Yl&&(t.flags|=128,c=!0,ra(l,!1),t.lanes=4194304)}else{if(!c)if(e=Al(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Bl(t,e),ra(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!ze)return We(t),null}else 2*et()-l.renderingStartTime>Yl&&i!==536870912&&(t.flags|=128,c=!0,ra(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=ct.current,Te(ct,c?i&1|2:i&1),ze&&Qn(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Hc(),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&&Bl(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&&we(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Kn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function wb(e,t){switch(Ac(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(ht),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}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));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return we(ct),null;case 4:return Se(),null;case 10:return Kn(t.type),null;case 22:case 23:return Jt(t),Hc(),e!==null&&we(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kn(ht),null;case 25:return null;default:return null}}function Om(e,t){switch(Ac(t),t.tag){case 3:Kn(ht),Se();break;case 26:case 27:case 5:ei(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:we(ct);break;case 10:Kn(t.type);break;case 22:case 23:Jt(t),Hc(),e!==null&&we(gi);break;case 24:Kn(ht)}}function aa(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){Ye(t,t.return,b)}}function ks(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var j=i,B=b;try{B()}catch(Y){Ye(c,j,Y)}}}l=l.next}while(l!==u)}}catch(Y){Ye(t,t.return,Y)}}function Tm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{bd(t,i)}catch(l){Ye(e,e.return,l)}}}function Nm(e,t,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ye(e,t,l)}}function la(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(c){Ye(e,t,c)}}function Dn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){Ye(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){Ye(e,t,c)}else i.current=null}function Cm(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(c){Ye(e,e.return,c)}}function bu(e,t,i){try{var l=e.stateNode;Gb(l,e.type,i,t),l[it]=t}catch(c){Ye(e,e.return,c)}}function km(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bs(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||km(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&&Bs(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 vu(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=Fn));else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(vu(e,t,i),e=e.sibling;e!==null;)vu(e,t,i),e=e.sibling}function Ll(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&&Bs(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Ll(e,t,i),e=e.sibling;e!==null;)Ll(e,t,i),e=e.sibling}function Mm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Ie]=e,t[it]=i}catch(u){Ye(e,e.return,u)}}var ns=!1,pt=!1,_u=!1,Rm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function Sb(e,t){if(e=e.containerInfo,$u=ao,e=Vh(e),mc(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 c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,j=-1,B=0,Y=0,Q=e,L=null;t:for(;;){for(var P;Q!==i||c!==0&&Q.nodeType!==3||(b=p+c),Q!==u||l!==0&&Q.nodeType!==3||(j=p+l),Q.nodeType===3&&(p+=Q.nodeValue.length),(P=Q.firstChild)!==null;)L=Q,Q=P;for(;;){if(Q===e)break t;if(L===i&&++B===c&&(b=p),L===u&&++Y===l&&(j=p),(P=Q.nextSibling)!==null)break;Q=L,L=Q.parentNode}Q=P}i=b===-1||j===-1?null:{start:b,end:j}}else i=null}i=i||{start:0,end:0}}else i=null;for(Yu={focusedElem:e,selectionRange:i},ao=!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++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ye(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Fu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(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 Dm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:is(e,i),l&4&&aa(5,i);break;case 1:if(is(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){Ye(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ye(i,i.return,p)}}l&64&&Tm(i),l&512&&la(i,i.return);break;case 3:if(is(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{bd(e,t)}catch(p){Ye(i,i.return,p)}}break;case 27:t===null&&l&4&&Mm(i);case 26:case 5:is(e,i),t===null&&l&4&&Cm(i),l&512&&la(i,i.return);break;case 12:is(e,i);break;case 31:is(e,i),l&4&&Um(e,i);break;case 13:is(e,i),l&4&&Bm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Mb.bind(null,i),Zb(e,i))));break;case 22:if(l=i.memoizedState!==null||ns,!l){t=t!==null&&t.memoizedState!==null||pt,c=ns;var u=pt;ns=l,(pt=t)&&!u?rs(e,i,(i.subtreeFlags&8772)!==0):is(e,i),ns=c,pt=u}break;case 30:break;default:is(e,i)}}function zm(e){var t=e.alternate;t!==null&&(e.alternate=null,zm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Di(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 ss(e,t,i){for(i=i.child;i!==null;)qm(e,t,i),i=i.sibling}function qm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||Dn(i,t),ss(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Dn(i,t);var l=tt,c=qt;Bs(i.type)&&(tt=i.stateNode,qt=!1),ss(e,t,i),ga(i.stateNode),tt=l,qt=c;break;case 5:pt||Dn(i,t);case 6:if(l=tt,c=qt,tt=null,ss(e,t,i),tt=l,qt=c,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,Tp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),dr(e)):Tp(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,ss(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:ks(2,i,t),pt||ks(4,i,t),ss(e,t,i);break;case 1:pt||(Dn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Nm(i,t,l)),ss(e,t,i);break;case 21:ss(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ss(e,t,i),pt=l;break;default:ss(e,t,i)}}function Um(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dr(e)}catch(i){Ye(t,t.return,i)}}}function Bm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dr(e)}catch(i){Ye(t,t.return,i)}}function Eb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Rm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Rm),t;default:throw Error(a(435,e.tag))}}function Hl(e,t){var i=Eb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Rb.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Bs(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));qm(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Lm(t,e),t=t.sibling}var En=null;function Lm(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&&(ks(3,e,e.return),aa(3,e),ks(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),l&64&&ns&&(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 c=En;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(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,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Ie]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Ie]=e,N(u),l=u;break e;case"link":var p=Lp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[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)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=Lp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[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)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Ie]=e,N(u),l=u}e.stateNode=l}else Hp(c,e.type,e.stateNode);else e.stateNode=Bp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Hp(c,e.type,e.stateNode):Bp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&bu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),i!==null&&l&4&&bu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),e.flags&32){c=e.stateNode;try{qi(c,"")}catch(he){Ye(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,bu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(_u=!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(he){Ye(e,e.return,he)}}break;case 3:if(no=null,c=En,En=eo(t.containerInfo),Ut(t,e),En=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{dr(t.containerInfo)}catch(he){Ye(e,e.return,he)}_u&&(_u=!1,Hm(e));break;case 4:l=En,En=eo(e.stateNode.containerInfo),Ut(t,e),Bt(e),En=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,Hl(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&($l=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 22:c=e.memoizedState!==null;var j=i!==null&&i.memoizedState!==null,B=ns,Y=pt;if(ns=B||c,pt=Y||j,Ut(t,e),pt=Y,ns=B,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||j||ns||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){j=i=t;try{if(u=j.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=j.stateNode;var Q=j.memoizedProps.style,L=Q!=null&&Q.hasOwnProperty("display")?Q.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){Ye(j,j.return,he)}}}else if(t.tag===6){if(i===null){j=t;try{j.stateNode.nodeValue=c?"":j.memoizedProps}catch(he){Ye(j,j.return,he)}}}else if(t.tag===18){if(i===null){j=t;try{var P=j.stateNode;c?Np(P,!0):Np(j.stateNode,!1)}catch(he){Ye(j,j.return,he)}}}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,Hl(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(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(km(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=xu(e);Ll(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(qi(p,""),i.flags&=-33);var b=xu(e);Ll(e,b,p);break;case 3:case 4:var j=i.stateNode.containerInfo,B=xu(e);vu(e,B,j);break;default:throw Error(a(161))}}catch(Y){Ye(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Hm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Hm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function is(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Dm(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ks(4,t,t.return),wi(t);break;case 1:Dn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Nm(t,t.return,i),wi(t);break;case 27:ga(t.stateNode);case 26:case 5:Dn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function rs(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:rs(c,u,i),aa(4,u);break;case 1:if(rs(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ye(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var j=c.shared.hiddenCallbacks;if(j!==null)for(c.shared.hiddenCallbacks=null,c=0;c<j.length;c++)yd(j[c],b)}catch(B){Ye(l,l.return,B)}}i&&p&64&&Tm(u),la(u,u.return);break;case 27:Mm(u);case 26:case 5:rs(c,u,i),i&&l===null&&p&4&&Cm(u),la(u,u.return);break;case 12:rs(c,u,i);break;case 31:rs(c,u,i),i&&p&4&&Um(c,u);break;case 13:rs(c,u,i),i&&p&4&&Bm(c,u);break;case 22:u.memoizedState===null&&rs(c,u,i),la(u,u.return);break;case 30:break;default:rs(c,u,i)}t=t.sibling}}function wu(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&&Jr(i))}function Su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Jr(e))}function An(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Pm(e,t,i,l),t=t.sibling}function Pm(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:An(e,t,i,l),c&2048&&aa(9,t);break;case 1:An(e,t,i,l);break;case 3:An(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Jr(e)));break;case 12:if(c&2048){An(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(j){Ye(t,t.return,j)}}else An(e,t,i,l);break;case 31:An(e,t,i,l);break;case 13:An(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?An(e,t,i,l):oa(e,t):u._visibility&2?An(e,t,i,l):(u._visibility|=2,nr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&wu(p,t);break;case 24:An(e,t,i,l),c&2048&&Su(t.alternate,t);break;default:An(e,t,i,l)}}function nr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,j=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:nr(u,p,b,j,c),aa(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?nr(u,p,b,j,c):oa(u,p):(Y._visibility|=2,nr(u,p,b,j,c)),c&&B&2048&&wu(p.alternate,p);break;case 24:nr(u,p,b,j,c),c&&B&2048&&Su(p.alternate,p);break;default:nr(u,p,b,j,c)}t=t.sibling}}function oa(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:oa(i,l),c&2048&&wu(l.alternate,l);break;case 24:oa(i,l),c&2048&&Su(l.alternate,l);break;default:oa(i,l)}t=t.sibling}}var ca=8192;function sr(e,t,i){if(e.subtreeFlags&ca)for(e=e.child;e!==null;)$m(e,t,i),e=e.sibling}function $m(e,t,i){switch(e.tag){case 26:sr(e,t,i),e.flags&ca&&e.memoizedState!==null&&ux(i,En,e.memoizedState,e.memoizedProps);break;case 5:sr(e,t,i);break;case 3:case 4:var l=En;En=eo(e.stateNode.containerInfo),sr(e,t,i),En=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ca,ca=16777216,sr(e,t,i),ca=l):sr(e,t,i));break;default:sr(e,t,i)}}function Ym(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 ua(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,Vm(l,e)}Ym(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Gm(e),e=e.sibling}function Gm(e){switch(e.tag){case 0:case 11:case 15:ua(e),e.flags&2048&&ks(9,e,e.return);break;case 3:ua(e);break;case 12:ua(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):ua(e);break;default:ua(e)}}function Pl(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,Vm(l,e)}Ym(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ks(8,t,t.return),Pl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Vm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:ks(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:Jr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(zm(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var Ab={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}},jb=typeof WeakMap=="function"?WeakMap:Map,Pe=0,Qe=null,Ne=null,Re=0,$e=0,It=null,Ms=!1,ir=!1,Eu=!1,as=0,at=0,Rs=0,Si=0,Au=0,Qt=0,rr=0,fa=null,Lt=null,ju=!1,$l=0,Fm=0,Yl=1/0,Gl=null,Ds=null,bt=0,zs=null,ar=null,ls=0,Ou=0,Tu=null,Jm=null,ha=0,Nu=null;function Xt(){return(Pe&2)!==0&&Re!==0?Re&-Re:$.T!==null?zu():Dr()}function Im(){if(Qt===0)if((Re&536870912)===0||ze){var e=Yn;Yn<<=1,(Yn&3932160)===0&&(Yn=262144),Qt=e}else Qt=536870912;return e=Ft.current,e!==null&&(e.flags|=32),Qt}function Ht(e,t,i){(e===Qe&&($e===2||$e===9)||e.cancelPendingCommit!==null)&&(lr(e,0),qs(e,Re,Qt,!1)),_n(e,i),((Pe&2)===0||e!==Qe)&&(e===Qe&&((Pe&2)===0&&(Si|=i),at===4&&qs(e,Re,Qt,!1)),zn(e))}function Qm(e,t,i){if((Pe&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?Nb(e,t):ku(e,t,!0),u=l;do{if(c===0){ir&&!l&&qs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!Ob(i)){c=ku(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=fa;var j=b.current.memoizedState.isDehydrated;if(j&&(lr(b,p).flags|=256),p=ku(b,p,!1),p!==2){if(Eu&&!j){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){lr(e,0),qs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:qs(l,t,Qt,!Ms);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=$l+300-et(),10<c)){if(qs(l,t,Qt,!Ms),si(l,0,!0)!==0)break e;ls=t,l.timeoutHandle=jp(Xm.bind(null,l,i,Lt,Gl,ju,t,Qt,Si,rr,Ms,u,"Throttled",-0,0),c);break e}Xm(l,i,Lt,Gl,ju,t,Qt,Si,rr,Ms,u,null,-0,0)}}break}while(!0);zn(e)}function Xm(e,t,i,l,c,u,p,b,j,B,Y,Q,L,P){if(e.timeoutHandle=-1,Q=t.subtreeFlags,Q&8192||(Q&16785408)===16785408){Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn},$m(t,u,Q);var he=(u&62914560)===u?$l-et():(u&4194048)===u?Fm-et():0;if(he=fx(Q,he),he!==null){ls=u,e.cancelPendingCommit=he(ip.bind(null,e,t,u,i,l,c,p,b,j,Y,Q,null,L,P)),qs(e,u,p,!B);return}}ip(e,t,u,i,l,c,p,b,j)}function Ob(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 c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))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 qs(e,t,i,l){t&=~Au,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&xs(e,i,t)}function Vl(){return(Pe&6)===0?(da(0),!1):!0}function Cu(){if(Ne!==null){if($e===0)var e=Ne.return;else e=Ne,Xn=mi=null,Fc(e),Ki=null,Qr=0,e=Ne;for(;e!==null;)Om(e.alternate,e),e=e.return;Ne=null}}function lr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Jb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ls=0,Cu(),Qe=e,Ne=i=In(e.current,null),Re=t,$e=0,It=null,Ms=!1,ir=ii(e,t),Eu=!1,rr=Qt=Au=Si=Rs=at=0,Lt=fa=null,ju=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return as=t,hl(),i}function Km(e,t){Ee=null,$.H=sa,t===Xi||t===vl?(t=dd(),$e=3):t===Dc?(t=dd(),$e=4):$e=t===ou?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,Ne===null&&(at=1,Dl(e,un(t,e.current)))}function Zm(){var e=Ft.current;return e===null?!0:(Re&4194048)===Re?mn===null:(Re&62914560)===Re||(Re&536870912)!==0?e===mn:!1}function Wm(){var e=$.H;return $.H=sa,e===null?sa:e}function ep(){var e=$.A;return $.A=Ab,e}function Fl(){at=4,Ms||(Re&4194048)!==Re&&Ft.current!==null||(ir=!0),(Rs&134217727)===0&&(Si&134217727)===0||Qe===null||qs(Qe,Re,Qt,!1)}function ku(e,t,i){var l=Pe;Pe|=2;var c=Wm(),u=ep();(Qe!==e||Re!==t)&&(Gl=null,lr(e,t)),t=!1;var p=at;e:do try{if($e!==0&&Ne!==null){var b=Ne,j=It;switch($e){case 8:Cu(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var B=$e;if($e=0,It=null,or(e,b,j,B),i&&ir){p=0;break e}break;default:B=$e,$e=0,It=null,or(e,b,j,B)}}Tb(),p=at;break}catch(Y){Km(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Xn=mi=null,Pe=l,$.H=c,$.A=u,Ne===null&&(Qe=null,Re=0,hl()),p}function Tb(){for(;Ne!==null;)tp(Ne)}function Nb(e,t){var i=Pe;Pe|=2;var l=Wm(),c=ep();Qe!==e||Re!==t?(Gl=null,Yl=et()+500,lr(e,t)):ir=ii(e,t);e:do try{if($e!==0&&Ne!==null){t=Ne;var u=It;t:switch($e){case 1:$e=0,It=null,or(e,t,u,1);break;case 2:case 9:if(fd(u)){$e=0,It=null,np(t);break}t=function(){$e!==2&&$e!==9||Qe!==e||($e=7),zn(e)},u.then(t,t);break e;case 3:$e=7;break e;case 4:$e=5;break e;case 7:fd(u)?($e=0,It=null,np(t)):($e=0,It=null,or(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Pp(p):b.stateNode.complete){$e=0,It=null;var j=b.sibling;if(j!==null)Ne=j;else{var B=b.return;B!==null?(Ne=B,Jl(B)):Ne=null}break t}}$e=0,It=null,or(e,t,u,5);break;case 6:$e=0,It=null,or(e,t,u,6);break;case 8:Cu(),at=6;break e;default:throw Error(a(462))}}Cb();break}catch(Y){Km(e,Y)}while(!0);return Xn=mi=null,$.H=l,$.A=c,Pe=i,Ne!==null?0:(Qe=null,Re=0,hl(),at)}function Cb(){for(;Ne!==null&&!Qa();)tp(Ne)}function tp(e){var t=Am(e.alternate,e,as);e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function np(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=xm(i,t,t.pendingProps,t.type,void 0,Re);break;case 11:t=xm(i,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:Fc(t);default:Om(i,t),t=Ne=ed(t,as),t=Am(i,t,as)}e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function or(e,t,i,l){Xn=mi=null,Fc(t),Ki=null,Qr=0;var c=t.return;try{if(bb(e,c,t,i,Re)){at=1,Dl(e,un(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Dl(e,un(i,e.current)),Ne=null;return}t.flags&32768?(ze||l===1?e=!0:ir||(Re&536870912)!==0?e=!1:(Ms=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),sp(t,e)):Jl(t)}function Jl(e){var t=e;do{if((t.flags&32768)!==0){sp(t,Ms);return}e=t.return;var i=_b(t.alternate,t,as);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 sp(e,t){do{var i=wb(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 ip(e,t,i,l,c,u,p,b,j){e.cancelPendingCommit=null;do Il();while(bt!==0);if((Pe&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=xc,bs(e,i,u,p,b,j),e===Qe&&(Ne=Qe=null,Re=0),ar=t,zs=e,ls=i,Ou=u,Tu=c,Jm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Db(ki,function(){return cp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=Pe,Pe|=4;try{Sb(e,t,i)}finally{Pe=p,te.p=c,$.T=l}}bt=1,rp(),ap(),lp()}}function rp(){if(bt===1){bt=0;var e=zs,t=ar,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{Lm(t,e);var u=Yu,p=Vh(e.containerInfo),b=u.focusedElem,j=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Gh(b.ownerDocument.documentElement,b)){if(j!==null&&mc(b)){var B=j.start,Y=j.end;if(Y===void 0&&(Y=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(Y,b.value.length);else{var Q=b.ownerDocument||document,L=Q&&Q.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(j.start,he),Je=j.end===void 0?ye:Math.min(j.end,he);!P.extend&&ye>Je&&(p=Je,Je=ye,ye=p);var R=Yh(b,ye),k=Yh(b,Je);if(R&&k&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==k.node||P.focusOffset!==k.offset)){var U=Q.createRange();U.setStart(R.node,R.offset),P.removeAllRanges(),ye>Je?(P.addRange(U),P.extend(k.node,k.offset)):(U.setEnd(k.node,k.offset),P.addRange(U))}}}}for(Q=[],P=b;P=P.parentNode;)P.nodeType===1&&Q.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<Q.length;b++){var F=Q[b];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}ao=!!$u,Yu=$u=null}finally{Pe=c,te.p=l,$.T=i}}e.current=t,bt=2}}function ap(){if(bt===2){bt=0;var e=zs,t=ar,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{Dm(e,t.alternate,t)}finally{Pe=c,te.p=l,$.T=i}}bt=3}}function lp(){if(bt===4||bt===3){bt=0,Ci();var e=zs,t=ar,i=ls,l=Jm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,ar=zs=null,op(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ds=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(ls&3)!==0&&Il(),zn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Nu?ha++:(ha=0,Nu=e):ha=0,da(0)}}function op(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Jr(t)))}function Il(){return rp(),ap(),lp(),cp()}function cp(){if(bt!==5)return!1;var e=zs,t=Ou;Ou=0;var i=ai(ls),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=Tu,Tu=null;var u=zs,p=ls;if(bt=0,ar=zs=null,ls=0,(Pe&6)!==0)throw Error(a(331));var b=Pe;if(Pe|=4,Gm(u.current),Pm(u,u.current,p,i),Pe=b,da(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,op(e,t)}}function up(e,t,i){t=un(i,t),t=lu(e.stateNode,t,2),e=Ts(e,t,2),e!==null&&(_n(e,2),zn(e))}function Ye(e,t,i){if(e.tag===3)up(e,e,i);else for(;t!==null;){if(t.tag===3){up(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ds===null||!Ds.has(l))){e=un(i,e),i=fm(2),l=Ts(t,i,2),l!==null&&(hm(i,l,t,e),_n(l,2),zn(l));break}}t=t.return}}function Mu(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new jb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Eu=!0,c.add(i),e=kb.bind(null,e,t,i),t.then(e,e))}function kb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Qe===e&&(Re&i)===i&&(at===4||at===3&&(Re&62914560)===Re&&300>et()-$l?(Pe&2)===0&&lr(e,0):Au|=i,rr===Re&&(rr=0)),zn(e)}function fp(e,t){t===0&&(t=Ri()),e=fi(e,t),e!==null&&(_n(e,t),zn(e))}function Mb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),fp(e,i)}function Rb(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.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),fp(e,i)}function Db(e,t){return Cr(e,t)}var Ql=null,cr=null,Ru=!1,Xl=!1,Du=!1,Us=0;function zn(e){e!==cr&&e.next===null&&(cr===null?Ql=cr=e:cr=cr.next=e),Xl=!0,Ru||(Ru=!0,qb())}function da(e,t){if(!Du&&Xl){Du=!0;do for(var i=!1,l=Ql;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,pp(l,u))}else u=Re,u=si(l,l===Qe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,pp(l,u));l=l.next}while(i);Du=!1}}function zb(){hp()}function hp(){Xl=Ru=!1;var e=0;Us!==0&&Fb()&&(e=Us);for(var t=et(),i=null,l=Ql;l!==null;){var c=l.next,u=dp(l,t);u===0?(l.next=null,i===null?Ql=c:i.next=c,c===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Xl=!0)),l=c}bt!==0&&bt!==5||da(e),Us!==0&&(Us=0)}function dp(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,j=c[p];j===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Rr(b,t)):j<=t&&(e.expiredLanes|=b),u&=~b}if(t=Qe,i=Re,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&($e===2||$e===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$n(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&$n(l),ai(i)){case 2:case 8:i=Ka;break;case 32:i=ki;break;case 268435456:i=Za;break;default:i=ki}return l=mp.bind(null,e),i=Cr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&$n(l),e.callbackPriority=2,e.callbackNode=null,2}function mp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Il()&&e.callbackNode!==i)return null;var l=Re;return l=si(e,e===Qe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Qm(e,l,t),dp(e,et()),e.callbackNode!=null&&e.callbackNode===i?mp.bind(null,e):null)}function pp(e,t){if(Il())return null;Qm(e,t,!0)}function qb(){Ib(function(){(Pe&6)!==0?Cr(Xa,zb):hp()})}function zu(){if(Us===0){var e=Ii;e===0&&(e=ps,ps<<=1,(ps&261888)===0&&(ps=256)),Us=e}return Us}function gp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:il(""+e)}function yp(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 Ub(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=gp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?gp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ol("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Us!==0){var j=p?yp(c,p):new FormData(c);tu(i,{pending:!0,data:j,method:c.method,action:u},null,j)}}else typeof u=="function"&&(b.preventDefault(),j=p?yp(c,p):new FormData(c),tu(i,{pending:!0,data:j,method:c.method,action:u},u,j))},currentTarget:c}]})}}for(var qu=0;qu<bc.length;qu++){var Uu=bc[qu],Bb=Uu.toLowerCase(),Lb=Uu[0].toUpperCase()+Uu.slice(1);Sn(Bb,"on"+Lb)}Sn(Ih,"onAnimationEnd"),Sn(Qh,"onAnimationIteration"),Sn(Xh,"onAnimationStart"),Sn("dblclick","onDoubleClick"),Sn("focusin","onFocus"),Sn("focusout","onBlur"),Sn(tb,"onTransitionRun"),Sn(nb,"onTransitionStart"),Sn(sb,"onTransitionCancel"),Sn(Kh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),Z("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Z("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Z("onBeforeInput",["compositionend","keypress","textInput","paste"]),Z("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ma="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(" "),Hb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ma));function bp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],j=b.instance,B=b.currentTarget;if(b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){fl(Y)}c.currentTarget=null,u=j}else for(p=0;p<l.length;p++){if(b=l[p],j=b.instance,B=b.currentTarget,b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){fl(Y)}c.currentTarget=null,u=j}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(xp(t,e,2,!1),i.add(l))}function Bu(e,t,i){var l=0;t&&(l|=4),xp(i,e,l,t)}var Kl="_reactListening"+Math.random().toString(36).slice(2);function Lu(e){if(!e[Kl]){e[Kl]=!0,z.forEach(function(i){i!=="selectionchange"&&(Hb.has(i)||Bu(i,!1,e),Bu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kl]||(t[Kl]=!0,Bu("selectionchange",!1,t))}}function xp(e,t,i,l){switch(Ip(t)){case 2:var c=mx;break;case 8:c=px;break;default:c=ef}i=c.bind(null,t,i,e),c=void 0,!rc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Hu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var j=p.tag;if((j===3||j===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(j=p.tag,j===5||j===6||j===26||j===27){l=u=p;continue e}b=b.parentNode}}l=l.return}Eh(function(){var B=u,Y=sc(i),Q=[];e:{var L=Zh.get(e);if(L!==void 0){var P=ol,he=e;switch(e){case"keypress":if(al(i)===0)break e;case"keydown":case"keyup":P=Ry;break;case"focusin":he="focus",P=cc;break;case"focusout":he="blur",P=cc;break;case"beforeblur":case"afterblur":P=cc;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=Oh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=_y;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=qy;break;case Ih:case Qh:case Xh:P=Ey;break;case Kh:P=By;break;case"scroll":case"scrollend":P=xy;break;case"wheel":P=Hy;break;case"copy":case"cut":case"paste":P=jy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Nh;break;case"toggle":case"beforetoggle":P=$y}var ye=(t&4)!==0,Je=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var k=B,U;k!==null;){var F=k;if(U=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||U===null||R===null||(F=qr(k,R),F!=null&&ye.push(pa(k,F,U))),Je)break;k=k.return}0<ye.length&&(L=new P(L,he,null,i,Y),Q.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==nc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=B,he=he?x(he):null,he!==null&&(Je=f(he),ye=he.tag,he!==Je||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=B),P!==he)){if(ye=Oh,F="onMouseLeave",R="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Nh,F="onPointerLeave",R="onPointerEnter",k="pointer"),Je=P==null?L:_(P),U=he==null?L:_(he),L=new ye(F,k+"leave",P,i,Y),L.target=Je,L.relatedTarget=U,F=null,x(Y)===B&&(ye=new ye(R,k+"enter",he,i,Y),ye.target=U,ye.relatedTarget=Je,F=ye),Je=F,P&&he)t:{for(ye=Pb,R=P,k=he,U=0,F=R;F;F=ye(F))U++;F=0;for(var ge=k;ge;ge=ye(ge))F++;for(;0<U-F;)R=ye(R),U--;for(;0<F-U;)k=ye(k),F--;for(;U--;){if(R===k||k!==null&&R===k.alternate){ye=R;break t}R=ye(R),k=ye(k)}ye=null}else ye=null;P!==null&&vp(Q,L,P,ye,!1),he!==null&&Je!==null&&vp(Q,Je,he,ye,!0)}}e:{if(L=B?_(B):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Be=Uh;else if(zh(L))if(Bh)Be=Zy;else{Be=Xy;var pe=Qy}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&tc(B.elementType)&&(Be=Uh):Be=Ky;if(Be&&(Be=Be(e,B))){qh(Q,Be,i,Y);break e}pe&&pe(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&ec(L,"number",L.value)}switch(pe=B?_(B):window,e){case"focusin":(zh(pe)||pe.contentEditable==="true")&&(Hi=pe,pc=B,Gr=null);break;case"focusout":Gr=pc=Hi=null;break;case"mousedown":gc=!0;break;case"contextmenu":case"mouseup":case"dragend":gc=!1,Fh(Q,i,Y);break;case"selectionchange":if(eb)break;case"keydown":case"keyup":Fh(Q,i,Y)}var Ae;if(fc)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else Li?Rh(e,i)&&(De="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(De="onCompositionStart");De&&(Ch&&i.locale!=="ko"&&(Li||De!=="onCompositionStart"?De==="onCompositionEnd"&&Li&&(Ae=Ah()):(_s=Y,ac="value"in _s?_s.value:_s.textContent,Li=!0)),pe=Zl(B,De),0<pe.length&&(De=new Th(De,e,null,i,Y),Q.push({event:De,listeners:pe}),Ae?De.data=Ae:(Ae=Dh(i),Ae!==null&&(De.data=Ae)))),(Ae=Gy?Vy(e,i):Fy(e,i))&&(De=Zl(B,"onBeforeInput"),0<De.length&&(pe=new Th("onBeforeInput","beforeinput",null,i,Y),Q.push({event:pe,listeners:De}),pe.data=Ae)),Ub(Q,e,B,i,Y)}bp(Q,t)})}function pa(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Zl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=qr(e,i),c!=null&&l.unshift(pa(e,c,u)),c=qr(e,t),c!=null&&l.push(pa(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Pb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function vp(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,j=b.alternate,B=b.stateNode;if(b=b.tag,j!==null&&j===l)break;b!==5&&b!==26&&b!==27||B===null||(j=B,c?(B=qr(i,u),B!=null&&p.unshift(pa(i,B,j))):c||(B=qr(i,u),B!=null&&p.push(pa(i,B,j)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var $b=/\r\n?/g,Yb=/\u0000|\uFFFD/g;function _p(e){return(typeof e=="string"?e:""+e).replace($b,`
26
+ `).replace(Yb,"")}function wp(e,t){return t=_p(t),_p(e)===t}function Fe(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&qi(e,""+l);break;case"className":wn(e,"class",l);break;case"tabIndex":wn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":wn(e,i,l);break;case"style":wh(e,l,u);break;case"data":if(t!=="object"){wn(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=il(""+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",c.name,c,null),Fe(e,t,"formEncType",c.formEncType,c,null),Fe(e,t,"formMethod",c.formMethod,c,null),Fe(e,t,"formTarget",c.formTarget,c,null)):(Fe(e,t,"encType",c.encType,c,null),Fe(e,t,"method",c.method,c,null),Fe(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=il(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Fn);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(c.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=il(""+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":Vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Vn(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=yy.get(i)||i,Ct(e,i,l))}}function Pu(e,t,i,l,c,u){switch(i){case"style":wh(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(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(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=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!I.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);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,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,p,i,null)}}c&&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=p=c=null,j=null,B=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":j=Y;break;case"defaultChecked":B=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Fe(e,t,l,Y,i,null)}}bh(e,u,b,j,B,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Fe(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?zi(e,!!l,t,!1):i!=null&&zi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,p,b,i,null)}vh(e,l,c,u);return;case"option":for(j in i)if(i.hasOwnProperty(j)&&(l=i[j],l!=null))switch(j){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Fe(e,t,j,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<ma.length;l++)Ce(ma[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(B in i)if(i.hasOwnProperty(B)&&(l=i[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,B,l,i,null)}return;default:if(tc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&Pu(e,t,Y,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 Gb(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 c=null,u=null,p=null,b=null,j=null,B=null,Y=null;for(P in i){var Q=i[P];if(i.hasOwnProperty(P)&&Q!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":j=Q;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,Q)}}for(var L in l){var P=l[L];if(Q=i[L],l.hasOwnProperty(L)&&(P!=null||Q!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":B=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==Q&&Fe(e,t,L,P,l,Q)}}Wo(e,p,b,j,B,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(j=i[u],i.hasOwnProperty(u)&&j!=null)switch(u){case"value":break;case"multiple":P=j;default:l.hasOwnProperty(u)||Fe(e,t,u,null,l,j)}for(c in l)if(u=l[c],j=i[c],l.hasOwnProperty(c)&&(u!=null||j!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==j&&Fe(e,t,c,u,l,j)}t=b,i=p,l=P,L!=null?zi(e,!!i,L,!1):!!l!=!!i&&(t!=null?zi(e,!!i,t,!0):zi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Fe(e,t,p,c,l,u)}xh(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Fe(e,t,he,null,l,L)}for(j in l)if(L=l[j],P=i[j],l.hasOwnProperty(j)&&L!==P&&(L!=null||P!=null))switch(j){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Fe(e,t,j,L,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 ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Fe(e,t,ye,null,l,L);for(B in l)if(L=l[B],P=i[B],l.hasOwnProperty(B)&&L!==P&&(L!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Fe(e,t,B,L,l,P)}return;default:if(tc(t)){for(var Je in i)L=i[Je],i.hasOwnProperty(Je)&&L!==void 0&&!l.hasOwnProperty(Je)&&Pu(e,t,Je,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||Pu(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Fe(e,t,R,null,l,L);for(Q in l)L=l[Q],P=i[Q],!l.hasOwnProperty(Q)||L===P||L==null&&P==null||Fe(e,t,Q,L,l,P)}function Sp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Vb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&Sp(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var j=i[l],B=j.startTime;if(B>b)break;var Y=j.transferSize,Q=j.initiatorType;Y&&Sp(Q)&&(j=j.responseEnd,p+=Y*(j<b?1:(b-B)/(j-B)))}if(--l,t+=8*(u+p)/(c.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 $u=null,Yu=null;function Wl(e){return e.nodeType===9?e:e.ownerDocument}function Ep(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 Ap(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 Gu(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 Vu=null;function Fb(){var e=window.event;return e&&e.type==="popstate"?e===Vu?!1:(Vu=e,!0):(Vu=null,!1)}var jp=typeof setTimeout=="function"?setTimeout:void 0,Jb=typeof clearTimeout=="function"?clearTimeout:void 0,Op=typeof Promise=="function"?Promise:void 0,Ib=typeof queueMicrotask=="function"?queueMicrotask:typeof Op<"u"?function(e){return Op.resolve(null).then(e).catch(Qb)}:jp;function Qb(e){setTimeout(function(){throw e})}function Bs(e){return e==="head"}function Tp(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),dr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")ga(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ga(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&ga(e.ownerDocument.body);i=c}while(i);dr(t)}function Np(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 Fu(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":Fu(i),Di(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Xb(e,t,i,l){for(;e.nodeType===1;){var c=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!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=pn(e.nextSibling),e===null)break}return null}function Kb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=pn(e.nextSibling),e===null))return null;return e}function Cp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=pn(e.nextSibling),e===null))return null;return e}function Ju(e){return e.data==="$?"||e.data==="$~"}function Iu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Zb(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 pn(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 Qu=null;function kp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return pn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Mp(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 Rp(e,t,i){switch(t=Wl(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 ga(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Di(e)}var gn=new Map,Dp=new Set;function eo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var os=te.d;te.d={f:Wb,r:ex,D:tx,C:nx,L:sx,m:ix,X:ax,S:rx,M:lx};function Wb(){var e=os.f(),t=Vl();return e||t}function ex(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Kd(t):os.r(e)}var ur=typeof document>"u"?null:document;function zp(e,t,i){var l=ur;if(l&&typeof t=="string"&&t){var c=on(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),Dp.has(c)||(Dp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function tx(e){os.D(e),zp("dns-prefetch",e,null)}function nx(e,t){os.C(e,t),zp("preconnect",e,t)}function sx(e,t,i){os.L(e,t,i);var l=ur;if(l&&e&&t){var c='link[rel="preload"][as="'+on(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+on(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+on(i.imageSizes)+'"]')):c+='[href="'+on(e)+'"]';var u=c;switch(t){case"style":u=fr(e);break;case"script":u=hr(e)}gn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),gn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ya(u))||t==="script"&&l.querySelector(ba(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function ix(e,t){os.m(e,t);var i=ur;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+on(l)+'"][href="'+on(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=hr(e)}if(!gn.has(u)&&(e=w({rel:"modulepreload",href:e},t),gn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ba(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function rx(e,t,i){os.S(e,t,i);var l=ur;if(l&&e){var c=A(l).hoistableStyles,u=fr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ya(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=gn.get(u))&&Xu(e,i);var j=p=l.createElement("link");N(j),At(j,"link",e),j._p=new Promise(function(B,Y){j.onload=B,j.onerror=Y}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,to(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function ax(e,t){os.X(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ba(c)),u||(e=w({src:e,async:!0},t),(t=gn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function lx(e,t){os.M(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ba(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=gn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function qp(e,t,i,l){var c=(c=rn.current)?eo(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=fr(i.href),i=A(c).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=fr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ya(e)))&&!u._p&&(p.instance=u,p.state.loading=5),gn.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},gn.set(e,i),u||ox(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}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=hr(i),i=A(c).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 fr(e){return'href="'+on(e)+'"'}function ya(e){return'link[rel="stylesheet"]['+e+"]"}function Up(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function ox(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),N(t),e.head.appendChild(t))}function hr(e){return'[src="'+on(e)+'"]'}function ba(e){return"script[async]"+e}function Bp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+on(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),to(l,i.precedence,e),t.instance=l;case"stylesheet":c=fr(i.href);var u=e.querySelector(ya(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Up(i),(c=gn.get(c))&&Xu(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),At(u,"link",l),t.state.loading|=4,to(u,i.precedence,e),t.instance=u;case"script":return u=hr(i.src),(c=e.querySelector(ba(u)))?(t.instance=c,N(c),c):(l=i,(c=gn.get(u))&&(l=w({},i),Ku(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);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,to(l,i.precedence,e));return t.instance}function to(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var no=null;function Lp(e,t,i){if(no===null){var l=new Map,c=no=new Map;c.set(i,l)}else c=no,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Ie]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function Hp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function cx(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 Pp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ux(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 c=fr(l.href),u=t.querySelector(ya(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=so.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Up(l),(c=gn.get(c))&&Xu(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),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=so.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Zu=0;function fx(e,t){return e.stylesheets&&e.count===0&&ro(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Zu===0&&(Zu=62500*Vb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Zu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function so(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ro(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var io=null;function ro(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,io=new Map,t.forEach(hx,e),io=null,so.call(e))}function hx(e,t){if(!(t.state.loading&4)){var i=io.get(e);if(i)var l=i.get(null);else{i=new Map,io.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=so.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var xa={$$typeof:me,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function dx(e,t,i,l,c,u,p,b,j){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=ys(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ys(0),this.hiddenUpdates=ys(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function $p(e,t,i,l,c,u,p,b,j,B,Y,Q){return e=new dx(e,t,i,p,j,B,Y,Q,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=kc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},zc(u),e}function Yp(e){return e?(e=Yi,e):Yi}function Gp(e,t,i,l,c,u){c=Yp(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=Ts(e,l,t),i!==null&&(Ht(i,e,t),Kr(i,e,t))}function Vp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Wu(e,t){Vp(e,t),(e=e.alternate)&&Vp(e,t)}function Fp(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),Wu(e,67108864)}}function Jp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Gn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),Wu(e,t)}}var ao=!0;function mx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function px(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function ef(e,t,i,l){if(ao){var c=tf(l);if(c===null)Hu(e,t,l,lo,i),Qp(e,l);else if(yx(c,e,t,i,l))l.stopPropagation();else if(Qp(e,l),t&4&&-1<gx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=vn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var j=1<<31-Nt(p);b.entanglements[1]|=j,p&=~j}zn(u),(Pe&6)===0&&(Yl=et()+500,da(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Vl(),Wu(u,2)}if(u=tf(l),u===null&&Hu(e,t,l,lo,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Hu(e,t,l,null,i)}}function tf(e){return e=sc(e),nf(e)}var lo=null;function nf(e){if(lo=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 lo=e,null}function Ip(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(Qo()){case Xa:return 2;case Ka:return 8;case ki:case Xo:return 32;case Za:return 268435456;default:return 32}default:return 32}}var sf=!1,Ls=null,Hs=null,Ps=null,va=new Map,_a=new Map,$s=[],gx="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 Qp(e,t){switch(e){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Ps=null;break;case"pointerover":case"pointerout":va.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_a.delete(t.pointerId)}}function wa(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&Fp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function yx(e,t,i,l,c){switch(t){case"focusin":return Ls=wa(Ls,e,t,i,l,c),!0;case"dragenter":return Hs=wa(Hs,e,t,i,l,c),!0;case"mouseover":return Ps=wa(Ps,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return va.set(u,wa(va.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,_a.set(u,wa(_a.get(u)||null,e,t,i,l,c)),!0}return!1}function Xp(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,el(e.priority,function(){Jp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,el(e.priority,function(){Jp(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 oo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=tf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);nc=l,i.target.dispatchEvent(l),nc=null}else return t=S(i),t!==null&&Fp(t),e.blockedOn=i,!1;t.shift()}return!0}function Kp(e,t,i){oo(e)&&i.delete(t)}function bx(){sf=!1,Ls!==null&&oo(Ls)&&(Ls=null),Hs!==null&&oo(Hs)&&(Hs=null),Ps!==null&&oo(Ps)&&(Ps=null),va.forEach(Kp),_a.forEach(Kp)}function co(e,t){e.blockedOn===t&&(e.blockedOn=null,sf||(sf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,bx)))}var uo=null;function Zp(e){uo!==e&&(uo=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){uo===e&&(uo=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(nf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,tu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function dr(e){function t(j){return co(j,e)}Ls!==null&&co(Ls,e),Hs!==null&&co(Hs,e),Ps!==null&&co(Ps,e),va.forEach(t),_a.forEach(t);for(var i=0;i<$s.length;i++){var l=$s[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<$s.length&&(i=$s[0],i.blockedOn===null);)Xp(i),i.blockedOn===null&&$s.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||Zp(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(nf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Zp(i)}}}function Wp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=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,c=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),c!==null&&(c(),c=null)}}}function rf(e){this._internalRoot=e}fo.prototype.render=rf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Gp(i,l,e,t,null,null)},fo.prototype.unmount=rf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Gp(e.current,2,null,e,null,null),Vl(),t[Yt]=null}};function fo(e){this._internalRoot=e}fo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Dr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<$s.length&&t!==0&&t<$s[i].priority;i++);$s.splice(i,0,e),i===0&&Xp(e)}};var e0=n.version;if(e0!=="19.2.4")throw Error(a(527,e0,"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?E(e):null,e=e===null?null:e.stateNode,e};var xx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ho=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ho.isDisabled&&ho.supportsFiber)try{ni=ho.inject(xx),ot=ho}catch{}}return Sa.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=lm,u=om,p=cm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=$p(e,1,!1,null,null,i,l,null,c,u,p,Wp),e[Yt]=t.current,Lu(e),new rf(t)},Sa.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=lm,p=om,b=cm,j=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(j=i.formState)),t=$p(e,1,!0,t,i??null,l,c,j,u,p,b,Wp),t.context=Yp(null),i=t.current,l=Xt(),l=Gn(l),c=Os(l),c.callback=null,Ts(i,c,l),i=l,t.current.lanes=i,_n(t,i),zn(t),e[Yt]=t.current,Lu(e),new fo(t)},Sa.version="19.2.4",Sa}var l0;function rv(){if(l0)return af.exports;l0=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=iv(),af.exports}var av=rv();const lv="modulepreload",ov=function(r,n){return new URL(r,n).href},o0={},_e=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(O=>({status:"fulfilled",value:O}),O=>({status:"rejected",reason:O}))))};const d=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(s.map(E=>{if(E=ov(E,a),E in o0)return;o0[E]=!0;const w=E.endsWith(".css"),O=w?'[rel="stylesheet"]':"";if(!!a)for(let D=d.length-1;D>=0;D--){const W=d[D];if(W.href===E&&(!w||W.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${O}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":lv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((D,W)=>{M.addEventListener("load",D),M.addEventListener("error",()=>W(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return o.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function Kf(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 mg(r){const n=Kf(r);return!n||typeof n.exp!="number"?null:n.exp}function Zf(r,n=0){const s=mg(r);return s===null?!0:Date.now()/1e3>=s-n}const Wt=window.__LT_BASE__??"",Af=`${Wt}/api`;let Fs=null;function mo(r){Fs=r}function pg(){return Fs}async function c0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${Af}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Gs=null;async function Xe(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Fs){if(Zf(Fs)){Gs||(Gs=c0().finally(()=>{Gs=null}));const o=await Gs;if(o)Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Fs}`}let a=await fetch(`${Af}${r}`,{...n,headers:s});if(a.status===401&&Fs){Gs||(Gs=c0().finally(()=>{Gs=null}));const o=await Gs;if(o&&(Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${Af}${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 o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const gg=T.createContext(null),cv=300;function cf(r,n){if(Zf(r))return null;const s=Kf(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):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 uv({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Zf(w)?(sessionStorage.removeItem("lt_token"),null):(mo(w),cf(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const O=mg(w);if(!O)return;const q=(O-cv)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{try{const M=Kf(w);if(M!=null&&M.sso){const re=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const C=await re.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const D=sessionStorage.getItem("lt_credentials");if(!D)return;const{username:W,password:se}=JSON.parse(D),ee=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:W,password:se})});if(!ee.ok)return;const me=await ee.json();me.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:me.token}}))}catch{}},q))},[]),f=T.useCallback((w,O,q)=>{const M={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(O==null?void 0:O.username)??null},D=cf(w,M);D&&(mo(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),O&&sessionStorage.setItem("lt_credentials",JSON.stringify(O)),s(D),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");mo(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),w&&(window.location.href=w)},[]);T.useEffect(()=>{const w=()=>h(),O=q=>{var W;const M=(W=q.detail)==null?void 0:W.token;if(!M)return;const D=cf(M);D&&(mo(M),sessionStorage.setItem("lt_token",M),s(D),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",O),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",O)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(O=>O.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(O=>O.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return m.jsx(gg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function ji(){const r=T.useContext(gg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const nn=new Uint8Array(0),Oi=new TextEncoder,en=new TextDecoder;function fv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function Ra(...r){const n=[];for(let s=0;s<r.length;s++)n.push(Oi.encode(r[s]));return n.length===0?nn:n.length===1?n[0]:fv(...n)}function u0(r){return!r||r.length===0?"":en.decode(r)}const f0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",h0=36,hv=0xcfd41b9100000,d0=33,dv=333,m0=22;function mv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function pv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):mv(r)}class gv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(m0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*hv),this.inc=Math.floor(Math.random()*(dv-d0)+d0)}setPre(){const n=new Uint8Array(12);pv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=f0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=m0-1;s>=12;s--)this.buf[s]=f0.charCodeAt(n%h0),n=Math.floor(n/h0)}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 Ks=new gv;var us;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(us||(us={}));var br;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(br||(br={}));var ie;(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"})(ie||(ie={}));function yv(r){return typeof r.code=="string"}class yg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return bv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const bv=new yg;class ue extends Error{constructor(s,a,o){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=o}static errorForCode(s,a){const o=yg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.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 Tn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Tn||(Tn={}));var Da;(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"})(Da||(Da={}));const ko="Nats-Service-Error",Mo="Nats-Service-Error-Code";class Ro extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Ro.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Mo))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(ko))||"";return new Ro(h,d.length?d:a)}return null}}function fs(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}.${Ks.next()}`}const jf="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function Yo(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function po(r){return en.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Sr(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,d)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{d(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Or(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});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 bg(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 xv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Wf(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 xv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function eh(r){return Math.floor(r/1e6)}function p0(r){let a=!0;const o=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 ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function hs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Is(r,n)}const uf="NATS/1.0";class Is{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 o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].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 Is,o=en.decode(n).split(`\r
27
27
  `),f=o[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 o.length>=1&&o.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 o=0;o<a.length;o++)n=`${n}\r
28
28
  ${s}: ${a[o]}`;return`${n}\r
29
29
  \r
30
- `}encode(){return ji.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.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(o=>o===n);case Kt.CanonicalMIME:return n=f0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}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 o=f0(n);a===Kt.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Qs.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(o=>{this.headers.delete(o)})}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 Qs;for(const a in n)s.headers.set(a,n[a]);return s}}function Af(){return{encode(r){return ji.encode(r)},decode(r){return en.decode(r)}}}function Nn(r){return{encode(n){try{return n===void 0&&(n=null),ji.encode(JSON.stringify(n))}catch(s){throw ue.errorForCode(ie.BadJson,s)}},decode(n){try{return JSON.parse(en.decode(n),r)}catch(s){throw ue.errorForCode(ie.BadJson,s)}}}}function gg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?ue.errorForCode(ie.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=en.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=en.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=Qs.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=nn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return Nn(n).decode(this.data)}string(){return en.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,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(Zf,"jc");function xr(r){return Go("durable",r)}function Mt(r){return Go("stream",r)}function Go(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
30
+ `}encode(){return Oi.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.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(o=>o===n);case Kt.CanonicalMIME:return n=p0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}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 o=p0(n);a===Kt.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Is.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(o=>{this.headers.delete(o)})}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 Is;for(const a in n)s.headers.set(a,n[a]);return s}}function Of(){return{encode(r){return Oi.encode(r)},decode(r){return en.decode(r)}}}function Nn(r){return{encode(n){try{return n===void 0&&(n=null),Oi.encode(JSON.stringify(n))}catch(s){throw ue.errorForCode(ie.BadJson,s)}},decode(n){try{return JSON.parse(en.decode(n),r)}catch(s){throw ue.errorForCode(ie.BadJson,s)}}}}function xg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?ue.errorForCode(ie.NoResponders):null}class th{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=en.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=en.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=Is.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=nn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return Nn(n).decode(this.data)}string(){return en.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,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(th,"jc");function xr(r){return Go("durable",r)}function Mt(r){return Go("stream",r)}function Go(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
31
31
  `,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
32
- `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Ta(r,n=""){if(n==="")throw Error(`${r} name required`);const s=Sv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function Sv(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 Ev(r,n,s){const a=fs(r,n),o={hdr:1,sid:0,size:0},f=new Zf(o,nn,{});return f._headers=a,f._subject=s,f}function vr(r){if(r.data.length!==0)return null;const n=r.headers;return n?yg(n.code,n.description):null}var bn;(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"})(bn||(bn={}));function Av(r){return r.code!==ie.JetStream409?!1:[bn.MaxBatchExceeded,bn.MaxExpiresExceeded,bn.MaxBytesExceeded,bn.MaxMessageSizeExceeded,bn.PushConsumer,bn.IdleHeartbeatMissed,bn.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 ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(bn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(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 ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.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 o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,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 Er;(function(r){r.Instant="instant",r.Original="original"})(Er||(Er={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Do;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Do||(Do={}));function Ov(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},n)}var h0;(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"})(h0||(h0={}));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 On;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(On||(On={}));var yr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(yr||(yr={}));var d0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(d0||(d0={}));const Zt="KV_";class jv{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=Ov("",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 xr(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=Er.Instant,this}replayOriginal(){return this.config.replay_policy=Er.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 Is(r){return new jv(r)}function m0(r){return typeof r.getOpts=="function"}class Tv{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,o=>o.charCodeAt(0)):a}}class _r{static encode(n){return _r.toB64URLEncoding(Tv.encode(n))}static decode(n,s=!1){return _r.decode(_r.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Ar{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 o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),ji.encode(n)}static toAscii(n){return en.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 o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}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 Nv(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 o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var Cv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Sa=Cv.performance||{};Sa.now||Sa.mozNow||Sa.msNow||Sa.oNow||Sa.webkitNow;var p0={versions:{}},kv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mv(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,Vo={exports:{}},g0={},y0=Mv(Nv({__proto__:null,default:g0},[g0]));ff=Vo,(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",o=!s.JS_SHA256_NO_NODE_JS&&p0.versions&&p0.versions.node;o?s=kv: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],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var q=function(C,X){return function(ce){return new ee(X,!0).update(ce)[C]()}},M=function(C){var X=q("hex",C);o&&(X=D(X,C)),X.create=function(){return new ee(C)},X.update=function(G){return X.create().update(G)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=q(V,C)}return X},D=function(C,X){var ce,V=y0,G=y0.Buffer,K=X?"sha224":"sha256";return ce=G.from&&!s.JS_SHA256_NO_BUFFER_FROM?G.from:function(ae){return new G(ae)},function(ae){if(typeof ae=="string")return V.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===G?V.createHash(K).update(ce(ae)).digest("hex"):C(ae)}},W=function(C,X){return function(ce,V){return new me(ce,X,!0).update(V)[C]()}},se=function(C){var X=W("hex",C);X.create=function(G){return new me(G,C)},X.update=function(G,K){return X.create(G).update(K)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=W(V,C)}return X};function ee(C,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],C?(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=C}function me(C,X,ce){var V,G=typeof C;if(G==="string"){var K,ae=[],ne=C.length,ke=0;for(V=0;V<ne;++V)(K=C.charCodeAt(V))<128?ae[ke++]=K:K<2048?(ae[ke++]=192|K>>>6,ae[ke++]=128|63&K):K<55296||K>=57344?(ae[ke++]=224|K>>>12,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++V)),ae[ke++]=240|K>>>18,ae[ke++]=128|K>>>12&63,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K);C=ae}else{if(G!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new ee(X,!0).update(C).array());var He=[],Me=[];for(V=0;V<64;++V){var $=C[V]||0;He[V]=92^$,Me[V]=54^$}ee.call(this,X,ce),this.update(Me),this.oKeyPad=He,this.inner=!0,this.sharedMemory=ce}ee.prototype.update=function(C){if(!this.finalized){var X,ce=typeof C;if(ce!=="string"){if(ce!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r);X=!0}for(var V,G,K=0,ae=C.length,ne=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,ne[0]=this.block,this.block=ne[16]=ne[1]=ne[2]=ne[3]=ne[4]=ne[5]=ne[6]=ne[7]=ne[8]=ne[9]=ne[10]=ne[11]=ne[12]=ne[13]=ne[14]=ne[15]=0),X)for(G=this.start;K<ae&&G<64;++K)ne[G>>>2]|=C[K]<<y[3&G++];else for(G=this.start;K<ae&&G<64;++K)(V=C.charCodeAt(K))<128?ne[G>>>2]|=V<<y[3&G++]:V<2048?(ne[G>>>2]|=(192|V>>>6)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):V<55296||V>=57344?(ne[G>>>2]|=(224|V>>>12)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):(V=65536+((1023&V)<<10|1023&C.charCodeAt(++K)),ne[G>>>2]|=(240|V>>>18)<<y[3&G++],ne[G>>>2]|=(128|V>>>12&63)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]);this.lastByteIndex=G,this.bytes+=G-this.start,G>=64?(this.block=ne[16],this.start=G-64,this.hash(),this.hashed=!0):this.start=G}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,X=this.lastByteIndex;C[16]=this.block,C[X>>>2]|=g[3&X],this.block=C[16],X>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var C,X,ce,V,G,K,ae,ne,ke,He=this.h0,Me=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,je=this.h7,_e=this.blocks;for(C=16;C<64;++C)X=((G=_e[C-15])>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,ce=((G=_e[C-2])>>>17|G<<15)^(G>>>19|G<<13)^G>>>10,_e[C]=_e[C-16]+X+_e[C-7]+ce|0;for(ke=Me&$,C=0;C<64;C+=4)this.first?(this.is224?(K=300032,je=(G=_e[0]-1413257819)-150054599|0,te=G+24177077|0):(K=704751109,je=(G=_e[0]-210244248)-1521486534|0,te=G+143694565|0),this.first=!1):(X=(He>>>2|He<<30)^(He>>>13|He<<19)^(He>>>22|He<<10),V=(K=He&Me)^He&$^ke,je=te+(G=je+(ce=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[C]+_e[C])|0,te=G+(X+V)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),V=(ae=te&He)^te&Me^K,be=$+(G=be+(ce=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&ve)+E[C+1]+_e[C+1])|0,X=(($=G+(X+V)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),V=(ne=$&te)^$&He^ae,ve=Me+(G=ve+(ce=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&je^~be&de)+E[C+2]+_e[C+2])|0,X=((Me=G+(X+V)|0)>>>2|Me<<30)^(Me>>>13|Me<<19)^(Me>>>22|Me<<10),V=(ke=Me&$)^Me&te^ne,de=He+(G=de+(ce=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&je)+E[C+3]+_e[C+3])|0,He=G+(X+V)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+He|0,this.h1=this.h1+Me|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+je|0},ee.prototype.hex=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=d[C>>>28&15]+d[C>>>24&15]+d[C>>>20&15]+d[C>>>16&15]+d[C>>>12&15]+d[C>>>8&15]+d[C>>>4&15]+d[15&C]+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[ce>>>28&15]+d[ce>>>24&15]+d[ce>>>20&15]+d[ce>>>16&15]+d[ce>>>12&15]+d[ce>>>8&15]+d[ce>>>4&15]+d[15&ce]+d[V>>>28&15]+d[V>>>24&15]+d[V>>>20&15]+d[V>>>16&15]+d[V>>>12&15]+d[V>>>8&15]+d[V>>>4&15]+d[15&V]+d[G>>>28&15]+d[G>>>24&15]+d[G>>>20&15]+d[G>>>16&15]+d[G>>>12&15]+d[G>>>8&15]+d[G>>>4&15]+d[15&G]+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||(ke+=d[ne>>>28&15]+d[ne>>>24&15]+d[ne>>>20&15]+d[ne>>>16&15]+d[ne>>>12&15]+d[ne>>>8&15]+d[ne>>>4&15]+d[15&ne]),ke},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,X>>>24&255,X>>>16&255,X>>>8&255,255&X,ce>>>24&255,ce>>>16&255,ce>>>8&255,255&ce,V>>>24&255,V>>>16&255,V>>>8&255,255&V,G>>>24&255,G>>>16&255,G>>>8&255,255&G,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||ke.push(ne>>>24&255,ne>>>16&255,ne>>>8&255,255&ne),ke},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),X=new DataView(C);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),C},me.prototype=new ee,me.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),ee.prototype.finalize.call(this)}};var re=M();re.sha256=re,re.sha224=M(!0),re.sha256.hmac=se(),re.sha224.hmac=se(!0),f?ff.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();Vo.exports;Vo.exports.sha224;var b0=Vo.exports.sha256;function Cf(r){return Bv(r)}function Rv(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 Dv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function zv(r){return Rv(r)?"hex":Dv(r)?"b64":""}function qv(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 Uv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Bv(r){switch(zv(r)){case"hex":return qv(r);case"b64":return Uv(r)}return null}function Lv(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 o=0;o<s.length;o++)if(s[o]!==a[o])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=Ks.next(),a&&(this.ctx=new Error)}}class Hv extends bg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
32
+ `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Na(r,n=""){if(n==="")throw Error(`${r} name required`);const s=vv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function vv(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 Tf(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Nf(r){var n;return Tf(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function _v(r,n,s){const a=hs(r,n),o={hdr:1,sid:0,size:0},f=new th(o,nn,{});return f._headers=a,f._subject=s,f}function vr(r){if(r.data.length!==0)return null;const n=r.headers;return n?vg(n.code,n.description):null}var bn;(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"})(bn||(bn={}));function wv(r){return r.code!==ie.JetStream409?!1:[bn.MaxBatchExceeded,bn.MaxExpiresExceeded,bn.MaxBytesExceeded,bn.MaxMessageSizeExceeded,bn.PushConsumer,bn.IdleHeartbeatMissed,bn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function vg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(bn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(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 ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.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 o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,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 nh{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 Cf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Cf||(Cf={}));var Ba;(function(r){r.Old="old",r.New="new"})(Ba||(Ba={}));var kf;(function(r){r.File="file",r.Memory="memory"})(kf||(kf={}));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 Er;(function(r){r.Instant="instant",r.Original="original"})(Er||(Er={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Do;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Do||(Do={}));function Sv(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},n)}var g0;(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"})(g0||(g0={}));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 jn;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(jn||(jn={}));var yr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(yr||(yr={}));var y0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(y0||(y0={}));const Zt="KV_";class Ev{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=Sv("",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 xr(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=Er.Instant,this}replayOriginal(){return this.config.replay_policy=Er.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 Ev(r)}function b0(r){return typeof r.getOpts=="function"}class Av{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,o=>o.charCodeAt(0)):a}}class _r{static encode(n){return _r.toB64URLEncoding(Av.encode(n))}static decode(n,s=!1){return _r.decode(_r.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Ar{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 o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),Oi.encode(n)}static toAscii(n){return en.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 o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}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 jv(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 o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var Ov=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Ea=Ov.performance||{};Ea.now||Ea.mozNow||Ea.msNow||Ea.oNow||Ea.webkitNow;var x0={versions:{}},Tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nv(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,Vo={exports:{}},v0={},_0=Nv(jv({__proto__:null,default:v0},[v0]));ff=Vo,(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",o=!s.JS_SHA256_NO_NODE_JS&&x0.versions&&x0.versions.node;o?s=Tv: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],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],O=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var q=function(C,X){return function(ce){return new ee(X,!0).update(ce)[C]()}},M=function(C){var X=q("hex",C);o&&(X=D(X,C)),X.create=function(){return new ee(C)},X.update=function(G){return X.create().update(G)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=q(V,C)}return X},D=function(C,X){var ce,V=_0,G=_0.Buffer,K=X?"sha224":"sha256";return ce=G.from&&!s.JS_SHA256_NO_BUFFER_FROM?G.from:function(ae){return new G(ae)},function(ae){if(typeof ae=="string")return V.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===G?V.createHash(K).update(ce(ae)).digest("hex"):C(ae)}},W=function(C,X){return function(ce,V){return new me(ce,X,!0).update(V)[C]()}},se=function(C){var X=W("hex",C);X.create=function(G){return new me(G,C)},X.update=function(G,K){return X.create(G).update(K)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=W(V,C)}return X};function ee(C,X){X?(O[0]=O[16]=O[1]=O[2]=O[3]=O[4]=O[5]=O[6]=O[7]=O[8]=O[9]=O[10]=O[11]=O[12]=O[13]=O[14]=O[15]=0,this.blocks=O):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(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=C}function me(C,X,ce){var V,G=typeof C;if(G==="string"){var K,ae=[],ne=C.length,ke=0;for(V=0;V<ne;++V)(K=C.charCodeAt(V))<128?ae[ke++]=K:K<2048?(ae[ke++]=192|K>>>6,ae[ke++]=128|63&K):K<55296||K>=57344?(ae[ke++]=224|K>>>12,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++V)),ae[ke++]=240|K>>>18,ae[ke++]=128|K>>>12&63,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K);C=ae}else{if(G!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new ee(X,!0).update(C).array());var He=[],Me=[];for(V=0;V<64;++V){var $=C[V]||0;He[V]=92^$,Me[V]=54^$}ee.call(this,X,ce),this.update(Me),this.oKeyPad=He,this.inner=!0,this.sharedMemory=ce}ee.prototype.update=function(C){if(!this.finalized){var X,ce=typeof C;if(ce!=="string"){if(ce!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r);X=!0}for(var V,G,K=0,ae=C.length,ne=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,ne[0]=this.block,this.block=ne[16]=ne[1]=ne[2]=ne[3]=ne[4]=ne[5]=ne[6]=ne[7]=ne[8]=ne[9]=ne[10]=ne[11]=ne[12]=ne[13]=ne[14]=ne[15]=0),X)for(G=this.start;K<ae&&G<64;++K)ne[G>>>2]|=C[K]<<y[3&G++];else for(G=this.start;K<ae&&G<64;++K)(V=C.charCodeAt(K))<128?ne[G>>>2]|=V<<y[3&G++]:V<2048?(ne[G>>>2]|=(192|V>>>6)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):V<55296||V>=57344?(ne[G>>>2]|=(224|V>>>12)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):(V=65536+((1023&V)<<10|1023&C.charCodeAt(++K)),ne[G>>>2]|=(240|V>>>18)<<y[3&G++],ne[G>>>2]|=(128|V>>>12&63)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]);this.lastByteIndex=G,this.bytes+=G-this.start,G>=64?(this.block=ne[16],this.start=G-64,this.hash(),this.hashed=!0):this.start=G}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,X=this.lastByteIndex;C[16]=this.block,C[X>>>2]|=g[3&X],this.block=C[16],X>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var C,X,ce,V,G,K,ae,ne,ke,He=this.h0,Me=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,Oe=this.h7,we=this.blocks;for(C=16;C<64;++C)X=((G=we[C-15])>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,ce=((G=we[C-2])>>>17|G<<15)^(G>>>19|G<<13)^G>>>10,we[C]=we[C-16]+X+we[C-7]+ce|0;for(ke=Me&$,C=0;C<64;C+=4)this.first?(this.is224?(K=300032,Oe=(G=we[0]-1413257819)-150054599|0,te=G+24177077|0):(K=704751109,Oe=(G=we[0]-210244248)-1521486534|0,te=G+143694565|0),this.first=!1):(X=(He>>>2|He<<30)^(He>>>13|He<<19)^(He>>>22|He<<10),V=(K=He&Me)^He&$^ke,Oe=te+(G=Oe+(ce=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[C]+we[C])|0,te=G+(X+V)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),V=(ae=te&He)^te&Me^K,be=$+(G=be+(ce=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&de^~Oe&ve)+E[C+1]+we[C+1])|0,X=(($=G+(X+V)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),V=(ne=$&te)^$&He^ae,ve=Me+(G=ve+(ce=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&Oe^~be&de)+E[C+2]+we[C+2])|0,X=((Me=G+(X+V)|0)>>>2|Me<<30)^(Me>>>13|Me<<19)^(Me>>>22|Me<<10),V=(ke=Me&$)^Me&te^ne,de=He+(G=de+(ce=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&Oe)+E[C+3]+we[C+3])|0,He=G+(X+V)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+He|0,this.h1=this.h1+Me|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+Oe|0},ee.prototype.hex=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=d[C>>>28&15]+d[C>>>24&15]+d[C>>>20&15]+d[C>>>16&15]+d[C>>>12&15]+d[C>>>8&15]+d[C>>>4&15]+d[15&C]+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[ce>>>28&15]+d[ce>>>24&15]+d[ce>>>20&15]+d[ce>>>16&15]+d[ce>>>12&15]+d[ce>>>8&15]+d[ce>>>4&15]+d[15&ce]+d[V>>>28&15]+d[V>>>24&15]+d[V>>>20&15]+d[V>>>16&15]+d[V>>>12&15]+d[V>>>8&15]+d[V>>>4&15]+d[15&V]+d[G>>>28&15]+d[G>>>24&15]+d[G>>>20&15]+d[G>>>16&15]+d[G>>>12&15]+d[G>>>8&15]+d[G>>>4&15]+d[15&G]+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||(ke+=d[ne>>>28&15]+d[ne>>>24&15]+d[ne>>>20&15]+d[ne>>>16&15]+d[ne>>>12&15]+d[ne>>>8&15]+d[ne>>>4&15]+d[15&ne]),ke},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,X>>>24&255,X>>>16&255,X>>>8&255,255&X,ce>>>24&255,ce>>>16&255,ce>>>8&255,255&ce,V>>>24&255,V>>>16&255,V>>>8&255,255&V,G>>>24&255,G>>>16&255,G>>>8&255,255&G,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||ke.push(ne>>>24&255,ne>>>16&255,ne>>>8&255,255&ne),ke},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),X=new DataView(C);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),C},me.prototype=new ee,me.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),ee.prototype.finalize.call(this)}};var re=M();re.sha256=re,re.sha224=M(!0),re.sha256.hmac=se(),re.sha224.hmac=se(!0),f?ff.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();Vo.exports;Vo.exports.sha224;var w0=Vo.exports.sha256;function Mf(r){return zv(r)}function Cv(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 kv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Mv(r){return Cv(r)?"hex":kv(r)?"b64":""}function Rv(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 Dv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function zv(r){switch(Mv(r)){case"hex":return Rv(r);case"b64":return Dv(r)}return null}function qv(r,n){const s=typeof r=="string"?Mf(r):r,a=typeof n=="string"?Mf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class _g{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=Ks.next(),a&&(this.ctx=new Error)}}class Uv extends _g{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
33
33
 
34
- ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===Tn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Tn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Tn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class xg extends bg{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=Sr(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
34
+ ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===Tn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Tn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Tn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class wg extends _g{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=Sr(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
35
 
36
- ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const Pv="$JS.API";function $v(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Yo({apiPrefix:Pv,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=$v(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Nn()}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 o=nn;s&&(o=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,o,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===ie.Timeout)&&d+1<f)await Or(h.backoff(d));else throw g}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=yg(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Na{constructor(n,s,a,o){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=o||{}}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,o;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}`),((o=n.streams)==null?void 0:o.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 Ai(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 Ue;(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"})(Ue||(Ue={}));class Yv{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=Ai(n)),this.server=n,this.set(Ue.JS_KV,"2.6.2"),this.set(Ue.JS_OBJECTSTORE,"2.6.3"),this.set(Ue.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ue.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ue.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ue.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ue.JS_SIMPLIFICATION,"2.9.4"),this.set(Ue.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ue.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ue.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ue.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ue.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ue.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,Ai(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=Ai(n)),kf(this.server,n)>=0}}class zo extends Pa{constructor(n,s){super(n,s)}async add(n,s,a=Do.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 o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&xr(o.config.durable_name);const f=this.nc;let{min:h,ok:d}=f.features.get(Ue.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{Go("name",g)}catch(j){const q=j.message,M=q.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${q.substring(M)}`):j}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:j,ok:q}=f.features.get(Ue.JS_MULTIPLE_CONSUMER_FILTER);if(!q)throw new Error(`consumer 'filter_subjects' requires server ${j}`);d=!1}if(s.metadata){const{min:j,ok:q}=f.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!q)throw new Error(`consumer 'metadata' requires server ${j}`)}if(d&&(E=s.name??s.durable_name??""),E!==""){let j=s.filter_subject??void 0;j===">"&&(j=void 0),y=j!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${E}.${j}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Do.Update)}async info(n,s){return Mt(n),xr(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),xr(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Na(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function mr(r,n,s=!1){if(s===!0&&!r)throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`))}class Gv extends _t{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");mr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&mr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(mr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(mr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(mr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&mr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,j)=>{const[q,M]=this.adapter(w,j);if(q){E(q,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};D&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(q,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:h,queue:d,timeout:g}=o,y={queue:d,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.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 E=>{await E.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[o,f]=this.adapter(s,a);o&&this.stop(o),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 tn;function Vv(r){tn=r}function vg(){return tn!==void 0&&tn.defaultPort!==void 0?tn.defaultPort:4222}function hf(){return tn!==void 0&&tn.urlParseFn?tn.urlParseFn:void 0}function Fv(){if(!tn||typeof tn.factory!="function")throw new Error("transport fn is not set");return tn.factory()}function Mf(){return tn!==void 0&&tn.dnsResolveFn?tn.dnsResolveFn:void 0}const Eo=`\r
37
- `,qo=Ar.fromAscii(Eo),Jv=new Uint8Array(qo)[0],Qv=new Uint8Array(qo)[1];function Iv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Jv&&r[s]===Qv)return s+1}return 0}function Xv(r){const n=Iv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return en.decode(a)}return""}const Kv=4,_g=48,Zv=65,Wv=97;function e1(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{o[d]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function Rf(r){return t1(r)!==void 0}function t1(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return wg(r);case":":return n1(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:o,ok:f}=s1(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return e1(n[0],n[1],n[2],n[3])}function n1(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:o,c:f,ok:h}=i1(r);if(!h||o>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+=Kv;break}if(n[a]=o>>8,n[a+1]=o,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 o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function s1(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 i1(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)-Wv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Zv+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 r1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Df(r){return!r1(r)}function a1(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 l1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=a1(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",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.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=l1(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 o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Df(o)?"["+o+"]":o}`);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 o1{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(o=>{o=a?a(o):o,this.servers.push(new Ra(o))}),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 o=new Ra(n,s);Rf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}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 o=[];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 E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&d.push(y),h.delete(E)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class c1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${us(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(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=gg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class u1{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:br.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 f1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function h1(r,n="Assertion failed."){if(!r)throw new f1(n)}const x0=32*1024,df=2**32-2;function po(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){h1(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=po(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(ji.encode(n))}write(n){const s=this._grow(n.byteLength);return po(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 o=this.capacity;if(n<=Math.floor(o/2)-s)po(this._buf.subarray(this._off),this._buf);else{if(o+n>df)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,df));po(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(x0);for(;;){const o=this.capacity-this.length<x0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?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 v0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const d1=48;class _0{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 oe.M:case oe.m:this.state=le.OP_M,this.hdr=-1,this.ma=v0();break;case oe.H:case oe.h:this.state=le.OP_H,this.hdr=0,this.ma=v0();break;case oe.P:case oe.p:this.state=le.OP_P;break;case oe.PLUS:this.state=le.OP_PLUS;break;case oe.MINUS:this.state=le.OP_MINUS;break;case oe.I:case oe.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case oe.M:case oe.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case oe.S:case oe.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case oe.G:case oe.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),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 o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-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 oe.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case oe.O:case oe.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case oe.K:case oe.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case oe.E:case oe.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case oe.SPACE:case oe.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 oe.SPACE:case oe.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),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 oe.I:case oe.i:this.state=le.OP_PI;break;case oe.O:case oe.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case oe.N:case oe.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case oe.G:case oe.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case oe.N:case oe.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case oe.G:case oe.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case oe.N:case oe.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case oe.F:case oe.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case oe.O:case oe.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),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 o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}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}: ${en.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}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]-d1)}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 oe;(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"})(oe||(oe={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=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]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),q=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function D(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function W(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function se(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,A,N){var z,Q=0;for(z=0;z<N;z++)Q|=x[S+z]^_[A+z];return(1&Q-1>>>8)-1}function re(x,S,_,A){return me(x,S,_,A,16)}function C(x,S,_,A){return me(x,S,_,A,32)}function X(x,S,_,A,N){var z=new Uint32Array(16),Q=new Uint32Array(16),Z=new Uint32Array(16),H=new Uint32Array(4),J,fe,Oe;for(J=0;J<4;J++)Q[5*J]=D(A,4*J),Q[1+J]=D(_,4*J),Q[6+J]=D(S,4*J),Q[11+J]=D(_,16+4*J);for(J=0;J<16;J++)Z[J]=Q[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(Oe=0;Oe<4;Oe++)H[Oe]=Q[(5*fe+4*Oe)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),Oe=0;Oe<4;Oe++)z[4*fe+(fe+Oe)%4]=H[Oe]}for(Oe=0;Oe<16;Oe++)Q[Oe]=z[Oe]}if(N){for(J=0;J<16;J++)Q[J]=Q[J]+Z[J]|0;for(J=0;J<4;J++)Q[5*J]=Q[5*J]-D(A,4*J)|0,Q[6+J]=Q[6+J]-D(S,4*J)|0;for(J=0;J<4;J++)se(x,4*J,Q[5*J]),se(x,16+4*J,Q[6+J])}else for(J=0;J<16;J++)se(x,4*J,Q[J]+Z[J]|0)}function ce(x,S,_,A){return X(x,S,_,A,!1),0}function V(x,S,_,A){return X(x,S,_,A,!0),0}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,A,N,z,Q){var Z=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)Z[fe]=0;for(fe=0;fe<8;fe++)Z[fe]=z[fe];for(;N>=64;){for(ce(H,Z,Q,G),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(Z[fe]&255)|0,Z[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(ce(H,Z,Q,G),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function ae(x,S,_,A,N){return K(x,S,null,0,_,A,N)}function ne(x,S,_,A,N){var z=new Uint8Array(32);return V(z,A,N,G),ae(x,S,_,A.subarray(16),z)}function ke(x,S,_,A,N,z,Q){var Z=new Uint8Array(32);return V(Z,z,Q,G),K(x,S,_,A,N,z.subarray(16),Z)}function He(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Me=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,z){var Q,Z,H,J,fe=new Uint32Array(17),Oe=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),wn=new Uint32Array(17);for(H=0;H<17;H++)Oe[H]=Ke[H]=0;for(H=0;H<16;H++)Oe[H]=z[H];for(Oe[3]&=15,Oe[4]&=252,Oe[7]&=15,Oe[8]&=252,Oe[11]&=15,Oe[12]&=252,Oe[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,He(Ke,Ct),Z=0;Z<17;Z++)for(fe[Z]=0,H=0;H<17;H++)fe[Z]=fe[Z]+Ke[H]*(H<=Z?Oe[Z-H]:320*Oe[Z+17-H]|0)|0|0;for(Z=0;Z<17;Z++)Ke[Z]=fe[Z];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)wn[H]=Ke[H];for(He(Ke,Me),Q=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=Q&(wn[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=z[H+16];for(Ct[16]=0,He(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,z){var Q=new Uint8Array(16);return $(Q,0,_,A,N,z),re(x,S,Q,0)}function de(x,S,_,A,N){var z;if(_<32)return-1;for(ke(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),z=0;z<16;z++)x[z]=0;return 0}function ve(x,S,_,A,N){var z,Q=new Uint8Array(32);if(_<32||(ne(Q,0,32,A,N),te(S,16,S,32,_-32,Q)!==0))return-1;for(ke(x,0,S,0,_,A,N),z=0;z<32;z++)x[z]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function je(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function _e(x,S,_){for(var A,N=~(_-1),z=0;z<16;z++)A=N&(x[z]^S[z]),x[z]^=A,S[z]^=A}function Te(x,S){var _,A,N,z=s(),Q=s();for(_=0;_<16;_++)Q[_]=S[_];for(je(Q),je(Q),je(Q),A=0;A<2;A++){for(z[0]=Q[0]-65517,_=1;_<15;_++)z[_]=Q[_]-65535-(z[_-1]>>16&1),z[_-1]&=65535;z[15]=Q[15]-32767-(z[14]>>16&1),N=z[15]>>16&1,z[14]&=65535,_e(Q,z,1-N)}for(_=0;_<16;_++)x[2*_]=Q[_]&255,x[2*_+1]=Q[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),C(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function rn(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function we(x,S,_){var A,N,z=new Float64Array(31);for(A=0;A<31;A++)z[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)z[A+N]+=S[A]*_[N];for(A=0;A<15;A++)z[A]+=38*z[A+16];for(A=0;A<16;A++)x[A]=z[A];je(x),je(x)}function Tt(x,S){we(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ti(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),z,Q,Z=s(),H=s(),J=s(),fe=s(),Oe=s(),Ke=s();for(Q=0;Q<31;Q++)A[Q]=S[Q];for(A[31]=S[31]&127|64,A[0]&=248,rn(N,_),Q=0;Q<16;Q++)H[Q]=N[Q],fe[Q]=Z[Q]=J[Q]=0;for(Z[0]=fe[0]=1,Q=254;Q>=0;--Q)z=A[Q>>>3]>>>(Q&7)&1,_e(Z,H,z),_e(J,fe,z),Ot(Oe,Z,J),jt(Z,Z,J),Ot(J,H,fe),jt(H,H,fe),Tt(fe,Oe),Tt(Ke,Z),we(Z,J,Z),we(J,H,Oe),Ot(Oe,Z,J),jt(Z,Z,J),Tt(H,Z),jt(J,fe,Ke),we(Z,J,g),Ot(Z,Z,fe),we(J,J,Z),we(Z,fe,Ke),we(fe,H,N),Tt(H,Oe),_e(Z,H,z),_e(J,fe,z);for(Q=0;Q<16;Q++)N[Q+16]=Z[Q],N[Q+32]=J[Q],N[Q+48]=H[Q],N[Q+64]=fe[Q];var Ct=N.subarray(32),wn=N.subarray(16);return ei(Ct,Ct),we(wn,wn,Ct),Te(x,wn),0}function an(x,S){return ti(x,S,f)}function Ni(x,S){return a(S,32),an(x,S)}function ds(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),V(x,o,A,G)}var Fa=de,Ja=ve;function Tr(x,S,_,A,N,z){var Q=new Uint8Array(32);return ds(Q,N,z),Fa(x,S,_,A,Q)}function Nr(x,S,_,A,N,z){var Q=new Uint8Array(32);return ds(Q,N,z),Ja(x,S,_,A,Q)}function $n(){var x=0,S=0,_=0,A=0,N=65535,z,Q,Z;for(Z=0;Z<arguments.length;Z++)z=arguments[Z].lo,Q=arguments[Z].hi,x+=z&N,S+=z>>>16,_+=Q&N,A+=Q>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Qa(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ci(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Io(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Ia(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Xa(x){return Ci(et(x,28),et(x,34),et(x,39))}function ki(x){return Ci(et(x,14),et(x,18),et(x,41))}function Xo(x){return Ci(et(x,1),et(x,8),Qa(x,7))}function Ka(x){return Ci(et(x,19),et(x,61),Qa(x,6))}var Ko=[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 Za(x,S,_){var A=[],N=[],z=[],Q=[],Z,H,J;for(H=0;H<8;H++)A[H]=z[H]=W(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)Q[H]=W(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=z[J];for(Z=$n(z[7],ki(z[4]),Io(z[4],z[5],z[6]),Ko[H],Q[H%16]),N[7]=$n(Z,Xa(z[0]),Ia(z[0],z[1],z[2])),N[3]=$n(N[3],Z),J=0;J<8;J++)z[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)Q[J]=$n(Q[J],Q[(J+9)%16],Xo(Q[(J+1)%16]),Ka(Q[(J+14)%16]))}for(H=0;H<8;H++)z[H]=$n(z[H],A[H]),A[H]=z[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=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 ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),z,Q=_;for(z=0;z<64;z++)A[z]=ni[z];for(Za(A,S,_),_%=128,z=0;z<256;z++)N[z]=0;for(z=0;z<_;z++)N[z]=S[Q-_+z];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(Q/536870912|0,Q<<3)),Za(A,N,_),z=0;z<64;z++)x[z]=A[z];return 0}function $t(x,S){var _=s(),A=s(),N=s(),z=s(),Q=s(),Z=s(),H=s(),J=s(),fe=s();jt(_,x[1],x[0]),jt(fe,S[1],S[0]),we(_,_,fe),Ot(A,x[0],x[1]),Ot(fe,S[0],S[1]),we(A,A,fe),we(N,x[3],S[3]),we(N,N,E),we(z,x[2],S[2]),Ot(z,z,z),jt(Q,A,_),jt(Z,z,N),Ot(H,z,N),Ot(J,A,_),we(x[0],Q,Z),we(x[1],J,H),we(x[2],H,Z),we(x[3],Q,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)_e(x[A],S[A],_)}function Cr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),we(_,S[0],N),we(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function kr(x,S,_){var A,N;for(be(x[0],h),be(x[1],d),be(x[2],d),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Mi(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],j),be(_[2],d),we(_[3],w,j),kr(x,_,S)}function ms(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],z;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Mi(N,A),Cr(x,N),z=0;z<32;z++)S[z+32]=x[z];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 ps(x,S){var _,A,N,z;for(A=63;A>=32;--A){for(_=0,N=A-32,z=A-12;N<z;++N)S[N]+=_-16*S[A]*Yn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Yn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Yn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function vn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;ps(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),z=new Uint8Array(64),Q=new Uint8Array(64),Z,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var Oe=_+64;for(Z=0;Z<_;Z++)x[64+Z]=S[Z];for(Z=0;Z<32;Z++)x[32+Z]=N[32+Z];for(ot(Q,x.subarray(32),_+32),vn(Q),Mi(fe,Q),Cr(x,fe),Z=32;Z<64;Z++)x[Z]=A[Z];for(ot(z,x,_+64),vn(z),Z=0;Z<64;Z++)J[Z]=0;for(Z=0;Z<32;Z++)J[Z]=Q[Z];for(Z=0;Z<32;Z++)for(H=0;H<32;H++)J[Z+H]+=z[Z]*N[H];return ps(x.subarray(32),J),Oe}function ii(x,S){var _=s(),A=s(),N=s(),z=s(),Q=s(),Z=s(),H=s();return be(x[2],d),rn(x[1],S),Tt(N,x[1]),we(z,N,y),jt(N,N,x[2]),Ot(z,x[2],z),Tt(Q,z),Tt(Z,Q),we(H,Z,Q),we(_,H,N),we(_,_,z),Ti(_,_),we(_,_,N),we(_,_,z),we(_,_,z),we(x[0],_,z),Tt(A,x[0]),we(A,A,z),lt(A,N)&&we(x[0],x[0],q),Tt(A,x[0]),we(A,A,z),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&jt(x[0],h,x[0]),we(x[3],x[0],x[1]),0)}function Mr(x,S,_,A){var N,z=new Uint8Array(32),Q=new Uint8Array(64),Z=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(Q,x,_),vn(Q),kr(Z,H,Q),Mi(H,S.subarray(32)),$t(Z,H),Cr(z,Z),_-=64,C(S,0,z,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Ri=32,gs=24,_n=32,ys=16,bs=32,ri=32,xs=32,Gn=32,ai=32,Rr=gs,Wa=_n,kn=ys,Qe=64,it=32,Yt=64,li=32,Dr=64;r.lowlevel={crypto_core_hsalsa20:V,crypto_stream_xor:ke,crypto_stream:ne,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:re,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:an,crypto_box_beforenm:ds,crypto_box_afternm:Fa,crypto_box:Tr,crypto_box_open:Nr,crypto_box_keypair:Ni,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ms,crypto_sign_open:Mr,crypto_secretbox_KEYBYTES:Ri,crypto_secretbox_NONCEBYTES:gs,crypto_secretbox_ZEROBYTES:_n,crypto_secretbox_BOXZEROBYTES:ys,crypto_scalarmult_BYTES:bs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:xs,crypto_box_SECRETKEYBYTES:Gn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:Rr,crypto_box_ZEROBYTES:Wa,crypto_box_BOXZEROBYTES:kn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:Dr,gf:s,D:y,L:Yn,pack25519:Te,unpack25519:rn,M:we,A:Ot,S:Tt,Z:jt,pow2523:Ti,add:$t,set25519:be,modL:ps,scalarmult:kr,scalarbase:Mi};function el(x,S){if(x.length!==Ri)throw new Error("bad key size");if(S.length!==gs)throw new Error("bad nonce size")}function tl(x,S){if(x.length!==xs)throw new Error("bad public key size");if(S.length!==Gn)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 Di(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(_n+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+_n]=x[z];return de(N,A,A.length,S,_),N.subarray(ys)},r.secretbox.open=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(ys+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+ys]=x[z];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(_n)},r.secretbox.keyLength=Ri,r.secretbox.nonceLength=gs,r.secretbox.overheadLength=ys,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==bs)throw new Error("bad p size");var _=new Uint8Array(bs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(bs);return an(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=bs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),tl(x,S);var _=new Uint8Array(ai);return ds(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(xs),S=new Uint8Array(Gn);return Ni(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Gn)throw new Error("bad secret key size");var S=new Uint8Array(xs);return an(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=xs,r.box.secretKeyLength=Gn,r.box.sharedKeyLength=ai,r.box.nonceLength=Rr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Mr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),z=0;z<N.length;z++)N[z]=_[z];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Qe),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Qe+x.length),N=new Uint8Array(Qe+x.length),z;for(z=0;z<Qe;z++)A[z]=S[z];for(z=0;z<x.length;z++)A[z+Qe]=x[z];return Mr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ms(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ms(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(Dr);return ot(S,x,x.length),S},r.hash.hashLength=Dr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,z=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(z.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=z[N];Di(z)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,z=x.randomBytes(A);for(N=0;N<A;N++)_[N]=z[N];Di(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const go=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;go.sign.keyPair.fromSeed,go.sign.detached,go.sign.detached.verify,go.randomBytes;var w0;(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"})(w0||(w0={}));var S0;(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"})(S0||(S0={}));function m1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function p1(){return()=>{}}function g1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function y1(r){return()=>({auth_token:typeof r=="function"?r():r})}const Sg=120*1e3,b1=2,Eg=2*1e3;function x1(){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 v1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(y1(r.token)),r.user&&n.push(g1(r.user,r.pass)),n.length===0?p1():m1(n)}function _1(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 ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Ef}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Yo(x1(),r);if(s.authenticator=v1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.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{us(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Mf()=="function"),s.resolve&&typeof Mf()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function w1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const S1=1024*32,E1=/^INFO\s+([^\r\n]+)\r\n/i,A1=ka(`PONG\r
38
- `),E0=ka(`PING\r
39
- `);class O1{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 o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Yo(this,o)}}class Ag extends _t{constructor(s,a,o={}){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");Yo(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Sr(o.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,o=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}=o(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(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.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 j1{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 o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Uo{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=S1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new j1,this.muxSubscriptions=new c1,this.outbound=new Ar,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Yv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new o1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new _0(this),this.heartbeats=new u1(this,this.options.pingInterval||Sg,this.options.maxPingOut||b1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new _0(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=Fv(),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:br.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:br.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)===ie.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=Sr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}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(o){throw a&&a.cancel(),await this.transport.close(o),o}}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 o=null;for(const f of a)try{o=null,this.dispatchStatus({type:br.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}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 o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&o.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Or(a)}}static async connect(n,s){const a=new Uo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[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 ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.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=a0(n),a=Uo.toError(s),o={type:cs.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.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(o),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(A1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(a0(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(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new O1({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}${Eo}`)),this.transport.send(E0)}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 o;typeof n=="string"?o=ka(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=nn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ji.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=nn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=o.length+d}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
36
+ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const Bv="$JS.API";function Lv(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Yo({apiPrefix:Bv,timeout:5e3},r)}class Ya{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=Lv(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Nn()}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 o=nn;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=Wf();for(let d=0;d<f;d++)try{const g=await this.nc.request(n,o,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===ie.Timeout)&&d+1<f)await Or(h.backoff(d));else throw g}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=vg(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Ca{constructor(n,s,a,o){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=o||{}}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,o;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}`),((o=n.streams)==null?void 0:o.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 Ai(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 Rf(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 Ue;(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"})(Ue||(Ue={}));class Hv{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=Ai(n)),this.server=n,this.set(Ue.JS_KV,"2.6.2"),this.set(Ue.JS_OBJECTSTORE,"2.6.3"),this.set(Ue.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ue.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ue.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ue.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ue.JS_SIMPLIFICATION,"2.9.4"),this.set(Ue.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ue.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ue.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ue.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ue.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ue.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:Rf(this.server,Ai(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=Ai(n)),Rf(this.server,n)>=0}}class zo extends Ya{constructor(n,s){super(n,s)}async add(n,s,a=Do.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 o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&xr(o.config.durable_name);const f=this.nc;let{min:h,ok:d}=f.features.get(Ue.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{Go("name",g)}catch(O){const q=O.message,M=q.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${q.substring(M)}`):O}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:O,ok:q}=f.features.get(Ue.JS_MULTIPLE_CONSUMER_FILTER);if(!q)throw new Error(`consumer 'filter_subjects' requires server ${O}`);d=!1}if(s.metadata){const{min:O,ok:q}=f.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!q)throw new Error(`consumer 'metadata' requires server ${O}`)}if(d&&(E=s.name??s.durable_name??""),E!==""){let O=s.filter_subject??void 0;O===">"&&(O=void 0),y=O!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${E}.${O}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Do.Update)}async info(n,s){return Mt(n),xr(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),xr(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Ca(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function mr(r,n,s=!1){if(s===!0&&!r)throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`))}class Pv extends _t{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");mr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&mr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(mr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(mr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(mr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&mr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,O)=>{const[q,M]=this.adapter(w,O);if(q){E(q,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};D&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(q,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:h,queue:d,timeout:g}=o,y={queue:d,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.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 E=>{await E.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[o,f]=this.adapter(s,a);o&&this.stop(o),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 tn;function $v(r){tn=r}function Sg(){return tn!==void 0&&tn.defaultPort!==void 0?tn.defaultPort:4222}function hf(){return tn!==void 0&&tn.urlParseFn?tn.urlParseFn:void 0}function Yv(){if(!tn||typeof tn.factory!="function")throw new Error("transport fn is not set");return tn.factory()}function Df(){return tn!==void 0&&tn.dnsResolveFn?tn.dnsResolveFn:void 0}const Eo=`\r
37
+ `,qo=Ar.fromAscii(Eo),Gv=new Uint8Array(qo)[0],Vv=new Uint8Array(qo)[1];function Fv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Gv&&r[s]===Vv)return s+1}return 0}function Jv(r){const n=Fv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return en.decode(a)}return""}const Iv=4,Eg=48,Qv=65,Xv=97;function Kv(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{o[d]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function zf(r){return Zv(r)!==void 0}function Zv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return Ag(r);case":":return Wv(r)}}function Ag(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:o,ok:f}=e1(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return Kv(n[0],n[1],n[2],n[3])}function Wv(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:o,c:f,ok:h}=t1(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=Ag(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+=Iv;break}if(n[a]=o>>8,n[a+1]=o,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 o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function e1(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)-Eg),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 t1(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)-Eg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Xv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Qv+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 n1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function qf(r){return!n1(r)}function s1(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 i1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=s1(r),qf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=qf(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",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class za{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=i1(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(zf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${qf(o)?"["+o+"]":o}`);h.port=`${this.port}`;const d=new za(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&bg(s),this.resolves=s,s}}class r1{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(o=>{o=a?a(o):o,this.servers.push(new za(o))}),this.randomize&&(this.servers=bg(this.servers))),this.servers.length===0&&this.addServer(`${jf}:${Sg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();zf(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 o=new za(n,s);zf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}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 o=[];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 za(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&d.push(y),h.delete(E)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class a1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${fs(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(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=xg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class l1{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:br.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 o1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function c1(r,n="Assertion failed."){if(!r)throw new o1(n)}const S0=32*1024,df=2**32-2;function go(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){c1(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=go(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 go(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 o=this.capacity;if(n<=Math.floor(o/2)-s)go(this._buf.subarray(this._off),this._buf);else{if(o+n>df)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,df));go(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(S0);for(;;){const o=this.capacity-this.length<S0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?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 E0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const u1=48;class A0{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 oe.M:case oe.m:this.state=le.OP_M,this.hdr=-1,this.ma=E0();break;case oe.H:case oe.h:this.state=le.OP_H,this.hdr=0,this.ma=E0();break;case oe.P:case oe.p:this.state=le.OP_P;break;case oe.PLUS:this.state=le.OP_PLUS;break;case oe.MINUS:this.state=le.OP_MINUS;break;case oe.I:case oe.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case oe.M:case oe.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case oe.S:case oe.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case oe.G:case oe.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),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 o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-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 oe.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case oe.O:case oe.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case oe.K:case oe.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case oe.E:case oe.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case oe.SPACE:case oe.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 oe.SPACE:case oe.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),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 oe.I:case oe.i:this.state=le.OP_PI;break;case oe.O:case oe.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case oe.N:case oe.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case oe.G:case oe.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case oe.N:case oe.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case oe.G:case oe.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case oe.N:case oe.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case oe.F:case oe.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case oe.O:case oe.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),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 o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}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}: ${en.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}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]-u1)}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 oe;(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"})(oe||(oe={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=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]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),O=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),q=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function D(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function W(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function se(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,A,N){var z,I=0;for(z=0;z<N;z++)I|=x[S+z]^_[A+z];return(1&I-1>>>8)-1}function re(x,S,_,A){return me(x,S,_,A,16)}function C(x,S,_,A){return me(x,S,_,A,32)}function X(x,S,_,A,N){var z=new Uint32Array(16),I=new Uint32Array(16),Z=new Uint32Array(16),H=new Uint32Array(4),J,fe,je;for(J=0;J<4;J++)I[5*J]=D(A,4*J),I[1+J]=D(_,4*J),I[6+J]=D(S,4*J),I[11+J]=D(_,16+4*J);for(J=0;J<16;J++)Z[J]=I[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(je=0;je<4;je++)H[je]=I[(5*fe+4*je)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),je=0;je<4;je++)z[4*fe+(fe+je)%4]=H[je]}for(je=0;je<16;je++)I[je]=z[je]}if(N){for(J=0;J<16;J++)I[J]=I[J]+Z[J]|0;for(J=0;J<4;J++)I[5*J]=I[5*J]-D(A,4*J)|0,I[6+J]=I[6+J]-D(S,4*J)|0;for(J=0;J<4;J++)se(x,4*J,I[5*J]),se(x,16+4*J,I[6+J])}else for(J=0;J<16;J++)se(x,4*J,I[J]+Z[J]|0)}function ce(x,S,_,A){return X(x,S,_,A,!1),0}function V(x,S,_,A){return X(x,S,_,A,!0),0}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,A,N,z,I){var Z=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)Z[fe]=0;for(fe=0;fe<8;fe++)Z[fe]=z[fe];for(;N>=64;){for(ce(H,Z,I,G),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(Z[fe]&255)|0,Z[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(ce(H,Z,I,G),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function ae(x,S,_,A,N){return K(x,S,null,0,_,A,N)}function ne(x,S,_,A,N){var z=new Uint8Array(32);return V(z,A,N,G),ae(x,S,_,A.subarray(16),z)}function ke(x,S,_,A,N,z,I){var Z=new Uint8Array(32);return V(Z,z,I,G),K(x,S,_,A,N,z.subarray(16),Z)}function He(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Me=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,z){var I,Z,H,J,fe=new Uint32Array(17),je=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),wn=new Uint32Array(17);for(H=0;H<17;H++)je[H]=Ke[H]=0;for(H=0;H<16;H++)je[H]=z[H];for(je[3]&=15,je[4]&=252,je[7]&=15,je[8]&=252,je[11]&=15,je[12]&=252,je[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,He(Ke,Ct),Z=0;Z<17;Z++)for(fe[Z]=0,H=0;H<17;H++)fe[Z]=fe[Z]+Ke[H]*(H<=Z?je[Z-H]:320*je[Z+17-H]|0)|0|0;for(Z=0;Z<17;Z++)Ke[Z]=fe[Z];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)wn[H]=Ke[H];for(He(Ke,Me),I=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=I&(wn[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=z[H+16];for(Ct[16]=0,He(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,z){var I=new Uint8Array(16);return $(I,0,_,A,N,z),re(x,S,I,0)}function de(x,S,_,A,N){var z;if(_<32)return-1;for(ke(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),z=0;z<16;z++)x[z]=0;return 0}function ve(x,S,_,A,N){var z,I=new Uint8Array(32);if(_<32||(ne(I,0,32,A,N),te(S,16,S,32,_-32,I)!==0))return-1;for(ke(x,0,S,0,_,A,N),z=0;z<32;z++)x[z]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function Oe(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function we(x,S,_){for(var A,N=~(_-1),z=0;z<16;z++)A=N&(x[z]^S[z]),x[z]^=A,S[z]^=A}function Te(x,S){var _,A,N,z=s(),I=s();for(_=0;_<16;_++)I[_]=S[_];for(Oe(I),Oe(I),Oe(I),A=0;A<2;A++){for(z[0]=I[0]-65517,_=1;_<15;_++)z[_]=I[_]-65535-(z[_-1]>>16&1),z[_-1]&=65535;z[15]=I[15]-32767-(z[14]>>16&1),N=z[15]>>16&1,z[14]&=65535,we(I,z,1-N)}for(_=0;_<16;_++)x[2*_]=I[_]&255,x[2*_+1]=I[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),C(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function rn(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function Se(x,S,_){var A,N,z=new Float64Array(31);for(A=0;A<31;A++)z[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)z[A+N]+=S[A]*_[N];for(A=0;A<15;A++)z[A]+=38*z[A+16];for(A=0;A<16;A++)x[A]=z[A];Oe(x),Oe(x)}function Tt(x,S){Se(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ti(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),z,I,Z=s(),H=s(),J=s(),fe=s(),je=s(),Ke=s();for(I=0;I<31;I++)A[I]=S[I];for(A[31]=S[31]&127|64,A[0]&=248,rn(N,_),I=0;I<16;I++)H[I]=N[I],fe[I]=Z[I]=J[I]=0;for(Z[0]=fe[0]=1,I=254;I>=0;--I)z=A[I>>>3]>>>(I&7)&1,we(Z,H,z),we(J,fe,z),jt(je,Z,J),Ot(Z,Z,J),jt(J,H,fe),Ot(H,H,fe),Tt(fe,je),Tt(Ke,Z),Se(Z,J,Z),Se(J,H,je),jt(je,Z,J),Ot(Z,Z,J),Tt(H,Z),Ot(J,fe,Ke),Se(Z,J,g),jt(Z,Z,fe),Se(J,J,Z),Se(Z,fe,Ke),Se(fe,H,N),Tt(H,je),we(Z,H,z),we(J,fe,z);for(I=0;I<16;I++)N[I+16]=Z[I],N[I+32]=J[I],N[I+48]=H[I],N[I+64]=fe[I];var Ct=N.subarray(32),wn=N.subarray(16);return ei(Ct,Ct),Se(wn,wn,Ct),Te(x,wn),0}function an(x,S){return ti(x,S,f)}function Ni(x,S){return a(S,32),an(x,S)}function ms(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),V(x,o,A,G)}var Ja=de,Ia=ve;function Nr(x,S,_,A,N,z){var I=new Uint8Array(32);return ms(I,N,z),Ja(x,S,_,A,I)}function Cr(x,S,_,A,N,z){var I=new Uint8Array(32);return ms(I,N,z),Ia(x,S,_,A,I)}function $n(){var x=0,S=0,_=0,A=0,N=65535,z,I,Z;for(Z=0;Z<arguments.length;Z++)z=arguments[Z].lo,I=arguments[Z].hi,x+=z&N,S+=z>>>16,_+=I&N,A+=I>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Qa(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ci(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Qo(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Xa(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Ka(x){return Ci(et(x,28),et(x,34),et(x,39))}function ki(x){return Ci(et(x,14),et(x,18),et(x,41))}function Xo(x){return Ci(et(x,1),et(x,8),Qa(x,7))}function Za(x){return Ci(et(x,19),et(x,61),Qa(x,6))}var Ko=[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 Wa(x,S,_){var A=[],N=[],z=[],I=[],Z,H,J;for(H=0;H<8;H++)A[H]=z[H]=W(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)I[H]=W(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=z[J];for(Z=$n(z[7],ki(z[4]),Qo(z[4],z[5],z[6]),Ko[H],I[H%16]),N[7]=$n(Z,Ka(z[0]),Xa(z[0],z[1],z[2])),N[3]=$n(N[3],Z),J=0;J<8;J++)z[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)I[J]=$n(I[J],I[(J+9)%16],Xo(I[(J+1)%16]),Za(I[(J+14)%16]))}for(H=0;H<8;H++)z[H]=$n(z[H],A[H]),A[H]=z[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=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 ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),z,I=_;for(z=0;z<64;z++)A[z]=ni[z];for(Wa(A,S,_),_%=128,z=0;z<256;z++)N[z]=0;for(z=0;z<_;z++)N[z]=S[I-_+z];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(I/536870912|0,I<<3)),Wa(A,N,_),z=0;z<64;z++)x[z]=A[z];return 0}function $t(x,S){var _=s(),A=s(),N=s(),z=s(),I=s(),Z=s(),H=s(),J=s(),fe=s();Ot(_,x[1],x[0]),Ot(fe,S[1],S[0]),Se(_,_,fe),jt(A,x[0],x[1]),jt(fe,S[0],S[1]),Se(A,A,fe),Se(N,x[3],S[3]),Se(N,N,E),Se(z,x[2],S[2]),jt(z,z,z),Ot(I,A,_),Ot(Z,z,N),jt(H,z,N),jt(J,A,_),Se(x[0],I,Z),Se(x[1],J,H),Se(x[2],H,Z),Se(x[3],I,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)we(x[A],S[A],_)}function kr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),Se(_,S[0],N),Se(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function Mr(x,S,_){var A,N;for(be(x[0],h),be(x[1],d),be(x[2],d),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Mi(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],O),be(_[2],d),Se(_[3],w,O),Mr(x,_,S)}function ps(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],z;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Mi(N,A),kr(x,N),z=0;z<32;z++)S[z+32]=x[z];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 gs(x,S){var _,A,N,z;for(A=63;A>=32;--A){for(_=0,N=A-32,z=A-12;N<z;++N)S[N]+=_-16*S[A]*Yn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Yn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Yn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function vn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;gs(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),z=new Uint8Array(64),I=new Uint8Array(64),Z,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var je=_+64;for(Z=0;Z<_;Z++)x[64+Z]=S[Z];for(Z=0;Z<32;Z++)x[32+Z]=N[32+Z];for(ot(I,x.subarray(32),_+32),vn(I),Mi(fe,I),kr(x,fe),Z=32;Z<64;Z++)x[Z]=A[Z];for(ot(z,x,_+64),vn(z),Z=0;Z<64;Z++)J[Z]=0;for(Z=0;Z<32;Z++)J[Z]=I[Z];for(Z=0;Z<32;Z++)for(H=0;H<32;H++)J[Z+H]+=z[Z]*N[H];return gs(x.subarray(32),J),je}function ii(x,S){var _=s(),A=s(),N=s(),z=s(),I=s(),Z=s(),H=s();return be(x[2],d),rn(x[1],S),Tt(N,x[1]),Se(z,N,y),Ot(N,N,x[2]),jt(z,x[2],z),Tt(I,z),Tt(Z,I),Se(H,Z,I),Se(_,H,N),Se(_,_,z),Ti(_,_),Se(_,_,N),Se(_,_,z),Se(_,_,z),Se(x[0],_,z),Tt(A,x[0]),Se(A,A,z),lt(A,N)&&Se(x[0],x[0],q),Tt(A,x[0]),Se(A,A,z),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&Ot(x[0],h,x[0]),Se(x[3],x[0],x[1]),0)}function Rr(x,S,_,A){var N,z=new Uint8Array(32),I=new Uint8Array(64),Z=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(I,x,_),vn(I),Mr(Z,H,I),Mi(H,S.subarray(32)),$t(Z,H),kr(z,Z),_-=64,C(S,0,z,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Ri=32,ys=24,_n=32,bs=16,xs=32,ri=32,vs=32,Gn=32,ai=32,Dr=ys,el=_n,kn=bs,Ie=64,it=32,Yt=64,li=32,zr=64;r.lowlevel={crypto_core_hsalsa20:V,crypto_stream_xor:ke,crypto_stream:ne,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:re,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:an,crypto_box_beforenm:ms,crypto_box_afternm:Ja,crypto_box:Nr,crypto_box_open:Cr,crypto_box_keypair:Ni,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ps,crypto_sign_open:Rr,crypto_secretbox_KEYBYTES:Ri,crypto_secretbox_NONCEBYTES:ys,crypto_secretbox_ZEROBYTES:_n,crypto_secretbox_BOXZEROBYTES:bs,crypto_scalarmult_BYTES:xs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:vs,crypto_box_SECRETKEYBYTES:Gn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:Dr,crypto_box_ZEROBYTES:el,crypto_box_BOXZEROBYTES:kn,crypto_sign_BYTES:Ie,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:zr,gf:s,D:y,L:Yn,pack25519:Te,unpack25519:rn,M:Se,A:jt,S:Tt,Z:Ot,pow2523:Ti,add:$t,set25519:be,modL:gs,scalarmult:Mr,scalarbase:Mi};function tl(x,S){if(x.length!==Ri)throw new Error("bad key size");if(S.length!==ys)throw new Error("bad nonce size")}function nl(x,S){if(x.length!==vs)throw new Error("bad public key size");if(S.length!==Gn)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 Di(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),tl(_,S);for(var A=new Uint8Array(_n+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+_n]=x[z];return de(N,A,A.length,S,_),N.subarray(bs)},r.secretbox.open=function(x,S,_){yt(x,S,_),tl(_,S);for(var A=new Uint8Array(bs+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+bs]=x[z];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(_n)},r.secretbox.keyLength=Ri,r.secretbox.nonceLength=ys,r.secretbox.overheadLength=bs,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==xs)throw new Error("bad p size");var _=new Uint8Array(xs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(xs);return an(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=xs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),nl(x,S);var _=new Uint8Array(ai);return ms(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(vs),S=new Uint8Array(Gn);return Ni(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Gn)throw new Error("bad secret key size");var S=new Uint8Array(vs);return an(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=vs,r.box.secretKeyLength=Gn,r.box.sharedKeyLength=ai,r.box.nonceLength=Dr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Ie+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Rr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),z=0;z<N.length;z++)N[z]=_[z];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Ie),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Ie)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Ie+x.length),N=new Uint8Array(Ie+x.length),z;for(z=0;z<Ie;z++)A[z]=S[z];for(z=0;z<x.length;z++)A[z+Ie]=x[z];return Rr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ps(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ps(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Ie,r.hash=function(x){yt(x);var S=new Uint8Array(zr);return ot(S,x,x.length),S},r.hash.hashLength=zr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,z=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(z.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=z[N];Di(z)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,z=x.randomBytes(A);for(N=0;N<A;N++)_[N]=z[N];Di(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const yo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;yo.sign.keyPair.fromSeed,yo.sign.detached,yo.sign.detached.verify,yo.randomBytes;var j0;(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"})(j0||(j0={}));var O0;(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"})(O0||(O0={}));function f1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function h1(){return()=>{}}function d1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function m1(r){return()=>({auth_token:typeof r=="function"?r():r})}const jg=120*1e3,p1=2,Og=2*1e3;function g1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:jg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Og,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function y1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(m1(r.token)),r.user&&n.push(d1(r.user,r.pass)),n.length===0?h1():f1(n)}function b1(r){const n=`${jf}:${Sg()}`;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 ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${jf}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Yo(g1(),r);if(s.authenticator=y1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.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{fs(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Df()=="function"),s.resolve&&typeof Df()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function x1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const v1=1024*32,_1=/^INFO\s+([^\r\n]+)\r\n/i,w1=Ra(`PONG\r
38
+ `),T0=Ra(`PING\r
39
+ `);class S1{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 o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Yo(this,o)}}class Tg extends _t{constructor(s,a,o={}){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");Yo(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Sr(o.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,o=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}=o(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(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.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 E1{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 o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Uo{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=v1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new E1,this.muxSubscriptions=new a1,this.outbound=new Ar,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Hv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new r1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new A0(this),this.heartbeats=new l1(this,this.options.pingInterval||jg,this.options.maxPingOut||p1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new A0(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=Yv(),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:br.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:br.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:us.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:us.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.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=Sr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}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(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Df(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:br.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}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():Og;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&o.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Or(a)}}static async connect(n,s){const a=new Uo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[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 ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.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 th(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=u0(n),a=Uo.toError(s),o={type:us.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.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(o),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(w1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(u0(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(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new S1({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(Ra(`CONNECT ${g}${Eo}`)),this.transport.send(T0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:us.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:us.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 o;typeof n=="string"?o=Ra(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=nn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=Oi.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=nn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=o.length+d}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
40
40
  `:g=`HPUB ${n} ${d} ${f}\r
41
41
  `,this.sendCommand(g,h,o,qo)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
42
42
  `:g=`PUB ${n} ${f}\r
@@ -44,20 +44,20 @@ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cance
44
44
  `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
45
45
  `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
46
46
  `):this.sendCommand(`UNSUB ${n.sid}\r
47
- `),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(E0),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}${Eo}`):n.push(`SUB ${a.subject} ${a.sid}${Eo}`)}),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 T1="$SRV";class A0{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,o){var f,h;return o=o||{},o.headers=o.headers||fs(),(f=o.headers)==null||f.set(Mo,`${n}`),(h=o.headers)==null||h.set(ko,s),this.msg.respond(a,o)}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!==""&&C1("service group",s);let o="";if(n instanceof $a)this.srv=n,o="";else if(n instanceof Ua){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,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;Ta("endpoint",n);let{subject:o,handler:f,metadata:h,queue:d}=a;o=o||n,d=d||this.queue,N1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new Ua(this,n,s)}}function N1(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,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function C1(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 $a{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"),Ta("name",this.config.name),Ta("queue",this.config.queue),Ai(this.config.version),this._id=Ks.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="",o){const f=o??T1;return s===""&&a===""?`${f}.${n}`:(Ta("control subject name",s),a!==""?(Ta("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=fs();if(n instanceof Ro){const a=n;s.set(ko,a.message),s.set(Mo,`${a.code}`)}else s.set(ko,n.message),s.set(Mo,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new k1(o,f,a),d.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new A0(E))}catch(j){d.stats.countError(j),E==null||E.respond(nn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).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:o,queue:f}=n;return{subject:s,metadata:a,name:o,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,o="",f=""){const h={};h.name=n,h.subject=$a.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Nn(),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()),o=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.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=(o,f)=>{o?this.stop(o).catch():s.push(new A0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class k1{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:o,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:o,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 M1{constructor(n,s={strategy:Tn.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(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=Nn(),h=$a.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,nn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Og(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function R1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Og(),storage:Nf.File}}const Bo="KV-Operation",O0="$KV",D1=/^[-/=.\w]+$/,z1=/^[-/=.>*\w]+$/,q1=/^[-\w]+$/;function U1(r){if(r.startsWith(".")||r.endsWith(".")||!D1.test(r))throw new Error(`invalid key: ${r}`)}function B1(r){if(r.startsWith(".")||r.endsWith(".")||!z1.test(r))throw new Error(`invalid key: ${r}`)}function L1(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 Ao(r){if(!q1.test(r))throw new Error(`invalid bucket name: ${r}`)}var qn;(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"})(qn||(qn={}));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",U1);v(this,"validateSearchKey",B1);v(this,"hasWildcards",L1);Ao(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=O0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Ao(s);const o=await n.jetstreamManager(),f=new Ba(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Ao(s);const h=new Ba(s,n,o);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(R1(),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 o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(j=>{const q=Object.assign({},j),M=q.name.startsWith(Zt)?q.name.substring(Zt.length):q.name;return q.name.startsWith(Zt)||(q.name=`${Zt}${q.name}`),!j.external&&M!==this.bucket&&(q.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),d=h?kf(h,Ai("2.7.2"))>=0:!1;a.discard=d?qa.New:qa.Old;const{ok:g,min:y}=f.features.get(Ue.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}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 o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,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}`:`${O0}.${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 e_(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new t_(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 o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):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 o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=fs();f.headers=g,g.set(qn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!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 o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.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=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.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 o=await this.keys(n),f=[];for await(const h of o)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 o=this.encodeKey(n);this.validateKey(o);const f=fs();f.set(Bo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(qn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),nn,{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===On.AllHistory&&(h=ft.All),s===On.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,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,On.AllHistory,o),g=d.filter_subject,y=Is(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,j)=>{if(w){a.stop(w);return}if(j){const q=this.jmToEntry(j);a.push(q),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,j=w.num_pending+w.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(q){a.stop(q)}finally{f=void 0}else h=j}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=On.LastValue;n.include===On.AllHistory?f=On.AllHistory:n.include===On.UpdatesOnly&&(f=On.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Is(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((q,M)=>{if(q){a.stop(q);return}if(M){const D=this.jmToEntry(M);if(h&&D.operation==="DEL")return;a.push(D),a.received++,d&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(E,w);if(d){const{info:{last:q}}=j,M=q.num_pending+q.delivered.consumer_seq;if(M===0||a.received>=M)try{d()}catch(D){a.stop(D)}finally{d=void 0}else g=M}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,On.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Is(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Bo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new jg(o,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!==Zs.None:!1}}const eh="OBJ_",j0="SHA-256=";function H1(r){return Ao(r),`${eh}${r}`}function P1(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 P1(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!==Zs.None:!1}}function yo(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 yn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(yn||(yn={}));var Un;(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"})(Un||(Un={}));var wr;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(wr||(wr={}));const T0=Uint8Array.of(43,65,67,75),$1=Uint8Array.of(45,78,65,75),Ea=Uint8Array.of(43,87,80,73),Y1=Uint8Array.of(43,78,88,84),G1=Uint8Array.of(43,84,69,82,77),V1=Uint8Array.of(32);function La(r,n=5e3){return new o_(r,n)}class pf extends _t{constructor(s,a,o=!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,o),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=o,this.timeout=null,this.inbox=us(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:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,j,q,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(jf(y))return;const D=(j=y.headers)==null?void 0:j.code,W=((M=(q=y.headers)==null?void 0:q.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:se,bytesLeft:ee}=this.parseDiscard(y.headers);if(se>0||ee>0)this.pending.msgs-=se,this.pending.bytes-=ee,this.pending.requests--,this.notify(wr.Discard,{msgsLeft:se,bytesLeft:ee});else if(D===400){this.stop(new ue(W,`${D}`));return}else if(D===409&&W==="consumer deleted"){if(this.notify(Un.ConsumerDeleted,`${D} ${W}`),!this.refilling||this.abortOnMissingResource){const me=new ue(W,`${D}`);this.stop(me);return}}else if(D===503){if(this.notify(Un.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new ue("no responders",`${D}`);this.stop(me);return}}else this.notify(wr.DebugEvent,`${D} ${W}`)}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 D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new Wf(o,g=>(this.notify(Un.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 E of g)switch(E.type){case cs.Disconnect:(y=this.monitor)==null||y.cancel();break;case cs.Reconnect:this.resetPending().then(w=>{var j;w&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.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 o=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(Un.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(Un.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=o.backoff(f),g=Or(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(wr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));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,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class F1 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 o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.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),o=Sr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new pf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await o.status())if(d.type===Un.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of o){s.resolve(d);break}})().catch(()=>{});const h=Sr(f);return o.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),o.close().catch()}),o.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(o=>(this._info=o,this._info))}}class J1{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=Ks.next(),typeof a.name_prefix=="string"&&(Go("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=yn.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,E;Ks.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 o=Xf([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(Un.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(Un.StreamNotFound,w),this.type===yn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(j),Promise.reject(j);if(s&&w>=this.maxInitialReset)throw j;await Or(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;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):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===yn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new F1),this.consumer=new qf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===yn.Fetch&&a?h=await this.consumer.fetch(n):this.type===yn.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(wr.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===yn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===yn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=yn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===yn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.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=yn.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(Ue.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 J1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Fo{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 Fo(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 zo(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Uf(new zo(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:o,ok:f}=s.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Ue.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,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(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=yo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(yo);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),o=Object.assign(a.config,s);o.mirror=yo(o.mirror),o.sources=(d=o.sources)==null?void 0:d.map(yo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);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],E=s||{};let w=0;for(;h>g;){w++,E.offset=d*w;const q=await this._request(a,E);h=q.total,y.push(q);const M=Object.getOwnPropertyNames(q.state.subjects).length;if(g+=M,M<d)break}let j={};for(let q=0;q<y.length;q++)f=y[q],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},o=`${this.prefix}.STREAM.LIST`;return new Na(o,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:o,seq:f}=s;if(typeof o=="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 o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Tg(o)}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 Na(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 Na(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Na(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Fo(this,s))}}class Q1 extends Pa{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):nn,h=this.opts.apiPrefix||"$JS.API",d=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=vr(g);if(y)return Promise.reject(y);const E=new Bf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${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(o,f,{strategy:Tn.SentinelMsg});return(async()=>{var w,j,q;let g=!1,y=!1,E;for await(const M of d){if(!g){g=!0;const D=((w=M.headers)==null?void 0:w.code)||0;if(D!==0&&D<200||D>299){E=(j=M.headers)==null?void 0:j.description.toLowerCase();break}if(((q=M.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Bf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);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(yr.Subject)}get seq(){const n=this.header.last(yr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(yr.TimeStamp)}get stream(){return this.header.last(yr.Stream)}json(n){return Nn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Bf,"jc");class I1 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 zo(s,a),this.direct=new Q1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),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):nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Qs.decode(n)}else this._header=fs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return Nn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Tg,"jc");class X1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Fo(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=Qs.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 N0(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 K1(){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 o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),d=Nn().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 re;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.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=((re=n.options)==null?void 0:re.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const q=Ks.next(),M=this._chunkSubject(q),D=this._metaSubject(w),W=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},N0(n)),se=st(),ee=[],me=new Ar;try{const C=s?s.getReader():null,X=b0.create();for(;;){const{done:ce,value:V}=C?await C.read():{done:!0,value:void 0};if(ce){if(me.size()>0){const ne=me.drain();X.update(ne),W.chunks++,W.size+=ne.length,ee.push(this.js.publish(M,ne,{timeout:f}))}await Promise.all(ee),ee.length=0,W.mtime=new Date().toISOString();const G=_r.encode(X.digest());W.digest=`${j0}${G}`,W.deleted=!1;const K=fs();typeof h=="number"&&K.set(qn.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(D,Nn().encode(W),{headers:K,timeout:f});if(W.revision=ae.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}se.resolve(new gf(W));break}if(V)for(me.fill(V);me.size()>y;){W.chunks++,W.size+=y;const G=me.drain(n.options.max_chunk_size);X.update(G),ee.push(this.js.publish(M,G,{timeout:f}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:M}),se.reject(C)}return se}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.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 Ar,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 o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Da.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(j0))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 o=st(),f={info:new gf(s),error:o};if(s.size===0)return f.data=K1(),o.resolve(null),Promise.resolve(f);let h;const d=Is();d.orderedConsumer();const g=b0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,d);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(Lv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Da))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);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=Nn(),o=fs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),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:o,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=o;const h=Object.assign({},a,N0(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,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Nn(),h=Is();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(o,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.${_r.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=H1(this.name)}catch(o){return Promise.reject(o)}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?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new Da(s,o,n);return await f.init(a),Promise.resolve(f)}}class Z1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_KV);return o?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:o,min:f}=a.nc.features.get(Ue.JS_OBJECTSTORE);return o?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 zo(s,a),this.streamAPI=new th(s,a),this.consumers=new Uf(this.consumerAPI),this.streams=new X1(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 Z1(this)}async publish(s,a=nn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||fs();o&&(o.msgID&&f.set(qn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(qn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(qn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(qn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(qn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,d={};h&&(d.timeout=h),o&&(d.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let j=0;j<g;j++)try{E=await this.nc.request(s,a,d);break}catch(q){if(q.code==="503"&&j+1<g)await Or(y);else throw q}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),xr(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=vr(d);if(g)throw g;return La(d,this.timeout)}fetch(s,a,o={}){Mt(s),xr(a);let f=null;const h=(o.max_bytes??0)>0;let d=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const j=o.idle_heartbeat||0;j&&(E.idle_heartbeat=nt(j),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(j*4)));const q=new _t,M=E.batch;let D=0;q.protocolFilterFn=(ee,me=!1)=>jf(ee.msg)?(y==null||y.work(),!1):!0,q.dispatchedFn=ee=>{if(ee){if(h&&(d+=ee.data.length),D++,f&&ee.info.pending===0)return;(q.getPending()===1&&ee.info.pending===0||M===D||g>0&&d>=g)&&q.stop()}};const W=us(this.nc.options.inboxPrefix),se=this.nc.subscribe(W,{max:o.batch,callback:(ee,me)=>{ee===null&&(ee=vr(me)),ee!==null?(f&&(f.cancel(),f=null),vv(ee)?q.stop(Cg(ee)===null?void 0:ee):q.stop(ee)):(y==null||y.work(),q.received++,q.push(La(me,this.timeout)))}});return w&&(f=Sr(w),f.catch(()=>{se.isClosed()||(se.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new Wf(j,ee=>(q.push(()=>{q.err=new ue(`${bn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await se.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:W}),q}async pullSubscribe(s,a=Is()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.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(o),d=new n_(this,o.deliver,h);d.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Is()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new Ng(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Is()){const o=m0(a)?a.getOpts():a;if(o.isBind=m0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=us(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.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=o.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}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||us(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=s_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=nh.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Of(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=a_),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:Er.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,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(vr(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=_1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new sh(n);Uo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(d=>{d.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.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 o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=nn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||Tn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.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=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(us(this.options.inboxPrefix),{callback:(M,D)=>{var W,se;if(((W=D==null?void 0:D.data)==null?void 0:W.length)===0&&((se=D==null?void 0:D.headers)==null?void 0:se.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
47
+ `),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(T0),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}${Eo}`):n.push(`SUB ${a.subject} ${a.sid}${Eo}`)}),n.length&&this.transport.send(Ra(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 Tg(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 A1="$SRV";class N0{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,o){var f,h;return o=o||{},o.headers=o.headers||hs(),(f=o.headers)==null||f.set(Mo,`${n}`),(h=o.headers)==null||h.set(ko,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class La{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&O1("service group",s);let o="";if(n instanceof Ga)this.srv=n,o="";else if(n instanceof La){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,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;Na("endpoint",n);let{subject:o,handler:f,metadata:h,queue:d}=a;o=o||n,d=d||this.queue,j1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new La(this,n,s)}}function j1(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,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function O1(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 Ga{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"),Na("name",this.config.name),Na("queue",this.config.queue),Ai(this.config.version),this._id=Ks.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="",o){const f=o??A1;return s===""&&a===""?`${f}.${n}`:(Na("control subject name",s),a!==""?(Na("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=hs();if(n instanceof Ro){const a=n;s.set(ko,a.message),s.set(Mo,`${a.code}`)}else s.set(ko,n.message),s.set(Mo,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new T1(o,f,a),d.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new N0(E))}catch(O){d.stats.countError(O),E==null||E.respond(nn,{headers:this.errorToHeader(O)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),d}info(){return{type:Da.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:o,queue:f}=n;return{subject:s,metadata:a,name:o,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:Da.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,o="",f=""){const h={};h.name=n,h.subject=Ga.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Nn(),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()),o=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.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:Da.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 La(this,n,s)}addEndpoint(n,s){return new La(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new N0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class T1{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:o,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:o,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 N1{constructor(n,s={strategy:Tn.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(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=Nn(),h=Ga.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,nn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Ng(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function C1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ng(),storage:kf.File}}const Bo="KV-Operation",C0="$KV",k1=/^[-/=.\w]+$/,M1=/^[-/=.>*\w]+$/,R1=/^[-\w]+$/;function D1(r){if(r.startsWith(".")||r.endsWith(".")||!k1.test(r))throw new Error(`invalid key: ${r}`)}function z1(r){if(r.startsWith(".")||r.endsWith(".")||!M1.test(r))throw new Error(`invalid key: ${r}`)}function q1(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 Ao(r){if(!R1.test(r))throw new Error(`invalid bucket name: ${r}`)}var qn;(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"})(qn||(qn={}));class Ha{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",D1);v(this,"validateSearchKey",z1);v(this,"hasWildcards",q1);Ao(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=C0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Ao(s);const o=await n.jetstreamManager(),f=new Ha(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Ao(s);const h=new Ha(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Ng(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(C1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Cf.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 o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(O=>{const q=Object.assign({},O),M=q.name.startsWith(Zt)?q.name.substring(Zt.length):q.name;return q.name.startsWith(Zt)||(q.name=`${Zt}${q.name}`),!O.external&&M!==this.bucket&&(q.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),d=h?Rf(h,Ai("2.7.2"))>=0:!1;a.discard=d?Ba.New:Ba.Old;const{ok:g,min:y}=f.features.get(Ue.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}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 o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,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}`:`${C0}.${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 K1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new Z1(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 o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):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 o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=hs();f.headers=g,g.set(qn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!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 o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.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=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.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 o=await this.keys(n),f=[];for await(const h of o)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 o=this.encodeKey(n);this.validateKey(o);const f=hs();f.set(Bo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(qn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),nn,{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===jn.AllHistory&&(h=ft.All),s===jn.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,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,jn.AllHistory,o),g=d.filter_subject,y=Qs(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,O)=>{if(w){a.stop(w);return}if(O){const q=this.jmToEntry(O);a.push(q),a.received++,(f&&h>0&&a.received>=h||O.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,O=w.num_pending+w.delivered.consumer_seq;if(O===0||a.received>=O)try{f()}catch(q){a.stop(q)}finally{f=void 0}else h=O}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=jn.LastValue;n.include===jn.AllHistory?f=jn.AllHistory:n.include===jn.UpdatesOnly&&(f=jn.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Qs(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((q,M)=>{if(q){a.stop(q);return}if(M){const D=this.jmToEntry(M);if(h&&D.operation==="DEL")return;a.push(D),a.received++,d&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(d),d=void 0)}});const O=await this.js.subscribe(E,w);if(d){const{info:{last:q}}=O,M=q.num_pending+q.delivered.consumer_seq;if(M===0||a.received>=M)try{d()}catch(D){a.stop(D)}finally{d=void 0}else g=M}return a._data=O,a.iterClosed.then(()=>{O.unsubscribe()}),O.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,jn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Qs(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Bo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Cg(o,s)}}class Cg{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 eh(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!==Zs.None:!1}}const sh="OBJ_",k0="SHA-256=";function U1(r){return Ao(r),`${sh}${r}`}function B1(r){return r.startsWith(sh)?r.substring(4):r}class Uf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return B1(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!==Zs.None:!1}}function bo(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 yn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(yn||(yn={}));var Un;(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"})(Un||(Un={}));var wr;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(wr||(wr={}));const M0=Uint8Array.of(43,65,67,75),L1=Uint8Array.of(45,78,65,75),Aa=Uint8Array.of(43,87,80,73),H1=Uint8Array.of(43,78,88,84),P1=Uint8Array.of(43,84,69,82,77),$1=Uint8Array.of(32);function Pa(r,n=5e3){return new r_(r,n)}class pf extends _t{constructor(s,a,o=!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,o),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=o,this.timeout=null,this.inbox=fs(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:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,O,q,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Nf(y))return;const D=(O=y.headers)==null?void 0:O.code,W=((M=(q=y.headers)==null?void 0:q.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:se,bytesLeft:ee}=this.parseDiscard(y.headers);if(se>0||ee>0)this.pending.msgs-=se,this.pending.bytes-=ee,this.pending.requests--,this.notify(wr.Discard,{msgsLeft:se,bytesLeft:ee});else if(D===400){this.stop(new ue(W,`${D}`));return}else if(D===409&&W==="consumer deleted"){if(this.notify(Un.ConsumerDeleted,`${D} ${W}`),!this.refilling||this.abortOnMissingResource){const me=new ue(W,`${D}`);this.stop(me);return}}else if(D===503){if(this.notify(Un.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new ue("no responders",`${D}`);this.stop(me);return}}else this.notify(wr.DebugEvent,`${D} ${W}`)}else this._push(Pa(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 D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new nh(o,g=>(this.notify(Un.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 E of g)switch(E.type){case us.Disconnect:(y=this.monitor)==null||y.cancel();break;case us.Reconnect:this.resetPending().then(w=>{var O;w&&((O=this.monitor)==null||O.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(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.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 o=Wf([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(Un.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(Un.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=o.backoff(f),g=Or(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(wr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));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,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Y1 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 o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.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 Bf{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),o=Sr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new pf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await o.status())if(d.type===Un.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of o){s.resolve(d);break}})().catch(()=>{});const h=Sr(f);return o.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),o.close().catch()}),o.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(o=>(this._info=o,this._info))}}class G1{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=Ks.next(),typeof a.name_prefix=="string"&&(Go("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=yn.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,E;Ks.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 o=Wf([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(Un.OrderedConsumerRecreated,f.name);break}catch(O){if(O.message==="stream not found"&&((y=this.iter)==null||y.notify(Un.StreamNotFound,w),this.type===yn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(O),Promise.reject(O);if(s&&w>=this.maxInitialReset)throw O;await Or(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;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):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===yn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new Y1),this.consumer=new Bf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===yn.Fetch&&a?h=await this.consumer.fetch(n):this.type===yn.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(wr.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===yn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===yn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=yn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===yn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.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=yn.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 Lf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(Ue.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 Bf(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 Bf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new ih(a.nc,a.opts).info(n).then(f=>Promise.resolve(new G1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Fo{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 Fo(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 Lf(new zo(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Lf(new zo(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 ih extends Ya{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Ue.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,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(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=bo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(bo);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),o=Object.assign(a.config,s);o.mirror=bo(o.mirror),o.sources=(d=o.sources)==null?void 0:d.map(bo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);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],E=s||{};let w=0;for(;h>g;){w++,E.offset=d*w;const q=await this._request(a,E);h=q.total,y.push(q);const M=Object.getOwnPropertyNames(q.state.subjects).length;if(g+=M,M<d)break}let O={};for(let q=0;q<y.length;q++)f=y[q],f.state.subjects&&(O=Object.assign(O,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=O}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},o=`${this.prefix}.STREAM.LIST`;return new Ca(o,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:o,seq:f}=s;if(typeof o=="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 o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new kg(o)}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 Cg(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Ca(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(sh));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new Uf(d))},s=`${this.prefix}.STREAM.LIST`;return new Ca(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Ca(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Fo(this,s))}}class V1 extends Ya{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):nn,h=this.opts.apiPrefix||"$JS.API",d=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=vr(g);if(y)return Promise.reject(y);const E=new Hf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${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(o,f,{strategy:Tn.SentinelMsg});return(async()=>{var w,O,q;let g=!1,y=!1,E;for await(const M of d){if(!g){g=!0;const D=((w=M.headers)==null?void 0:w.code)||0;if(D!==0&&D<200||D>299){E=(O=M.headers)==null?void 0:O.description.toLowerCase();break}if(((q=M.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Hf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Hf{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(yr.Subject)}get seq(){const n=this.header.last(yr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(yr.TimeStamp)}get stream(){return this.header.last(yr.Stream)}json(n){return Nn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Hf,"jc");class F1 extends Ya{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new ih(s,a),this.consumers=new zo(s,a),this.direct=new V1(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,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class kg{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):nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Is.decode(n)}else this._header=hs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return Nn(n).decode(this.data)}string(){return en.decode(this.data)}}v(kg,"jc");class J1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Fo(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=Is.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 R0(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 I1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class qa{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 o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),d=Nn().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 Uf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Uf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var re;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.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=((re=n.options)==null?void 0:re.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:O}=this._checkNotEmpty(n.name);if(O)return Promise.reject(O);const q=Ks.next(),M=this._chunkSubject(q),D=this._metaSubject(w),W=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},R0(n)),se=st(),ee=[],me=new Ar;try{const C=s?s.getReader():null,X=w0.create();for(;;){const{done:ce,value:V}=C?await C.read():{done:!0,value:void 0};if(ce){if(me.size()>0){const ne=me.drain();X.update(ne),W.chunks++,W.size+=ne.length,ee.push(this.js.publish(M,ne,{timeout:f}))}await Promise.all(ee),ee.length=0,W.mtime=new Date().toISOString();const G=_r.encode(X.digest());W.digest=`${k0}${G}`,W.deleted=!1;const K=hs();typeof h=="number"&&K.set(qn.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(D,Nn().encode(W),{headers:K,timeout:f});if(W.revision=ae.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}se.resolve(new gf(W));break}if(V)for(me.fill(V);me.size()>y;){W.chunks++,W.size+=y;const G=me.drain(n.options.max_chunk_size);X.update(G),ee.push(this.js.publish(M,G,{timeout:f}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:M}),se.reject(C)}return se}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.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 Ar,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 o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await qa.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(k0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Mf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new gf(s),error:o};if(s.size===0)return f.data=I1(),o.resolve(null),Promise.resolve(f);let h;const d=Qs();d.orderedConsumer();const g=w0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,d);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(qv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof qa))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);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=Nn(),o=hs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),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:o,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=o;const h=Object.assign({},a,R0(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,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Nn(),h=Qs();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(o,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.${_r.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=U1(this.name)}catch(o){return Promise.reject(o)}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=Ba.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?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new qa(s,o,n);return await f.init(a),Promise.resolve(f)}}class Q1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_KV);return o?s.bindOnly?Ha.bind(this.js,n,s):Ha.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:o,min:f}=a.nc.features.get(Ue.JS_OBJECTSTORE);return o?qa.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class rh extends Ya{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new zo(s,a),this.streamAPI=new ih(s,a),this.consumers=new Lf(this.consumerAPI),this.streams=new J1(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 Q1(this)}async publish(s,a=nn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||hs();o&&(o.msgID&&f.set(qn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(qn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(qn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(qn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(qn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,d={};h&&(d.timeout=h),o&&(d.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let O=0;O<g;O++)try{E=await this.nc.request(s,a,d);break}catch(q){if(q.code==="503"&&O+1<g)await Or(y);else throw q}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),xr(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=vr(d);if(g)throw g;return Pa(d,this.timeout)}fetch(s,a,o={}){Mt(s),xr(a);let f=null;const h=(o.max_bytes??0)>0;let d=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const O=o.idle_heartbeat||0;O&&(E.idle_heartbeat=nt(O),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(O*4)));const q=new _t,M=E.batch;let D=0;q.protocolFilterFn=(ee,me=!1)=>Nf(ee.msg)?(y==null||y.work(),!1):!0,q.dispatchedFn=ee=>{if(ee){if(h&&(d+=ee.data.length),D++,f&&ee.info.pending===0)return;(q.getPending()===1&&ee.info.pending===0||M===D||g>0&&d>=g)&&q.stop()}};const W=fs(this.nc.options.inboxPrefix),se=this.nc.subscribe(W,{max:o.batch,callback:(ee,me)=>{ee===null&&(ee=vr(me)),ee!==null?(f&&(f.cancel(),f=null),yv(ee)?q.stop(Rg(ee)===null?void 0:ee):q.stop(ee)):(y==null||y.work(),q.received++,q.push(Pa(me,this.timeout)))}});return w&&(f=Sr(w),f.catch(()=>{se.isClosed()||(se.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{O&&(y=new nh(O,ee=>(q.push(()=>{q.err=new ue(`${bn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await se.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:W}),q}async pullSubscribe(s,a=Qs()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.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(o),d=new W1(this,o.deliver,h);d.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Qs()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new Mg(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Qs()){const o=b0(a)?a.getOpts():a;if(o.isBind=b0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=fs(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.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=o.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}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||fs(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=e_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=rh.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Tf(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=s_),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:Er.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,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(vr(h.msg)||(g=f.monitor)==null||g.work(),Nf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Tf(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class ah{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=b1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new ah(n);Uo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(d=>{d.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.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 Tg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=nn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||Tn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.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=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(fs(this.options.inboxPrefix),{callback:(M,D)=>{var W,se;if(((W=D==null?void 0:D.data)==null?void 0:W.length)===0&&((se=D==null?void 0:D.headers)==null?void 0:se.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
48
48
 
49
- ${g}`),w(M);return}d(null,D),a.strategy===Tn.Count&&(y--,y===0&&w()),a.strategy===Tn.JitterTimer&&(q(),j=setTimeout(()=>{w()},300)),a.strategy===Tn.SentinelMsg&&D&&D.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{h()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),q(),E.drain().then(()=>{h()}).catch(D=>{h()})};f.iterClosed.then(()=>{q(),E==null||E.unsubscribe()}).catch(M=>{q(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let j=setTimeout(()=>{w()},a.maxWait);const q=()=>{j&&clearTimeout(j)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new Hv(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(E){y.cancel(E)}}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 o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new ue("timeout",ie.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new ue("reply can only be used with noMux",ie.InvalidOption));if(a.noMux){const f=a.reply?a.reply:us(this.options.inboxPrefix),h=st(),d=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(d&&y.code!==ie.Timeout&&(y.stack+=`
49
+ ${g}`),w(M);return}d(null,D),a.strategy===Tn.Count&&(y--,y===0&&w()),a.strategy===Tn.JitterTimer&&(q(),O=setTimeout(()=>{w()},300)),a.strategy===Tn.SentinelMsg&&D&&D.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{h()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),q(),E.drain().then(()=>{h()}).catch(D=>{h()})};f.iterClosed.then(()=>{q(),E==null||E.unsubscribe()}).catch(M=>{q(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let O=setTimeout(()=>{w()},a.maxWait);const q=()=>{O&&clearTimeout(O)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new Uv(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(E){y.cancel(E)}}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 o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new ue("timeout",ie.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new ue("reply can only be used with noMux",ie.InvalidOption));if(a.noMux){const f=a.reply?a.reply:fs(this.options.inboxPrefix),h=st(),d=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(d&&y.code!==ie.Timeout&&(y.stack+=`
50
50
 
51
- ${d.stack}`),g.unsubscribe(),h.reject(y)):(y=gg(E),y?(d&&(y.stack+=`
51
+ ${d.stack}`),g.unsubscribe(),h.reject(y)):(y=xg(E),y?(d&&(y.stack+=`
52
52
 
53
- ${d.stack}`),h.reject(y)):h.resolve(E))}});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,o);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(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.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 I1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new nh(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.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 W1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class W1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new $a(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new M1(this.nc,n,s)}}class e_{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(Bo)||"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 t_{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(Bo))||"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 Gv{constructor(s,a,o){super(s.nc,a,o);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=us(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.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,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(Kf(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=d=>{var E,w,j,q;const g=Ev(409,`${bn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((j=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(M+1),(q=this.monitor)==null||q.restart(),!1}return!f.noIterator};this.monitor=new Wf(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=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=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class n_ extends Ng{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,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(Ue.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,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(h),{reply:w})}}}function s_(r,n){return r?r_(n):i_(n)}function i_(r){return(n,s)=>n?[n,null]:(n=vr(s),n?[n,null]:[null,La(s,r)])}function r_(r){return(n,s)=>{if(n)return[n,null];const a=vr(s);return a!==null?[Cg(a),null]:[null,La(s,r)]}}function Cg(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return Av(r)?r:null;default:return r}return null}function a_(r){r&&r.ack()}function l_(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 o_{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=l_(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]===Ea[0]&&n[1]===Ea[1]&&n[2]===Ea[2]&&n[3]===Ea[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,T0,{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(T0)}nak(n){let s=$1;n&&(s=Af().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Ea)}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 o=Nn().encode(a),f=Ar.concat(Y1,V1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=G1;(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 c_="1.30.3",u_="nats.ws";class f_{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=c_,this.lang=u_,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 ue("tls",ie.InvalidOption)),a;this.options=s;const o=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=o.indexOf("wss://")===0,this.socket=new WebSocket(o);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=Ar.concat(...this.yields),d=Xv(h);if(d!==""){const g=E1.exec(d);if(!g){s.debug&&console.error("!!!",mo(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);w1(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 ue(h.message,ie.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 Or(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(`> ${mo(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(`< ${mo(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${mo(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 h_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="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(o){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 d_(r={}){return Vv({defaultPort:443,urlParseFn:h_,factory:()=>new f_}),sh.connect(r)}const m_=null,p_=null,g_="lt.events";function kg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Ya=T.createContext({connected:!1,subscribe:()=>()=>{}});function y_(){const{connected:r}=T.useContext(Ya);return{connected:r}}function b_(r,n){const{subscribe:s}=T.useContext(Ya),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const x_=T.createContext({connected:!1,subscribe:()=>()=>{}}),v_=Af();function __({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),d=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((j,q)=>{const M=g.current;return M.has(j)||M.set(j,new Set),M.get(j).add(q),()=>{const D=M.get(j);D&&(D.delete(q),D.size===0&&M.delete(j))}},[]),E=T.useCallback((j,q)=>{for(const[M,D]of g.current)if(kg(j,M))for(const W of D)try{W(q)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const j=n||m_;if(!j){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await d_({servers:j,token:s||p_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,h(!0);const M=q.subscribe("lt.>");o.current=M,(async()=>{for await(const D of M)try{const W=JSON.parse(v_.decode(D.data));E(D.subject,W)}catch{}})(),(async()=>{for await(const D of q.status())D.type==="disconnect"||D.type==="error"?h(!1):D.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),m.jsx(x_.Provider,{value:{connected:f,subscribe:y},children:m.jsx(Ya.Provider,{value:{connected:f,subscribe:y},children:r})})}const Ln=Object.create(null);Ln.open="0";Ln.close="1";Ln.ping="2";Ln.pong="3";Ln.message="4";Ln.upgrade="5";Ln.noop="6";const Oo=Object.create(null);Object.keys(Ln).forEach(r=>{Oo[Ln[r]]=r});const Lf={type:"error",data:"parser error"},Mg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Rg=typeof ArrayBuffer=="function",Dg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,ih=({type:r,data:n},s,a)=>Mg&&n instanceof Blob?s?a(n):C0(n,a):Rg&&(n instanceof ArrayBuffer||Dg(n))?s?a(n):C0(new Blob([n]),a):a(Ln[r]+(n||"")),C0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function k0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let yf;function w_(r,n){if(Mg&&r.data instanceof Blob)return r.data.arrayBuffer().then(k0).then(n);if(Rg&&(r.data instanceof ArrayBuffer||Dg(r.data)))return n(k0(r.data));ih(r,!1,s=>{yf||(yf=new TextEncoder),n(yf.encode(s))})}const M0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ca=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<M0.length;r++)Ca[M0.charCodeAt(r)]=r;const S_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ca[r.charCodeAt(a)],h=Ca[r.charCodeAt(a+1)],d=Ca[r.charCodeAt(a+2)],g=Ca[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|d>>2,E[o++]=(d&3)<<6|g&63;return y},E_=typeof ArrayBuffer=="function",rh=(r,n)=>{if(typeof r!="string")return{type:"message",data:zg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:A_(r.substring(1),n)}:Oo[s]?r.length>1?{type:Oo[s],data:r.substring(1)}:{type:Oo[s]}:Lf},A_=(r,n)=>{if(E_){const s=S_(r);return zg(s,n)}else return{base64:!0,data:r}},zg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},qg="",O_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{ih(f,!1,d=>{a[h]=d,++o===s&&n(a.join(qg))})})},j_=(r,n)=>{const s=r.split(qg),a=[];for(let o=0;o<s.length;o++){const f=rh(s[o],n);if(a.push(f),f.type==="error")break}return a};function T_(){return new TransformStream({transform(r,n){w_(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let bf;function bo(r){return r.reduce((n,s)=>n+s.length,0)}function xo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=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 N_(r,n){bf||(bf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(bo(s)<1)break;const g=xo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(bo(s)<2)break;const g=xo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(bo(s)<8)break;const g=xo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){d.enqueue(Lf);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(bo(s)<o)break;const g=xo(s,o);d.enqueue(rh(f?g:bf.decode(g),n)),a=0}if(o===0||o>r){d.enqueue(Lf);break}}}})}const Ug=4;function gt(r){if(r)return C_(r)}function C_(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,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,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,o=s.length;a<o;++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 Jo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),xn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),k_="arraybuffer";function Bg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const M_=xn.setTimeout,R_=xn.clearTimeout;function Qo(r,n){n.useNativeTimers?(r.setTimeoutFn=M_.bind(xn),r.clearTimeoutFn=R_.bind(xn)):(r.setTimeoutFn=xn.setTimeout.bind(xn),r.clearTimeoutFn=xn.clearTimeout.bind(xn))}const D_=1.33;function z_(r){return typeof r=="string"?q_(r):Math.ceil((r.byteLength||r.size)*D_)}function q_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;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 Lg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function U_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function B_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class L_ 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,Qo(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 L_(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=U_(n);return s.length?"?"+s:""}}class H_ 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)};j_(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,O_(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]=Lg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Hg=!1;try{Hg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const P_=Hg;function $_(){}class Y_ extends H_{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",(o,f)=>{this.onError("xhr post error",o,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 Bn extends gt{constructor(n,s,a){super(),this.createRequest=n,Qo(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=Bg(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 o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}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 o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.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(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Bn.requestsCount++,Bn.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=$_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Bn.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()}}Bn.requestsCount=0;Bn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",R0);else if(typeof addEventListener=="function"){const r="onpagehide"in xn?"pagehide":"unload";addEventListener(r,R0,!1)}}function R0(){for(let r in Bn.requests)Bn.requests.hasOwnProperty(r)&&Bn.requests[r].abort()}const G_=(function(){const r=Pg({xdomain:!1});return r&&r.responseType!==null})();class V_ extends Y_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=G_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Bn(Pg,this.uri(),n)}}function Pg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||P_))return new XMLHttpRequest}catch{}if(!n)try{return new xn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const $g=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class F_ extends ah{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=$g?{}:Bg(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(o){return this.emitReserved("error",o)}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],o=s===n.length-1;ih(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Jo(()=>{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]=Lg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const xf=xn.WebSocket||xn.MozWebSocket;class J_ extends F_{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 Q_ 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=N_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=T_();o.readable.pipeTo(n.writable),this._writer=o.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],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const I_={websocket:J_,webtransport:Q_,polling:V_},X_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,K_=["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 o=X_.exec(r||""),f={},h=14;for(;h--;)f[K_[h]]=o[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=Z_(f,f.path),f.queryKey=W_(f,f.query),f}function Z_(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 W_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Pf=typeof addEventListener=="function"&&typeof removeEventListener=="function",jo=[];Pf&&addEventListener("offline",()=>{jo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=k_,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);Qo(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 o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=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=B_(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"})},jo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Ug,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=z_(o)),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,Jo(()=>{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,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=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),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Pf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=jo.indexOf(this._offlineEventListener);a!==-1&&jo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=Ug;class ew extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),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,E(),s.close(),s=null)}const h=w=>{const j=new Error("probe error: "+w);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",o),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 tw=class extends ew{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(o=>I_[o]).filter(o=>!!o)),super(n,a)}};function nw(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 sw=typeof ArrayBuffer=="function",iw=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Yg=Object.prototype.toString,rw=typeof Blob=="function"||typeof Blob<"u"&&Yg.call(Blob)==="[object BlobConstructor]",aw=typeof File=="function"||typeof File<"u"&&Yg.call(File)==="[object FileConstructor]";function lh(r){return sw&&(r instanceof ArrayBuffer||iw(r))||rw&&r instanceof Blob||aw&&r instanceof File}function To(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(To(r[s]))return!0;return!1}if(lh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return To(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&To(r[s]))return!0;return!1}function lw(r){const n=[],s=r.data,a=r;return a.data=$f(s,n),a.attachments=n.length,{packet:a,buffers:n}}function $f(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]=$f(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]=$f(r[a],n));return s}return r}function ow(r,n){return r.data=Yf(r.data,n),delete r.attachments,r}function Yf(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]=Yf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Yf(r[s],n));return r}const cw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var qe;(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"})(qe||(qe={}));class uw{constructor(n){this.replacer=n}encode(n){return(n.type===qe.EVENT||n.type===qe.ACK)&&To(n)?this.encodeAsBinary({type:n.type===qe.EVENT?qe.BINARY_EVENT:qe.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===qe.BINARY_EVENT||n.type===qe.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=lw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class oh 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===qe.BINARY_EVENT;a||s.type===qe.BINARY_ACK?(s.type=a?qe.EVENT:qe.ACK,this.reconstructor=new fw(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(qe[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===qe.BINARY_EVENT||a.type===qe.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(!hw(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 o=n.charAt(s+1);if(o!==""&&Number(o)==o){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(oh.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 qe.CONNECT:return D0(s);case qe.DISCONNECT:return s===void 0;case qe.CONNECT_ERROR:return typeof s=="string"||D0(s);case qe.EVENT:case qe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&cw.indexOf(s[0])===-1);case qe.ACK:case qe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class fw{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=ow(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const hw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function D0(r){return Object.prototype.toString.call(r)==="[object Object]"}const dw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:oh,Encoder:uw,get PacketType(){return qe}},Symbol.toStringTag,{value:"Module"}));function jn(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const mw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Gg 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=[jn(n,"open",this.onopen.bind(this)),jn(n,"packet",this.onpacket.bind(this)),jn(n,"error",this.onerror.bind(this)),jn(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,o,f;if(mw.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:qe.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const d=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.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 o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===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"))},o),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,d)=>h?o(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((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(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:qe.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 qe.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 qe.EVENT:case qe.BINARY_EVENT:this.onevent(n);break;case qe.ACK:case qe.BINARY_ACK:this.onack(n);break;case qe.DISCONNECT:this.ondisconnect();break;case qe.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(...o){a||(a=!0,s.packet({type:qe.ACK,id:n,data:o}))}}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:qe.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 jr(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}jr.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};jr.prototype.reset=function(){this.attempts=0};jr.prototype.setMin=function(r){this.ms=r};jr.prototype.setMax=function(r){this.max=r};jr.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,Qo(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 jr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||dw;this.encoder=new o.Encoder,this.decoder=new o.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 tw(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=jn(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=jn(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),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(jn(n,"ping",this.onping.bind(this)),jn(n,"data",this.ondata.bind(this)),jn(n,"error",this.onerror.bind(this)),jn(n,"close",this.onclose.bind(this)),jn(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){Jo(()=>{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 Gg(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(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):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 Aa={};function No(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=nw(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Aa[o]&&f in Aa[o].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Gf(a,n):(Aa[o]||(Aa[o]=new Gf(a,n)),g=Aa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(No,{Manager:Gf,Socket:Gg,io:No,connect:No});const pw=T.createContext({connected:!1,subscribe:()=>()=>{}});function gw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.useCallback((d,g)=>{const y=o.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const E=y.get(d);E&&(E.delete(g),E.size===0&&y.delete(d))}},[]),h=T.useCallback((d,g)=>{for(const[y,E]of o.current)if(kg(d,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const d=hg(),g=No({path:`${Wt}/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,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),m.jsx(pw.Provider,{value:{connected:s,subscribe:f},children:m.jsx(Ya.Provider,{value:{connected:s,subscribe:f},children:r})})}function yw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Wt}/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(),E=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,j=null;const q=hg();if(q)try{const M=await fetch(`${Wt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(M.ok){const D=await M.json();w=D.natsWsUrl??w,j=D.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:j})}s(E==="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"?m.jsx(__,{url:a.url,token:a.token,children:r}):n==="socketio"?m.jsx(gw,{children:r}):m.jsx(m.Fragment,{children:r})}function Vg(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),a=r||s("engineer"),o=n("admin"),f=r||n("admin");return{isBuilder:a,isOps:o,canBulk:f}}const Vf="lt_ai_override";function bw(){return Xe("/settings")}function Ff(){try{if(localStorage.getItem(Vf)==="off")return!1}catch{}return null}function xw(){var s;const r=Hn({queryKey:["settings"],queryFn:bw,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 vw(){const[r,n]=T.useState(()=>Ff()===!1),s=T.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=T.createContext(null),z0="lt_sidebar_collapsed";function _w({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(z0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(z0,String(f))}catch{}return f})},[]);return m.jsx(Fg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Jg(){const r=T.useContext(Fg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function RE(r){const n=r?`?period=${r}`:"";return Hn({queryKey:["escalationStats",r],queryFn:()=>Xe(`/escalations/stats${n}`)})}function DE(){return Hn({queryKey:["escalationTypes"],queryFn:()=>Xe("/escalations/types")})}function ww(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),Hn({queryKey:["escalations",a],queryFn:()=>Xe(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function Sw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),Hn({queryKey:["escalations","available",a],queryFn:()=>Xe(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function zE(r){return Hn({queryKey:["escalations","by-workflow",r],queryFn:()=>Xe(`/escalations/by-workflow/${r}`),enabled:!!r})}function qE(r){return Hn({queryKey:["escalations",r],queryFn:()=>Xe(`/escalations/${r}`),enabled:!!r})}function UE(){const r=Cn();return Pn({mutationFn:({id:n,durationMinutes:s})=>Xe(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function BE(){const r=Cn();return Pn({mutationFn:n=>Xe(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function LE(){const r=Cn();return Pn({mutationFn:({id:n,resolverPayload:s})=>Xe(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function HE(){const r=Cn();return Pn({mutationFn:({id:n,targetRole:s})=>Xe(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function PE(){const r=Cn();return Pn({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 $E(){const r=Cn();return Pn({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 YE(){const r=Cn();return Pn({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 GE(){const r=Cn();return Pn({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 VE(){const r=Cn();return Pn({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 Ew(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=Cn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);b_(`${g_}.system.escalation.>`,o);const{data:f}=Sw({limit:1}),{data:h}=ww({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(h==null?void 0:h.total)??0}}function ch({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=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 m.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[m.jsx("img",{src:`${Wt}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),m.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function Aw({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{isBuilder:o}=Vg(),{available:f,mine:h}=Ew(),{connected:d}=y_(),{toggleAIOverride:g}=vw(),[y,E]=T.useState(!1),w=T.useRef(null);return T.useEffect(()=>{if(!y)return;const j=q=>{w.current&&!w.current.contains(q.target)&&E(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[y]),m.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:[m.jsx("div",{className:"flex items-center gap-4",children:m.jsx(gr,{to:"/","aria-label":"Home",onClick:j=>{(j.ctrlKey||j.metaKey)&&(j.preventDefault(),g())},children:m.jsx(ch,{})})}),m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsxs(gr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[m.jsx(Zp,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"available",f>0&&m.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),m.jsxs(gr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${h>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[m.jsx(Zp,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",h>0&&m.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:h})]}),o&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"w-px h-4 bg-surface-border"}),m.jsxs("button",{type:"button",onClick:()=>{d?r==null||r():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${d?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:d?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[m.jsx(ag,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),m.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:[m.jsx(lg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&m.jsxs("div",{className:"relative",ref:w,children:[m.jsxs("button",{onClick:()=>E(j=>!j),className:"btn-ghost text-xs flex items-center gap-1",children:[m.jsx(Ax,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,m.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y&&m.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:[m.jsx(gr,{to:"/credentials",onClick:()=>E(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),m.jsx("button",{onClick:()=>{E(!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]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),m.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:m.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",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function Ow(){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 jw({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(d=>s.startsWith(d)),[o,f]=T.useState(a),h=o||a;return n?m.jsx(m.Fragment,{children:r.items.map(d=>m.jsx(Co,{to:d.to,className:Jf(!0),title:d.label,children:d.icon&&m.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):m.jsxs("div",{children:[m.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:[m.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:r.label})]}),m.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:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m.jsx(uh,{open:h,children:r.items.map(d=>m.jsxs(Co,{to:d.to,end:d.end,className:Ow(),children:[d.icon&&m.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:d.label})]},d.to))})]})}function Tw(r){return r.kind==="group"}function Nw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=Jf(n)({isActive:d});return m.jsxs(Co,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}return m.jsxs(Co,{to:r.to,end:r.end,className:Jf(n),title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}function Ga({heading:r,entries:n}){const{collapsed:s}=Jg();return m.jsxs("div",{className:"space-y-1",children:[s?m.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):m.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>Tw(a)?m.jsx(jw,{group:a,collapsed:s},a.label):m.jsx(Nw,{entry:a,collapsed:s},a.to))]})}function Cw({aiEnabled:r=!1,isBuilder:n=!1}){const s=[{to:"/",label:"Recent Activity",icon:Ox,end:!0}];return n&&s.push({to:"/capabilities",label:"Capabilities",icon:jx},{to:"/agents",label:r?"Agents":"Automations",icon:Tx},{to:"/topics",label:"Topics",icon:ag}),m.jsx(Ga,{heading:"Work",entries:s})}function kw(){const r=[{kind:"group",label:"Workflows",icon:kx,matchPaths:["/workflows/registry","/workflows/start","/workflows/workers"],items:[{to:"/workflows/registry",label:"Configure",icon:Nx},{to:"/workflows/start",label:"Invoke",icon:Cx}]},{kind:"group",label:"Executions",icon:Dx,matchPaths:["/workflows/executions","/mcp/executions"],items:[{to:"/workflows/executions",label:"Workflows",icon:Mx},{to:"/mcp/executions",label:"Pipelines",icon:Rx}]}];return m.jsx(Ga,{heading:"Build",entries:r})}const Mw=[{to:"/mcp/queries",label:"Designer",icon:zx},{to:"/mcp/servers",label:"Servers & Tools",icon:qx},{to:"/mcp/workflows",label:"Pipeline Tools",icon:Ux}];function Rw(){return m.jsx(Ga,{heading:"Design",entries:Mw})}const Dw=[{to:"/files",label:"Files",icon:Bx},{to:"/knowledge",label:"Knowledge",icon:Lx}];function zw(){return m.jsx(Ga,{heading:"Storage",entries:Dw})}function qw({isBuilder:r=!1}){const n=[{to:"/admin/users",label:"Accounts",icon:Hx},...r?[{to:"/admin/roles",label:"Roles & Permissions",icon:Px}]:[]],s=[{kind:"group",label:"Identity & Access",icon:$x,matchPaths:n.map(a=>a.to),items:n}];return r&&s.push({kind:"group",label:"Infrastructure",icon:Fx,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:Yx},{to:"/admin/streams",label:"Messages",icon:Gx},{to:"/admin/maintenance",label:"DB Maintenance",icon:Vx}]}),m.jsx(Ga,{heading:"Admin",entries:s})}const Qg="lt_event_feed_patterns";function Uw(r){if(r.startsWith("/topics/")){const f=decodeURIComponent(r.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=r.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(r.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=r.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const o=r.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.activity.${o[1]}.>`:r.startsWith("/mcp")?"lt.events.system.activity.>":"lt.events.system.>"}function Bw(){try{const r=localStorage.getItem(Qg);return r?JSON.parse(r):[]}catch{return[]}}function vf(r){try{localStorage.setItem(Qg,JSON.stringify(r))}catch{}}function Lw(){const{pathname:r}=Ws(),[n,s]=T.useState(Bw),a=T.useMemo(()=>Uw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return vf(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return vf(E),E})},[]),d=T.useCallback(()=>{s([]),vf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:d}}function Hw({children:r,className:n=""}){return m.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const _f=280,q0="cubic-bezier(0.4, 0, 0.2, 1)",vo=40;function Pw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-vo*2,o=s-vo*2,f=r.width/a,h=r.height/o,d=r.left+r.width/2-(vo+a/2),g=r.top+r.height/2-(vo+o/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Ig({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),d=T.useRef(!1);T.useEffect(()=>{var j,q;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&o==="open"&&(h.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const j=q=>{q.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o,n]);const g=T.useCallback(j=>{j.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const j=setTimeout(()=>f(null),_f+50);return()=>clearTimeout(j)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?Pw(h.current):"none",w=y?0:1;return ig.createPortal(m.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${_f}ms ${q0}, opacity ${_f}ms ${q0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function $w({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Yw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Gw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Vw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Fw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Jw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Qw(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]),o=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=o.map(d=>`<tr class="border-t border-surface-border">${s(d).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</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 _o(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Iw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,w)=>Qw(`${y}
53
+ ${d.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new wg(this.protocol.muxSubscriptions,n,a,o);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(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.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 F1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new rh(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.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 X1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class X1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Ga(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new N1(this.nc,n,s)}}class K1{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(Bo)||"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 Z1{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(eh(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Bo))||"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 Mg extends Pv{constructor(s,a,o){super(s.nc,a,o);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=fs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.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,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(eh(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=d=>{var E,w,O,q;const g=_v(409,`${bn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((O=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:O.stream_seq)||0;return this._resetOrderedConsumer(M+1),(q=this.monitor)==null||q.restart(),!1}return!f.noIterator};this.monitor=new nh(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=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=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class W1 extends Mg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,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(Ue.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,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(h),{reply:w})}}}function e_(r,n){return r?n_(n):t_(n)}function t_(r){return(n,s)=>n?[n,null]:(n=vr(s),n?[n,null]:[null,Pa(s,r)])}function n_(r){return(n,s)=>{if(n)return[n,null];const a=vr(s);return a!==null?[Rg(a),null]:[null,Pa(s,r)]}}function Rg(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return wv(r)?r:null;default:return r}return null}function s_(r){r&&r.ack()}function i_(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 r_{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=i_(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]===Aa[0]&&n[1]===Aa[1]&&n[2]===Aa[2]&&n[3]===Aa[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 wg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,M0,{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(M0)}nak(n){let s=L1;n&&(s=Of().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Aa)}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 o=Nn().encode(a),f=Ar.concat(H1,$1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=P1;(n==null?void 0:n.length)>0&&(s=Of().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const a_="1.30.3",l_="nats.ws";class o_{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=a_,this.lang=l_,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 ue("tls",ie.InvalidOption)),a;this.options=s;const o=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=o.indexOf("wss://")===0,this.socket=new WebSocket(o);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=Ar.concat(...this.yields),d=Jv(h);if(d!==""){const g=_1.exec(d);if(!g){s.debug&&console.error("!!!",po(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);x1(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 ue(h.message,ie.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 Or(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(`> ${po(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(`< ${po(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${po(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 c_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="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(o){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 u_(r={}){return $v({defaultPort:443,urlParseFn:c_,factory:()=>new o_}),ah.connect(r)}const f_=null,h_=null,d_="lt.events";function Dg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Va=T.createContext({connected:!1,subscribe:()=>()=>{}});function m_(){const{connected:r}=T.useContext(Va);return{connected:r}}function p_(r,n){const{subscribe:s}=T.useContext(Va),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const g_=T.createContext({connected:!1,subscribe:()=>()=>{}}),y_=Of();function b_({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),d=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((O,q)=>{const M=g.current;return M.has(O)||M.set(O,new Set),M.get(O).add(q),()=>{const D=M.get(O);D&&(D.delete(q),D.size===0&&M.delete(O))}},[]),E=T.useCallback((O,q)=>{for(const[M,D]of g.current)if(Dg(O,M))for(const W of D)try{W(q)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const O=n||f_;if(!O){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await u_({servers:O,token:s||h_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,h(!0);const M=q.subscribe("lt.>");o.current=M,(async()=>{for await(const D of M)try{const W=JSON.parse(y_.decode(D.data));E(D.subject,W)}catch{}})(),(async()=>{for await(const D of q.status())D.type==="disconnect"||D.type==="error"?h(!1):D.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),m.jsx(g_.Provider,{value:{connected:f,subscribe:y},children:m.jsx(Va.Provider,{value:{connected:f,subscribe:y},children:r})})}const Ln=Object.create(null);Ln.open="0";Ln.close="1";Ln.ping="2";Ln.pong="3";Ln.message="4";Ln.upgrade="5";Ln.noop="6";const jo=Object.create(null);Object.keys(Ln).forEach(r=>{jo[Ln[r]]=r});const Pf={type:"error",data:"parser error"},zg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",qg=typeof ArrayBuffer=="function",Ug=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,lh=({type:r,data:n},s,a)=>zg&&n instanceof Blob?s?a(n):D0(n,a):qg&&(n instanceof ArrayBuffer||Ug(n))?s?a(n):D0(new Blob([n]),a):a(Ln[r]+(n||"")),D0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function z0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let yf;function x_(r,n){if(zg&&r.data instanceof Blob)return r.data.arrayBuffer().then(z0).then(n);if(qg&&(r.data instanceof ArrayBuffer||Ug(r.data)))return n(z0(r.data));lh(r,!1,s=>{yf||(yf=new TextEncoder),n(yf.encode(s))})}const q0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ka=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<q0.length;r++)ka[q0.charCodeAt(r)]=r;const v_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=ka[r.charCodeAt(a)],h=ka[r.charCodeAt(a+1)],d=ka[r.charCodeAt(a+2)],g=ka[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|d>>2,E[o++]=(d&3)<<6|g&63;return y},__=typeof ArrayBuffer=="function",oh=(r,n)=>{if(typeof r!="string")return{type:"message",data:Bg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:w_(r.substring(1),n)}:jo[s]?r.length>1?{type:jo[s],data:r.substring(1)}:{type:jo[s]}:Pf},w_=(r,n)=>{if(__){const s=v_(r);return Bg(s,n)}else return{base64:!0,data:r}},Bg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Lg="",S_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{lh(f,!1,d=>{a[h]=d,++o===s&&n(a.join(Lg))})})},E_=(r,n)=>{const s=r.split(Lg),a=[];for(let o=0;o<s.length;o++){const f=oh(s[o],n);if(a.push(f),f.type==="error")break}return a};function A_(){return new TransformStream({transform(r,n){x_(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let bf;function xo(r){return r.reduce((n,s)=>n+s.length,0)}function vo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=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 j_(r,n){bf||(bf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(xo(s)<1)break;const g=vo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(xo(s)<2)break;const g=vo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(xo(s)<8)break;const g=vo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){d.enqueue(Pf);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(xo(s)<o)break;const g=vo(s,o);d.enqueue(oh(f?g:bf.decode(g),n)),a=0}if(o===0||o>r){d.enqueue(Pf);break}}}})}const Hg=4;function gt(r){if(r)return O_(r)}function O_(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,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,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,o=s.length;a<o;++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 Jo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),xn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),T_="arraybuffer";function Pg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const N_=xn.setTimeout,C_=xn.clearTimeout;function Io(r,n){n.useNativeTimers?(r.setTimeoutFn=N_.bind(xn),r.clearTimeoutFn=C_.bind(xn)):(r.setTimeoutFn=xn.setTimeout.bind(xn),r.clearTimeoutFn=xn.clearTimeout.bind(xn))}const k_=1.33;function M_(r){return typeof r=="string"?R_(r):Math.ceil((r.byteLength||r.size)*k_)}function R_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;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 $g(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function D_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function z_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class q_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class ch extends gt{constructor(n){super(),this.writable=!1,Io(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 q_(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=oh(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=D_(n);return s.length?"?"+s:""}}class U_ extends ch{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)};E_(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,S_(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]=$g()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Yg=!1;try{Yg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const B_=Yg;function L_(){}class H_ extends U_{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",(o,f)=>{this.onError("xhr post error",o,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 Bn extends gt{constructor(n,s,a){super(),this.createRequest=n,Io(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=Pg(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 o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}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 o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.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(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Bn.requestsCount++,Bn.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=L_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Bn.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()}}Bn.requestsCount=0;Bn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",U0);else if(typeof addEventListener=="function"){const r="onpagehide"in xn?"pagehide":"unload";addEventListener(r,U0,!1)}}function U0(){for(let r in Bn.requests)Bn.requests.hasOwnProperty(r)&&Bn.requests[r].abort()}const P_=(function(){const r=Gg({xdomain:!1});return r&&r.responseType!==null})();class $_ extends H_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=P_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Bn(Gg,this.uri(),n)}}function Gg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||B_))return new XMLHttpRequest}catch{}if(!n)try{return new xn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Vg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Y_ extends ch{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Vg?{}:Pg(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(o){return this.emitReserved("error",o)}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],o=s===n.length-1;lh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Jo(()=>{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]=$g()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const xf=xn.WebSocket||xn.MozWebSocket;class G_ extends Y_{createSocket(n,s,a){return Vg?new xf(n,s,a):s?new xf(n,s):new xf(n)}doWrite(n,s){this.ws.send(s)}}class V_ extends ch{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=j_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=A_();o.readable.pipeTo(n.writable),this._writer=o.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],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const F_={websocket:G_,webtransport:V_,polling:$_},J_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,I_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $f(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 o=J_.exec(r||""),f={},h=14;for(;h--;)f[I_[h]]=o[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=Q_(f,f.path),f.queryKey=X_(f,f.query),f}function Q_(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 X_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Yf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oo=[];Yf&&addEventListener("offline",()=>{Oo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=T_,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=$f(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=$f(s.host).host);Io(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 o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=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=z_(this.opts.query)),Yf&&(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"})},Oo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Hg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=M_(o)),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,Jo(()=>{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,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=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),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Yf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Oo.indexOf(this._offlineEventListener);a!==-1&&Oo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=Hg;class K_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const O=new Error("probe error");O.transport=s.name,this.emitReserved("upgradeError",O)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const O=new Error("probe error: "+w);O.transport=s.name,f(),this.emitReserved("upgradeError",O)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",o),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 Z_=class extends K_{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(o=>F_[o]).filter(o=>!!o)),super(n,a)}};function W_(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=$f(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 ew=typeof ArrayBuffer=="function",tw=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Fg=Object.prototype.toString,nw=typeof Blob=="function"||typeof Blob<"u"&&Fg.call(Blob)==="[object BlobConstructor]",sw=typeof File=="function"||typeof File<"u"&&Fg.call(File)==="[object FileConstructor]";function uh(r){return ew&&(r instanceof ArrayBuffer||tw(r))||nw&&r instanceof Blob||sw&&r instanceof File}function To(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(To(r[s]))return!0;return!1}if(uh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return To(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&To(r[s]))return!0;return!1}function iw(r){const n=[],s=r.data,a=r;return a.data=Gf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Gf(r,n){if(!r)return r;if(uh(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]=Gf(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]=Gf(r[a],n));return s}return r}function rw(r,n){return r.data=Vf(r.data,n),delete r.attachments,r}function Vf(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]=Vf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Vf(r[s],n));return r}const aw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var qe;(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"})(qe||(qe={}));class lw{constructor(n){this.replacer=n}encode(n){return(n.type===qe.EVENT||n.type===qe.ACK)&&To(n)?this.encodeAsBinary({type:n.type===qe.EVENT?qe.BINARY_EVENT:qe.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===qe.BINARY_EVENT||n.type===qe.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=iw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class fh 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===qe.BINARY_EVENT;a||s.type===qe.BINARY_ACK?(s.type=a?qe.EVENT:qe.ACK,this.reconstructor=new ow(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(uh(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(qe[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===qe.BINARY_EVENT||a.type===qe.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(!cw(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 o=n.charAt(s+1);if(o!==""&&Number(o)==o){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(fh.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 qe.CONNECT:return B0(s);case qe.DISCONNECT:return s===void 0;case qe.CONNECT_ERROR:return typeof s=="string"||B0(s);case qe.EVENT:case qe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&aw.indexOf(s[0])===-1);case qe.ACK:case qe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ow{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=rw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const cw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function B0(r){return Object.prototype.toString.call(r)==="[object Object]"}const uw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:fh,Encoder:lw,get PacketType(){return qe}},Symbol.toStringTag,{value:"Module"}));function On(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const fw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Jg 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,o,f;if(fw.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:qe.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const d=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.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 o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===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"))},o),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,d)=>h?o(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((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(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:qe.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 qe.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 qe.EVENT:case qe.BINARY_EVENT:this.onevent(n);break;case qe.ACK:case qe.BINARY_ACK:this.onack(n);break;case qe.DISCONNECT:this.ondisconnect();break;case qe.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(...o){a||(a=!0,s.packet({type:qe.ACK,id:n,data:o}))}}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:qe.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 Tr(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}Tr.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};Tr.prototype.reset=function(){this.attempts=0};Tr.prototype.setMin=function(r){this.ms=r};Tr.prototype.setMax=function(r){this.max=r};Tr.prototype.setJitter=function(r){this.jitter=r};class Ff 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,Io(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 Tr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||uw;this.encoder=new o.Encoder,this.decoder=new o.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 Z_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=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(()=>{o(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),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){Jo(()=>{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 Jg(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(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):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 ja={};function No(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=W_(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=ja[o]&&f in ja[o].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Ff(a,n):(ja[o]||(ja[o]=new Ff(a,n)),g=ja[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(No,{Manager:Ff,Socket:Jg,io:No,connect:No});const hw=T.createContext({connected:!1,subscribe:()=>()=>{}});function dw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.useCallback((d,g)=>{const y=o.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const E=y.get(d);E&&(E.delete(g),E.size===0&&y.delete(d))}},[]),h=T.useCallback((d,g)=>{for(const[y,E]of o.current)if(Dg(d,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const d=pg(),g=No({path:`${Wt}/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,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),m.jsx(hw.Provider,{value:{connected:s,subscribe:f},children:m.jsx(Va.Provider,{value:{connected:s,subscribe:f},children:r})})}function mw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Wt}/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(),E=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,O=null;const q=pg();if(q)try{const M=await fetch(`${Wt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(M.ok){const D=await M.json();w=D.natsWsUrl??w,O=D.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:O})}s(E==="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"?m.jsx(b_,{url:a.url,token:a.token,children:r}):n==="socketio"?m.jsx(dw,{children:r}):m.jsx(m.Fragment,{children:r})}function Ig(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=ji(),a=r||s("engineer"),o=n("admin"),f=r||n("admin");return{isBuilder:a,isOps:o,canBulk:f}}const Jf="lt_ai_override";function pw(){return Xe("/settings")}function If(){try{if(localStorage.getItem(Jf)==="off")return!1}catch{}return null}function Qg(){var s;const r=Hn({queryKey:["settings"],queryFn:pw,staleTime:1/0}),n=If();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function gw(){const[r,n]=T.useState(()=>If()===!1),s=T.useCallback(()=>{const a=If()===!1;try{a?localStorage.removeItem(Jf):localStorage.setItem(Jf,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Xg=T.createContext(null),L0="lt_sidebar_collapsed";function yw({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(L0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(L0,String(f))}catch{}return f})},[]);return m.jsx(Xg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Kg(){const r=T.useContext(Xg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function ME(r){const n=r?`?period=${r}`:"";return Hn({queryKey:["escalationStats",r],queryFn:()=>Xe(`/escalations/stats${n}`)})}function RE(){return Hn({queryKey:["escalationTypes"],queryFn:()=>Xe("/escalations/types")})}function bw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),Hn({queryKey:["escalations",a],queryFn:()=>Xe(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function xw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),Hn({queryKey:["escalations","available",a],queryFn:()=>Xe(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function DE(r){return Hn({queryKey:["escalations","by-workflow",r],queryFn:()=>Xe(`/escalations/by-workflow/${r}`),enabled:!!r})}function zE(r){return Hn({queryKey:["escalations",r],queryFn:()=>Xe(`/escalations/${r}`),enabled:!!r})}function qE(){const r=Cn();return Pn({mutationFn:({id:n,durationMinutes:s})=>Xe(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function UE(){const r=Cn();return Pn({mutationFn:n=>Xe(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function BE(){const r=Cn();return Pn({mutationFn:({id:n,resolverPayload:s})=>Xe(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function LE(){const r=Cn();return Pn({mutationFn:({id:n,targetRole:s})=>Xe(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function HE(){const r=Cn();return Pn({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 PE(){const r=Cn();return Pn({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 $E(){const r=Cn();return Pn({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 YE(){const r=Cn();return Pn({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 GE(){const r=Cn();return Pn({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 vw(){const{user:r}=ji(),n=r==null?void 0:r.userId,s=Cn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);p_(`${d_}.system.escalation.>`,o);const{data:f}=xw({limit:1}),{data:h}=bw({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(h==null?void 0:h.total)??0}}function hh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=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 m.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[m.jsx("img",{src:`${Wt}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),m.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function _w({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=ji(),{isBuilder:o}=Ig(),{available:f,mine:h}=vw(),{connected:d}=m_(),{toggleAIOverride:g}=gw(),[y,E]=T.useState(!1),w=T.useRef(null);return T.useEffect(()=>{if(!y)return;const O=q=>{w.current&&!w.current.contains(q.target)&&E(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[y]),m.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:[m.jsx("div",{className:"flex items-center gap-4",children:m.jsx(gr,{to:"/","aria-label":"Home",onClick:O=>{(O.ctrlKey||O.metaKey)&&(O.preventDefault(),g())},children:m.jsx(hh,{})})}),m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsxs(gr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[m.jsx(Sf,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"available",f>0&&m.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),m.jsxs(gr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${h>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[m.jsx(Sf,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",h>0&&m.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:h})]}),o&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"w-px h-4 bg-surface-border"}),m.jsxs("button",{type:"button",onClick:()=>{d?r==null||r():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${d?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:d?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[m.jsx(ug,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),m.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:[m.jsx(fg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&m.jsxs("div",{className:"relative",ref:w,children:[m.jsxs("button",{onClick:()=>E(O=>!O),className:"btn-ghost text-xs flex items-center gap-1",children:[m.jsx(Nx,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,m.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y&&m.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:[m.jsx(gr,{to:"/credentials",onClick:()=>E(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),m.jsx("button",{onClick:()=>{E(!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 dh({open:r,children:n}){const[s,a]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),m.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:m.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function Qf(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function ww(){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 Sw({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(d=>s.startsWith(d)),[o,f]=T.useState(a),h=o||a;return n?m.jsx(m.Fragment,{children:r.items.map(d=>m.jsx(Co,{to:d.to,className:Qf(!0),title:d.label,children:d.icon&&m.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):m.jsxs("div",{children:[m.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:[m.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:r.label})]}),m.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:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m.jsx(dh,{open:h,children:r.items.map(d=>m.jsxs(Co,{to:d.to,end:d.end,className:ww(),children:[d.icon&&m.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:d.label})]},d.to))})]})}function Ew(r){return r.kind==="group"}function Aw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=Qf(n)({isActive:d});return m.jsxs(Co,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}return m.jsxs(Co,{to:r.to,end:r.end,className:Qf(n),title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}function jr({heading:r,entries:n}){const{collapsed:s}=Kg();return m.jsxs("div",{className:"space-y-1",children:[s?m.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):m.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>Ew(a)?m.jsx(Sw,{group:a,collapsed:s},a.label):m.jsx(Aw,{entry:a,collapsed:s},a.to))]})}function jw({aiEnabled:r=!1,isBuilder:n=!1}){if(!n){const a=[{to:"/escalations/queue",label:"My Queue",icon:Sf},{to:"/escalations/available",label:"Available",icon:Ef}];return m.jsx(jr,{heading:"Work",entries:a})}const s=[{to:"/agents",label:r?"Agents":"Automations",icon:Cx},{to:"/topics",label:"Topics",icon:ug},{to:"/capabilities",label:"Capabilities",icon:kx}];return m.jsx(jr,{heading:"React",entries:s})}function Ow(){const r=[{kind:"group",label:"Procedural",icon:Mx,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Configure",icon:t0},{to:"/workflows/durable/invoke",label:"Invoke",icon:n0},{to:"/workflows/executions",label:"Executions",icon:Ef}]},{kind:"group",label:"Graph",icon:Xf,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:t0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:n0},{to:"/mcp/executions",label:"Executions",icon:Ef}]}];return m.jsx(jr,{heading:"Orchestrate",entries:r})}const Tw=[{to:"/mcp/queries",label:"Designer",icon:Rx},{to:"/mcp/servers",label:"Servers & Tools",icon:Dx}];function Nw(){return m.jsx(jr,{heading:"Design",entries:Tw})}const Cw=[{to:"/files",label:"Files",icon:zx},{to:"/knowledge",label:"Knowledge",icon:qx}];function kw(){return m.jsx(jr,{heading:"Storage",entries:Cw})}function Mw({isBuilder:r=!1}){const n=[{to:"/admin/users",label:"Accounts",icon:Ux},...r?[{to:"/admin/roles",label:"Roles & Permissions",icon:Bx}]:[]],s=[{kind:"group",label:"Identity & Access",icon:Lx,matchPaths:n.map(a=>a.to),items:n}];return r&&s.push({kind:"group",label:"Infrastructure",icon:Yx,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:Hx},{to:"/admin/streams",label:"Messages",icon:Px},{to:"/admin/maintenance",label:"DB Maintenance",icon:$x}]}),m.jsx(jr,{heading:"Admin",entries:s})}const Zg="lt_event_feed_patterns";function Rw(r){if(r.startsWith("/topics/")){const f=decodeURIComponent(r.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=r.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(r.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=r.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const o=r.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(r.startsWith("/mcp"),"lt.events.system.>")}function Dw(){try{const r=localStorage.getItem(Zg);return r?JSON.parse(r):[]}catch{return[]}}function vf(r){try{localStorage.setItem(Zg,JSON.stringify(r))}catch{}}function zw(){const{pathname:r}=Ws(),[n,s]=T.useState(Dw),a=T.useMemo(()=>Rw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return vf(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return vf(E),E})},[]),d=T.useCallback(()=>{s([]),vf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:d}}function qw({children:r,className:n=""}){return m.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const _f=280,H0="cubic-bezier(0.4, 0, 0.2, 1)",_o=40;function Uw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-_o*2,o=s-_o*2,f=r.width/a,h=r.height/o,d=r.left+r.width/2-(_o+a/2),g=r.top+r.height/2-(_o+o/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Wg({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),d=T.useRef(!1);T.useEffect(()=>{var O,q;r&&!d.current?(h.current=((O=s==null?void 0:s.current)==null?void 0:O.getBoundingClientRect())??null,f("entering")):!r&&d.current&&o==="open"&&(h.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const O=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(O)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const O=q=>{q.key==="Escape"&&n()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[o,n]);const g=T.useCallback(O=>{O.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const O=setTimeout(()=>f(null),_f+50);return()=>clearTimeout(O)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?Uw(h.current):"none",w=y?0:1;return og.createPortal(m.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${_f}ms ${H0}, opacity ${_f}ms ${H0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function Bw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Lw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Hw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Pw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function $w({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Yw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Gw(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]),o=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=o.map(d=>`<tr class="border-t border-surface-border">${s(d).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</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 wo(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Vw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,w)=>Gw(`${y}
55
55
  ${E}
56
- ${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${_o(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${_o(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${_o(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="${_o(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(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(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 E=[];let w=y,j;for(;(j=d.exec(w))!==null;){const q=j.index+j[0].length;E.push(w.slice(0,q)),w=w.slice(q).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&E.push(w),E.map(q=>{const M=q.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Xw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Kw(r){return Xw.test(r)}function fh({content:r,className:n,onClick:s}){const a=T.useMemo(()=>Iw(r),[r]);return m.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Lo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[d,g]=T.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return m.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>m.jsxs("div",{children:[m.jsx(Lo,{data:y,depth:n+1,generation:s}),E<r.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?m.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],j)=>m.jsxs("div",{children:[m.jsx("span",{className:"text-text-secondary",children:E}),m.jsx("span",{className:"text-text-tertiary",children:": "}),m.jsx(Lo,{data:w,depth:n+1,generation:s}),j<y.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return m.jsx("span",{children:String(r)})}function za({data:r,depth:n=0}){if(r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Kw(r)?m.jsx(fh,{content:r}):m.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):m.jsx("div",{className:"space-y-2",children:r.map((s,a)=>m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),m.jsx("div",{className:"flex-1",children:m.jsx(za,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):m.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return m.jsxs("div",{children:[m.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?m.jsx("p",{className:"text-sm text-text-primary",children:m.jsx(za,{data:o,depth:n+1})}):m.jsx(za,{data:o,depth:n+1})]},a)})})}return m.jsx("span",{children:String(r)})}function U0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return m.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&m.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?m.jsx(Jw,{className:y}):m.jsx(Fw,{className:y})}),m.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?m.jsx($w,{className:y}):m.jsx(Yw,{className:y})}),m.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?m.jsx(Vw,{className:`${y} text-status-success`}):m.jsx(Gw,{className:y})}),h&&m.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:m.jsx(og,{className:y})}),d&&m.jsx("button",{onClick:d,className:E,title:"Close (Esc)",children:m.jsx(cg,{className:y})})]})}function Zw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,d]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[j,q]=T.useState(a?0:1),[M,D]=T.useState(1),W=j%2===0,se=M%2===0,ee=T.useCallback(()=>q(K=>K+1),[]),me=T.useCallback(()=>D(K=>K+1),[]);let re=r;if(typeof r=="string")try{re=JSON.parse(r)}catch{}const C=async()=>{const K=typeof r=="string"?r:JSON.stringify(re,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{D(1),w(!0)},[]),ce=s==="panel",V=ce?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",G=ce?"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 m.jsxs("div",{className:V,children:[n&&m.jsx(Hw,{children:n}),m.jsxs("div",{ref:f,className:"relative",children:[m.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:m.jsx(U0,{mode:h,setMode:d,isCollapsed:W,onToggleCollapse:ee,onCopy:C,copied:g,onFullscreen:X})}),m.jsx("div",{className:G,children:h==="json"?m.jsx(Lo,{data:re,generation:j}):m.jsx(za,{data:re})})]}),m.jsxs(Ig,{open:E,onClose:()=>w(!1),sourceRef:f,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx(U0,{mode:h,setMode:d,isCollapsed:se,onToggleCollapse:me,onCopy:C,copied:g,onClose:()=>w(!1),large:!0})}),m.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?m.jsx(Lo,{data:re,generation:M}):m.jsx(za,{data:re})})]})]})}const Ww=100,B0=500;let eS=0;const Xg={"escalation.created":"text-blue-400","escalation.claimed":"text-status-warning","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 Kg(r){const n=r.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:r}function L0({event:r,forceExpanded:n=!1}){var j,q;const[s,a]=T.useState(n),o=Xg[Kg(r.type)]||"text-text-tertiary";T.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",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return m.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[m.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[m.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"})}),m.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),m.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):"",(q=r.data)!=null&&q.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),m.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:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),m.jsx(uh,{open:s,children:m.jsx("div",{className:w,children:m.jsx(Zw,{data:r.data})})})]})}function tS({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,d]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:j}=T.useContext(Ya),{patterns:q,pagePattern:M,userPatterns:D,addPattern:W,removePattern:se}=Lw(),ee=T.useCallback(re=>{const C=String(re.type||"unknown");if(C.startsWith("mesh."))return;const X=`${C}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ce=Date.now(),V=w.current.get(X);if(!(V&&ce-V<B0)){if(w.current.set(X,ce),w.current.size>200)for(const[G,K]of w.current)ce-K>B0*2&&w.current.delete(G);f(G=>[{id:++eS,type:C,timestamp:re.timestamp||new Date().toISOString(),data:re},...G].slice(0,Ww))}},[]),me=T.useRef(ee);return me.current=ee,T.useEffect(()=>{const re=q.map(C=>j(C,X=>me.current(X)));return()=>re.forEach(C=>C())},[j,q.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),m.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[m.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?m.jsx(Jx,{className:"w-3 h-3 text-text-tertiary"}):m.jsx(Qx,{className:"w-3 h-3 text-text-tertiary"}),m.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&m.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&m.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Xg[Kg(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),m.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[m.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:re=>{re.stopPropagation(),a()},children:m.jsx(Ix,{className:"w-3 h-3"})}),o.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),d(!0)},children:m.jsx(og,{className:"w-3 h-3"})}),m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),f([])},children:m.jsx(Xx,{className:"w-3 h-3"})})]})]})]}),s&&m.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[m.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),m.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),D.map(re=>m.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[re.replace("lt.events.",""),m.jsx("button",{onClick:()=>se(re),className:"text-text-quaternary hover:text-status-error",children:m.jsx($o,{className:"w-2 h-2"})})]},re))]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",value:g,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&g.trim()&&(W(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),m.jsxs("button",{onClick:()=>{g.trim()&&(W(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[m.jsx(Kx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),m.jsx(uh,{open:r,children:m.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?m.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>m.jsx(L0,{event:re},re.id))})}),m.jsxs(Ig,{open:h,onClose:()=>d(!1),sourceRef:E,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx("button",{onClick:()=>d(!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:m.jsx(cg,{className:"w-5 h-5"})})}),o.length===0?m.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>m.jsx(L0,{event:re,forceExpanded:!0},re.id))]})]})}function nS(){return Hn({queryKey:["docs"],queryFn:()=>Xe("/docs"),staleTime:5*6e4})}function sS(r){return Hn({queryKey:["docs",r],queryFn:()=>Xe(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function iS(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),d=T.useRef(r),g=T.useRef(s);h.current=o,d.current=r,g.current=s;const y=T.useCallback((M,D)=>{var se;const W=h.current;if(W){const ee=((se=D==null?void 0:D.current)==null?void 0:se.scrollTop)??0;n([...d.current,{...W,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const D=d.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...se,scrollTop:me}])}n(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const D=g.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...d.current,{...se,scrollTop:me}])}a(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),j=T.useCallback(M=>{var se,ee;const D=h.current;if(!D)return;const W=((se=M==null?void 0:M.current)==null?void 0:se.scrollTop)??0;n([...d.current,{...D,scrollTop:W}]),a([]),f({...D,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),q=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:j,reset:q}}function rS(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);o=d.join("/")}return{path:o,anchor:a}}function aS(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 lS(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function oS({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const E=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=rS(g.dataset.docLink,n);s(E,w);return}};return m.jsx(fh,{content:r,className:"docs-content",onClick:o})}function cS(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const d=o[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function uS({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=cS(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 m.jsxs("details",{open:!0,children:[m.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:[m.jsx(Zx,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),m.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>m.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return m.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>m.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...o.values()].map(d=>h(d))]})}function fS({open:r,onClose:n}){var ce,V,G;const[s,a]=T.useState(!1),{data:o}=nS(),f=iS(),{data:h,isLoading:d}=sS(((ce=f.current)==null?void 0:ce.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.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"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var ne;const K=aS(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((ne=f.current)==null?void 0:ne.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&E(K.anchor)},[f]),j=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const K=lS(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(V=f.current)==null?void 0:V.path]),T.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const q=T.useCallback((K,ae)=>{ae&&E(ae),f.navigate(K,g)},[f]),M=T.useCallback(K=>{f.navigate(K,g)},[f]),D=T.useCallback(()=>{f.goBack(g)},[f]),W=T.useCallback(()=>{f.goForward(g)},[f]),se=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){j.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},re=((G=f.current)==null?void 0:G.path)??null,C=f.backStack.length>0,X=f.forwardStack.length>0;return m.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[m.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),m.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:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{onClick:D,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:m.jsx(Wx,{className:"w-4 h-4"})}),m.jsx("button",{onClick:W,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:m.jsx(Wp,{className:"w-4 h-4"})}),m.jsx(lg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),m.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),m.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:m.jsx($o,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?m.jsx(uS,{docs:o.docs,selected:re,onSelect:M}):m.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),m.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:re?d?m.jsxs("div",{className:"animate-pulse space-y-2",children:[m.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?m.jsx(oS,{content:h.content,currentPath:re,onNavigate:q,onAnchorClick:se}):m.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[m.jsx(Wp,{className:"w-5 h-5 mb-2"}),m.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function hS(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const H0=2e3;function dS(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
56
+ ${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${wo(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${wo(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${wo(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="${wo(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(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(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 E=[];let w=y,O;for(;(O=d.exec(w))!==null;){const q=O.index+O[0].length;E.push(w.slice(0,q)),w=w.slice(q).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&E.push(w),E.map(q=>{const M=q.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Fw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Jw(r){return Fw.test(r)}function mh({content:r,className:n,onClick:s}){const a=T.useMemo(()=>Vw(r),[r]);return m.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Lo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[d,g]=T.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return m.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>m.jsxs("div",{children:[m.jsx(Lo,{data:y,depth:n+1,generation:s}),E<r.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?m.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],O)=>m.jsxs("div",{children:[m.jsx("span",{className:"text-text-secondary",children:E}),m.jsx("span",{className:"text-text-tertiary",children:": "}),m.jsx(Lo,{data:w,depth:n+1,generation:s}),O<y.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return m.jsx("span",{children:String(r)})}function Ua({data:r,depth:n=0}){if(r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Jw(r)?m.jsx(mh,{content:r}):m.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):m.jsx("div",{className:"space-y-2",children:r.map((s,a)=>m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),m.jsx("div",{className:"flex-1",children:m.jsx(Ua,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):m.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return m.jsxs("div",{children:[m.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?m.jsx("p",{className:"text-sm text-text-primary",children:m.jsx(Ua,{data:o,depth:n+1})}):m.jsx(Ua,{data:o,depth:n+1})]},a)})})}return m.jsx("span",{children:String(r)})}function P0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return m.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&m.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?m.jsx(Yw,{className:y}):m.jsx($w,{className:y})}),m.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?m.jsx(Bw,{className:y}):m.jsx(Lw,{className:y})}),m.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?m.jsx(Pw,{className:`${y} text-status-success`}):m.jsx(Hw,{className:y})}),h&&m.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:m.jsx(hg,{className:y})}),d&&m.jsx("button",{onClick:d,className:E,title:"Close (Esc)",children:m.jsx(dg,{className:y})})]})}function Iw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,d]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[O,q]=T.useState(a?0:1),[M,D]=T.useState(1),W=O%2===0,se=M%2===0,ee=T.useCallback(()=>q(K=>K+1),[]),me=T.useCallback(()=>D(K=>K+1),[]);let re=r;if(typeof r=="string")try{re=JSON.parse(r)}catch{}const C=async()=>{const K=typeof r=="string"?r:JSON.stringify(re,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{D(1),w(!0)},[]),ce=s==="panel",V=ce?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",G=ce?"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 m.jsxs("div",{className:V,children:[n&&m.jsx(qw,{children:n}),m.jsxs("div",{ref:f,className:"relative",children:[m.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:m.jsx(P0,{mode:h,setMode:d,isCollapsed:W,onToggleCollapse:ee,onCopy:C,copied:g,onFullscreen:X})}),m.jsx("div",{className:G,children:h==="json"?m.jsx(Lo,{data:re,generation:O}):m.jsx(Ua,{data:re})})]}),m.jsxs(Wg,{open:E,onClose:()=>w(!1),sourceRef:f,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx(P0,{mode:h,setMode:d,isCollapsed:se,onToggleCollapse:me,onCopy:C,copied:g,onClose:()=>w(!1),large:!0})}),m.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?m.jsx(Lo,{data:re,generation:M}):m.jsx(Ua,{data:re})})]})]})}const Qw=100,$0=500;let Xw=0;const ey={"escalation.created":"text-blue-400","escalation.claimed":"text-status-warning","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 ty(r){const n=r.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:r}function Y0({event:r,forceExpanded:n=!1}){var O,q;const[s,a]=T.useState(n),o=ey[ty(r.type)]||"text-text-tertiary";T.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",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return m.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[m.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[m.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"})}),m.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),m.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(O=r.data)!=null&&O.workflowId?String(r.data.workflowId):"",(q=r.data)!=null&&q.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),m.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:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),m.jsx(dh,{open:s,children:m.jsx("div",{className:w,children:m.jsx(Iw,{data:r.data})})})]})}function Kw({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,d]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:O}=T.useContext(Va),{patterns:q,pagePattern:M,userPatterns:D,addPattern:W,removePattern:se}=zw(),ee=T.useCallback(re=>{const C=String(re.type||"unknown");if(C.startsWith("mesh."))return;const X=`${C}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ce=Date.now(),V=w.current.get(X);if(!(V&&ce-V<$0)){if(w.current.set(X,ce),w.current.size>200)for(const[G,K]of w.current)ce-K>$0*2&&w.current.delete(G);f(G=>[{id:++Xw,type:C,timestamp:re.timestamp||new Date().toISOString(),data:re},...G].slice(0,Qw))}},[]),me=T.useRef(ee);return me.current=ee,T.useEffect(()=>{const re=q.map(C=>O(C,X=>me.current(X)));return()=>re.forEach(C=>C())},[O,q.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),m.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[m.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?m.jsx(Gx,{className:"w-3 h-3 text-text-tertiary"}):m.jsx(Vx,{className:"w-3 h-3 text-text-tertiary"}),m.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&m.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&m.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${ey[ty(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),m.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[m.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:re=>{re.stopPropagation(),a()},children:m.jsx(Fx,{className:"w-3 h-3"})}),o.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),d(!0)},children:m.jsx(hg,{className:"w-3 h-3"})}),m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),f([])},children:m.jsx(Jx,{className:"w-3 h-3"})})]})]})]}),s&&m.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[m.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),m.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),D.map(re=>m.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[re.replace("lt.events.",""),m.jsx("button",{onClick:()=>se(re),className:"text-text-quaternary hover:text-status-error",children:m.jsx($o,{className:"w-2 h-2"})})]},re))]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",value:g,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&g.trim()&&(W(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),m.jsxs("button",{onClick:()=>{g.trim()&&(W(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[m.jsx(Ix,{className:"w-2.5 h-2.5"})," Add"]})]})]}),m.jsx(dh,{open:r,children:m.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?m.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>m.jsx(Y0,{event:re},re.id))})}),m.jsxs(Wg,{open:h,onClose:()=>d(!1),sourceRef:E,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx("button",{onClick:()=>d(!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:m.jsx(dg,{className:"w-5 h-5"})})}),o.length===0?m.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>m.jsx(Y0,{event:re,forceExpanded:!0},re.id))]})]})}function Zw(){return Hn({queryKey:["docs"],queryFn:()=>Xe("/docs"),staleTime:5*6e4})}function Ww(r){return Hn({queryKey:["docs",r],queryFn:()=>Xe(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function eS(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),d=T.useRef(r),g=T.useRef(s);h.current=o,d.current=r,g.current=s;const y=T.useCallback((M,D)=>{var se;const W=h.current;if(W){const ee=((se=D==null?void 0:D.current)==null?void 0:se.scrollTop)??0;n([...d.current,{...W,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const D=d.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...se,scrollTop:me}])}n(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const D=g.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...d.current,{...se,scrollTop:me}])}a(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),O=T.useCallback(M=>{var se,ee;const D=h.current;if(!D)return;const W=((se=M==null?void 0:M.current)==null?void 0:se.scrollTop)??0;n([...d.current,{...D,scrollTop:W}]),a([]),f({...D,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),q=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:O,reset:q}}function tS(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);o=d.join("/")}return{path:o,anchor:a}}function nS(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 sS(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function iS({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const E=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=tS(g.dataset.docLink,n);s(E,w);return}};return m.jsx(mh,{content:r,className:"docs-content",onClick:o})}function rS(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const d=o[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function aS({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=rS(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 m.jsxs("details",{open:!0,children:[m.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:[m.jsx(Qx,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),m.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>m.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return m.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>m.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...o.values()].map(d=>h(d))]})}function lS({open:r,onClose:n}){var ce,V,G;const[s,a]=T.useState(!1),{data:o}=Zw(),f=eS(),{data:h,isLoading:d}=Ww(((ce=f.current)==null?void 0:ce.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.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"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var ne;const K=nS(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((ne=f.current)==null?void 0:ne.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&E(K.anchor)},[f]),O=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(O.current){O.current=!1;return}const K=sS(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(V=f.current)==null?void 0:V.path]),T.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const q=T.useCallback((K,ae)=>{ae&&E(ae),f.navigate(K,g)},[f]),M=T.useCallback(K=>{f.navigate(K,g)},[f]),D=T.useCallback(()=>{f.goBack(g)},[f]),W=T.useCallback(()=>{f.goForward(g)},[f]),se=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){O.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},re=((G=f.current)==null?void 0:G.path)??null,C=f.backStack.length>0,X=f.forwardStack.length>0;return m.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[m.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),m.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:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{onClick:D,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:m.jsx(Xx,{className:"w-4 h-4"})}),m.jsx("button",{onClick:W,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:m.jsx(s0,{className:"w-4 h-4"})}),m.jsx(fg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),m.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),m.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:m.jsx($o,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?m.jsx(aS,{docs:o.docs,selected:re,onSelect:M}):m.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),m.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:re?d?m.jsxs("div",{className:"animate-pulse space-y-2",children:[m.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?m.jsx(iS,{content:h.content,currentPath:re,onNavigate:q,onAnchorClick:se}):m.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[m.jsx(s0,{className:"w-5 h-5 mb-2"}),m.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function oS(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const G0=2e3;function cS(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
57
57
  ${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
58
58
  `)}
59
59
  [End prior conversation]
60
60
 
61
- `}function mS(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 Zg=T.createContext(null);function pS({children:r}){const n=Ws(),[s,a]=T.useState(!1),[o,f]=T.useState([]),[h,d]=T.useState(null),[g,y]=T.useState({}),E=T.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??hS(n.pathname)};T.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const j=T.useCallback(()=>a(se=>!se),[]),q=T.useCallback(se=>{y(se)},[]),M=T.useCallback(()=>{f([]),d(null)},[]),D=T.useCallback(async se=>{var V;const ee=new Date().toISOString(),me={id:`user-${Date.now()}`,role:"user",content:se,timestamp:ee},re={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:ee,pending:!0};f(G=>[...G,me,re]);const C={...w};(V=C.entities)!=null&&V.yamlContent&&C.entities.yamlContent.length>H0&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,H0)+`
62
- ... (truncated)`});const ce=`${dS(o.concat(me))}${se}`;try{const K=(await Xe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ce,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;d(K),f(ae=>ae.map(ne=>ne.id===re.id?{...ne,workflowId:K}:ne)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var ae;try{const ne=await Xe(`/workflows/${K}/result`),ke=(ae=ne==null?void 0:ne.result)==null?void 0:ae.data;if(ke){E.current&&clearInterval(E.current),E.current=null,d(null);const He=mS(ke);let Me;try{Me=(await Xe(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===re.id?{...te,content:He,timestamp:new Date().toISOString(),pending:!1,durationMs:Me}:te))}}catch{}},3e3)}catch{f(G=>G.map(K=>K.id===re.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,w]),W=T.useCallback(async se=>{const ee=o.find(C=>C.id===se);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const me=o.indexOf(ee),re=o.slice(0,me).reverse().find(C=>C.role==="user");if(re){f(C=>C.map(X=>X.id===se?{...X,compilationStatus:"compiling"}:X));try{const C=await Xe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:ee.content})}),X=await Xe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await Xe(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"done"}:V))}catch(C){const X=C instanceof Error?C.message:"Compilation failed";f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"error",compilationError:X}:V))}}},[o]);return m.jsx(Zg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:o,sendMessage:D,pageContext:w,setPageContext:q,activeWorkflowId:h,clearMessages:M,compileMessage:W},children:r})}function Wg(){const r=T.useContext(Zg);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function gS(){const{helpOpen:r,toggleHelp:n}=Wg();return m.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:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?m.jsx($o,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):m.jsx("img",{src:`${Wt}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const ey=6048e5,yS=864e5,P0=6e4,$0=525600,Y0=43200,G0=1440,V0=Symbol.for("constructDateFrom");function hs(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&V0 in r?r[V0](n):r instanceof Date?new r.constructor(n):new Date(n)}function sn(r,n){return hs(n||r,r)}let bS={};function Va(){return bS}function Ha(r,n){var d,g,y,E;const s=Va(),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??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=sn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Ho(r,n){return Ha(r,{...n,weekStartsOn:1})}function ty(r,n){const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=hs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Ho(o),h=hs(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=Ho(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Po(r){const n=sn(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 ny(r,...n){const s=hs.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function F0(r,n){const s=sn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function xS(r,n,s){const[a,o]=ny(s==null?void 0:s.in,r,n),f=F0(a),h=F0(o),d=+f-Po(f),g=+h-Po(h);return Math.round((d-g)/yS)}function vS(r,n){const s=ty(r,n),a=hs(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Ho(a)}function _S(r,n){const s=+sn(r)-+sn(n);return s<0?-1:s>0?1:s}function wS(r){return hs(r,Date.now())}function SS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function ES(r){return!(!SS(r)&&typeof r!="number"||isNaN(+sn(r)))}function AS(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function OS(r,n){const s=sn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const jS={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"}},TS=(r,n,s)=>{let a;const o=jS[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function wf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const NS={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},CS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},kS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},MS={date:wf({formats:NS,defaultWidth:"full"}),time:wf({formats:CS,defaultWidth:"full"}),dateTime:wf({formats:kS,defaultWidth:"full"})},RS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},DS=(r,n,s,a)=>RS[r];function Oa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;o=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const zS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},qS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},US={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"]},BS={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"]},LS={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"}},HS={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"}},PS=(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"},$S={ordinalNumber:PS,era:Oa({values:zS,defaultWidth:"wide"}),quarter:Oa({values:qS,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Oa({values:US,defaultWidth:"wide"}),day:Oa({values:BS,defaultWidth:"wide"}),dayPeriod:Oa({values:LS,defaultWidth:"wide",formattingValues:HS,defaultFormattingWidth:"wide"})};function ja(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?GS(d,w=>w.test(h)):YS(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function YS(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function GS(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function VS(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=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(o.length);return{value:h,rest:d}}}const FS=/^(\d+)(th|st|nd|rd)?/i,JS=/\d+/i,QS={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},IS={any:[/^b/i,/^(a|c)/i]},XS={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},KS={any:[/1/i,/2/i,/3/i,/4/i]},ZS={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},WS={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]},e2={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},t2={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]},n2={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},s2={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}},i2={ordinalNumber:VS({matchPattern:FS,parsePattern:JS,valueCallback:r=>parseInt(r,10)}),era:ja({matchPatterns:QS,defaultMatchWidth:"wide",parsePatterns:IS,defaultParseWidth:"any"}),quarter:ja({matchPatterns:XS,defaultMatchWidth:"wide",parsePatterns:KS,defaultParseWidth:"any",valueCallback:r=>r+1}),month:ja({matchPatterns:ZS,defaultMatchWidth:"wide",parsePatterns:WS,defaultParseWidth:"any"}),day:ja({matchPatterns:e2,defaultMatchWidth:"wide",parsePatterns:t2,defaultParseWidth:"any"}),dayPeriod:ja({matchPatterns:n2,defaultMatchWidth:"any",parsePatterns:s2,defaultParseWidth:"any"})},sy={code:"en-US",formatDistance:TS,formatLong:MS,formatRelative:DS,localize:$S,match:i2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function r2(r,n){const s=sn(r,n==null?void 0:n.in);return xS(s,OS(s))+1}function a2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ho(s)-+vS(s);return Math.round(a/ey)+1}function iy(r,n){var E,w,j,q;const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Va(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(j=o.locale)==null?void 0:j.options)==null?void 0:q.firstWeekContainsDate)??1,h=hs((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=hs((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 l2(r,n){var d,g,y,E;const s=Va(),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??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=iy(r,n),f=hs((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Ha(f,n)}function o2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ha(s,n)-+l2(s,n);return Math.round(a/ey)+1}function Ge(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Gs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ge(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ge(s+1,2)},d(r,n){return Ge(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 Ge(r.getHours()%12||12,n.length)},H(r,n){return Ge(r.getHours(),n.length)},m(r,n){return Ge(r.getMinutes(),n.length)},s(r,n){return Ge(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ge(o,n.length)}},pr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},J0={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(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Gs.y(r,n)},Y:function(r,n,s,a){const o=iy(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ge(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ge(f,n.length)},R:function(r,n){const s=ty(r);return Ge(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ge(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 Ge(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 Ge(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 Gs.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 Ge(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 o=o2(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ge(o,n.length)},I:function(r,n,s){const a=a2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ge(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Gs.d(r,n)},D:function(r,n,s){const a=r2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ge(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 o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ge(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ge(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ge(o,n.length);case"io":return s.ordinalNumber(o,{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 o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=pr.noon:a===0?o=pr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=pr.evening:a>=12?o=pr.afternoon:a>=4?o=pr.morning:o=pr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{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 Gs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Gs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Gs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Gs.s(r,n)},S:function(r,n){return Gs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return I0(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return I0(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+Q0(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+Q0(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ge(a,n.length)},T:function(r,n,s){return Ge(+r,n.length)}};function Q0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ge(f,2)}function I0(r,n){return r%60===0?(r>0?"-":"+")+Ge(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ge(Math.trunc(a/60),2),f=Ge(a%60,2);return s+o+n+f}const X0=(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"})}},ry=(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"})}},c2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return X0(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}}",X0(a,n)).replace("{{time}}",ry(o,n))},u2={p:ry,P:c2},f2=/^D+$/,h2=/^Y+$/,d2=["D","DD","YY","YYYY"];function m2(r){return f2.test(r)}function p2(r){return h2.test(r)}function g2(r,n,s){const a=y2(r,n,s);if(console.warn(a),d2.includes(r))throw new RangeError(a)}function y2(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 b2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,v2=/^'([^]*?)'?$/,_2=/''/g,w2=/[a-zA-Z]/;function ay(r,n,s){var E,w,j,q;const a=Va(),o=a.locale??sy,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((q=(j=a.locale)==null?void 0:j.options)==null?void 0:q.weekStartsOn)??0,d=sn(r,s==null?void 0:s.in);if(!ES(d))throw new RangeError("Invalid time value");let g=n.match(x2).map(M=>{const D=M[0];if(D==="p"||D==="P"){const W=u2[D];return W(M,o.formatLong)}return M}).join("").match(b2).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const D=M[0];if(D==="'")return{isToken:!1,value:S2(M)};if(J0[D])return{isToken:!0,value:M};if(D.match(w2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const D=M.value;(p2(D)||m2(D))&&g2(D,n,String(r));const W=J0[D[0]];return W(d,D,o.localize,y)}).join("")}function S2(r){const n=r.match(v2);return n?n[1].replace(_2,"'"):r}function E2(r,n,s){const a=Va(),o=(s==null?void 0:s.locale)??a.locale??sy,f=_S(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]=ny(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=AS((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-d.getTime(),w=E/P0,j=Po(g)-Po(d),q=(E-j)/P0,M=s==null?void 0:s.unit;let D;if(M?D=M:w<1?D="second":w<60?D="minute":w<G0?D="hour":q<Y0?D="day":q<$0?D="month":D="year",D==="second"){const W=y(E/1e3);return o.formatDistance("xSeconds",W,h)}else if(D==="minute"){const W=y(w);return o.formatDistance("xMinutes",W,h)}else if(D==="hour"){const W=y(w/60);return o.formatDistance("xHours",W,h)}else if(D==="day"){const W=y(q/G0);return o.formatDistance("xDays",W,h)}else if(D==="month"){const W=y(q/Y0);return W===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",W,h)}else{const W=y(q/$0);return o.formatDistance("xYears",W,h)}}function A2(r,n){return E2(r,wS(r),n)}function O2(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":A2(n,{addSuffix:!0})}function FE(r){return r<=0?"Expired":hh(r)}function j2(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),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function JE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return hh(a-s)}function ly({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[d,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),j=220,q=T.useCallback(()=>{if(!y.current)return;const se=y.current.getBoundingClientRect(),ee=window.innerWidth-j-8,me=Math.max(8,Math.min(se.left,ee));g({top:se.bottom+4,left:me})},[]),M=T.useCallback(async(se,ee)=>{try{await navigator.clipboard.writeText(se),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),D=T.useCallback(()=>{clearTimeout(w.current),q(),o(!0)},[q]),W=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),m.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:D,onMouseLeave:W,children:[n,a&&d&&ig.createPortal(m.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:D,onMouseLeave:W,children:r.map(se=>m.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(se.value,se.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:se.label}),m.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===se.label?"✓":se.value})]},se.label))}),document.body)]})}function T2(r,n){const s=new Date(r);switch(n){case"relative":return O2(r);case"datetime":return ay(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function N2(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:ay(n,"MMM d, yyyy h:mm:ss a")}]}function C2({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>N2(r),[r]);return m.jsx(ly,{options:o,children:m.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:T2(r,n)})})}function k2({ms:r,className:n=""}){const s=j2(r),a=T.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?m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):m.jsx(ly,{options:a,children:m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const M2=["sm","md","lg","full"],K0={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"},Z0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function R2({which:r}){const n="stroke-current";switch(r){case"sm":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function D2({msg:r}){const[n,s]=T.useState(0);T.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),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return m.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),m.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&m.jsxs(gr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[m.jsx(ug,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function z2({msg:r,compileMessage:n}){const s=r.role==="assistant";return m.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[m.jsx(C2,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),m.jsx(k2,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&m.jsx(gr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:m.jsx(ug,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&m.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:m.jsx(ev,{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 q2(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Wg(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[j,q]=T.useState(!0),M=T.useRef(null),D=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&D.current&&D.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const C=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,E,n]),!r)return null;const W=()=>{const C=g.trim();!C||f||(a(C),y(""),D.current&&(D.current.style.height="auto"))},se=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),W())},ee=E==="full",me=o.page.replace(/-/g," "),re=ee?{}:{bottom:"108px"};return m.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?K0.full:`right-6 ${K0[E]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[m.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:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),m.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),m.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[m.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:M2.map(C=>m.jsx("button",{onClick:()=>w(C),className:`p-1 rounded transition-colors ${C===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===E,"aria-label":Z0[C],title:Z0[C],children:m.jsx(R2,{which:C})},C))}),s.length>0&&m.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:m.jsx(tv,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),m.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:m.jsx($o,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),m.jsxs("div",{ref:M,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&&m.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>m.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[m.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?m.jsx(D2,{msg:C}):C.role==="assistant"?m.jsx(fh,{content:C.content}):C.content}),!C.pending&&m.jsx("div",{className:"mt-0.5",children:m.jsx(z2,{msg:C,compileMessage:d})})]},C.id))]}),m.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:[m.jsx("textarea",{ref:D,value:g,onChange:C=>{y(C.target.value);const X=C.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:se,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}),m.jsx("button",{onClick:W,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:m.jsx(nv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function U2(){var M;const{isBuilder:r,isOps:n}=Vg(),{data:s}=xw(),a=!!((M=s==null?void 0:s.ai)!=null&&M.enabled),{collapsed:o,toggle:f}=Jg(),[h,d]=T.useState(!1),[g,y]=T.useState(!1),[E,w]=T.useState(()=>window.location.hash.startsWith("#docs")),j=Ws(),q=T.useRef(null);return T.useEffect(()=>{const D=q.current;D&&(D.classList.remove("animate-page-in"),D.offsetWidth,D.classList.add("animate-page-in"))},[j.pathname]),T.useEffect(()=>{const D=()=>{window.location.hash.startsWith("#docs")&&w(!0)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]),m.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[m.jsx(Aw,{onToggleEventFeed:()=>d(D=>!D),onToggleDocs:()=>w(D=>!D)}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsxs("aside",{className:`${o?"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:[m.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[m.jsx(Cw,{aiEnabled:a,isBuilder:r}),r&&m.jsx(kw,{}),r&&a&&m.jsx(Rw,{}),r&&m.jsx(zw,{}),(r||n)&&m.jsx(qw,{isBuilder:r})]}),m.jsx("button",{onClick:f,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${o?"flex justify-center":"flex items-center px-7"}`,"aria-label":o?"Expand sidebar":"Collapse sidebar",children:o?m.jsx(sv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):m.jsx(iv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{ref:q,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:m.jsx(So,{})})})]}),m.jsx(tS,{open:h,onToggle:()=>d(D=>!D),configOpen:g,onToggleConfig:()=>y(D=>!D)}),m.jsx(fS,{open:E,onClose:()=>{w(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),a&&m.jsx(gS,{}),a&&m.jsx(q2,{})]})}function B2(){const{isAuthenticated:r}=Oi(),n=Ws();return r?m.jsx(_w,{children:m.jsx(pS,{children:m.jsx(U2,{})})}):m.jsx(Fs,{to:"/login",state:{from:n.pathname},replace:!0})}function oy({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.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"}),m.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"}),m.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"}),m.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 m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),m.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),m.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),m.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("path",{d:"M12 8v4l3 3"})]})}}async function L2(){return Xe("/auth/oauth/providers")}async function H2(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Xe(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function QE(){return Hn({queryKey:["oauth-connections"],queryFn:()=>Xe("/auth/oauth/connections")})}function IE(){const r=Cn();return Pn({mutationFn:({provider:n,label:s})=>H2(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function P2(){var ce;const{login:r,isAuthenticated:n}=Oi(),s=rg(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),d=((ce=a.state)==null?void 0:ce.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,j]=T.useState(""),[q,M]=T.useState(h||""),[D,W]=T.useState(!1),[se,ee]=T.useState(!!f),[me,re]=T.useState([]),C=T.useRef(!1);if(T.useEffect(()=>{f||C.current||(C.current=!0,(async()=>{var V,G,K,ae;try{const ne=await fetch(`${Wt}/api/settings`);if(!ne.ok)return;const ke=await ne.json();if(!((V=ke.auth)!=null&&V.sso))return;const He=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!He.ok){M("Host authentication required — please log in to your organization first");return}const Me=await He.json();Me.token&&((G=ke.auth)!=null&&G.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",ke.auth.ssoLogoutUrl),ee(!0),r(Me.token,void 0,{displayName:(K=Me.user)==null?void 0:K.display_name,username:(ae=Me.user)==null?void 0:ae.external_id}))}catch{}})())},[]),T.useEffect(()=>{f||L2().then(re).catch(()=>{})},[]),T.useEffect(()=>{if(!se)return;const V=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(V)},[se]),n&&!se)return m.jsx(Fs,{to:d,replace:!0});const X=async V=>{var G,K;if(V.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}W(!0);try{const ae=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ne=await ae.json();if(!ae.ok){M(ne.error||"Login failed");return}ee(!0),r(ne.token,{username:y.trim(),password:w},{displayName:(G=ne.user)==null?void 0:G.display_name,username:(K=ne.user)==null?void 0:K.external_id})}catch{M("Unable to connect to server")}finally{W(!1)}};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${se?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:m.jsx(ch,{size:"lg",hideLabel:se})}),m.jsxs("form",{onSubmit:X,className:`space-y-5 transition-opacity duration-300 ${se?"opacity-0":""}`,children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),m.jsx("input",{id:"username",type:"text",value:y,onChange:V=>E(V.target.value),className:"input",placeholder:"Enter your username",autoFocus:!se,autoComplete:"username"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),m.jsx("input",{id:"password",type:"password",value:w,onChange:V=>j(V.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&m.jsx("p",{className:"text-sm text-status-error",children:q}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:D||se,children:D?"Signing in...":"Sign In"}),me.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[m.jsx("div",{className:"flex-1 h-px bg-border"}),m.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),m.jsx("div",{className:"flex-1 h-px bg-border"})]}),m.jsx("div",{className:"space-y-2",children:me.filter(V=>V.provider!=="anthropic").map(V=>m.jsxs("a",{href:`${Wt}/api/auth/oauth/${V.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[m.jsx(oy,{provider:V.provider}),"Sign in with ",V.name]},V.provider))})]})]})]})})}function W0(){const{isAuthenticated:r}=Oi(),n=rg(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[d,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,j]=T.useState(!1),q=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),D=W=>{W.preventDefault();const se=f.trim();if(!se){E("A token or API key is required");return}if(!se.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),E("");const ee=`${Wt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(se)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:"mb-10",children:m.jsx(ch,{size:"lg"})}),m.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[m.jsx(oy,{provider:"anthropic",className:"w-6 h-6"}),m.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),m.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."}),m.jsxs("form",{onSubmit:D,className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),m.jsx("input",{id:"token",type:"password",value:f,onChange:W=>h(W.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&m.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&m.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),m.jsx("input",{id:"label",type:"text",value:d,onChange:W=>g(W.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),m.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&&m.jsx("p",{className:"text-sm text-status-error",children:y}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),m.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),m.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",m.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."]}),m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",m.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 wo({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?m.jsx(So,{}):r&&r.some(h=>f(h))?m.jsx(So,{}):n&&n.some(h=>o(h))?m.jsx(So,{}):m.jsx(Fs,{to:s,replace:!0})}const $2=T.lazy(()=>Ae(()=>import("./ProcessesListPage-CXvSLTIM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),Y2=T.lazy(()=>Ae(()=>import("./ProcessDetailPage-DUCOOvOK.js"),__vite__mapDeps([16,1,2,4,17,13,18,15,9,6,19,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),G2=T.lazy(()=>Ae(()=>import("./McpOverview-BN4GsBGI.js"),__vite__mapDeps([22,1,23,24,25,26,12,13,27,6]),import.meta.url).then(r=>({default:r.McpOverview}))),V2=T.lazy(()=>Ae(()=>import("./McpRunsPage-QsXid9Xe.js"),__vite__mapDeps([28,1,24,25,5,6,29,26,7,8,15,13,9,30,12,11,10,14,31]),import.meta.url).then(r=>({default:r.McpRunsPage}))),F2=T.lazy(()=>Ae(()=>import("./McpRunDetailPage-CQOeYqxa.js"),__vite__mapDeps([32,1,24,18,12,13,33,6,34,35,14,36,37,11]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),J2=T.lazy(()=>Ae(()=>import("./McpQueryPage-BK5L2PqJ.js"),__vite__mapDeps([38,1,12,13,7,8,11,10,14,9,30,15,31,5,6,4,39]),import.meta.url).then(r=>({default:r.McpQueryPage}))),Q2=T.lazy(()=>Ae(()=>import("./McpQueryDetailPage-lCW668WQ.js"),__vite__mapDeps([40,1,12,13,18,39,41,6,25,4,42,34,24,3,2,43,44,45,46,33,47,36]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),I2=T.lazy(()=>Ae(()=>import("./EscalationsOverview-Cv5UvuHI.js"),__vite__mapDeps([48,1,4,12,13,27,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),X2=T.lazy(()=>Ae(()=>import("./AvailableEscalationsPage-B2ZAb41C.js"),__vite__mapDeps([49,1,4,50,5,6,7,8,10,12,13,51,52,53,21,54,11,55,19,15,9,56,31,14]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),K2=T.lazy(()=>Ae(()=>import("./OperatorDashboard-CZQSINho.js"),__vite__mapDeps([57,1,4,50,5,6,7,8,12,13,10,31,54,11,55,19,15,9,56,14]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),Z2=T.lazy(()=>Ae(()=>import("./index-CVGgSoda.js"),__vite__mapDeps([58,1,35,50,12,13,56,3,4,20,21,52,51,18,19,33,6,34]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),W2=T.lazy(()=>Ae(()=>import("./WorkflowsOverview-GefO_yn0.js"),__vite__mapDeps([59,1,3,4,12,13,27,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),eE=T.lazy(()=>Ae(()=>import("./index-CWlP6vHG.js"),__vite__mapDeps([60,1,3,12,13,15,45,46,6,7,8,61,47,18]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),tE=T.lazy(()=>Ae(()=>import("./index-CWlP6vHG.js"),__vite__mapDeps([60,1,3,12,13,15,45,46,6,7,8,61,47,18]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),nE=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-DC4XHMWt.js"),__vite__mapDeps([62,1,9,30,3,29,26,6,4,5,7,8,15,13,12,11,10,14,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),sE=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-DC4XHMWt.js"),__vite__mapDeps([62,1,9,30,3,29,26,6,4,5,7,8,15,13,12,11,10,14,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),iE=T.lazy(()=>Ae(()=>import("./YamlWorkflowsPage-CMsrFooO.js"),__vite__mapDeps([63,1,25,41,5,6,64,12,13,11,8,44,45,46,43,61,47,18,65]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),rE=T.lazy(()=>Ae(()=>import("./TasksListPage-uJ6z37J-.js"),__vite__mapDeps([66,1,2,3,5,6,7,8,18,55,47,10,11,12,13,15]),import.meta.url).then(r=>({default:r.TasksListPage}))),aE=T.lazy(()=>Ae(()=>import("./TaskDetailPage-CRowpkeZ.js"),__vite__mapDeps([67,1,2,18,55,12,13,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),eg=T.lazy(()=>Ae(()=>import("./WorkflowExecutionPage-Cfx-xlRT.js"),__vite__mapDeps([68,1,3,4,35,2,12,13,34,14,18,33,6,36,37,11]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),lE=T.lazy(()=>Ae(()=>import("./AdminDashboard-CgJC8ZZF.js"),__vite__mapDeps([69,1,2,4,23,17,13,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),oE=T.lazy(()=>Ae(()=>import("./index-si70YcIP.js"),__vite__mapDeps([70,1,3,7,8,11,31,5,6,12,13,71,15]),import.meta.url).then(r=>({default:r.WorkersPage}))),cE=T.lazy(()=>Ae(()=>import("./index-C45DvtAZ.js"),__vite__mapDeps([72,1,3,7,8,73,53,6,11,31,5,12,13,19,71,15,74,50,45,46]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),tg=T.lazy(()=>Ae(()=>import("./index-C45DvtAZ.js"),__vite__mapDeps([72,1,3,7,8,73,53,6,11,31,5,12,13,19,71,15,74,50,45,46]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),uE=T.lazy(()=>Ae(()=>import("./index-hAZiac0C.js"),__vite__mapDeps([75,1,23,8,73,53,6,12,13,11,10,5,64,76,44,45,46,43,65,31,18]),import.meta.url).then(r=>({default:r.McpServersPage}))),ng=T.lazy(()=>Ae(()=>import("./index-FhasoOjO.js"),__vite__mapDeps([77,1,23,74,12,13,42,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),fE=T.lazy(()=>Ae(()=>import("./index-WQQJ_cp7.js"),__vite__mapDeps([78,1,21,5,6,7,8,10,11,9,73,53,31,12,13,19,46,50,47]),import.meta.url).then(r=>({default:r.UsersPage}))),hE=T.lazy(()=>Ae(()=>import("./RolesPage-DlQR0Iz_.js"),__vite__mapDeps([79,1,50,7,8,73,53,6,12,13,31]),import.meta.url).then(r=>({default:r.RolesPage}))),dE=T.lazy(()=>Ae(()=>import("./index-CLUYzdwz.js"),__vite__mapDeps([80,1,12,13,53,6,51]),import.meta.url).then(r=>({default:r.MaintenancePage}))),mE=T.lazy(()=>Ae(()=>import("./index-DasoTRjT.js"),__vite__mapDeps([81,1,17,13,11,5,6,29,26,53,34,71,7,8,31]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),pE=T.lazy(()=>Ae(()=>import("./index-C-mbURj-.js"),__vite__mapDeps([82,1,6,5,29,26,7,8,10,11,9,12,13,14]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),gE=T.lazy(()=>Ae(()=>import("./CredentialsPage-DVOK3aaR.js"),__vite__mapDeps([83,1,12,13,47,73,53,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),yE=T.lazy(()=>Ae(()=>import("./index-C9ClHiiW.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,47]),import.meta.url).then(r=>({default:r.FilesPage}))),bE=T.lazy(()=>Ae(()=>import("./index-vgxjge70.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,47,87,42,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),xE=T.lazy(()=>Ae(()=>import("./HomePage-CzvVyTq4.js"),__vite__mapDeps([88,1,3,24,26,2,4,19,13,15,14,6]),import.meta.url).then(r=>({default:r.HomePage}))),vE=T.lazy(()=>Ae(()=>import("./AgentsPage-Mom3N1Av.js"),__vite__mapDeps([89,1,90,4,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.AgentsPage}))),_E=T.lazy(()=>Ae(()=>import("./AgentDetailPage-D5dHrfaM.js"),__vite__mapDeps([91,1,90,92,13,4,15,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),sg=T.lazy(()=>Ae(()=>import("./AgentConfigPage-Bjl2Lsvo.js"),__vite__mapDeps([93,1,90,92,13,12,87,44,45,46,3,25,94,95,15,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),wE=T.lazy(()=>Ae(()=>import("./CapabilitiesPage-CK2fJ9Sy.js"),__vite__mapDeps([96,1,94,76,23,44,45,46,13,43,65,6,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),SE=T.lazy(()=>Ae(()=>import("./TopicsPage-letISGGD.js"),__vite__mapDeps([97,1,95,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.TopicsPage}))),EE=T.lazy(()=>Ae(()=>import("./TopicDetailPage-Dm0hDlS8.js"),__vite__mapDeps([98,1,95,14,13,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function AE(){return m.jsxs("div",{className:"animate-pulse space-y-4",children:[m.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return m.jsx(T.Suspense,{fallback:m.jsx(AE,{}),children:m.jsx("div",{className:"animate-page-enter",children:r})})}const cy=new vx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{cy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=`${window.__LT_BASE__||""}/login`;window.location.pathname!==n&&(window.location.href=`${n}?returnTo=${encodeURIComponent(window.location.pathname)}`)});const OE=Sx([{path:"/login",element:m.jsx(P2,{})},{path:"/connect/anthropic",element:m.jsx(W0,{})},{path:"/connect/:provider",element:m.jsx(W0,{})},{path:"/",element:m.jsx(B2,{}),children:[{index:!0,element:m.jsx(xe,{children:m.jsx(xE,{})})},{path:"processes/all",element:m.jsx(xe,{children:m.jsx($2,{})})},{path:"processes/detail/:originId",element:m.jsx(xe,{children:m.jsx(Y2,{})})},{path:"credentials",element:m.jsx(xe,{children:m.jsx(gE,{})})},{path:"connections",element:m.jsx(Fs,{to:"/credentials",replace:!0})},{path:"escalations",element:m.jsx(xe,{children:m.jsx(I2,{})})},{path:"escalations/available",element:m.jsx(xe,{children:m.jsx(X2,{})})},{path:"escalations/queue",element:m.jsx(xe,{children:m.jsx(K2,{})})},{path:"escalations/detail/:id",element:m.jsx(xe,{children:m.jsx(Z2,{})})},{path:"capabilities",element:m.jsx(xe,{children:m.jsx(wE,{})})},{path:"agents",element:m.jsx(xe,{children:m.jsx(vE,{})})},{path:"agents/new",element:m.jsx(xe,{children:m.jsx(sg,{})})},{path:"agents/:id",element:m.jsx(xe,{children:m.jsx(_E,{})})},{path:"agents/:id/edit",element:m.jsx(xe,{children:m.jsx(sg,{})})},{path:"topics",element:m.jsx(xe,{children:m.jsx(SE,{})})},{path:"topics/:topic",element:m.jsx(xe,{children:m.jsx(EE,{})})},{element:m.jsx(wo,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:m.jsx(xe,{children:m.jsx(W2,{})})},{path:"workflows/executions",element:m.jsx(xe,{children:m.jsx(sE,{})})},{path:"workflows/durable/executions",element:m.jsx(xe,{children:m.jsx(nE,{})})},{path:"workflows/durable/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(eg,{})})},{path:"workflows/tasks",element:m.jsx(xe,{children:m.jsx(rE,{})})},{path:"workflows/tasks/detail/:id",element:m.jsx(xe,{children:m.jsx(aE,{})})},{path:"workflows/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(eg,{})})},{path:"workflows/start",element:m.jsx(xe,{children:m.jsx(eE,{})})},{path:"workflows/durable/invoke",element:m.jsx(xe,{children:m.jsx(tE,{})})},{path:"workflows/cron",element:m.jsx(Fs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:m.jsx(xe,{children:m.jsx(oE,{})})},{path:"workflows/registry",element:m.jsx(xe,{children:m.jsx(cE,{})})},{path:"workflows/registry/new",element:m.jsx(xe,{children:m.jsx(tg,{})})},{path:"workflows/registry/:workflowType",element:m.jsx(xe,{children:m.jsx(tg,{})})}]},{element:m.jsx(wo,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:m.jsx(xe,{children:m.jsx(G2,{})})},{path:"mcp/queries",element:m.jsx(xe,{children:m.jsx(J2,{})})},{path:"mcp/queries/:workflowId",element:m.jsx(xe,{children:m.jsx(Q2,{})})},{path:"mcp/tools",element:m.jsx(Fs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:m.jsx(xe,{children:m.jsx(uE,{})})},{path:"mcp/servers/new",element:m.jsx(xe,{children:m.jsx(ng,{})})},{path:"mcp/servers/:serverId",element:m.jsx(xe,{children:m.jsx(ng,{})})},{path:"mcp/workflows",element:m.jsx(xe,{children:m.jsx(iE,{})})},{path:"mcp/executions",element:m.jsx(xe,{children:m.jsx(V2,{})})},{path:"mcp/executions/:jobId",element:m.jsx(xe,{children:m.jsx(F2,{})})},{path:"files",element:m.jsx(xe,{children:m.jsx(yE,{})})},{path:"knowledge",element:m.jsx(xe,{children:m.jsx(bE,{})})}]},{element:m.jsx(wo,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:m.jsx(xe,{children:m.jsx(lE,{})})},{path:"admin/users",element:m.jsx(xe,{children:m.jsx(fE,{})})}]},{element:m.jsx(wo,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:m.jsx(Fs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:m.jsx(Fs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:m.jsx(xe,{children:m.jsx(hE,{})})},{path:"admin/maintenance",element:m.jsx(xe,{children:m.jsx(dE,{})})},{path:"admin/controlplane",element:m.jsx(xe,{children:m.jsx(mE,{})})},{path:"admin/streams",element:m.jsx(xe,{children:m.jsx(pE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function jE(){return m.jsx(_x,{client:cy,children:m.jsx(dv,{children:m.jsx(yw,{children:m.jsx(Ex,{router:OE})})})})}cv.createRoot(document.getElementById("root")).render(m.jsx(T.StrictMode,{children:m.jsx(jE,{})}));export{hh as A,QE as B,uh as C,k2 as D,IE as E,Ig as F,hg as G,Zw as J,Wt as L,g_ as N,oy as O,Hw as S,JE as a,b_ as b,C2 as c,Xe as d,zE as e,j2 as f,UE as g,LE as h,RE as i,Oi as j,PE as k,$E as l,YE as m,GE as n,VE as o,DE as p,Sw as q,ww as r,Vg as s,BE as t,xw as u,qE as v,HE as w,ay as x,ly as y,FE as z};
63
- //# sourceMappingURL=index-CWEOhAiK.js.map
61
+ `}function uS(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 ny=T.createContext(null);function fS({children:r}){const n=Ws(),[s,a]=T.useState(!1),[o,f]=T.useState([]),[h,d]=T.useState(null),[g,y]=T.useState({}),E=T.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??oS(n.pathname)};T.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const O=T.useCallback(()=>a(se=>!se),[]),q=T.useCallback(se=>{y(se)},[]),M=T.useCallback(()=>{f([]),d(null)},[]),D=T.useCallback(async se=>{var V;const ee=new Date().toISOString(),me={id:`user-${Date.now()}`,role:"user",content:se,timestamp:ee},re={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:ee,pending:!0};f(G=>[...G,me,re]);const C={...w};(V=C.entities)!=null&&V.yamlContent&&C.entities.yamlContent.length>G0&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,G0)+`
62
+ ... (truncated)`});const ce=`${cS(o.concat(me))}${se}`;try{const K=(await Xe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ce,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;d(K),f(ae=>ae.map(ne=>ne.id===re.id?{...ne,workflowId:K}:ne)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var ae;try{const ne=await Xe(`/workflows/${K}/result`),ke=(ae=ne==null?void 0:ne.result)==null?void 0:ae.data;if(ke){E.current&&clearInterval(E.current),E.current=null,d(null);const He=uS(ke);let Me;try{Me=(await Xe(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===re.id?{...te,content:He,timestamp:new Date().toISOString(),pending:!1,durationMs:Me}:te))}}catch{}},3e3)}catch{f(G=>G.map(K=>K.id===re.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,w]),W=T.useCallback(async se=>{const ee=o.find(C=>C.id===se);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const me=o.indexOf(ee),re=o.slice(0,me).reverse().find(C=>C.role==="user");if(re){f(C=>C.map(X=>X.id===se?{...X,compilationStatus:"compiling"}:X));try{const C=await Xe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:ee.content})}),X=await Xe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await Xe(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"done"}:V))}catch(C){const X=C instanceof Error?C.message:"Compilation failed";f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"error",compilationError:X}:V))}}},[o]);return m.jsx(ny.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:O,messages:o,sendMessage:D,pageContext:w,setPageContext:q,activeWorkflowId:h,clearMessages:M,compileMessage:W},children:r})}function sy(){const r=T.useContext(ny);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function hS(){const{helpOpen:r,toggleHelp:n}=sy();return m.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:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?m.jsx($o,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):m.jsx("img",{src:`${Wt}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const iy=6048e5,dS=864e5,V0=6e4,F0=525600,J0=43200,I0=1440,Q0=Symbol.for("constructDateFrom");function ds(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&Q0 in r?r[Q0](n):r instanceof Date?new r.constructor(n):new Date(n)}function sn(r,n){return ds(n||r,r)}let mS={};function Fa(){return mS}function $a(r,n){var d,g,y,E;const s=Fa(),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??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=sn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Ho(r,n){return $a(r,{...n,weekStartsOn:1})}function ry(r,n){const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=ds(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Ho(o),h=ds(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=Ho(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Po(r){const n=sn(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 ay(r,...n){const s=ds.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function X0(r,n){const s=sn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function pS(r,n,s){const[a,o]=ay(s==null?void 0:s.in,r,n),f=X0(a),h=X0(o),d=+f-Po(f),g=+h-Po(h);return Math.round((d-g)/dS)}function gS(r,n){const s=ry(r,n),a=ds(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Ho(a)}function yS(r,n){const s=+sn(r)-+sn(n);return s<0?-1:s>0?1:s}function bS(r){return ds(r,Date.now())}function xS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function vS(r){return!(!xS(r)&&typeof r!="number"||isNaN(+sn(r)))}function _S(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function wS(r,n){const s=sn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const SS={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"}},ES=(r,n,s)=>{let a;const o=SS[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function wf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const AS={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},jS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},OS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},TS={date:wf({formats:AS,defaultWidth:"full"}),time:wf({formats:jS,defaultWidth:"full"}),dateTime:wf({formats:OS,defaultWidth:"full"})},NS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},CS=(r,n,s,a)=>NS[r];function Oa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;o=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const kS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},MS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},RS={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"]},DS={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"]},zS={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"}},qS={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"}},US=(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"},BS={ordinalNumber:US,era:Oa({values:kS,defaultWidth:"wide"}),quarter:Oa({values:MS,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Oa({values:RS,defaultWidth:"wide"}),day:Oa({values:DS,defaultWidth:"wide"}),dayPeriod:Oa({values:zS,defaultWidth:"wide",formattingValues:qS,defaultFormattingWidth:"wide"})};function Ta(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?HS(d,w=>w.test(h)):LS(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function LS(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function HS(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function PS(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=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(o.length);return{value:h,rest:d}}}const $S=/^(\d+)(th|st|nd|rd)?/i,YS=/\d+/i,GS={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},VS={any:[/^b/i,/^(a|c)/i]},FS={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},JS={any:[/1/i,/2/i,/3/i,/4/i]},IS={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},QS={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]},XS={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},KS={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]},ZS={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},WS={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}},e2={ordinalNumber:PS({matchPattern:$S,parsePattern:YS,valueCallback:r=>parseInt(r,10)}),era:Ta({matchPatterns:GS,defaultMatchWidth:"wide",parsePatterns:VS,defaultParseWidth:"any"}),quarter:Ta({matchPatterns:FS,defaultMatchWidth:"wide",parsePatterns:JS,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Ta({matchPatterns:IS,defaultMatchWidth:"wide",parsePatterns:QS,defaultParseWidth:"any"}),day:Ta({matchPatterns:XS,defaultMatchWidth:"wide",parsePatterns:KS,defaultParseWidth:"any"}),dayPeriod:Ta({matchPatterns:ZS,defaultMatchWidth:"any",parsePatterns:WS,defaultParseWidth:"any"})},ly={code:"en-US",formatDistance:ES,formatLong:TS,formatRelative:CS,localize:BS,match:e2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function t2(r,n){const s=sn(r,n==null?void 0:n.in);return pS(s,wS(s))+1}function n2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ho(s)-+gS(s);return Math.round(a/iy)+1}function oy(r,n){var E,w,O,q;const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Fa(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(O=o.locale)==null?void 0:O.options)==null?void 0:q.firstWeekContainsDate)??1,h=ds((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=$a(h,n),g=ds((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=$a(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function s2(r,n){var d,g,y,E;const s=Fa(),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??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=oy(r,n),f=ds((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),$a(f,n)}function i2(r,n){const s=sn(r,n==null?void 0:n.in),a=+$a(s,n)-+s2(s,n);return Math.round(a/iy)+1}function Ge(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Vs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ge(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ge(s+1,2)},d(r,n){return Ge(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 Ge(r.getHours()%12||12,n.length)},H(r,n){return Ge(r.getHours(),n.length)},m(r,n){return Ge(r.getMinutes(),n.length)},s(r,n){return Ge(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ge(o,n.length)}},pr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},K0={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(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Vs.y(r,n)},Y:function(r,n,s,a){const o=oy(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ge(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ge(f,n.length)},R:function(r,n){const s=ry(r);return Ge(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ge(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 Ge(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 Ge(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 Vs.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 Ge(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 o=i2(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ge(o,n.length)},I:function(r,n,s){const a=n2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ge(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Vs.d(r,n)},D:function(r,n,s){const a=t2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ge(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 o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ge(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ge(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ge(o,n.length);case"io":return s.ordinalNumber(o,{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 o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=pr.noon:a===0?o=pr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=pr.evening:a>=12?o=pr.afternoon:a>=4?o=pr.morning:o=pr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{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 Vs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Vs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Vs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Vs.s(r,n)},S:function(r,n){return Vs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return W0(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return W0(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+Z0(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+Z0(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ge(a,n.length)},T:function(r,n,s){return Ge(+r,n.length)}};function Z0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ge(f,2)}function W0(r,n){return r%60===0?(r>0?"-":"+")+Ge(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ge(Math.trunc(a/60),2),f=Ge(a%60,2);return s+o+n+f}const eg=(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"})}},cy=(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"})}},r2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return eg(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}}",eg(a,n)).replace("{{time}}",cy(o,n))},a2={p:cy,P:r2},l2=/^D+$/,o2=/^Y+$/,c2=["D","DD","YY","YYYY"];function u2(r){return l2.test(r)}function f2(r){return o2.test(r)}function h2(r,n,s){const a=d2(r,n,s);if(console.warn(a),c2.includes(r))throw new RangeError(a)}function d2(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 m2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,p2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,g2=/^'([^]*?)'?$/,y2=/''/g,b2=/[a-zA-Z]/;function uy(r,n,s){var E,w,O,q;const a=Fa(),o=a.locale??ly,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((q=(O=a.locale)==null?void 0:O.options)==null?void 0:q.weekStartsOn)??0,d=sn(r,s==null?void 0:s.in);if(!vS(d))throw new RangeError("Invalid time value");let g=n.match(p2).map(M=>{const D=M[0];if(D==="p"||D==="P"){const W=a2[D];return W(M,o.formatLong)}return M}).join("").match(m2).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const D=M[0];if(D==="'")return{isToken:!1,value:x2(M)};if(K0[D])return{isToken:!0,value:M};if(D.match(b2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const D=M.value;(f2(D)||u2(D))&&h2(D,n,String(r));const W=K0[D[0]];return W(d,D,o.localize,y)}).join("")}function x2(r){const n=r.match(g2);return n?n[1].replace(y2,"'"):r}function v2(r,n,s){const a=Fa(),o=(s==null?void 0:s.locale)??a.locale??ly,f=yS(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]=ay(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=_S((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-d.getTime(),w=E/V0,O=Po(g)-Po(d),q=(E-O)/V0,M=s==null?void 0:s.unit;let D;if(M?D=M:w<1?D="second":w<60?D="minute":w<I0?D="hour":q<J0?D="day":q<F0?D="month":D="year",D==="second"){const W=y(E/1e3);return o.formatDistance("xSeconds",W,h)}else if(D==="minute"){const W=y(w);return o.formatDistance("xMinutes",W,h)}else if(D==="hour"){const W=y(w/60);return o.formatDistance("xHours",W,h)}else if(D==="day"){const W=y(q/I0);return o.formatDistance("xDays",W,h)}else if(D==="month"){const W=y(q/J0);return W===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",W,h)}else{const W=y(q/F0);return o.formatDistance("xYears",W,h)}}function _2(r,n){return v2(r,bS(r),n)}function w2(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":_2(n,{addSuffix:!0})}function VE(r){return r<=0?"Expired":ph(r)}function S2(r){return r==null?"--":ph(r)}function ph(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),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function FE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return ph(a-s)}function fy({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[d,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),O=220,q=T.useCallback(()=>{if(!y.current)return;const se=y.current.getBoundingClientRect(),ee=window.innerWidth-O-8,me=Math.max(8,Math.min(se.left,ee));g({top:se.bottom+4,left:me})},[]),M=T.useCallback(async(se,ee)=>{try{await navigator.clipboard.writeText(se),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),D=T.useCallback(()=>{clearTimeout(w.current),q(),o(!0)},[q]),W=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),m.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:D,onMouseLeave:W,children:[n,a&&d&&og.createPortal(m.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:D,onMouseLeave:W,children:r.map(se=>m.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(se.value,se.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:se.label}),m.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===se.label?"✓":se.value})]},se.label))}),document.body)]})}function E2(r,n){const s=new Date(r);switch(n){case"relative":return w2(r);case"datetime":return uy(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function A2(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:uy(n,"MMM d, yyyy h:mm:ss a")}]}function j2({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>A2(r),[r]);return m.jsx(fy,{options:o,children:m.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:E2(r,n)})})}function O2({ms:r,className:n=""}){const s=S2(r),a=T.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?m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):m.jsx(fy,{options:a,children:m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const T2=["sm","md","lg","full"],tg={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"},ng={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function N2({which:r}){const n="stroke-current";switch(r){case"sm":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function C2({msg:r}){const[n,s]=T.useState(0);T.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),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return m.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),m.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&m.jsxs(gr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[m.jsx(Xf,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function k2({msg:r,compileMessage:n}){const s=r.role==="assistant";return m.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[m.jsx(j2,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),m.jsx(O2,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&m.jsx(gr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:m.jsx(Xf,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&m.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:m.jsx(Kx,{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 M2(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:d}=sy(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[O,q]=T.useState(!0),M=T.useRef(null),D=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&D.current&&D.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const C=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,E,n]),!r)return null;const W=()=>{const C=g.trim();!C||f||(a(C),y(""),D.current&&(D.current.style.height="auto"))},se=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),W())},ee=E==="full",me=o.page.replace(/-/g," "),re=ee?{}:{bottom:"108px"};return m.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?tg.full:`right-6 ${tg[E]}`} ${O?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[m.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),m.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),m.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[m.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:T2.map(C=>m.jsx("button",{onClick:()=>w(C),className:`p-1 rounded transition-colors ${C===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===E,"aria-label":ng[C],title:ng[C],children:m.jsx(N2,{which:C})},C))}),s.length>0&&m.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:m.jsx(Zx,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),m.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:m.jsx($o,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),m.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&m.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>m.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[m.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?m.jsx(C2,{msg:C}):C.role==="assistant"?m.jsx(mh,{content:C.content}):C.content}),!C.pending&&m.jsx("div",{className:"mt-0.5",children:m.jsx(k2,{msg:C,compileMessage:d})})]},C.id))]}),m.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsx("textarea",{ref:D,value:g,onChange:C=>{y(C.target.value);const X=C.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:se,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}),m.jsx("button",{onClick:W,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:m.jsx(Wx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function R2(){var M;const{isBuilder:r,isOps:n}=Ig(),{data:s}=Qg(),a=!!((M=s==null?void 0:s.ai)!=null&&M.enabled),{collapsed:o,toggle:f}=Kg(),[h,d]=T.useState(!1),[g,y]=T.useState(!1),[E,w]=T.useState(()=>window.location.hash.startsWith("#docs")),O=Ws(),q=T.useRef(null);return T.useEffect(()=>{const D=q.current;D&&(D.classList.remove("animate-page-in"),D.offsetWidth,D.classList.add("animate-page-in"))},[O.pathname]),T.useEffect(()=>{const D=()=>{window.location.hash.startsWith("#docs")&&w(!0)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]),m.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[m.jsx(_w,{onToggleEventFeed:()=>d(D=>!D),onToggleDocs:()=>w(D=>!D)}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsxs("aside",{className:`${o?"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:[m.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[m.jsx(jw,{aiEnabled:a,isBuilder:r}),r&&m.jsx(Ow,{}),r&&a&&m.jsx(Nw,{}),r&&m.jsx(kw,{}),(r||n)&&m.jsx(Mw,{isBuilder:r})]}),m.jsx("button",{onClick:f,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${o?"flex justify-center":"flex items-center px-7"}`,"aria-label":o?"Expand sidebar":"Collapse sidebar",children:o?m.jsx(ev,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):m.jsx(tv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{ref:q,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:m.jsx(Ma,{})})})]}),m.jsx(Kw,{open:h,onToggle:()=>d(D=>!D),configOpen:g,onToggleConfig:()=>y(D=>!D)}),m.jsx(lS,{open:E,onClose:()=>{w(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),a&&m.jsx(hS,{}),a&&m.jsx(M2,{})]})}function D2(){const{isAuthenticated:r}=ji(),n=Ws();return r?m.jsx(yw,{children:m.jsx(fS,{children:m.jsx(R2,{})})}):m.jsx(cs,{to:"/login",state:{from:n.pathname},replace:!0})}function hy({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.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"}),m.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"}),m.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"}),m.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 m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),m.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),m.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),m.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("path",{d:"M12 8v4l3 3"})]})}}async function z2(){return Xe("/auth/oauth/providers")}async function q2(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Xe(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function JE(){return Hn({queryKey:["oauth-connections"],queryFn:()=>Xe("/auth/oauth/connections")})}function IE(){const r=Cn();return Pn({mutationFn:({provider:n,label:s})=>q2(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function U2(){var ce;const{login:r,isAuthenticated:n}=ji(),s=cg(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),d=((ce=a.state)==null?void 0:ce.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,O]=T.useState(""),[q,M]=T.useState(h||""),[D,W]=T.useState(!1),[se,ee]=T.useState(!!f),[me,re]=T.useState([]),C=T.useRef(!1);if(T.useEffect(()=>{f||C.current||(C.current=!0,(async()=>{var V,G,K,ae;try{const ne=await fetch(`${Wt}/api/settings`);if(!ne.ok)return;const ke=await ne.json();if(!((V=ke.auth)!=null&&V.sso))return;const He=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!He.ok){M("Host authentication required — please log in to your organization first");return}const Me=await He.json();Me.token&&((G=ke.auth)!=null&&G.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",ke.auth.ssoLogoutUrl),ee(!0),r(Me.token,void 0,{displayName:(K=Me.user)==null?void 0:K.display_name,username:(ae=Me.user)==null?void 0:ae.external_id}))}catch{}})())},[]),T.useEffect(()=>{f||z2().then(re).catch(()=>{})},[]),T.useEffect(()=>{if(!se)return;const V=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(V)},[se]),n&&!se)return m.jsx(cs,{to:d,replace:!0});const X=async V=>{var G,K;if(V.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}W(!0);try{const ae=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ne=await ae.json();if(!ae.ok){M(ne.error||"Login failed");return}ee(!0),r(ne.token,{username:y.trim(),password:w},{displayName:(G=ne.user)==null?void 0:G.display_name,username:(K=ne.user)==null?void 0:K.external_id})}catch{M("Unable to connect to server")}finally{W(!1)}};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${se?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:m.jsx(hh,{size:"lg",hideLabel:se})}),m.jsxs("form",{onSubmit:X,className:`space-y-5 transition-opacity duration-300 ${se?"opacity-0":""}`,children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),m.jsx("input",{id:"username",type:"text",value:y,onChange:V=>E(V.target.value),className:"input",placeholder:"Enter your username",autoFocus:!se,autoComplete:"username"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),m.jsx("input",{id:"password",type:"password",value:w,onChange:V=>O(V.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&m.jsx("p",{className:"text-sm text-status-error",children:q}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:D||se,children:D?"Signing in...":"Sign In"}),me.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[m.jsx("div",{className:"flex-1 h-px bg-border"}),m.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),m.jsx("div",{className:"flex-1 h-px bg-border"})]}),m.jsx("div",{className:"space-y-2",children:me.filter(V=>V.provider!=="anthropic").map(V=>m.jsxs("a",{href:`${Wt}/api/auth/oauth/${V.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[m.jsx(hy,{provider:V.provider}),"Sign in with ",V.name]},V.provider))})]})]})]})})}function sg(){const{isAuthenticated:r}=ji(),n=cg(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[d,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,O]=T.useState(!1),q=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),D=W=>{W.preventDefault();const se=f.trim();if(!se){E("A token or API key is required");return}if(!se.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}O(!0),E("");const ee=`${Wt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(se)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:"mb-10",children:m.jsx(hh,{size:"lg"})}),m.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[m.jsx(hy,{provider:"anthropic",className:"w-6 h-6"}),m.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),m.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."}),m.jsxs("form",{onSubmit:D,className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),m.jsx("input",{id:"token",type:"password",value:f,onChange:W=>h(W.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&m.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&m.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),m.jsx("input",{id:"label",type:"text",value:d,onChange:W=>g(W.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),m.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&&m.jsx("p",{className:"text-sm text-status-error",children:y}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),m.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),m.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",m.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."]}),m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",m.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 So({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=ji();return a?m.jsx(Ma,{}):r&&r.some(h=>f(h))?m.jsx(Ma,{}):n&&n.some(h=>o(h))?m.jsx(Ma,{}):m.jsx(cs,{to:s,replace:!0})}function B2({redirectTo:r="/"}){var a;const{data:n,isLoading:s}=Qg();return s||!n?null:(a=n.ai)!=null&&a.enabled?m.jsx(Ma,{}):m.jsx(cs,{to:r,replace:!0})}const L2=T.lazy(()=>_e(()=>import("./ProcessesListPage-DG54t-Nd.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),H2=T.lazy(()=>_e(()=>import("./ProcessDetailPage-BLfLfmWX.js"),__vite__mapDeps([16,1,2,4,17,13,18,15,9,6,19,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),P2=T.lazy(()=>_e(()=>import("./McpOverview-B4GsHxij.js"),__vite__mapDeps([22,1,23,24,25,26,12,13,27,6]),import.meta.url).then(r=>({default:r.McpOverview}))),$2=T.lazy(()=>_e(()=>import("./McpRunsPage-Bdke-HoQ.js"),__vite__mapDeps([28,1,24,25,5,6,29,26,7,8,15,13,9,30,12,11,10,14,31]),import.meta.url).then(r=>({default:r.McpRunsPage}))),Y2=T.lazy(()=>_e(()=>import("./McpRunDetailPage-Dt7Ai3qB.js"),__vite__mapDeps([32,1,24,18,12,13,33,6,34,35,14,36,37,11]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),G2=T.lazy(()=>_e(()=>import("./McpQueryPage-B-8WR3GV.js"),__vite__mapDeps([38,1,12,13,7,8,11,10,14,9,30,15,31,5,6,4,39]),import.meta.url).then(r=>({default:r.McpQueryPage}))),V2=T.lazy(()=>_e(()=>import("./McpQueryDetailPage-DZKpzWST.js"),__vite__mapDeps([40,1,12,13,18,39,6,25,4,41,34,24,3,2,42,43,44,45,46,47,33,48,36]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),F2=T.lazy(()=>_e(()=>import("./EscalationsOverview-BIEeflEV.js"),__vite__mapDeps([49,1,4,12,13,27,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),J2=T.lazy(()=>_e(()=>import("./AvailableEscalationsPage-Ci24fdxC.js"),__vite__mapDeps([50,1,4,51,5,6,7,8,10,12,13,52,53,54,21,55,11,56,19,15,9,57,31,14]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),I2=T.lazy(()=>_e(()=>import("./OperatorDashboard-VZ97mufd.js"),__vite__mapDeps([58,1,4,51,5,6,7,8,12,13,10,31,55,11,56,19,15,9,57,14]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),Q2=T.lazy(()=>_e(()=>import("./index-B-BK3vtk.js"),__vite__mapDeps([59,1,35,51,12,13,57,3,4,20,21,53,52,18,19,33,6,34]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),X2=T.lazy(()=>_e(()=>import("./WorkflowsOverview-Cwo2rqGT.js"),__vite__mapDeps([60,1,3,4,12,13,27,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),K2=T.lazy(()=>_e(()=>import("./index-BBBGETMs.js"),__vite__mapDeps([61,1,3,12,13,15,62,45,46,6]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),Z2=T.lazy(()=>_e(()=>import("./index-BBBGETMs.js"),__vite__mapDeps([61,1,3,12,13,15,62,45,46,6]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),W2=T.lazy(()=>_e(()=>import("./WorkflowsDashboard-Bcf17vCt.js"),__vite__mapDeps([63,1,9,30,3,29,26,6,4,5,7,8,15,13,12,11,10,14,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),eE=T.lazy(()=>_e(()=>import("./WorkflowsDashboard-Bcf17vCt.js"),__vite__mapDeps([63,1,9,30,3,29,26,6,4,5,7,8,15,13,12,11,10,14,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),tE=T.lazy(()=>_e(()=>import("./YamlWorkflowsPage-DOiEQDOq.js"),__vite__mapDeps([64,1,25,5,6,12,13,11,8,47,62,18]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),nE=T.lazy(()=>_e(()=>import("./GraphInvokePage-DtAW8ilc.js"),__vite__mapDeps([65,1,25,12,13,42,44,45,46,43,6,47,62]),import.meta.url).then(r=>({default:r.GraphInvokePage}))),sE=T.lazy(()=>_e(()=>import("./YamlWorkflowDetailPage-Bv8ZFwO-.js"),__vite__mapDeps([66,1,25,18,62,13,6]),import.meta.url).then(r=>({default:r.YamlWorkflowDetailPage}))),iE=T.lazy(()=>_e(()=>import("./TasksListPage-DoHXxZF-.js"),__vite__mapDeps([67,1,2,3,5,6,7,8,18,56,48,10,11,12,13,15]),import.meta.url).then(r=>({default:r.TasksListPage}))),rE=T.lazy(()=>_e(()=>import("./TaskDetailPage-CLl2mgBC.js"),__vite__mapDeps([68,1,2,18,56,12,13,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),ig=T.lazy(()=>_e(()=>import("./WorkflowExecutionPage-DEDsBmn1.js"),__vite__mapDeps([69,1,3,4,35,2,12,13,34,14,18,33,6,36,37,11]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),aE=T.lazy(()=>_e(()=>import("./AdminDashboard-CMzR4d-w.js"),__vite__mapDeps([70,1,2,4,23,17,13,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),lE=T.lazy(()=>_e(()=>import("./index-Cb7aSzox.js"),__vite__mapDeps([71,1,3,7,8,11,31,5,6,12,13,72,15]),import.meta.url).then(r=>({default:r.WorkersPage}))),oE=T.lazy(()=>_e(()=>import("./index-CMRW_PE-.js"),__vite__mapDeps([73,1,3,7,8,74,54,6,11,31,5,12,13,19,72,15,51,45,46,62]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),rg=T.lazy(()=>_e(()=>import("./index-CMRW_PE-.js"),__vite__mapDeps([73,1,3,7,8,74,54,6,11,31,5,12,13,19,72,15,51,45,46,62]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),cE=T.lazy(()=>_e(()=>import("./index-BTp73vYK.js"),__vite__mapDeps([75,1,23,8,74,54,6,12,13,11,10,5,76,44,45,46,47,43,31,18]),import.meta.url).then(r=>({default:r.McpServersPage}))),ag=T.lazy(()=>_e(()=>import("./index-H5Yb8CY2.js"),__vite__mapDeps([77,1,23,12,13,41,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),uE=T.lazy(()=>_e(()=>import("./index-Cjb8ulHm.js"),__vite__mapDeps([78,1,21,5,6,7,8,10,11,9,74,54,31,12,13,19,46,51,48]),import.meta.url).then(r=>({default:r.UsersPage}))),fE=T.lazy(()=>_e(()=>import("./RolesPage-Bdlv3DdW.js"),__vite__mapDeps([79,1,51,7,8,74,54,6,12,13,31]),import.meta.url).then(r=>({default:r.RolesPage}))),hE=T.lazy(()=>_e(()=>import("./index-_JsRJPds.js"),__vite__mapDeps([80,1,12,13,54,6,52]),import.meta.url).then(r=>({default:r.MaintenancePage}))),dE=T.lazy(()=>_e(()=>import("./index-DgLZ8Ix5.js"),__vite__mapDeps([81,1,17,13,11,5,6,29,26,54,34,72,7,8,31]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),mE=T.lazy(()=>_e(()=>import("./index-rbuNUyAh.js"),__vite__mapDeps([82,1,6,5,29,26,7,8,10,11,9,12,13,14]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),pE=T.lazy(()=>_e(()=>import("./CredentialsPage-BDzFa3HV.js"),__vite__mapDeps([83,1,12,13,48,74,54,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),gE=T.lazy(()=>_e(()=>import("./index-CCup2uaP.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,48]),import.meta.url).then(r=>({default:r.FilesPage}))),yE=T.lazy(()=>_e(()=>import("./index-BInTEEIX.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,48,87,41,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),bE=T.lazy(()=>_e(()=>import("./HomePage-HsO-M8ub.js"),__vite__mapDeps([88,1,3,24,26,2,4,19,13,15,14,6]),import.meta.url).then(r=>({default:r.HomePage}))),xE=T.lazy(()=>_e(()=>import("./AgentsPage-ntuzWHCD.js"),__vite__mapDeps([89,1,90,4,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.AgentsPage}))),vE=T.lazy(()=>_e(()=>import("./AgentDetailPage-CSrejvSl.js"),__vite__mapDeps([91,1,90,92,13,4,15,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),lg=T.lazy(()=>_e(()=>import("./AgentConfigPage-DHCpN4xk.js"),__vite__mapDeps([93,1,90,92,13,12,87,44,45,46,3,25,94,95,15,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),_E=T.lazy(()=>_e(()=>import("./CapabilitiesPage-Bea9yLmU.js"),__vite__mapDeps([96,1,94,76,23,44,45,46,13,47,6,43,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),wE=T.lazy(()=>_e(()=>import("./TopicsPage-Bc-4ne6V.js"),__vite__mapDeps([97,1,95,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.TopicsPage}))),SE=T.lazy(()=>_e(()=>import("./TopicDetailPage-W9RKkNNp.js"),__vite__mapDeps([98,1,95,14,13,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function EE(){return m.jsxs("div",{className:"animate-pulse space-y-4",children:[m.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return m.jsx(T.Suspense,{fallback:m.jsx(EE,{}),children:m.jsx("div",{className:"animate-page-enter",children:r})})}const dy=new Ex({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{dy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=`${window.__LT_BASE__||""}/login`;window.location.pathname!==n&&(window.location.href=`${n}?returnTo=${encodeURIComponent(window.location.pathname)}`)});const AE=Ox([{path:"/login",element:m.jsx(U2,{})},{path:"/connect/anthropic",element:m.jsx(sg,{})},{path:"/connect/:provider",element:m.jsx(sg,{})},{path:"/",element:m.jsx(D2,{}),children:[{index:!0,element:m.jsx(xe,{children:m.jsx(bE,{})})},{path:"processes/all",element:m.jsx(xe,{children:m.jsx(L2,{})})},{path:"processes/detail/:originId",element:m.jsx(xe,{children:m.jsx(H2,{})})},{path:"credentials",element:m.jsx(xe,{children:m.jsx(pE,{})})},{path:"connections",element:m.jsx(cs,{to:"/credentials",replace:!0})},{path:"escalations",element:m.jsx(xe,{children:m.jsx(F2,{})})},{path:"escalations/available",element:m.jsx(xe,{children:m.jsx(J2,{})})},{path:"escalations/queue",element:m.jsx(xe,{children:m.jsx(I2,{})})},{path:"escalations/detail/:id",element:m.jsx(xe,{children:m.jsx(Q2,{})})},{path:"capabilities",element:m.jsx(xe,{children:m.jsx(_E,{})})},{path:"agents",element:m.jsx(xe,{children:m.jsx(xE,{})})},{path:"agents/new",element:m.jsx(xe,{children:m.jsx(lg,{})})},{path:"agents/:id",element:m.jsx(xe,{children:m.jsx(vE,{})})},{path:"agents/:id/edit",element:m.jsx(xe,{children:m.jsx(lg,{})})},{path:"topics",element:m.jsx(xe,{children:m.jsx(wE,{})})},{path:"topics/:topic",element:m.jsx(xe,{children:m.jsx(SE,{})})},{element:m.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:m.jsx(xe,{children:m.jsx(X2,{})})},{path:"workflows/executions",element:m.jsx(xe,{children:m.jsx(eE,{})})},{path:"workflows/durable/executions",element:m.jsx(xe,{children:m.jsx(W2,{})})},{path:"workflows/durable/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(ig,{})})},{path:"workflows/tasks",element:m.jsx(xe,{children:m.jsx(iE,{})})},{path:"workflows/tasks/detail/:id",element:m.jsx(xe,{children:m.jsx(rE,{})})},{path:"workflows/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(ig,{})})},{path:"workflows/start",element:m.jsx(xe,{children:m.jsx(K2,{})})},{path:"workflows/durable/invoke",element:m.jsx(xe,{children:m.jsx(Z2,{})})},{path:"workflows/cron",element:m.jsx(cs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:m.jsx(xe,{children:m.jsx(lE,{})})},{path:"workflows/registry",element:m.jsx(xe,{children:m.jsx(oE,{})})},{path:"workflows/registry/new",element:m.jsx(xe,{children:m.jsx(rg,{})})},{path:"workflows/registry/:workflowType",element:m.jsx(xe,{children:m.jsx(rg,{})})}]},{element:m.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:m.jsx(xe,{children:m.jsx(tE,{})})},{path:"mcp/workflows/invoke",element:m.jsx(xe,{children:m.jsx(nE,{})})},{path:"mcp/workflows/:id",element:m.jsx(xe,{children:m.jsx(sE,{})})},{path:"mcp/executions",element:m.jsx(xe,{children:m.jsx($2,{})})},{path:"mcp/executions/:jobId",element:m.jsx(xe,{children:m.jsx(Y2,{})})},{path:"files",element:m.jsx(xe,{children:m.jsx(gE,{})})},{path:"knowledge",element:m.jsx(xe,{children:m.jsx(yE,{})})},{element:m.jsx(B2,{}),children:[{path:"mcp",element:m.jsx(xe,{children:m.jsx(P2,{})})},{path:"mcp/queries",element:m.jsx(xe,{children:m.jsx(G2,{})})},{path:"mcp/queries/:workflowId",element:m.jsx(xe,{children:m.jsx(V2,{})})},{path:"mcp/tools",element:m.jsx(cs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:m.jsx(xe,{children:m.jsx(cE,{})})},{path:"mcp/servers/new",element:m.jsx(xe,{children:m.jsx(ag,{})})},{path:"mcp/servers/:serverId",element:m.jsx(xe,{children:m.jsx(ag,{})})}]}]},{element:m.jsx(So,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:m.jsx(xe,{children:m.jsx(aE,{})})},{path:"admin/users",element:m.jsx(xe,{children:m.jsx(uE,{})})}]},{element:m.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:m.jsx(cs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:m.jsx(cs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:m.jsx(xe,{children:m.jsx(fE,{})})},{path:"admin/maintenance",element:m.jsx(xe,{children:m.jsx(hE,{})})},{path:"admin/controlplane",element:m.jsx(xe,{children:m.jsx(dE,{})})},{path:"admin/streams",element:m.jsx(xe,{children:m.jsx(mE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function jE(){return m.jsx(Ax,{client:dy,children:m.jsx(uv,{children:m.jsx(mw,{children:m.jsx(Tx,{router:AE})})})})}av.createRoot(document.getElementById("root")).render(m.jsx(T.StrictMode,{children:m.jsx(jE,{})}));export{ph as A,JE as B,dh as C,O2 as D,IE as E,Wg as F,pg as G,Iw as J,Wt as L,d_ as N,hy as O,qw as S,FE as a,p_ as b,j2 as c,Xe as d,DE as e,S2 as f,qE as g,BE as h,ME as i,ji as j,HE as k,PE as l,$E as m,YE as n,GE as o,RE as p,xw as q,bw as r,Ig as s,UE as t,Qg as u,zE as v,LE as w,uy as x,fy as y,VE as z};
63
+ //# sourceMappingURL=index-B7lEd0cY.js.map