@hotmeshio/long-tail 0.17.1 → 0.17.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 (183) hide show
  1. package/dashboard/dist/assets/{AdminDashboard-D-YHIR8w.js → AdminDashboard-B_AVB7tk.js} +2 -2
  2. package/dashboard/dist/assets/{AdminDashboard-D-YHIR8w.js.map → AdminDashboard-B_AVB7tk.js.map} +1 -1
  3. package/dashboard/dist/assets/{AgentConfigPage-CG54Ll2A.js → AgentConfigPage-JoZko3JB.js} +2 -2
  4. package/dashboard/dist/assets/{AgentConfigPage-CG54Ll2A.js.map → AgentConfigPage-JoZko3JB.js.map} +1 -1
  5. package/dashboard/dist/assets/{AgentDetailPage-rTcofeW4.js → AgentDetailPage-DfpR2Fgg.js} +3 -3
  6. package/dashboard/dist/assets/{AgentDetailPage-rTcofeW4.js.map → AgentDetailPage-DfpR2Fgg.js.map} +1 -1
  7. package/dashboard/dist/assets/{AgentsPage-B7PNjrkn.js → AgentsPage-F2ixDk1Q.js} +2 -2
  8. package/dashboard/dist/assets/{AgentsPage-B7PNjrkn.js.map → AgentsPage-F2ixDk1Q.js.map} +1 -1
  9. package/dashboard/dist/assets/AvailableEscalationsPage-D-W4OP55.js +2 -0
  10. package/dashboard/dist/assets/{AvailableEscalationsPage-CEDwyzlx.js.map → AvailableEscalationsPage-D-W4OP55.js.map} +1 -1
  11. package/dashboard/dist/assets/{BotPicker-cg1qXRF3.js → BotPicker-B8Yal8Mm.js} +2 -2
  12. package/dashboard/dist/assets/{BotPicker-cg1qXRF3.js.map → BotPicker-B8Yal8Mm.js.map} +1 -1
  13. package/dashboard/dist/assets/BulkAssignModal-ySfoaF7f.js +2 -0
  14. package/dashboard/dist/assets/{BulkAssignModal-BDzaHGAb.js.map → BulkAssignModal-ySfoaF7f.js.map} +1 -1
  15. package/dashboard/dist/assets/{CapabilitiesPage-CswExj9-.js → CapabilitiesPage-BSJ2oFj6.js} +2 -2
  16. package/dashboard/dist/assets/{CapabilitiesPage-CswExj9-.js.map → CapabilitiesPage-BSJ2oFj6.js.map} +1 -1
  17. package/dashboard/dist/assets/{CollapsibleSection-CpVKfkkq.js → CollapsibleSection-CcV88IUy.js} +2 -2
  18. package/dashboard/dist/assets/{CollapsibleSection-CpVKfkkq.js.map → CollapsibleSection-CcV88IUy.js.map} +1 -1
  19. package/dashboard/dist/assets/{CountdownTimer-ClJhYGg1.js → CountdownTimer-C-E9MXMk.js} +2 -2
  20. package/dashboard/dist/assets/{CountdownTimer-ClJhYGg1.js.map → CountdownTimer-C-E9MXMk.js.map} +1 -1
  21. package/dashboard/dist/assets/{CredentialsPage-DYBp7v8W.js → CredentialsPage-DrydlZ65.js} +2 -2
  22. package/dashboard/dist/assets/{CredentialsPage-DYBp7v8W.js.map → CredentialsPage-DrydlZ65.js.map} +1 -1
  23. package/dashboard/dist/assets/{CronLabel-Bd_fipHy.js → CronLabel-BxQmJXos.js} +2 -2
  24. package/dashboard/dist/assets/{CronLabel-Bd_fipHy.js.map → CronLabel-BxQmJXos.js.map} +1 -1
  25. package/dashboard/dist/assets/{ElapsedCell-B-Wn6Y8B.js → ElapsedCell-lszUXiyP.js} +2 -2
  26. package/dashboard/dist/assets/{ElapsedCell-B-Wn6Y8B.js.map → ElapsedCell-lszUXiyP.js.map} +1 -1
  27. package/dashboard/dist/assets/{EntityTimelinePanel-DcgFUbk4.js → EntityTimelinePanel-CwzIV87U.js} +2 -2
  28. package/dashboard/dist/assets/{EntityTimelinePanel-DcgFUbk4.js.map → EntityTimelinePanel-CwzIV87U.js.map} +1 -1
  29. package/dashboard/dist/assets/{EscalationListSchemaPage-DpnorXeU.js → EscalationListSchemaPage-D16uUVcG.js} +3 -3
  30. package/dashboard/dist/assets/{EscalationListSchemaPage-DpnorXeU.js.map → EscalationListSchemaPage-D16uUVcG.js.map} +1 -1
  31. package/dashboard/dist/assets/{EscalationSchemaPage-LPTJJDfP.js → EscalationSchemaPage-BLM3dUEw.js} +2 -2
  32. package/dashboard/dist/assets/{EscalationSchemaPage-LPTJJDfP.js.map → EscalationSchemaPage-BLM3dUEw.js.map} +1 -1
  33. package/dashboard/dist/assets/{EscalationsOverview-Bq5_ICUt.js → EscalationsOverview-BlFjoKlR.js} +2 -2
  34. package/dashboard/dist/assets/{EscalationsOverview-Bq5_ICUt.js.map → EscalationsOverview-BlFjoKlR.js.map} +1 -1
  35. package/dashboard/dist/assets/{EventTable-Cinbdm1u.js → EventTable-rTkMR8Zf.js} +2 -2
  36. package/dashboard/dist/assets/{EventTable-Cinbdm1u.js.map → EventTable-rTkMR8Zf.js.map} +1 -1
  37. package/dashboard/dist/assets/{FilterBar-DyojX5m4.js → FilterBar-BeVBUdfJ.js} +2 -2
  38. package/dashboard/dist/assets/{FilterBar-DyojX5m4.js.map → FilterBar-BeVBUdfJ.js.map} +1 -1
  39. package/dashboard/dist/assets/{GraphInvokePage-Ba5fNcgv.js → GraphInvokePage-BV60xkVy.js} +2 -2
  40. package/dashboard/dist/assets/{GraphInvokePage-Ba5fNcgv.js.map → GraphInvokePage-BV60xkVy.js.map} +1 -1
  41. package/dashboard/dist/assets/{HomePage-DuFXqfz3.js → HomePage-BA0RYzFc.js} +2 -2
  42. package/dashboard/dist/assets/{HomePage-DuFXqfz3.js.map → HomePage-BA0RYzFc.js.map} +1 -1
  43. package/dashboard/dist/assets/{ListToolbar-GpwHcjkZ.js → ListToolbar-4IfsUXfV.js} +2 -2
  44. package/dashboard/dist/assets/{ListToolbar-GpwHcjkZ.js.map → ListToolbar-4IfsUXfV.js.map} +1 -1
  45. package/dashboard/dist/assets/{McpOverview-Bi23-hih.js → McpOverview-gDegMXvF.js} +2 -2
  46. package/dashboard/dist/assets/{McpOverview-Bi23-hih.js.map → McpOverview-gDegMXvF.js.map} +1 -1
  47. package/dashboard/dist/assets/{McpQueryDetailPage-FhHSfX9W.js → McpQueryDetailPage-CnCffPks.js} +2 -2
  48. package/dashboard/dist/assets/{McpQueryDetailPage-FhHSfX9W.js.map → McpQueryDetailPage-CnCffPks.js.map} +1 -1
  49. package/dashboard/dist/assets/{McpQueryPage-czMlM7vR.js → McpQueryPage-CLEMtLOG.js} +2 -2
  50. package/dashboard/dist/assets/{McpQueryPage-czMlM7vR.js.map → McpQueryPage-CLEMtLOG.js.map} +1 -1
  51. package/dashboard/dist/assets/{McpRunDetailPage-BOh2M0Ca.js → McpRunDetailPage-tr-lrWVv.js} +2 -2
  52. package/dashboard/dist/assets/{McpRunDetailPage-BOh2M0Ca.js.map → McpRunDetailPage-tr-lrWVv.js.map} +1 -1
  53. package/dashboard/dist/assets/{McpRunsPage-DfJzbGYM.js → McpRunsPage-nE0d_1Px.js} +2 -2
  54. package/dashboard/dist/assets/{McpRunsPage-DfJzbGYM.js.map → McpRunsPage-nE0d_1Px.js.map} +1 -1
  55. package/dashboard/dist/assets/{OperationsPage-BS8blKLj.js → OperationsPage-C8h1DN5Q.js} +2 -2
  56. package/dashboard/dist/assets/{OperationsPage-BS8blKLj.js.map → OperationsPage-C8h1DN5Q.js.map} +1 -1
  57. package/dashboard/dist/assets/{OperatorDashboard-BWtTKrcJ.js → OperatorDashboard-DCG8BFKE.js} +2 -2
  58. package/dashboard/dist/assets/{OperatorDashboard-BWtTKrcJ.js.map → OperatorDashboard-DCG8BFKE.js.map} +1 -1
  59. package/dashboard/dist/assets/{PersonaDetailPage-VkhuauBf.js → PersonaDetailPage-BEVeJr1q.js} +2 -2
  60. package/dashboard/dist/assets/{PersonaDetailPage-VkhuauBf.js.map → PersonaDetailPage-BEVeJr1q.js.map} +1 -1
  61. package/dashboard/dist/assets/PersonasPage-B5fj2AK6.js +2 -0
  62. package/dashboard/dist/assets/{PersonasPage-DRoneLfx.js.map → PersonasPage-B5fj2AK6.js.map} +1 -1
  63. package/dashboard/dist/assets/ProcessDetailPage-CWGby6KD.js +2 -0
  64. package/dashboard/dist/assets/{ProcessDetailPage-B5mmkHS0.js.map → ProcessDetailPage-CWGby6KD.js.map} +1 -1
  65. package/dashboard/dist/assets/{ProcessesListPage-BV0e2OfH.js → ProcessesListPage-nFdLMlfb.js} +2 -2
  66. package/dashboard/dist/assets/{ProcessesListPage-BV0e2OfH.js.map → ProcessesListPage-nFdLMlfb.js.map} +1 -1
  67. package/dashboard/dist/assets/RoleDetailPage-OmOdRm1F.js +8 -0
  68. package/dashboard/dist/assets/{RoleDetailPage-eenl_a5Z.js.map → RoleDetailPage-OmOdRm1F.js.map} +1 -1
  69. package/dashboard/dist/assets/{RolesPage-BLfJcFf7.js → RolesPage-DwprdPCA.js} +2 -2
  70. package/dashboard/dist/assets/{RolesPage-BLfJcFf7.js.map → RolesPage-DwprdPCA.js.map} +1 -1
  71. package/dashboard/dist/assets/{RunAsSelector-BnLKKs51.js → RunAsSelector-DGw9EKSR.js} +2 -2
  72. package/dashboard/dist/assets/{RunAsSelector-BnLKKs51.js.map → RunAsSelector-DGw9EKSR.js.map} +1 -1
  73. package/dashboard/dist/assets/{ScanCodesPage-BWIcjnr4.js → ScanCodesPage-RPi4qZ_l.js} +2 -2
  74. package/dashboard/dist/assets/{ScanCodesPage-BWIcjnr4.js.map → ScanCodesPage-RPi4qZ_l.js.map} +1 -1
  75. package/dashboard/dist/assets/{ScanSchemeDetailPage-sAuU8cZj.js → ScanSchemeDetailPage-BKc4lUjc.js} +2 -2
  76. package/dashboard/dist/assets/{ScanSchemeDetailPage-sAuU8cZj.js.map → ScanSchemeDetailPage-BKc4lUjc.js.map} +1 -1
  77. package/dashboard/dist/assets/{ScanStationPage-CA_q1uaI.js → ScanStationPage-DUfxcntB.js} +2 -2
  78. package/dashboard/dist/assets/{ScanStationPage-CA_q1uaI.js.map → ScanStationPage-DUfxcntB.js.map} +1 -1
  79. package/dashboard/dist/assets/{StickyPagination-sVI21e82.js → StickyPagination-DXOk5z5X.js} +2 -2
  80. package/dashboard/dist/assets/{StickyPagination-sVI21e82.js.map → StickyPagination-DXOk5z5X.js.map} +1 -1
  81. package/dashboard/dist/assets/{StreamMessageDetail-Djm_zQAv.js → StreamMessageDetail-BB1h2zZN.js} +2 -2
  82. package/dashboard/dist/assets/{StreamMessageDetail-Djm_zQAv.js.map → StreamMessageDetail-BB1h2zZN.js.map} +1 -1
  83. package/dashboard/dist/assets/{SwimlaneTimeline-CwxXRmRQ.js → SwimlaneTimeline-CapKokLg.js} +2 -2
  84. package/dashboard/dist/assets/{SwimlaneTimeline-CwxXRmRQ.js.map → SwimlaneTimeline-CapKokLg.js.map} +1 -1
  85. package/dashboard/dist/assets/{TaskDetailPage-SiBSTsfp.js → TaskDetailPage-Dfzdp97x.js} +2 -2
  86. package/dashboard/dist/assets/{TaskDetailPage-SiBSTsfp.js.map → TaskDetailPage-Dfzdp97x.js.map} +1 -1
  87. package/dashboard/dist/assets/{TasksListPage-CBTFz3Bp.js → TasksListPage-DxlS7PTD.js} +2 -2
  88. package/dashboard/dist/assets/{TasksListPage-CBTFz3Bp.js.map → TasksListPage-DxlS7PTD.js.map} +1 -1
  89. package/dashboard/dist/assets/{TimeAgo-Ctwwdamz.js → TimeAgo-Bv5viQ1m.js} +2 -2
  90. package/dashboard/dist/assets/{TimeAgo-Ctwwdamz.js.map → TimeAgo-Bv5viQ1m.js.map} +1 -1
  91. package/dashboard/dist/assets/{TimestampCell-CI8UrDuQ.js → TimestampCell-DXNBf_eb.js} +2 -2
  92. package/dashboard/dist/assets/{TimestampCell-CI8UrDuQ.js.map → TimestampCell-DXNBf_eb.js.map} +1 -1
  93. package/dashboard/dist/assets/{ToolTestPanel-Cf9ZEBF7.js → ToolTestPanel-f32mir7Q.js} +2 -2
  94. package/dashboard/dist/assets/{ToolTestPanel-Cf9ZEBF7.js.map → ToolTestPanel-f32mir7Q.js.map} +1 -1
  95. package/dashboard/dist/assets/{TopicDetailPage-BYIOSVNy.js → TopicDetailPage-D-N8Vsd4.js} +2 -2
  96. package/dashboard/dist/assets/{TopicDetailPage-BYIOSVNy.js.map → TopicDetailPage-D-N8Vsd4.js.map} +1 -1
  97. package/dashboard/dist/assets/{TopicsPage-C9x4tIEi.js → TopicsPage-hqlu32wg.js} +2 -2
  98. package/dashboard/dist/assets/{TopicsPage-C9x4tIEi.js.map → TopicsPage-hqlu32wg.js.map} +1 -1
  99. package/dashboard/dist/assets/UserName-BhA_ItNN.js +2 -0
  100. package/dashboard/dist/assets/{UserName-Ck-eLb-1.js.map → UserName-BhA_ItNN.js.map} +1 -1
  101. package/dashboard/dist/assets/{WorkflowExecutionPage-BPxoPK8g.js → WorkflowExecutionPage-BAgMKnhe.js} +2 -2
  102. package/dashboard/dist/assets/{WorkflowExecutionPage-BPxoPK8g.js.map → WorkflowExecutionPage-BAgMKnhe.js.map} +1 -1
  103. package/dashboard/dist/assets/{WorkflowsDashboard-CDHQUYEr.js → WorkflowsDashboard-B2wYT_hj.js} +2 -2
  104. package/dashboard/dist/assets/{WorkflowsDashboard-CDHQUYEr.js.map → WorkflowsDashboard-B2wYT_hj.js.map} +1 -1
  105. package/dashboard/dist/assets/{WorkflowsOverview-DGp8J0G2.js → WorkflowsOverview--jC5F9lz.js} +2 -2
  106. package/dashboard/dist/assets/{WorkflowsOverview-DGp8J0G2.js.map → WorkflowsOverview--jC5F9lz.js.map} +1 -1
  107. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B112bGAY.js → YamlWorkflowDetailPage-BdB5eX8s.js} +2 -2
  108. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B112bGAY.js.map → YamlWorkflowDetailPage-BdB5eX8s.js.map} +1 -1
  109. package/dashboard/dist/assets/{YamlWorkflowsPage-Cw5wddH7.js → YamlWorkflowsPage-BUQQU9II.js} +2 -2
  110. package/dashboard/dist/assets/{YamlWorkflowsPage-Cw5wddH7.js.map → YamlWorkflowsPage-BUQQU9II.js.map} +1 -1
  111. package/dashboard/dist/assets/{agents-CZ8WIdWH.js → agents-BF_S1J_z.js} +2 -2
  112. package/dashboard/dist/assets/{agents-CZ8WIdWH.js.map → agents-BF_S1J_z.js.map} +1 -1
  113. package/dashboard/dist/assets/{bots-Xu3MUuXN.js → bots-CGlEoWAu.js} +2 -2
  114. package/dashboard/dist/assets/{bots-Xu3MUuXN.js.map → bots-CGlEoWAu.js.map} +1 -1
  115. package/dashboard/dist/assets/{capabilities-XJukFiLn.js → capabilities-Pq8pG0kX.js} +2 -2
  116. package/dashboard/dist/assets/{capabilities-XJukFiLn.js.map → capabilities-Pq8pG0kX.js.map} +1 -1
  117. package/dashboard/dist/assets/{controlplane-D8ZQQUAV.js → controlplane-dY6a4iYT.js} +2 -2
  118. package/dashboard/dist/assets/{controlplane-D8ZQQUAV.js.map → controlplane-dY6a4iYT.js.map} +1 -1
  119. package/dashboard/dist/assets/{escalation-columns-C1GyAMeK.js → escalation-columns-CBUTda5U.js} +2 -2
  120. package/dashboard/dist/assets/{escalation-columns-C1GyAMeK.js.map → escalation-columns-CBUTda5U.js.map} +1 -1
  121. package/dashboard/dist/assets/{index-CRxbF5vt.js → index-BHfISWyn.js} +2 -2
  122. package/dashboard/dist/assets/{index-CRxbF5vt.js.map → index-BHfISWyn.js.map} +1 -1
  123. package/dashboard/dist/assets/{index-DCaGxwKU.js → index-BTksPQZe.js} +2 -2
  124. package/dashboard/dist/assets/{index-DCaGxwKU.js.map → index-BTksPQZe.js.map} +1 -1
  125. package/dashboard/dist/assets/{index-Dc43wixL.js → index-BWtW5puE.js} +2 -2
  126. package/dashboard/dist/assets/{index-Dc43wixL.js.map → index-BWtW5puE.js.map} +1 -1
  127. package/dashboard/dist/assets/{index-D_5_1D7U.js → index-Bn-6MP9-.js} +2 -2
  128. package/dashboard/dist/assets/{index-D_5_1D7U.js.map → index-Bn-6MP9-.js.map} +1 -1
  129. package/dashboard/dist/assets/{index-CHAmwNDI.js → index-BrFGgfjR.js} +2 -2
  130. package/dashboard/dist/assets/{index-CHAmwNDI.js.map → index-BrFGgfjR.js.map} +1 -1
  131. package/dashboard/dist/assets/{index-DFmV19fc.js → index-ByYeo8P7.js} +2 -2
  132. package/dashboard/dist/assets/{index-DFmV19fc.js.map → index-ByYeo8P7.js.map} +1 -1
  133. package/dashboard/dist/assets/{index-CgGR0kM6.js → index-CivQGQpu.js} +3 -3
  134. package/dashboard/dist/assets/{index-CgGR0kM6.js.map → index-CivQGQpu.js.map} +1 -1
  135. package/dashboard/dist/assets/{index-DeRM0-Xz.js → index-CwQn-nhR.js} +2 -2
  136. package/dashboard/dist/assets/{index-DeRM0-Xz.js.map → index-CwQn-nhR.js.map} +1 -1
  137. package/dashboard/dist/assets/{index-COtlcGK_.js → index-D0bjzVum.js} +2 -2
  138. package/dashboard/dist/assets/{index-COtlcGK_.js.map → index-D0bjzVum.js.map} +1 -1
  139. package/dashboard/dist/assets/{index-DWhyH1kV.js → index-D1KCPoRr.js} +2 -2
  140. package/dashboard/dist/assets/{index-DWhyH1kV.js.map → index-D1KCPoRr.js.map} +1 -1
  141. package/dashboard/dist/assets/index-D9rtK9QF.js +67 -0
  142. package/dashboard/dist/assets/index-D9rtK9QF.js.map +1 -0
  143. package/dashboard/dist/assets/{index-DYIy3uT5.js → index-DrlZc3C0.js} +2 -2
  144. package/dashboard/dist/assets/{index-DYIy3uT5.js.map → index-DrlZc3C0.js.map} +1 -1
  145. package/dashboard/dist/assets/index-U7HShN30.js +2 -0
  146. package/dashboard/dist/assets/{index-CR96SICL.js.map → index-U7HShN30.js.map} +1 -1
  147. package/dashboard/dist/assets/{knowledge-sjJNIdJY.js → knowledge-8_TilyaY.js} +2 -2
  148. package/dashboard/dist/assets/{knowledge-sjJNIdJY.js.map → knowledge-8_TilyaY.js.map} +1 -1
  149. package/dashboard/dist/assets/{mcp-CQeu19Jf.js → mcp-hY3O2HJa.js} +2 -2
  150. package/dashboard/dist/assets/{mcp-CQeu19Jf.js.map → mcp-hY3O2HJa.js.map} +1 -1
  151. package/dashboard/dist/assets/{mcp-query-B9GuC88j.js → mcp-query-CA8NEf2e.js} +2 -2
  152. package/dashboard/dist/assets/{mcp-query-B9GuC88j.js.map → mcp-query-CA8NEf2e.js.map} +1 -1
  153. package/dashboard/dist/assets/{personas-CQr9sXg3.js → personas-DrWgQ94s.js} +2 -2
  154. package/dashboard/dist/assets/{personas-CQr9sXg3.js.map → personas-DrWgQ94s.js.map} +1 -1
  155. package/dashboard/dist/assets/{pipelines-DzMf-VE7.js → pipelines-DdgSlafC.js} +2 -2
  156. package/dashboard/dist/assets/{pipelines-DzMf-VE7.js.map → pipelines-DdgSlafC.js.map} +1 -1
  157. package/dashboard/dist/assets/{tasks-QKuXlyLe.js → tasks-UyjER1TA.js} +2 -2
  158. package/dashboard/dist/assets/{tasks-QKuXlyLe.js.map → tasks-UyjER1TA.js.map} +1 -1
  159. package/dashboard/dist/assets/{topics-DQAQnGV7.js → topics-CIc5SpT_.js} +2 -2
  160. package/dashboard/dist/assets/{topics-DQAQnGV7.js.map → topics-CIc5SpT_.js.map} +1 -1
  161. package/dashboard/dist/assets/{useDebouncedValue-DuE9Mj3I.js → useDebouncedValue-CmUqBRK4.js} +2 -2
  162. package/dashboard/dist/assets/{useDebouncedValue-DuE9Mj3I.js.map → useDebouncedValue-CmUqBRK4.js.map} +1 -1
  163. package/dashboard/dist/assets/{useNamespace-BTCrNkwo.js → useNamespace-BOZOwXTE.js} +2 -2
  164. package/dashboard/dist/assets/{useNamespace-BTCrNkwo.js.map → useNamespace-BOZOwXTE.js.map} +1 -1
  165. package/dashboard/dist/assets/{useYamlActivityEvents-_aa1_rNu.js → useYamlActivityEvents-BsTpIsba.js} +2 -2
  166. package/dashboard/dist/assets/{useYamlActivityEvents-_aa1_rNu.js.map → useYamlActivityEvents-BsTpIsba.js.map} +1 -1
  167. package/dashboard/dist/assets/{workflows-CEWX3imM.js → workflows-BkFI3IwE.js} +2 -2
  168. package/dashboard/dist/assets/{workflows-CEWX3imM.js.map → workflows-BkFI3IwE.js.map} +1 -1
  169. package/dashboard/dist/assets/{yaml-workflows-Bek1Mg86.js → yaml-workflows-CeeqNi9k.js} +2 -2
  170. package/dashboard/dist/assets/{yaml-workflows-Bek1Mg86.js.map → yaml-workflows-CeeqNi9k.js.map} +1 -1
  171. package/dashboard/dist/index.html +1 -1
  172. package/package.json +1 -1
  173. package/dashboard/dist/assets/AvailableEscalationsPage-CEDwyzlx.js +0 -2
  174. package/dashboard/dist/assets/BulkAssignModal-BDzaHGAb.js +0 -2
  175. package/dashboard/dist/assets/PersonasPage-DRoneLfx.js +0 -2
  176. package/dashboard/dist/assets/ProcessDetailPage-B5mmkHS0.js +0 -2
  177. package/dashboard/dist/assets/RoleDetailPage-eenl_a5Z.js +0 -8
  178. package/dashboard/dist/assets/UserName-Ck-eLb-1.js +0 -2
  179. package/dashboard/dist/assets/index-BEeGFfuP.js +0 -67
  180. package/dashboard/dist/assets/index-BEeGFfuP.js.map +0 -1
  181. package/dashboard/dist/assets/index-CR96SICL.js +0 -2
  182. package/dashboard/dist/assets/users-D-DhFQBy.js +0 -2
  183. package/dashboard/dist/assets/users-D-DhFQBy.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-nFdLMlfb.js","./vendor-query-RUZdMvN6.js","./tasks-UyjER1TA.js","./workflows-BkFI3IwE.js","./useFilterParams-crmlBw_l.js","./vendor-react-CdqEC2zv.js","./useDebouncedValue-CmUqBRK4.js","./api-path-u2Jf9QXS.js","./DataTable-DFPMeqyQ.js","./EmptyState-lpUFYfun.js","./TimestampCell-DXNBf_eb.js","./StickyPagination-DXOk5z5X.js","./FilterBar-BeVBUdfJ.js","./vendor-icons-h-jlRSb9.js","./PageHeader-CFVw67M6.js","./ListToolbar-4IfsUXfV.js","./WorkflowPill-CN-952iI.js","./ProcessDetailPage-CWGby6KD.js","./PageHeaderWithStats-D9tQxILm.js","./StatusBadge-BDeUwPtb.js","./RolePill-Di_5hfvw.js","./UserName-BhA_ItNN.js","./McpOverview-gDegMXvF.js","./mcp-hY3O2HJa.js","./pipelines-DdgSlafC.js","./yaml-workflows-CeeqNi9k.js","./controlplane-dY6a4iYT.js","./StatCard-BXQ8dD9Y.js","./McpRunsPage-nE0d_1Px.js","./useNamespace-BOZOwXTE.js","./ElapsedCell-lszUXiyP.js","./RowActions-eYrzgQSj.js","./McpRunDetailPage-tr-lrWVv.js","./SegmentedTabs-DXNzY05q.js","./EventTable-rTkMR8Zf.js","./SwimlaneTimeline-CapKokLg.js","./StreamMessageDetail-BB1h2zZN.js","./CopyableId-4Lqlc5cU.js","./McpQueryPage-CLEMtLOG.js","./mcp-query-CA8NEf2e.js","./McpQueryDetailPage-CnCffPks.js","./TagInput-BLwxTNsI.js","./CollapsibleSection-CcV88IUy.js","./useYamlActivityEvents-BsTpIsba.js","./helpers-DzO-OGPe.js","./RunAsSelector-DGw9EKSR.js","./BotPicker-B8Yal8Mm.js","./bots-CGlEoWAu.js","./ToolPill-C6hkOqPx.js","./TimeAgo-Bv5viQ1m.js","./EscalationsOverview-BlFjoKlR.js","./AvailableEscalationsPage-D-W4OP55.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-ySfoaF7f.js","./Modal-BU7No9NH.js","./constants-BHkpVaqx.js","./escalation-columns-CBUTda5U.js","./EntityTimelinePanel-CwzIV87U.js","./PriorityBadge-BETdj4M-.js","./CountdownTimer-C-E9MXMk.js","./OperatorDashboard-DCG8BFKE.js","./index-CivQGQpu.js","./metadata-display-DHjqWkLG.js","./WorkflowsOverview--jC5F9lz.js","./index-ByYeo8P7.js","./NamespacePill-DONj6eUU.js","./WorkflowsDashboard-B2wYT_hj.js","./YamlWorkflowsPage-BUQQU9II.js","./GraphInvokePage-BV60xkVy.js","./YamlWorkflowDetailPage-BdB5eX8s.js","./TasksListPage-DxlS7PTD.js","./TaskDetailPage-Dfzdp97x.js","./WorkflowExecutionPage-BAgMKnhe.js","./AdminDashboard-B_AVB7tk.js","./index-BrFGgfjR.js","./TaskQueuePill-DVgcqd-h.js","./index-BTksPQZe.js","./ConfirmDeleteModal-CQsJUzEa.js","./index-BWtW5puE.js","./ToolTestPanel-f32mir7Q.js","./index-DrlZc3C0.js","./index-U7HShN30.js","./personas-DrWgQ94s.js","./ScopeBadge-CqIIeWjK.js","./RolesPage-DwprdPCA.js","./RoleDetailPage-OmOdRm1F.js","./AutoGrowTextarea-DgEQeRQw.js","./PersonasPage-B5fj2AK6.js","./PersonaDetailPage-BEVeJr1q.js","./EscalationSchemaPage-BLM3dUEw.js","./EscalationListSchemaPage-D16uUVcG.js","./ScanCodesPage-RPi4qZ_l.js","./ScanSchemeDetailPage-BKc4lUjc.js","./ScanStationPage-DUfxcntB.js","./index-CwQn-nhR.js","./OperationsPage-C8h1DN5Q.js","./index-D1KCPoRr.js","./index-BHfISWyn.js","./CredentialsPage-DrydlZ65.js","./index-Bn-6MP9-.js","./DropZone-Pv-v5RAs.js","./index-D0bjzVum.js","./knowledge-8_TilyaY.js","./HomePage-BA0RYzFc.js","./AgentsPage-F2ixDk1Q.js","./agents-BF_S1J_z.js","./AgentDetailPage-DfpR2Fgg.js","./CronLabel-BxQmJXos.js","./AgentConfigPage-JoZko3JB.js","./capabilities-Pq8pG0kX.js","./topics-CIc5SpT_.js","./CapabilitiesPage-BSJ2oFj6.js","./TopicsPage-hqlu32wg.js","./TopicDetailPage-D-N8Vsd4.js"])))=>i.map(i=>d[i]);
2
+ var dw=Object.defineProperty;var mw=(r,t,s)=>t in r?dw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var A=(r,t,s)=>mw(r,typeof t!="symbol"?t+"":t,s);import{r as pw,u as st,a as j,j as p,b as Ve,c as We,g as yw,Q as gw,d as bw}from"./vendor-query-RUZdMvN6.js";import{r as vw,u as _o,a as vn,b as mb,L as Fs,N as Ki,c as Gn,O as $i,d as xw,R as _w}from"./vendor-react-CdqEC2zv.js";import{X as Ft,E as ww,S as Sw,M as Ew,a as hu,b as Ow,C as pb,c as ed,I as td,R as yb,B as gb,U as Aw,d as jw,L as Tw,e as kw,Z as Nw,P as Yy,f as bb,g as Cw,h as Ky,i as Qy,j as Xy,k as Mw,W as Cd,l as Rw,m as Dw,F as qw,n as vb,o as Lw,D as Bw,N as Uw,p as Pw,q as xb,r as _b,s as wb,t as Sb,u as zw,v as Iw,w as $w,G as Hw,T as Gw,x as Fw,y as Vw,z as Yw}from"./vendor-icons-h-jlRSb9.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const m of c.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();var qh={exports:{}},Qa={},Lh={exports:{}},Bh={};/**
3
+ * @license React
4
+ * scheduler.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Jy;function Kw(){return Jy||(Jy=1,(function(r){function t(Y,ae){var de=Y.length;Y.push(ae);e:for(;0<de;){var Oe=de-1>>>1,we=Y[Oe];if(0<l(we,ae))Y[Oe]=ae,Y[de]=we,de=Oe;else break e}}function s(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var ae=Y[0],de=Y.pop();if(de!==ae){Y[0]=de;e:for(var Oe=0,we=Y.length,Ne=we>>>1;Oe<Ne;){var Ae=2*(Oe+1)-1,ke=Y[Ae],et=Ae+1,oe=Y[et];if(0>l(ke,de))et<we&&0>l(oe,ke)?(Y[Oe]=oe,Y[et]=de,Oe=et):(Y[Oe]=ke,Y[Ae]=de,Oe=Ae);else if(et<we&&0>l(oe,de))Y[Oe]=oe,Y[et]=de,Oe=et;else break e}}return ae}function l(Y,ae){var de=Y.sortIndex-ae.sortIndex;return de!==0?de:Y.id-ae.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;r.unstable_now=function(){return c.now()}}else{var m=Date,y=m.now();r.unstable_now=function(){return m.now()-y}}var g=[],f=[],d=1,b=null,v=3,x=!1,w=!1,S=!1,M=!1,B=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null;function fe(Y){for(var ae=s(f);ae!==null;){if(ae.callback===null)i(f);else if(ae.startTime<=Y)i(f),ae.sortIndex=ae.expirationTime,t(g,ae);else break;ae=s(f)}}function C(Y){if(S=!1,fe(Y),!w)if(s(g)!==null)w=!0,U||(U=!0,X());else{var ae=s(f);ae!==null&&Te(C,ae.startTime-Y)}}var U=!1,re=-1,K=5,L=-1;function F(){return M?!0:!(r.unstable_now()-L<K)}function ee(){if(M=!1,U){var Y=r.unstable_now();L=Y;var ae=!0;try{e:{w=!1,S&&(S=!1,P(re),re=-1),x=!0;var de=v;try{t:{for(fe(Y),b=s(g);b!==null&&!(b.expirationTime>Y&&F());){var Oe=b.callback;if(typeof Oe=="function"){b.callback=null,v=b.priorityLevel;var we=Oe(b.expirationTime<=Y);if(Y=r.unstable_now(),typeof we=="function"){b.callback=we,fe(Y),ae=!0;break t}b===s(g)&&i(g),fe(Y)}else i(g);b=s(g)}if(b!==null)ae=!0;else{var Ne=s(f);Ne!==null&&Te(C,Ne.startTime-Y),ae=!1}}break e}finally{b=null,v=de,x=!1}ae=void 0}}finally{ae?X():U=!1}}}var X;if(typeof se=="function")X=function(){se(ee)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,ve=he.port2;he.port1.onmessage=ee,X=function(){ve.postMessage(null)}}else X=function(){B(ee,0)};function Te(Y,ae){re=B(function(){Y(r.unstable_now())},ae)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(Y){Y.callback=null},r.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<Y?Math.floor(1e3/Y):5},r.unstable_getCurrentPriorityLevel=function(){return v},r.unstable_next=function(Y){switch(v){case 1:case 2:case 3:var ae=3;break;default:ae=v}var de=v;v=ae;try{return Y()}finally{v=de}},r.unstable_requestPaint=function(){M=!0},r.unstable_runWithPriority=function(Y,ae){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var de=v;v=Y;try{return ae()}finally{v=de}},r.unstable_scheduleCallback=function(Y,ae,de){var Oe=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Oe+de:Oe):de=Oe,Y){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=de+we,Y={id:d++,callback:ae,priorityLevel:Y,startTime:de,expirationTime:we,sortIndex:-1},de>Oe?(Y.sortIndex=de,t(f,Y),s(g)===null&&Y===s(f)&&(S?(P(re),re=-1):S=!0,Te(C,de-Oe))):(Y.sortIndex=we,t(g,Y),w||x||(w=!0,U||(U=!0,X()))),Y},r.unstable_shouldYield=F,r.unstable_wrapCallback=function(Y){var ae=v;return function(){var de=v;v=ae;try{return Y.apply(this,arguments)}finally{v=de}}}})(Bh)),Bh}var Zy;function Qw(){return Zy||(Zy=1,Lh.exports=Kw()),Lh.exports}/**
11
+ * @license React
12
+ * react-dom-client.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var Wy;function Xw(){if(Wy)return Qa;Wy=1;var r=Qw(),t=pw(),s=vw();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function m(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function y(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(i(188))}function f(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,o=n;;){var u=a.return;if(u===null)break;var h=u.alternate;if(h===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===a)return g(u),e;if(h===o)return g(u),n;h=h.sibling}throw Error(i(188))}if(a.return!==o.return)a=u,o=h;else{for(var _=!1,E=u.child;E;){if(E===a){_=!0,a=u,o=h;break}if(E===o){_=!0,o=u,a=h;break}E=E.sibling}if(!_){for(E=h.child;E;){if(E===a){_=!0,a=h,o=u;break}if(E===o){_=!0,o=h,a=u;break}E=E.sibling}if(!_)throw Error(i(189))}}if(a.alternate!==o)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:n}function d(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=d(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),se=Symbol.for("react.context"),fe=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=ee&&e[ee]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function ve(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case B:return"Profiler";case M:return"StrictMode";case C:return"Suspense";case U:return"SuspenseList";case L:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case se:return e.displayName||"Context";case P:return(e._context.displayName||"Context")+".Consumer";case fe:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case re:return n=e.displayName||null,n!==null?n:ve(e.type)||"Memo";case K:n=e._payload,e=e._init;try{return ve(e(n))}catch{}}return null}var Te=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Oe=[],we=-1;function Ne(e){return{current:e}}function Ae(e){0>we||(e.current=Oe[we],Oe[we]=null,we--)}function ke(e,n){we++,Oe[we]=e.current,e.current=n}var et=Ne(null),oe=Ne(null),Ie=Ne(null),tt=Ne(null);function yt(e,n){switch(ke(Ie,n),ke(oe,e),ke(et,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?yy(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=yy(n),e=gy(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ae(et),ke(et,e)}function je(){Ae(et),Ae(oe),Ae(Ie)}function Lt(e){e.memoizedState!==null&&ke(tt,e);var n=et.current,a=gy(n,e.type);n!==a&&(ke(oe,e),ke(et,a))}function gs(e){oe.current===e&&(Ae(et),Ae(oe)),tt.current===e&&(Ae(tt),Fa._currentValue=de)}var Qs,bs;function _n(e){if(Qs===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Qs=n&&n[1]||"",bs=-1<a.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+Qs+e+bs}var Xs=!1;function Nr(e,n){if(!e||Xs)return"";Xs=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(Q){var G=Q}Reflect.construct(e,[],ne)}else{try{ne.call()}catch(Q){G=Q}e.call(ne.prototype)}}else{try{throw Error()}catch(Q){G=Q}(ne=e())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(Q){if(Q&&G&&typeof Q.stack=="string")return[Q.stack,G.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=o.DetermineComponentFrameRoot(),_=h[0],E=h[1];if(_&&E){var R=_.split(`
21
+ `),H=E.split(`
22
+ `);for(u=o=0;o<R.length&&!R[o].includes("DetermineComponentFrameRoot");)o++;for(;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;if(o===R.length||u===H.length)for(o=R.length-1,u=H.length-1;1<=o&&0<=u&&R[o]!==H[u];)u--;for(;1<=o&&0<=u;o--,u--)if(R[o]!==H[u]){if(o!==1||u!==1)do if(o--,u--,0>u||R[o]!==H[u]){var J=`
23
+ `+R[o].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=o&&0<=u);break}}}finally{Xs=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?_n(a):""}function ko(e,n){switch(e.tag){case 26:case 27:case 5:return _n(e.type);case 16:return _n("Lazy");case 13:return e.child!==n&&n!==null?_n("Suspense Fallback"):_n("Suspense");case 19:return _n("SuspenseList");case 0:case 15:return Nr(e.type,!1);case 11:return Nr(e.type.render,!1);case 1:return Nr(e.type,!0);case 31:return _n("Activity");default:return""}}function No(e){try{var n="",a=null;do n+=ko(e,a),a=e,e=e.return;while(e);return n}catch(o){return`
24
+ Error generating stack: `+o.message+`
25
+ `+o.stack}}var ta=Object.prototype.hasOwnProperty,na=r.unstable_scheduleCallback,rr=r.unstable_cancelCallback,Co=r.unstable_shouldYield,Js=r.unstable_requestPaint,lt=r.unstable_now,Eu=r.unstable_getCurrentPriorityLevel,Mo=r.unstable_ImmediatePriority,Ro=r.unstable_UserBlockingPriority,Zs=r.unstable_NormalPriority,Ou=r.unstable_LowPriority,Do=r.unstable_IdlePriority,Au=r.log,qo=r.unstable_setDisableYieldValue,vs=null,gt=null;function en(e){if(typeof Au=="function"&&qo(e),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(vs,e)}catch{}}var Bt=Math.clz32?Math.clz32:Ws,ra=Math.log,sa=Math.LN2;function Ws(e){return e>>>=0,e===0?32:31-(ra(e)/sa|0)|0}var Cr=256,sr=262144,Mr=4194304;function qn(e){var n=e&42;if(n!==0)return n;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 xs(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var u=0,h=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var E=o&134217727;return E!==0?(o=E&~h,o!==0?u=qn(o):(_&=E,_!==0?u=qn(_):a||(a=E&~e,a!==0&&(u=qn(a))))):(E=o&~h,E!==0?u=qn(E):_!==0?u=qn(_):a||(a=o&~e,a!==0&&(u=qn(a)))),u===0?0:n!==0&&n!==u&&(n&h)===0&&(h=u&-u,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:u}function _s(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ia(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 ei(){var e=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),e}function Rr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Ln(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Dr(e,n,a,o,u,h){var _=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var E=e.entanglements,R=e.expirationTimes,H=e.hiddenUpdates;for(a=_&~a;0<a;){var J=31-Bt(a),ne=1<<J;E[J]=0,R[J]=-1;var G=H[J];if(G!==null)for(H[J]=null,J=0;J<G.length;J++){var Q=G[J];Q!==null&&(Q.lane&=-536870913)}a&=~ne}o!==0&&qr(e,o,0),h!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=h&~(_&~n))}function qr(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Bt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function ws(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Bt(a),u=1<<o;u&n|e[o]&n&&(e[o]|=n),a&=~u}}function Lr(e,n){var a=n&-n;return a=(a&42)!==0?1:ir(a),(a&(e.suspendedLanes|n))!==0?0:a}function ir(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 Ss(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function aa(){var e=ae.p;return e!==0?e:(e=window.event,e===void 0?32:zy(e.type))}function Lo(e,n){var a=ae.p;try{return ae.p=e,n()}finally{ae.p=a}}var Yn=Math.random().toString(36).slice(2),nt="__reactFiber$"+Yn,ht="__reactProps$"+Yn,tn="__reactContainer$"+Yn,Es="__reactEvents$"+Yn,oa="__reactListeners$"+Yn,Bo="__reactHandles$"+Yn,Uo="__reactResources$"+Yn,At="__reactMarker$"+Yn;function ti(e){delete e[nt],delete e[ht],delete e[Es],delete e[oa],delete e[Bo]}function O(e){var n=e[nt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[tn]||a[nt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Ey(e);e!==null;){if(a=e[nt])return a;e=Ey(e)}return n}e=a,a=e.parentNode}return null}function k(e){if(e=e[nt]||e[tn]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function T(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function N(e){var n=e[Uo];return n||(n=e[Uo]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function D(e){e[At]=!0}var I=new Set,te={};function ie(e,n){V(e,n),V(e+"Capture",n)}function V(e,n){for(te[e]=n,e=0;e<n.length;e++)I.add(n[e])}var W=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]*$"),pe={},Re={};function it(e){return ta.call(Re,e)?!0:ta.call(pe,e)?!1:W.test(e)?Re[e]=!0:(pe[e]=!0,!1)}function Ut(e,n,a){if(it(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Bn(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function ar(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function wn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lm(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function ax(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(_){a=""+_,h.call(this,_)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function ju(e){if(!e._valueTracker){var n=lm(e)?"checked":"value";e._valueTracker=ax(e,n,""+e[n])}}function cm(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=lm(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function Po(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 ox=/[\n"\\]/g;function Sn(e){return e.replace(ox,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Tu(e,n,a,o,u,h,_,E){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+wn(n)):e.value!==""+wn(n)&&(e.value=""+wn(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?ku(e,_,wn(n)):a!=null?ku(e,_,wn(a)):o!=null&&e.removeAttribute("value"),u==null&&h!=null&&(e.defaultChecked=!!h),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+wn(E):e.removeAttribute("name")}function um(e,n,a,o,u,h,_,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){ju(e);return}a=a!=null?""+wn(a):"",n=n!=null?""+wn(n):a,E||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=E?e.checked:!!o,e.defaultChecked=!!o,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),ju(e)}function ku(e,n,a){n==="number"&&Po(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ni(e,n,a,o){if(e=e.options,n){n={};for(var u=0;u<a.length;u++)n["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=n.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&o&&(e[a].defaultSelected=!0)}else{for(a=""+wn(a),n=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function fm(e,n,a){if(n!=null&&(n=""+wn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+wn(a):""}function hm(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(Te(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=wn(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),ju(e)}function ri(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var lx=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 dm(e,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,a):typeof a!="number"||a===0||lx.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function mm(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&a[u]!==o&&dm(e,u,o)}else for(var h in n)n.hasOwnProperty(h)&&dm(e,h,n[h])}function Nu(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 cx=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"]]),ux=/^[\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 zo(e){return ux.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function or(){}var Cu=null;function Mu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var si=null,ii=null;function pm(e){var n=k(e);if(n&&(e=n.stateNode)){var a=e[ht]||null;e:switch(e=n.stateNode,n.type){case"input":if(Tu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Sn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var u=o[ht]||null;if(!u)throw Error(i(90));Tu(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&cm(o)}break e;case"textarea":fm(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&ni(e,!!a.multiple,n,!1)}}}var Ru=!1;function ym(e,n,a){if(Ru)return e(n,a);Ru=!0;try{var o=e(n);return o}finally{if(Ru=!1,(si!==null||ii!==null)&&(jl(),si&&(n=si,e=ii,ii=si=null,pm(n),e)))for(n=0;n<e.length;n++)pm(e[n])}}function la(e,n){var a=e.stateNode;if(a===null)return null;var o=a[ht]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var lr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Du=!1;if(lr)try{var ca={};Object.defineProperty(ca,"passive",{get:function(){Du=!0}}),window.addEventListener("test",ca,ca),window.removeEventListener("test",ca,ca)}catch{Du=!1}var Br=null,qu=null,Io=null;function gm(){if(Io)return Io;var e,n=qu,a=n.length,o,u="value"in Br?Br.value:Br.textContent,h=u.length;for(e=0;e<a&&n[e]===u[e];e++);var _=a-e;for(o=1;o<=_&&n[a-o]===u[h-o];o++);return Io=u.slice(e,1<o?1-o:void 0)}function $o(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ho(){return!0}function bm(){return!1}function Yt(e){function n(a,o,u,h,_){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=h,this.target=_,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Ho:bm,this.isPropagationStopped=bm,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ho)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ho)},persist:function(){},isPersistent:Ho}),n}var Os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Go=Yt(Os),ua=b({},Os,{view:0,detail:0}),fx=Yt(ua),Lu,Bu,fa,Fo=b({},ua,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pu,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!==fa&&(fa&&e.type==="mousemove"?(Lu=e.screenX-fa.screenX,Bu=e.screenY-fa.screenY):Bu=Lu=0,fa=e),Lu)},movementY:function(e){return"movementY"in e?e.movementY:Bu}}),vm=Yt(Fo),hx=b({},Fo,{dataTransfer:0}),dx=Yt(hx),mx=b({},ua,{relatedTarget:0}),Uu=Yt(mx),px=b({},Os,{animationName:0,elapsedTime:0,pseudoElement:0}),yx=Yt(px),gx=b({},Os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bx=Yt(gx),vx=b({},Os,{data:0}),xm=Yt(vx),xx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_x={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"},wx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=wx[e])?!!n[e]:!1}function Pu(){return Sx}var Ex=b({},ua,{key:function(e){if(e.key){var n=xx[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=$o(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?_x[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pu,charCode:function(e){return e.type==="keypress"?$o(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$o(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ox=Yt(Ex),Ax=b({},Fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_m=Yt(Ax),jx=b({},ua,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pu}),Tx=Yt(jx),kx=b({},Os,{propertyName:0,elapsedTime:0,pseudoElement:0}),Nx=Yt(kx),Cx=b({},Fo,{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}),Mx=Yt(Cx),Rx=b({},Os,{newState:0,oldState:0}),Dx=Yt(Rx),qx=[9,13,27,32],zu=lr&&"CompositionEvent"in window,ha=null;lr&&"documentMode"in document&&(ha=document.documentMode);var Lx=lr&&"TextEvent"in window&&!ha,wm=lr&&(!zu||ha&&8<ha&&11>=ha),Sm=" ",Em=!1;function Om(e,n){switch(e){case"keyup":return qx.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Am(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ai=!1;function Bx(e,n){switch(e){case"compositionend":return Am(n);case"keypress":return n.which!==32?null:(Em=!0,Sm);case"textInput":return e=n.data,e===Sm&&Em?null:e;default:return null}}function Ux(e,n){if(ai)return e==="compositionend"||!zu&&Om(e,n)?(e=gm(),Io=qu=Br=null,ai=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return wm&&n.locale!=="ko"?null:n.data;default:return null}}var Px={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 jm(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Px[e.type]:n==="textarea"}function Tm(e,n,a,o){si?ii?ii.push(o):ii=[o]:si=o,n=Dl(n,"onChange"),0<n.length&&(a=new Go("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var da=null,ma=null;function zx(e){uy(e,0)}function Vo(e){var n=T(e);if(cm(n))return e}function km(e,n){if(e==="change")return n}var Nm=!1;if(lr){var Iu;if(lr){var $u="oninput"in document;if(!$u){var Cm=document.createElement("div");Cm.setAttribute("oninput","return;"),$u=typeof Cm.oninput=="function"}Iu=$u}else Iu=!1;Nm=Iu&&(!document.documentMode||9<document.documentMode)}function Mm(){da&&(da.detachEvent("onpropertychange",Rm),ma=da=null)}function Rm(e){if(e.propertyName==="value"&&Vo(ma)){var n=[];Tm(n,ma,e,Mu(e)),ym(zx,n)}}function Ix(e,n,a){e==="focusin"?(Mm(),da=n,ma=a,da.attachEvent("onpropertychange",Rm)):e==="focusout"&&Mm()}function $x(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Vo(ma)}function Hx(e,n){if(e==="click")return Vo(n)}function Gx(e,n){if(e==="input"||e==="change")return Vo(n)}function Fx(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var nn=typeof Object.is=="function"?Object.is:Fx;function pa(e,n){if(nn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!ta.call(n,u)||!nn(e[u],n[u]))return!1}return!0}function Dm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function qm(e,n){var a=Dm(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Dm(a)}}function Lm(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Lm(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Bm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Po(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Po(e.document)}return n}function Hu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Vx=lr&&"documentMode"in document&&11>=document.documentMode,oi=null,Gu=null,ya=null,Fu=!1;function Um(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Fu||oi==null||oi!==Po(o)||(o=oi,"selectionStart"in o&&Hu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),ya&&pa(ya,o)||(ya=o,o=Dl(Gu,"onSelect"),0<o.length&&(n=new Go("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=oi)))}function As(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var li={animationend:As("Animation","AnimationEnd"),animationiteration:As("Animation","AnimationIteration"),animationstart:As("Animation","AnimationStart"),transitionrun:As("Transition","TransitionRun"),transitionstart:As("Transition","TransitionStart"),transitioncancel:As("Transition","TransitionCancel"),transitionend:As("Transition","TransitionEnd")},Vu={},Pm={};lr&&(Pm=document.createElement("div").style,"AnimationEvent"in window||(delete li.animationend.animation,delete li.animationiteration.animation,delete li.animationstart.animation),"TransitionEvent"in window||delete li.transitionend.transition);function js(e){if(Vu[e])return Vu[e];if(!li[e])return e;var n=li[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Pm)return Vu[e]=n[a];return e}var zm=js("animationend"),Im=js("animationiteration"),$m=js("animationstart"),Yx=js("transitionrun"),Kx=js("transitionstart"),Qx=js("transitioncancel"),Hm=js("transitionend"),Gm=new Map,Yu="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(" ");Yu.push("scrollEnd");function Un(e,n){Gm.set(e,n),ie(n,[e])}var Yo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],ci=0,Ku=0;function Ko(){for(var e=ci,n=Ku=ci=0;n<e;){var a=En[n];En[n++]=null;var o=En[n];En[n++]=null;var u=En[n];En[n++]=null;var h=En[n];if(En[n++]=null,o!==null&&u!==null){var _=o.pending;_===null?u.next=u:(u.next=_.next,_.next=u),o.pending=u}h!==0&&Fm(a,u,h)}}function Qo(e,n,a,o){En[ci++]=e,En[ci++]=n,En[ci++]=a,En[ci++]=o,Ku|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Qu(e,n,a,o){return Qo(e,n,a,o),Xo(e)}function Ts(e,n){return Qo(e,null,null,n),Xo(e)}function Fm(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var u=!1,h=e.return;h!==null;)h.childLanes|=a,o=h.alternate,o!==null&&(o.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(u=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,u&&n!==null&&(u=31-Bt(a),e=h.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=a|536870912),h):null}function Xo(e){if(50<Ua)throw Ua=0,ih=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var ui={};function Xx(e,n,a,o){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rn(e,n,a,o){return new Xx(e,n,a,o)}function Xu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cr(e,n){var a=e.alternate;return a===null?(a=rn(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Vm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Jo(e,n,a,o,u,h){var _=0;if(o=e,typeof e=="function")Xu(e)&&(_=1);else if(typeof e=="string")_=tw(e,a,et.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case L:return e=rn(31,a,n,u),e.elementType=L,e.lanes=h,e;case S:return ks(a.children,u,h,n);case M:_=8,u|=24;break;case B:return e=rn(12,a,n,u|2),e.elementType=B,e.lanes=h,e;case C:return e=rn(13,a,n,u),e.elementType=C,e.lanes=h,e;case U:return e=rn(19,a,n,u),e.elementType=U,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case se:_=10;break e;case P:_=9;break e;case fe:_=11;break e;case re:_=14;break e;case K:_=16,o=null;break e}_=29,a=Error(i(130,e===null?"null":typeof e,"")),o=null}return n=rn(_,a,n,u),n.elementType=e,n.type=o,n.lanes=h,n}function ks(e,n,a,o){return e=rn(7,e,o,n),e.lanes=a,e}function Ju(e,n,a){return e=rn(6,e,null,n),e.lanes=a,e}function Ym(e){var n=rn(18,null,null,0);return n.stateNode=e,n}function Zu(e,n,a){return n=rn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Km=new WeakMap;function On(e,n){if(typeof e=="object"&&e!==null){var a=Km.get(e);return a!==void 0?a:(n={value:e,source:n,stack:No(n)},Km.set(e,n),n)}return{value:e,source:n,stack:No(n)}}var fi=[],hi=0,Zo=null,ga=0,An=[],jn=0,Ur=null,Kn=1,Qn="";function ur(e,n){fi[hi++]=ga,fi[hi++]=Zo,Zo=e,ga=n}function Qm(e,n,a){An[jn++]=Kn,An[jn++]=Qn,An[jn++]=Ur,Ur=e;var o=Kn;e=Qn;var u=32-Bt(o)-1;o&=~(1<<u),a+=1;var h=32-Bt(n)+u;if(30<h){var _=u-u%5;h=(o&(1<<_)-1).toString(32),o>>=_,u-=_,Kn=1<<32-Bt(n)+u|a<<u|o,Qn=h+e}else Kn=1<<h|a<<u|o,Qn=e}function Wu(e){e.return!==null&&(ur(e,1),Qm(e,1,0))}function ef(e){for(;e===Zo;)Zo=fi[--hi],fi[hi]=null,ga=fi[--hi],fi[hi]=null;for(;e===Ur;)Ur=An[--jn],An[jn]=null,Qn=An[--jn],An[jn]=null,Kn=An[--jn],An[jn]=null}function Xm(e,n){An[jn++]=Kn,An[jn++]=Qn,An[jn++]=Ur,Kn=n.id,Qn=n.overflow,Ur=e}var Mt=null,at=null,Ue=!1,Pr=null,Tn=!1,tf=Error(i(519));function zr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ba(On(n,e)),tf}function Jm(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[nt]=e,n[ht]=o,a){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(a=0;a<za.length;a++)qe(za[a],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),um(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),hm(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||my(n.textContent,a)?(o.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),o.onScroll!=null&&qe("scroll",n),o.onScrollEnd!=null&&qe("scrollend",n),o.onClick!=null&&(n.onclick=or),n=!0):n=!1,n||zr(e,!0)}function Zm(e){for(Mt=e.return;Mt;)switch(Mt.tag){case 5:case 31:case 13:Tn=!1;return;case 27:case 3:Tn=!0;return;default:Mt=Mt.return}}function di(e){if(e!==Mt)return!1;if(!Ue)return Zm(e),Ue=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||xh(e.type,e.memoizedProps)),a=!a),a&&at&&zr(e),Zm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));at=Sy(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));at=Sy(e)}else n===27?(n=at,es(e.type)?(e=Oh,Oh=null,at=e):at=n):at=Mt?Nn(e.stateNode.nextSibling):null;return!0}function Ns(){at=Mt=null,Ue=!1}function nf(){var e=Pr;return e!==null&&(Jt===null?Jt=e:Jt.push.apply(Jt,e),Pr=null),e}function ba(e){Pr===null?Pr=[e]:Pr.push(e)}var rf=Ne(null),Cs=null,fr=null;function Ir(e,n,a){ke(rf,n._currentValue),n._currentValue=a}function hr(e){e._currentValue=rf.current,Ae(rf)}function sf(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function af(e,n,a,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var h=u.dependencies;if(h!==null){var _=u.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=u;for(var R=0;R<n.length;R++)if(E.context===n[R]){h.lanes|=a,E=h.alternate,E!==null&&(E.lanes|=a),sf(h.return,a,e),o||(_=null);break e}h=E.next}}else if(u.tag===18){if(_=u.return,_===null)throw Error(i(341));_.lanes|=a,h=_.alternate,h!==null&&(h.lanes|=a),sf(_,a,e),_=null}else _=u.child;if(_!==null)_.return=u;else for(_=u;_!==null;){if(_===e){_=null;break}if(u=_.sibling,u!==null){u.return=_.return,_=u;break}_=_.return}u=_}}function mi(e,n,a,o){e=null;for(var u=n,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var _=u.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var E=u.type;nn(u.pendingProps.value,_.value)||(e!==null?e.push(E):e=[E])}}else if(u===tt.current){if(_=u.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Fa):e=[Fa])}u=u.return}e!==null&&af(n,e,a,o),n.flags|=262144}function Wo(e){for(e=e.firstContext;e!==null;){if(!nn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ms(e){Cs=e,fr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Rt(e){return Wm(Cs,e)}function el(e,n){return Cs===null&&Ms(e),Wm(e,n)}function Wm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},fr===null){if(e===null)throw Error(i(308));fr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else fr=fr.next=n;return a}var Jx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},Zx=r.unstable_scheduleCallback,Wx=r.unstable_NormalPriority,_t={$$typeof:se,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function of(){return{controller:new Jx,data:new Map,refCount:0}}function va(e){e.refCount--,e.refCount===0&&Zx(Wx,function(){e.controller.abort()})}var xa=null,lf=0,pi=0,yi=null;function e_(e,n){if(xa===null){var a=xa=[];lf=0,pi=fh(),yi={status:"pending",value:void 0,then:function(o){a.push(o)}}}return lf++,n.then(e0,e0),n}function e0(){if(--lf===0&&xa!==null){yi!==null&&(yi.status="fulfilled");var e=xa;xa=null,pi=0,yi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function t_(e,n){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var u=0;u<a.length;u++)(0,a[u])(n)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var t0=Y.S;Y.S=function(e,n){Up=lt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&e_(e,n),t0!==null&&t0(e,n)};var Rs=Ne(null);function cf(){var e=Rs.current;return e!==null?e:rt.pooledCache}function tl(e,n){n===null?ke(Rs,Rs.current):ke(Rs,n.pool)}function n0(){var e=cf();return e===null?null:{parent:_t._currentValue,pool:e}}var gi=Error(i(460)),uf=Error(i(474)),nl=Error(i(542)),rl={then:function(){}};function r0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function s0(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(or,or),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,a0(e),e;default:if(typeof n.status=="string")n.then(or,or);else{if(e=rt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,a0(e),e}throw qs=n,gi}}function Ds(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(qs=a,gi):a}}var qs=null;function i0(){if(qs===null)throw Error(i(459));var e=qs;return qs=null,e}function a0(e){if(e===gi||e===nl)throw Error(i(483))}var bi=null,_a=0;function sl(e){var n=_a;return _a+=1,bi===null&&(bi=[]),s0(bi,e,n)}function wa(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function il(e,n){throw n.$$typeof===v?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function o0(e){function n(z,q){if(e){var $=z.deletions;$===null?(z.deletions=[q],z.flags|=16):$.push(q)}}function a(z,q){if(!e)return null;for(;q!==null;)n(z,q),q=q.sibling;return null}function o(z){for(var q=new Map;z!==null;)z.key!==null?q.set(z.key,z):q.set(z.index,z),z=z.sibling;return q}function u(z,q){return z=cr(z,q),z.index=0,z.sibling=null,z}function h(z,q,$){return z.index=$,e?($=z.alternate,$!==null?($=$.index,$<q?(z.flags|=67108866,q):$):(z.flags|=67108866,q)):(z.flags|=1048576,q)}function _(z){return e&&z.alternate===null&&(z.flags|=67108866),z}function E(z,q,$,Z){return q===null||q.tag!==6?(q=Ju($,z.mode,Z),q.return=z,q):(q=u(q,$),q.return=z,q)}function R(z,q,$,Z){var _e=$.type;return _e===S?J(z,q,$.props.children,Z,$.key):q!==null&&(q.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===K&&Ds(_e)===q.type)?(q=u(q,$.props),wa(q,$),q.return=z,q):(q=Jo($.type,$.key,$.props,null,z.mode,Z),wa(q,$),q.return=z,q)}function H(z,q,$,Z){return q===null||q.tag!==4||q.stateNode.containerInfo!==$.containerInfo||q.stateNode.implementation!==$.implementation?(q=Zu($,z.mode,Z),q.return=z,q):(q=u(q,$.children||[]),q.return=z,q)}function J(z,q,$,Z,_e){return q===null||q.tag!==7?(q=ks($,z.mode,Z,_e),q.return=z,q):(q=u(q,$),q.return=z,q)}function ne(z,q,$){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Ju(""+q,z.mode,$),q.return=z,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case x:return $=Jo(q.type,q.key,q.props,null,z.mode,$),wa($,q),$.return=z,$;case w:return q=Zu(q,z.mode,$),q.return=z,q;case K:return q=Ds(q),ne(z,q,$)}if(Te(q)||X(q))return q=ks(q,z.mode,$,null),q.return=z,q;if(typeof q.then=="function")return ne(z,sl(q),$);if(q.$$typeof===se)return ne(z,el(z,q),$);il(z,q)}return null}function G(z,q,$,Z){var _e=q!==null?q.key:null;if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return _e!==null?null:E(z,q,""+$,Z);if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return $.key===_e?R(z,q,$,Z):null;case w:return $.key===_e?H(z,q,$,Z):null;case K:return $=Ds($),G(z,q,$,Z)}if(Te($)||X($))return _e!==null?null:J(z,q,$,Z,null);if(typeof $.then=="function")return G(z,q,sl($),Z);if($.$$typeof===se)return G(z,q,el(z,$),Z);il(z,$)}return null}function Q(z,q,$,Z,_e){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return z=z.get($)||null,E(q,z,""+Z,_e);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:return z=z.get(Z.key===null?$:Z.key)||null,R(q,z,Z,_e);case w:return z=z.get(Z.key===null?$:Z.key)||null,H(q,z,Z,_e);case K:return Z=Ds(Z),Q(z,q,$,Z,_e)}if(Te(Z)||X(Z))return z=z.get($)||null,J(q,z,Z,_e,null);if(typeof Z.then=="function")return Q(z,q,$,sl(Z),_e);if(Z.$$typeof===se)return Q(z,q,$,el(q,Z),_e);il(q,Z)}return null}function ye(z,q,$,Z){for(var _e=null,He=null,be=q,Me=q=0,Be=null;be!==null&&Me<$.length;Me++){be.index>Me?(Be=be,be=null):Be=be.sibling;var Ge=G(z,be,$[Me],Z);if(Ge===null){be===null&&(be=Be);break}e&&be&&Ge.alternate===null&&n(z,be),q=h(Ge,q,Me),He===null?_e=Ge:He.sibling=Ge,He=Ge,be=Be}if(Me===$.length)return a(z,be),Ue&&ur(z,Me),_e;if(be===null){for(;Me<$.length;Me++)be=ne(z,$[Me],Z),be!==null&&(q=h(be,q,Me),He===null?_e=be:He.sibling=be,He=be);return Ue&&ur(z,Me),_e}for(be=o(be);Me<$.length;Me++)Be=Q(be,z,Me,$[Me],Z),Be!==null&&(e&&Be.alternate!==null&&be.delete(Be.key===null?Me:Be.key),q=h(Be,q,Me),He===null?_e=Be:He.sibling=Be,He=Be);return e&&be.forEach(function(is){return n(z,is)}),Ue&&ur(z,Me),_e}function Ee(z,q,$,Z){if($==null)throw Error(i(151));for(var _e=null,He=null,be=q,Me=q=0,Be=null,Ge=$.next();be!==null&&!Ge.done;Me++,Ge=$.next()){be.index>Me?(Be=be,be=null):Be=be.sibling;var is=G(z,be,Ge.value,Z);if(is===null){be===null&&(be=Be);break}e&&be&&is.alternate===null&&n(z,be),q=h(is,q,Me),He===null?_e=is:He.sibling=is,He=is,be=Be}if(Ge.done)return a(z,be),Ue&&ur(z,Me),_e;if(be===null){for(;!Ge.done;Me++,Ge=$.next())Ge=ne(z,Ge.value,Z),Ge!==null&&(q=h(Ge,q,Me),He===null?_e=Ge:He.sibling=Ge,He=Ge);return Ue&&ur(z,Me),_e}for(be=o(be);!Ge.done;Me++,Ge=$.next())Ge=Q(be,z,Me,Ge.value,Z),Ge!==null&&(e&&Ge.alternate!==null&&be.delete(Ge.key===null?Me:Ge.key),q=h(Ge,q,Me),He===null?_e=Ge:He.sibling=Ge,He=Ge);return e&&be.forEach(function(hw){return n(z,hw)}),Ue&&ur(z,Me),_e}function Ze(z,q,$,Z){if(typeof $=="object"&&$!==null&&$.type===S&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case x:e:{for(var _e=$.key;q!==null;){if(q.key===_e){if(_e=$.type,_e===S){if(q.tag===7){a(z,q.sibling),Z=u(q,$.props.children),Z.return=z,z=Z;break e}}else if(q.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===K&&Ds(_e)===q.type){a(z,q.sibling),Z=u(q,$.props),wa(Z,$),Z.return=z,z=Z;break e}a(z,q);break}else n(z,q);q=q.sibling}$.type===S?(Z=ks($.props.children,z.mode,Z,$.key),Z.return=z,z=Z):(Z=Jo($.type,$.key,$.props,null,z.mode,Z),wa(Z,$),Z.return=z,z=Z)}return _(z);case w:e:{for(_e=$.key;q!==null;){if(q.key===_e)if(q.tag===4&&q.stateNode.containerInfo===$.containerInfo&&q.stateNode.implementation===$.implementation){a(z,q.sibling),Z=u(q,$.children||[]),Z.return=z,z=Z;break e}else{a(z,q);break}else n(z,q);q=q.sibling}Z=Zu($,z.mode,Z),Z.return=z,z=Z}return _(z);case K:return $=Ds($),Ze(z,q,$,Z)}if(Te($))return ye(z,q,$,Z);if(X($)){if(_e=X($),typeof _e!="function")throw Error(i(150));return $=_e.call($),Ee(z,q,$,Z)}if(typeof $.then=="function")return Ze(z,q,sl($),Z);if($.$$typeof===se)return Ze(z,q,el(z,$),Z);il(z,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,q!==null&&q.tag===6?(a(z,q.sibling),Z=u(q,$),Z.return=z,z=Z):(a(z,q),Z=Ju($,z.mode,Z),Z.return=z,z=Z),_(z)):a(z,q)}return function(z,q,$,Z){try{_a=0;var _e=Ze(z,q,$,Z);return bi=null,_e}catch(be){if(be===gi||be===nl)throw be;var He=rn(29,be,null,z.mode);return He.lanes=Z,He.return=z,He}finally{}}}var Ls=o0(!0),l0=o0(!1),$r=!1;function ff(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Hr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Gr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Fe&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=Xo(e),Fm(e,null,a),n}return Qo(e,o,n,a),Xo(e)}function Sa(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,ws(e,a)}}function df(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=_:h=h.next=_,a=a.next}while(a!==null);h===null?u=h=n:h=h.next=n}else u=h=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var mf=!1;function Ea(){if(mf){var e=yi;if(e!==null)throw e}}function Oa(e,n,a,o){mf=!1;var u=e.updateQueue;$r=!1;var h=u.firstBaseUpdate,_=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var R=E,H=R.next;R.next=null,_===null?h=H:_.next=H,_=R;var J=e.alternate;J!==null&&(J=J.updateQueue,E=J.lastBaseUpdate,E!==_&&(E===null?J.firstBaseUpdate=H:E.next=H,J.lastBaseUpdate=R))}if(h!==null){var ne=u.baseState;_=0,J=H=R=null,E=h;do{var G=E.lane&-536870913,Q=G!==E.lane;if(Q?(Le&G)===G:(o&G)===G){G!==0&&G===pi&&(mf=!0),J!==null&&(J=J.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ye=e,Ee=E;G=n;var Ze=a;switch(Ee.tag){case 1:if(ye=Ee.payload,typeof ye=="function"){ne=ye.call(Ze,ne,G);break e}ne=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Ee.payload,G=typeof ye=="function"?ye.call(Ze,ne,G):ye,G==null)break e;ne=b({},ne,G);break e;case 2:$r=!0}}G=E.callback,G!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=u.callbacks,Q===null?u.callbacks=[G]:Q.push(G))}else Q={lane:G,tag:E.tag,payload:E.payload,callback:E.callback,next:null},J===null?(H=J=Q,R=ne):J=J.next=Q,_|=G;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;Q=E,E=Q.next,Q.next=null,u.lastBaseUpdate=Q,u.shared.pending=null}}while(!0);J===null&&(R=ne),u.baseState=R,u.firstBaseUpdate=H,u.lastBaseUpdate=J,h===null&&(u.shared.lanes=0),Qr|=_,e.lanes=_,e.memoizedState=ne}}function c0(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function u0(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)c0(a[e],n)}var vi=Ne(null),al=Ne(0);function f0(e,n){e=_r,ke(al,e),ke(vi,n),_r=e|n.baseLanes}function pf(){ke(al,_r),ke(vi,vi.current)}function yf(){_r=al.current,Ae(vi),Ae(al)}var sn=Ne(null),kn=null;function Fr(e){var n=e.alternate;ke(bt,bt.current&1),ke(sn,e),kn===null&&(n===null||vi.current!==null||n.memoizedState!==null)&&(kn=e)}function gf(e){ke(bt,bt.current),ke(sn,e),kn===null&&(kn=e)}function h0(e){e.tag===22?(ke(bt,bt.current),ke(sn,e),kn===null&&(kn=e)):Vr()}function Vr(){ke(bt,bt.current),ke(sn,sn.current)}function an(e){Ae(sn),kn===e&&(kn=null),Ae(bt)}var bt=Ne(0);function ol(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Sh(a)||Eh(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var dr=0,Ce=null,Xe=null,wt=null,ll=!1,xi=!1,Bs=!1,cl=0,Aa=0,_i=null,n_=0;function dt(){throw Error(i(321))}function bf(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!nn(e[a],n[a]))return!1;return!0}function vf(e,n,a,o,u,h){return dr=h,Ce=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?Q0:Df,Bs=!1,h=a(o,u),Bs=!1,xi&&(h=m0(n,a,o,u)),d0(e),h}function d0(e){Y.H=ka;var n=Xe!==null&&Xe.next!==null;if(dr=0,wt=Xe=Ce=null,ll=!1,Aa=0,_i=null,n)throw Error(i(300));e===null||St||(e=e.dependencies,e!==null&&Wo(e)&&(St=!0))}function m0(e,n,a,o){Ce=e;var u=0;do{if(xi&&(_i=null),Aa=0,xi=!1,25<=u)throw Error(i(301));if(u+=1,wt=Xe=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}Y.H=X0,h=n(a,o)}while(xi);return h}function r_(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?ja(n):n,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Ce.flags|=1024),n}function xf(){var e=cl!==0;return cl=0,e}function _f(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function wf(e){if(ll){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}ll=!1}dr=0,wt=Xe=Ce=null,xi=!1,Aa=cl=0,_i=null}function Pt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?Ce.memoizedState=wt=e:wt=wt.next=e,wt}function vt(){if(Xe===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var n=wt===null?Ce.memoizedState:wt.next;if(n!==null)wt=n,Xe=e;else{if(e===null)throw Ce.alternate===null?Error(i(467)):Error(i(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},wt===null?Ce.memoizedState=wt=e:wt=wt.next=e}return wt}function ul(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ja(e){var n=Aa;return Aa+=1,_i===null&&(_i=[]),e=s0(_i,e,n),n=Ce,(wt===null?n.memoizedState:wt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?Q0:Df),e}function fl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ja(e);if(e.$$typeof===se)return Rt(e)}throw Error(i(438,String(e)))}function Sf(e){var n=null,a=Ce.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=Ce.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=ul(),Ce.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=F;return n.index++,a}function mr(e,n){return typeof n=="function"?n(e):n}function hl(e){var n=vt();return Ef(n,Xe,e)}function Ef(e,n,a){var o=e.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=a;var u=e.baseQueue,h=o.pending;if(h!==null){if(u!==null){var _=u.next;u.next=h.next,h.next=_}n.baseQueue=u=h,o.pending=null}if(h=e.baseState,u===null)e.memoizedState=h;else{n=u.next;var E=_=null,R=null,H=n,J=!1;do{var ne=H.lane&-536870913;if(ne!==H.lane?(Le&ne)===ne:(dr&ne)===ne){var G=H.revertLane;if(G===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ne===pi&&(J=!0);else if((dr&G)===G){H=H.next,G===pi&&(J=!0);continue}else ne={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=ne,_=h):R=R.next=ne,Ce.lanes|=G,Qr|=G;ne=H.action,Bs&&a(h,ne),h=H.hasEagerState?H.eagerState:a(h,ne)}else G={lane:ne,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=G,_=h):R=R.next=G,Ce.lanes|=ne,Qr|=ne;H=H.next}while(H!==null&&H!==n);if(R===null?_=h:R.next=E,!nn(h,e.memoizedState)&&(St=!0,J&&(a=yi,a!==null)))throw a;e.memoizedState=h,e.baseState=_,e.baseQueue=R,o.lastRenderedState=h}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Of(e){var n=vt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var o=a.dispatch,u=a.pending,h=n.memoizedState;if(u!==null){a.pending=null;var _=u=u.next;do h=e(h,_.action),_=_.next;while(_!==u);nn(h,n.memoizedState)||(St=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,o]}function p0(e,n,a){var o=Ce,u=vt(),h=Ue;if(h){if(a===void 0)throw Error(i(407));a=a()}else a=n();var _=!nn((Xe||u).memoizedState,a);if(_&&(u.memoizedState=a,St=!0),u=u.queue,Tf(b0.bind(null,o,u,e),[e]),u.getSnapshot!==n||_||wt!==null&&wt.memoizedState.tag&1){if(o.flags|=2048,wi(9,{destroy:void 0},g0.bind(null,o,u,a,n),null),rt===null)throw Error(i(349));h||(dr&127)!==0||y0(o,n,a)}return a}function y0(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ce.updateQueue,n===null?(n=ul(),Ce.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function g0(e,n,a,o){n.value=a,n.getSnapshot=o,v0(n)&&x0(e)}function b0(e,n,a){return a(function(){v0(n)&&x0(e)})}function v0(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!nn(e,a)}catch{return!0}}function x0(e){var n=Ts(e,2);n!==null&&Zt(n,e,2)}function Af(e){var n=Pt();if(typeof e=="function"){var a=e;if(e=a(),Bs){en(!0);try{a()}finally{en(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:e},n}function _0(e,n,a,o){return e.baseState=a,Ef(e,Xe,typeof o=="function"?o:mr)}function s_(e,n,a,o,u){if(pl(e))throw Error(i(485));if(e=n.action,e!==null){var h={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){h.listeners.push(_)}};Y.T!==null?a(!0):h.isTransition=!1,o(h),a=n.pending,a===null?(h.next=n.pending=h,w0(n,h)):(h.next=a.next,n.pending=a.next=h)}}function w0(e,n){var a=n.action,o=n.payload,u=e.state;if(n.isTransition){var h=Y.T,_={};Y.T=_;try{var E=a(u,o),R=Y.S;R!==null&&R(_,E),S0(e,n,E)}catch(H){jf(e,n,H)}finally{h!==null&&_.types!==null&&(h.types=_.types),Y.T=h}}else try{h=a(u,o),S0(e,n,h)}catch(H){jf(e,n,H)}}function S0(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){E0(e,n,o)},function(o){return jf(e,n,o)}):E0(e,n,a)}function E0(e,n,a){n.status="fulfilled",n.value=a,O0(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,w0(e,a)))}function jf(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,O0(n),n=n.next;while(n!==o)}e.action=null}function O0(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function A0(e,n){return n}function j0(e,n){if(Ue){var a=rt.formState;if(a!==null){e:{var o=Ce;if(Ue){if(at){t:{for(var u=at,h=Tn;u.nodeType!==8;){if(!h){u=null;break t}if(u=Nn(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){at=Nn(u.nextSibling),o=u.data==="F!";break e}}zr(o)}o=!1}o&&(n=a[0])}}return a=Pt(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:A0,lastRenderedState:n},a.queue=o,a=V0.bind(null,Ce,o),o.dispatch=a,o=Af(!1),h=Rf.bind(null,Ce,!1,o.queue),o=Pt(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,a=s_.bind(null,Ce,u,h,a),u.dispatch=a,o.memoizedState=e,[n,a,!1]}function T0(e){var n=vt();return k0(n,Xe,e)}function k0(e,n,a){if(n=Ef(e,n,A0)[0],e=hl(mr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=ja(n)}catch(_){throw _===gi?nl:_}else o=n;n=vt();var u=n.queue,h=u.dispatch;return a!==n.memoizedState&&(Ce.flags|=2048,wi(9,{destroy:void 0},i_.bind(null,u,a),null)),[o,h,e]}function i_(e,n){e.action=n}function N0(e){var n=vt(),a=Xe;if(a!==null)return k0(n,a,e);vt(),n=n.memoizedState,a=vt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function wi(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=Ce.updateQueue,n===null&&(n=ul(),Ce.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function C0(){return vt().memoizedState}function dl(e,n,a,o){var u=Pt();Ce.flags|=e,u.memoizedState=wi(1|n,{destroy:void 0},a,o===void 0?null:o)}function ml(e,n,a,o){var u=vt();o=o===void 0?null:o;var h=u.memoizedState.inst;Xe!==null&&o!==null&&bf(o,Xe.memoizedState.deps)?u.memoizedState=wi(n,h,a,o):(Ce.flags|=e,u.memoizedState=wi(1|n,h,a,o))}function M0(e,n){dl(8390656,8,e,n)}function Tf(e,n){ml(2048,8,e,n)}function a_(e){Ce.flags|=4;var n=Ce.updateQueue;if(n===null)n=ul(),Ce.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function R0(e){var n=vt().memoizedState;return a_({ref:n,nextImpl:e}),function(){if((Fe&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function D0(e,n){return ml(4,2,e,n)}function q0(e,n){return ml(4,4,e,n)}function L0(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function B0(e,n,a){a=a!=null?a.concat([e]):null,ml(4,4,L0.bind(null,n,e),a)}function kf(){}function U0(e,n){var a=vt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&bf(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function P0(e,n){var a=vt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&bf(n,o[1]))return o[0];if(o=e(),Bs){en(!0);try{e()}finally{en(!1)}}return a.memoizedState=[o,n],o}function Nf(e,n,a){return a===void 0||(dr&1073741824)!==0&&(Le&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=zp(),Ce.lanes|=e,Qr|=e,a)}function z0(e,n,a,o){return nn(a,n)?a:vi.current!==null?(e=Nf(e,a,o),nn(e,n)||(St=!0),e):(dr&42)===0||(dr&1073741824)!==0&&(Le&261930)===0?(St=!0,e.memoizedState=a):(e=zp(),Ce.lanes|=e,Qr|=e,n)}function I0(e,n,a,o,u){var h=ae.p;ae.p=h!==0&&8>h?h:8;var _=Y.T,E={};Y.T=E,Rf(e,!1,n,a);try{var R=u(),H=Y.S;if(H!==null&&H(E,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var J=t_(R,o);Ta(e,n,J,cn(e))}else Ta(e,n,o,cn(e))}catch(ne){Ta(e,n,{then:function(){},status:"rejected",reason:ne},cn())}finally{ae.p=h,_!==null&&E.types!==null&&(_.types=E.types),Y.T=_}}function o_(){}function Cf(e,n,a,o){if(e.tag!==5)throw Error(i(476));var u=$0(e).queue;I0(e,u,n,de,a===null?o_:function(){return H0(e),a(o)})}function $0(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:de},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function H0(e){var n=$0(e);n.next===null&&(n=e.alternate.memoizedState),Ta(e,n.next.queue,{},cn())}function Mf(){return Rt(Fa)}function G0(){return vt().memoizedState}function F0(){return vt().memoizedState}function l_(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=cn();e=Hr(a);var o=Gr(n,e,a);o!==null&&(Zt(o,n,a),Sa(o,n,a)),n={cache:of()},e.payload=n;return}n=n.return}}function c_(e,n,a){var o=cn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},pl(e)?Y0(n,a):(a=Qu(e,n,a,o),a!==null&&(Zt(a,e,o),K0(a,n,o)))}function V0(e,n,a){var o=cn();Ta(e,n,a,o)}function Ta(e,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(pl(e))Y0(n,u);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var _=n.lastRenderedState,E=h(_,a);if(u.hasEagerState=!0,u.eagerState=E,nn(E,_))return Qo(e,n,u,0),rt===null&&Ko(),!1}catch{}finally{}if(a=Qu(e,n,u,o),a!==null)return Zt(a,e,o),K0(a,n,o),!0}return!1}function Rf(e,n,a,o){if(o={lane:2,revertLane:fh(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},pl(e)){if(n)throw Error(i(479))}else n=Qu(e,a,o,2),n!==null&&Zt(n,e,2)}function pl(e){var n=e.alternate;return e===Ce||n!==null&&n===Ce}function Y0(e,n){xi=ll=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function K0(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,ws(e,a)}}var ka={readContext:Rt,use:fl,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useLayoutEffect:dt,useInsertionEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useSyncExternalStore:dt,useId:dt,useHostTransitionStatus:dt,useFormState:dt,useActionState:dt,useOptimistic:dt,useMemoCache:dt,useCacheRefresh:dt};ka.useEffectEvent=dt;var Q0={readContext:Rt,use:fl,useCallback:function(e,n){return Pt().memoizedState=[e,n===void 0?null:n],e},useContext:Rt,useEffect:M0,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,dl(4194308,4,L0.bind(null,n,e),a)},useLayoutEffect:function(e,n){return dl(4194308,4,e,n)},useInsertionEffect:function(e,n){dl(4,2,e,n)},useMemo:function(e,n){var a=Pt();n=n===void 0?null:n;var o=e();if(Bs){en(!0);try{e()}finally{en(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=Pt();if(a!==void 0){var u=a(n);if(Bs){en(!0);try{a(n)}finally{en(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=c_.bind(null,Ce,e),[o.memoizedState,e]},useRef:function(e){var n=Pt();return e={current:e},n.memoizedState=e},useState:function(e){e=Af(e);var n=e.queue,a=V0.bind(null,Ce,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:kf,useDeferredValue:function(e,n){var a=Pt();return Nf(a,e,n)},useTransition:function(){var e=Af(!1);return e=I0.bind(null,Ce,e.queue,!0,!1),Pt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=Ce,u=Pt();if(Ue){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),rt===null)throw Error(i(349));(Le&127)!==0||y0(o,n,a)}u.memoizedState=a;var h={value:a,getSnapshot:n};return u.queue=h,M0(b0.bind(null,o,h,e),[e]),o.flags|=2048,wi(9,{destroy:void 0},g0.bind(null,o,h,a,n),null),a},useId:function(){var e=Pt(),n=rt.identifierPrefix;if(Ue){var a=Qn,o=Kn;a=(o&~(1<<32-Bt(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=cl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=n_++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Mf,useFormState:j0,useActionState:j0,useOptimistic:function(e){var n=Pt();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Rf.bind(null,Ce,!0,a),a.dispatch=n,[e,n]},useMemoCache:Sf,useCacheRefresh:function(){return Pt().memoizedState=l_.bind(null,Ce)},useEffectEvent:function(e){var n=Pt(),a={impl:e};return n.memoizedState=a,function(){if((Fe&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Df={readContext:Rt,use:fl,useCallback:U0,useContext:Rt,useEffect:Tf,useImperativeHandle:B0,useInsertionEffect:D0,useLayoutEffect:q0,useMemo:P0,useReducer:hl,useRef:C0,useState:function(){return hl(mr)},useDebugValue:kf,useDeferredValue:function(e,n){var a=vt();return z0(a,Xe.memoizedState,e,n)},useTransition:function(){var e=hl(mr)[0],n=vt().memoizedState;return[typeof e=="boolean"?e:ja(e),n]},useSyncExternalStore:p0,useId:G0,useHostTransitionStatus:Mf,useFormState:T0,useActionState:T0,useOptimistic:function(e,n){var a=vt();return _0(a,Xe,e,n)},useMemoCache:Sf,useCacheRefresh:F0};Df.useEffectEvent=R0;var X0={readContext:Rt,use:fl,useCallback:U0,useContext:Rt,useEffect:Tf,useImperativeHandle:B0,useInsertionEffect:D0,useLayoutEffect:q0,useMemo:P0,useReducer:Of,useRef:C0,useState:function(){return Of(mr)},useDebugValue:kf,useDeferredValue:function(e,n){var a=vt();return Xe===null?Nf(a,e,n):z0(a,Xe.memoizedState,e,n)},useTransition:function(){var e=Of(mr)[0],n=vt().memoizedState;return[typeof e=="boolean"?e:ja(e),n]},useSyncExternalStore:p0,useId:G0,useHostTransitionStatus:Mf,useFormState:N0,useActionState:N0,useOptimistic:function(e,n){var a=vt();return Xe!==null?_0(a,Xe,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Sf,useCacheRefresh:F0};X0.useEffectEvent=R0;function qf(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Lf={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=cn(),u=Hr(o);u.payload=n,a!=null&&(u.callback=a),n=Gr(e,u,o),n!==null&&(Zt(n,e,o),Sa(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=cn(),u=Hr(o);u.tag=1,u.payload=n,a!=null&&(u.callback=a),n=Gr(e,u,o),n!==null&&(Zt(n,e,o),Sa(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=cn(),o=Hr(a);o.tag=2,n!=null&&(o.callback=n),n=Gr(e,o,a),n!==null&&(Zt(n,e,a),Sa(n,e,a))}};function J0(e,n,a,o,u,h,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,h,_):n.prototype&&n.prototype.isPureReactComponent?!pa(a,o)||!pa(u,h):!0}function Z0(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&Lf.enqueueReplaceState(n,n.state,null)}function Us(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function W0(e){Yo(e)}function ep(e){console.error(e)}function tp(e){Yo(e)}function yl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function np(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Bf(e,n,a){return a=Hr(a),a.tag=3,a.payload={element:null},a.callback=function(){yl(e,n)},a}function rp(e){return e=Hr(e),e.tag=3,e}function sp(e,n,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var h=o.value;e.payload=function(){return u(h)},e.callback=function(){np(n,a,o)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){np(n,a,o),typeof u!="function"&&(Xr===null?Xr=new Set([this]):Xr.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function u_(e,n,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&mi(n,a,u,!0),a=sn.current,a!==null){switch(a.tag){case 31:case 13:return kn===null?Tl():a.alternate===null&&mt===0&&(mt=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===rl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),lh(e,o,u)),!1;case 22:return a.flags|=65536,o===rl?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),lh(e,o,u)),!1}throw Error(i(435,a.tag))}return lh(e,o,u),Tl(),!1}if(Ue)return n=sn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==tf&&(e=Error(i(422),{cause:o}),ba(On(e,a)))):(o!==tf&&(n=Error(i(423),{cause:o}),ba(On(n,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=On(o,a),u=Bf(e.stateNode,o,u),df(e,u),mt!==4&&(mt=2)),!1;var h=Error(i(520),{cause:o});if(h=On(h,a),Ba===null?Ba=[h]:Ba.push(h),mt!==4&&(mt=2),n===null)return!0;o=On(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Bf(a.stateNode,o,e),df(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Xr===null||!Xr.has(h))))return a.flags|=65536,u&=-u,a.lanes|=u,u=rp(u),sp(u,e,a,o),df(a,u),!1}a=a.return}while(a!==null);return!1}var Uf=Error(i(461)),St=!1;function Dt(e,n,a,o){n.child=e===null?l0(n,null,a,o):Ls(n,e.child,a,o)}function ip(e,n,a,o,u){a=a.render;var h=n.ref;if("ref"in o){var _={};for(var E in o)E!=="ref"&&(_[E]=o[E])}else _=o;return Ms(n),o=vf(e,n,a,_,h,u),E=xf(),e!==null&&!St?(_f(e,n,u),pr(e,n,u)):(Ue&&E&&Wu(n),n.flags|=1,Dt(e,n,o,u),n.child)}function ap(e,n,a,o,u){if(e===null){var h=a.type;return typeof h=="function"&&!Xu(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,op(e,n,h,o,u)):(e=Jo(a.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Vf(e,u)){var _=h.memoizedProps;if(a=a.compare,a=a!==null?a:pa,a(_,o)&&e.ref===n.ref)return pr(e,n,u)}return n.flags|=1,e=cr(h,o),e.ref=n.ref,e.return=n,n.child=e}function op(e,n,a,o,u){if(e!==null){var h=e.memoizedProps;if(pa(h,o)&&e.ref===n.ref)if(St=!1,n.pendingProps=o=h,Vf(e,u))(e.flags&131072)!==0&&(St=!0);else return n.lanes=e.lanes,pr(e,n,u)}return Pf(e,n,a,o,u)}function lp(e,n,a,o){var u=o.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~h}else o=0,n.child=null;return cp(e,n,h,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&tl(n,h!==null?h.cachePool:null),h!==null?f0(n,h):pf(),h0(n);else return o=n.lanes=536870912,cp(e,n,h!==null?h.baseLanes|a:a,a,o)}else h!==null?(tl(n,h.cachePool),f0(n,h),Vr(),n.memoizedState=null):(e!==null&&tl(n,null),pf(),Vr());return Dt(e,n,u,a),n.child}function Na(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function cp(e,n,a,o,u){var h=cf();return h=h===null?null:{parent:_t._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&tl(n,null),pf(),h0(n),e!==null&&mi(e,n,o,!0),n.childLanes=u,null}function gl(e,n){return n=vl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function up(e,n,a){return Ls(n,e.child,null,a),e=gl(n,n.pendingProps),e.flags|=2,an(n),n.memoizedState=null,e}function f_(e,n,a){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ue){if(o.mode==="hidden")return e=gl(n,o),n.lanes=536870912,Na(null,e);if(gf(n),(e=at)?(e=wy(e,Tn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ur!==null?{id:Kn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=Ym(e),a.return=n,n.child=a,Mt=n,at=null)):e=null,e===null)throw zr(n);return n.lanes=536870912,null}return gl(n,o)}var h=e.memoizedState;if(h!==null){var _=h.dehydrated;if(gf(n),u)if(n.flags&256)n.flags&=-257,n=up(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(St||mi(e,n,a,!1),u=(a&e.childLanes)!==0,St||u){if(o=rt,o!==null&&(_=Lr(o,a),_!==0&&_!==h.retryLane))throw h.retryLane=_,Ts(e,_),Zt(o,e,_),Uf;Tl(),n=up(e,n,a)}else e=h.treeContext,at=Nn(_.nextSibling),Mt=n,Ue=!0,Pr=null,Tn=!1,e!==null&&Xm(n,e),n=gl(n,o),n.flags|=4096;return n}return e=cr(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function bl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Pf(e,n,a,o,u){return Ms(n),a=vf(e,n,a,o,void 0,u),o=xf(),e!==null&&!St?(_f(e,n,u),pr(e,n,u)):(Ue&&o&&Wu(n),n.flags|=1,Dt(e,n,a,u),n.child)}function fp(e,n,a,o,u,h){return Ms(n),n.updateQueue=null,a=m0(n,o,a,u),d0(e),o=xf(),e!==null&&!St?(_f(e,n,h),pr(e,n,h)):(Ue&&o&&Wu(n),n.flags|=1,Dt(e,n,a,h),n.child)}function hp(e,n,a,o,u){if(Ms(n),n.stateNode===null){var h=ui,_=a.contextType;typeof _=="object"&&_!==null&&(h=Rt(_)),h=new a(o,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Lf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=o,h.state=n.memoizedState,h.refs={},ff(n),_=a.contextType,h.context=typeof _=="object"&&_!==null?Rt(_):ui,h.state=n.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(qf(n,a,_,o),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(_=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),_!==h.state&&Lf.enqueueReplaceState(h,h.state,null),Oa(n,o,h,u),Ea(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){h=n.stateNode;var E=n.memoizedProps,R=Us(a,E);h.props=R;var H=h.context,J=a.contextType;_=ui,typeof J=="object"&&J!==null&&(_=Rt(J));var ne=a.getDerivedStateFromProps;J=typeof ne=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,J||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||H!==_)&&Z0(n,h,o,_),$r=!1;var G=n.memoizedState;h.state=G,Oa(n,o,h,u),Ea(),H=n.memoizedState,E||G!==H||$r?(typeof ne=="function"&&(qf(n,a,ne,o),H=n.memoizedState),(R=$r||J0(n,a,R,o,G,H,_))?(J||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=H),h.props=o,h.state=H,h.context=_,o=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{h=n.stateNode,hf(e,n),_=n.memoizedProps,J=Us(a,_),h.props=J,ne=n.pendingProps,G=h.context,H=a.contextType,R=ui,typeof H=="object"&&H!==null&&(R=Rt(H)),E=a.getDerivedStateFromProps,(H=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(_!==ne||G!==R)&&Z0(n,h,o,R),$r=!1,G=n.memoizedState,h.state=G,Oa(n,o,h,u),Ea();var Q=n.memoizedState;_!==ne||G!==Q||$r||e!==null&&e.dependencies!==null&&Wo(e.dependencies)?(typeof E=="function"&&(qf(n,a,E,o),Q=n.memoizedState),(J=$r||J0(n,a,J,o,G,Q,R)||e!==null&&e.dependencies!==null&&Wo(e.dependencies))?(H||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,Q,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,Q,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=Q),h.props=o,h.state=Q,h.context=R,o=J):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),o=!1)}return h=o,bl(e,n),o=(n.flags&128)!==0,h||o?(h=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&o?(n.child=Ls(n,e.child,null,u),n.child=Ls(n,null,a,u)):Dt(e,n,a,u),n.memoizedState=h.state,e=n.child):e=pr(e,n,u),e}function dp(e,n,a,o){return Ns(),n.flags|=256,Dt(e,n,a,o),n.child}var zf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function If(e){return{baseLanes:e,cachePool:n0()}}function $f(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=ln),e}function mp(e,n,a){var o=n.pendingProps,u=!1,h=(n.flags&128)!==0,_;if((_=h)||(_=e!==null&&e.memoizedState===null?!1:(bt.current&2)!==0),_&&(u=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ue){if(u?Fr(n):Vr(),(e=at)?(e=wy(e,Tn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ur!==null?{id:Kn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=Ym(e),a.return=n,n.child=a,Mt=n,at=null)):e=null,e===null)throw zr(n);return Eh(e)?n.lanes=32:n.lanes=536870912,null}var E=o.children;return o=o.fallback,u?(Vr(),u=n.mode,E=vl({mode:"hidden",children:E},u),o=ks(o,u,a,null),E.return=n,o.return=n,E.sibling=o,n.child=E,o=n.child,o.memoizedState=If(a),o.childLanes=$f(e,_,a),n.memoizedState=zf,Na(null,o)):(Fr(n),Hf(n,E))}var R=e.memoizedState;if(R!==null&&(E=R.dehydrated,E!==null)){if(h)n.flags&256?(Fr(n),n.flags&=-257,n=Gf(e,n,a)):n.memoizedState!==null?(Vr(),n.child=e.child,n.flags|=128,n=null):(Vr(),E=o.fallback,u=n.mode,o=vl({mode:"visible",children:o.children},u),E=ks(E,u,a,null),E.flags|=2,o.return=n,E.return=n,o.sibling=E,n.child=o,Ls(n,e.child,null,a),o=n.child,o.memoizedState=If(a),o.childLanes=$f(e,_,a),n.memoizedState=zf,n=Na(null,o));else if(Fr(n),Eh(E)){if(_=E.nextSibling&&E.nextSibling.dataset,_)var H=_.dgst;_=H,o=Error(i(419)),o.stack="",o.digest=_,ba({value:o,source:null,stack:null}),n=Gf(e,n,a)}else if(St||mi(e,n,a,!1),_=(a&e.childLanes)!==0,St||_){if(_=rt,_!==null&&(o=Lr(_,a),o!==0&&o!==R.retryLane))throw R.retryLane=o,Ts(e,o),Zt(_,e,o),Uf;Sh(E)||Tl(),n=Gf(e,n,a)}else Sh(E)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,at=Nn(E.nextSibling),Mt=n,Ue=!0,Pr=null,Tn=!1,e!==null&&Xm(n,e),n=Hf(n,o.children),n.flags|=4096);return n}return u?(Vr(),E=o.fallback,u=n.mode,R=e.child,H=R.sibling,o=cr(R,{mode:"hidden",children:o.children}),o.subtreeFlags=R.subtreeFlags&65011712,H!==null?E=cr(H,E):(E=ks(E,u,a,null),E.flags|=2),E.return=n,o.return=n,o.sibling=E,n.child=o,Na(null,o),o=n.child,E=e.child.memoizedState,E===null?E=If(a):(u=E.cachePool,u!==null?(R=_t._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=n0(),E={baseLanes:E.baseLanes|a,cachePool:u}),o.memoizedState=E,o.childLanes=$f(e,_,a),n.memoizedState=zf,Na(e.child,o)):(Fr(n),a=e.child,e=a.sibling,a=cr(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=a,n.memoizedState=null,a)}function Hf(e,n){return n=vl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function vl(e,n){return e=rn(22,e,null,n),e.lanes=0,e}function Gf(e,n,a){return Ls(n,e.child,null,a),e=Hf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function pp(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),sf(e.return,n,a)}function Ff(e,n,a,o,u,h){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:h}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=o,_.tail=a,_.tailMode=u,_.treeForkCount=h)}function yp(e,n,a){var o=n.pendingProps,u=o.revealOrder,h=o.tail;o=o.children;var _=bt.current,E=(_&2)!==0;if(E?(_=_&1|2,n.flags|=128):_&=1,ke(bt,_),Dt(e,n,o,a),o=Ue?ga:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&pp(e,a,n);else if(e.tag===19)pp(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=n.child,u=null;a!==null;)e=a.alternate,e!==null&&ol(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=n.child,n.child=null):(u=a.sibling,a.sibling=null),Ff(n,!1,u,a,h,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&ol(e)===null){n.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}Ff(n,!0,a,null,h,o);break;case"together":Ff(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function pr(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Qr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(mi(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,a=cr(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=cr(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Vf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Wo(e)))}function h_(e,n,a){switch(n.tag){case 3:yt(n,n.stateNode.containerInfo),Ir(n,_t,e.memoizedState.cache),Ns();break;case 27:case 5:Lt(n);break;case 4:yt(n,n.stateNode.containerInfo);break;case 10:Ir(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,gf(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Fr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?mp(e,n,a):(Fr(n),e=pr(e,n,a),e!==null?e.sibling:null);Fr(n);break;case 19:var u=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(mi(e,n,a,!1),o=(a&n.childLanes)!==0),u){if(o)return yp(e,n,a);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ke(bt,bt.current),o)break;return null;case 22:return n.lanes=0,lp(e,n,a,n.pendingProps);case 24:Ir(n,_t,e.memoizedState.cache)}return pr(e,n,a)}function gp(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)St=!0;else{if(!Vf(e,a)&&(n.flags&128)===0)return St=!1,h_(e,n,a);St=(e.flags&131072)!==0}else St=!1,Ue&&(n.flags&1048576)!==0&&Qm(n,ga,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=Ds(n.elementType),n.type=e,typeof e=="function")Xu(e)?(o=Us(e,o),n.tag=1,n=hp(null,n,e,o,a)):(n.tag=0,n=Pf(null,n,e,o,a));else{if(e!=null){var u=e.$$typeof;if(u===fe){n.tag=11,n=ip(null,n,e,o,a);break e}else if(u===re){n.tag=14,n=ap(null,n,e,o,a);break e}}throw n=ve(e)||e,Error(i(306,n,""))}}return n;case 0:return Pf(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,u=Us(o,n.pendingProps),hp(e,n,o,u,a);case 3:e:{if(yt(n,n.stateNode.containerInfo),e===null)throw Error(i(387));o=n.pendingProps;var h=n.memoizedState;u=h.element,hf(e,n),Oa(n,o,null,a);var _=n.memoizedState;if(o=_.cache,Ir(n,_t,o),o!==h.cache&&af(n,[_t],a,!0),Ea(),o=_.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=dp(e,n,o,a);break e}else if(o!==u){u=On(Error(i(424)),n),ba(u),n=dp(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(at=Nn(e.firstChild),Mt=n,Ue=!0,Pr=null,Tn=!0,a=l0(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ns(),o===u){n=pr(e,n,a);break e}Dt(e,n,o,a)}n=n.child}return n;case 26:return bl(e,n),e===null?(a=Ty(n.type,null,n.pendingProps,null))?n.memoizedState=a:Ue||(a=n.type,e=n.pendingProps,o=ql(Ie.current).createElement(a),o[nt]=n,o[ht]=e,qt(o,a,e),D(o),n.stateNode=o):n.memoizedState=Ty(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Lt(n),e===null&&Ue&&(o=n.stateNode=Oy(n.type,n.pendingProps,Ie.current),Mt=n,Tn=!0,u=at,es(n.type)?(Oh=u,at=Nn(o.firstChild)):at=u),Dt(e,n,n.pendingProps.children,a),bl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ue&&((u=o=at)&&(o=$_(o,n.type,n.pendingProps,Tn),o!==null?(n.stateNode=o,Mt=n,at=Nn(o.firstChild),Tn=!1,u=!0):u=!1),u||zr(n)),Lt(n),u=n.type,h=n.pendingProps,_=e!==null?e.memoizedProps:null,o=h.children,xh(u,h)?o=null:_!==null&&xh(u,_)&&(n.flags|=32),n.memoizedState!==null&&(u=vf(e,n,r_,null,null,a),Fa._currentValue=u),bl(e,n),Dt(e,n,o,a),n.child;case 6:return e===null&&Ue&&((e=a=at)&&(a=H_(a,n.pendingProps,Tn),a!==null?(n.stateNode=a,Mt=n,at=null,e=!0):e=!1),e||zr(n)),null;case 13:return mp(e,n,a);case 4:return yt(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Ls(n,null,o,a):Dt(e,n,o,a),n.child;case 11:return ip(e,n,n.type,n.pendingProps,a);case 7:return Dt(e,n,n.pendingProps,a),n.child;case 8:return Dt(e,n,n.pendingProps.children,a),n.child;case 12:return Dt(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,Ir(n,n.type,o.value),Dt(e,n,o.children,a),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Ms(n),u=Rt(u),o=o(u),n.flags|=1,Dt(e,n,o,a),n.child;case 14:return ap(e,n,n.type,n.pendingProps,a);case 15:return op(e,n,n.type,n.pendingProps,a);case 19:return yp(e,n,a);case 31:return f_(e,n,a);case 22:return lp(e,n,a,n.pendingProps);case 24:return Ms(n),o=Rt(_t),e===null?(u=cf(),u===null&&(u=rt,h=of(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=a),u=h),n.memoizedState={parent:o,cache:u},ff(n),Ir(n,_t,u)):((e.lanes&a)!==0&&(hf(e,n),Oa(n,null,null,a),Ea()),u=e.memoizedState,h=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),Ir(n,_t,o)):(o=h.cache,Ir(n,_t,o),o!==u.cache&&af(n,[_t],a,!0))),Dt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function yr(e){e.flags|=4}function Yf(e,n,a,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Gp())e.flags|=8192;else throw qs=rl,uf}else e.flags&=-16777217}function bp(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ry(n))if(Gp())e.flags|=8192;else throw qs=rl,uf}function xl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ei():536870912,e.lanes|=n,Ai|=n)}function Ca(e,n){if(!Ue)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function ot(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function d_(e,n,a){var o=n.pendingProps;switch(ef(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ot(n),null;case 1:return ot(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),hr(_t),je(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(di(n)?yr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,nf())),ot(n),null;case 26:var u=n.type,h=n.memoizedState;return e===null?(yr(n),h!==null?(ot(n),bp(n,h)):(ot(n),Yf(n,u,null,o,a))):h?h!==e.memoizedState?(yr(n),ot(n),bp(n,h)):(ot(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&yr(n),ot(n),Yf(n,u,e,o,a)),null;case 27:if(gs(n),a=Ie.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&yr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return ot(n),null}e=et.current,di(n)?Jm(n):(e=Oy(u,o,a),n.stateNode=e,yr(n))}return ot(n),null;case 5:if(gs(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&yr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return ot(n),null}if(h=et.current,di(n))Jm(n);else{var _=ql(Ie.current);switch(h){case 1:h=_.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=_.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=_.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?_.createElement("select",{is:o.is}):_.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?_.createElement(u,{is:o.is}):_.createElement(u)}}h[nt]=n,h[ht]=o;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)h.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=h;e:switch(qt(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&yr(n)}}return ot(n),Yf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&yr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ie.current,di(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,u=Mt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[nt]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||my(e.nodeValue,a)),e||zr(n,!0)}else e=ql(e).createTextNode(o),e[nt]=n,n.stateNode=e}return ot(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=di(n),a!==null){if(e===null){if(!o)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[nt]=n}else Ns(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ot(n),e=!1}else a=nf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(an(n),n):(an(n),null);if((n.flags&128)!==0)throw Error(i(558))}return ot(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=di(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(i(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));u[nt]=n}else Ns(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ot(n),u=!1}else u=nf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(an(n),n):(an(n),null)}return an(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),xl(n,n.updateQueue),ot(n),null);case 4:return je(),e===null&&ph(n.stateNode.containerInfo),ot(n),null;case 10:return hr(n.type),ot(n),null;case 19:if(Ae(bt),o=n.memoizedState,o===null)return ot(n),null;if(u=(n.flags&128)!==0,h=o.rendering,h===null)if(u)Ca(o,!1);else{if(mt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=ol(e),h!==null){for(n.flags|=128,Ca(o,!1),e=h.updateQueue,n.updateQueue=e,xl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Vm(a,e),a=a.sibling;return ke(bt,bt.current&1|2),Ue&&ur(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&lt()>Ol&&(n.flags|=128,u=!0,Ca(o,!1),n.lanes=4194304)}else{if(!u)if(e=ol(h),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,xl(n,e),Ca(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!Ue)return ot(n),null}else 2*lt()-o.renderingStartTime>Ol&&a!==536870912&&(n.flags|=128,u=!0,Ca(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(e=o.last,e!==null?e.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=lt(),e.sibling=null,a=bt.current,ke(bt,u?a&1|2:a&1),Ue&&ur(n,o.treeForkCount),e):(ot(n),null);case 22:case 23:return an(n),yf(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(ot(n),n.subtreeFlags&6&&(n.flags|=8192)):ot(n),a=n.updateQueue,a!==null&&xl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&Ae(Rs),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),hr(_t),ot(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function m_(e,n){switch(ef(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return hr(_t),je(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return gs(n),null;case 31:if(n.memoizedState!==null){if(an(n),n.alternate===null)throw Error(i(340));Ns()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(an(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Ns()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Ae(bt),null;case 4:return je(),null;case 10:return hr(n.type),null;case 22:case 23:return an(n),yf(),e!==null&&Ae(Rs),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return hr(_t),null;case 25:return null;default:return null}}function vp(e,n){switch(ef(n),n.tag){case 3:hr(_t),je();break;case 26:case 27:case 5:gs(n);break;case 4:je();break;case 31:n.memoizedState!==null&&an(n);break;case 13:an(n);break;case 19:Ae(bt);break;case 10:hr(n.type);break;case 22:case 23:an(n),yf(),e!==null&&Ae(Rs);break;case 24:hr(_t)}}function Ma(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&e)===e){o=void 0;var h=a.create,_=a.inst;o=h(),_.destroy=o}a=a.next}while(a!==u)}}catch(E){Ke(n,n.return,E)}}function Yr(e,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&e)===e){var _=o.inst,E=_.destroy;if(E!==void 0){_.destroy=void 0,u=n;var R=a,H=E;try{H()}catch(J){Ke(u,R,J)}}}o=o.next}while(o!==h)}}catch(J){Ke(n,n.return,J)}}function xp(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{u0(n,a)}catch(o){Ke(e,e.return,o)}}}function _p(e,n,a){a.props=Us(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ke(e,n,o)}}function Ra(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(u){Ke(e,n,u)}}function Xn(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Ke(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Ke(e,n,u)}else a.current=null}function wp(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Ke(e,e.return,u)}}function Kf(e,n,a){try{var o=e.stateNode;L_(o,e.type,a,n),o[ht]=n}catch(u){Ke(e,e.return,u)}}function Sp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&es(e.type)||e.tag===4}function Qf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Sp(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&&es(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 Xf(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=or));else if(o!==4&&(o===27&&es(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Xf(e,n,a),e=e.sibling;e!==null;)Xf(e,n,a),e=e.sibling}function _l(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&es(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(_l(e,n,a),e=e.sibling;e!==null;)_l(e,n,a),e=e.sibling}function Ep(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);qt(n,o,a),n[nt]=e,n[ht]=a}catch(h){Ke(e,e.return,h)}}var gr=!1,Et=!1,Jf=!1,Op=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function p_(e,n){if(e=e.containerInfo,bh=$l,e=Bm(e),Hu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var u=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var _=0,E=-1,R=-1,H=0,J=0,ne=e,G=null;t:for(;;){for(var Q;ne!==a||u!==0&&ne.nodeType!==3||(E=_+u),ne!==h||o!==0&&ne.nodeType!==3||(R=_+o),ne.nodeType===3&&(_+=ne.nodeValue.length),(Q=ne.firstChild)!==null;)G=ne,ne=Q;for(;;){if(ne===e)break t;if(G===a&&++H===u&&(E=_),G===h&&++J===o&&(R=_),(Q=ne.nextSibling)!==null)break;ne=G,G=ne.parentNode}ne=Q}a=E===-1||R===-1?null:{start:E,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(vh={focusedElem:e,selectionRange:a},$l=!1,Tt=n;Tt!==null;)if(n=Tt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Tt=e;else for(;Tt!==null;){switch(n=Tt,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,u=h.memoizedProps,h=h.memoizedState,o=a.stateNode;try{var ye=Us(a.type,u);e=o.getSnapshotBeforeUpdate(ye,h),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){Ke(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)wh(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":wh(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(i(163))}if(e=n.sibling,e!==null){e.return=n.return,Tt=e;break}Tt=n.return}}function Ap(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:vr(e,a),o&4&&Ma(5,a);break;case 1:if(vr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(_){Ke(a,a.return,_)}else{var u=Us(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){Ke(a,a.return,_)}}o&64&&xp(a),o&512&&Ra(a,a.return);break;case 3:if(vr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{u0(e,n)}catch(_){Ke(a,a.return,_)}}break;case 27:n===null&&o&4&&Ep(a);case 26:case 5:vr(e,a),n===null&&o&4&&wp(a),o&512&&Ra(a,a.return);break;case 12:vr(e,a);break;case 31:vr(e,a),o&4&&kp(e,a);break;case 13:vr(e,a),o&4&&Np(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=E_.bind(null,a),G_(e,a))));break;case 22:if(o=a.memoizedState!==null||gr,!o){n=n!==null&&n.memoizedState!==null||Et,u=gr;var h=Et;gr=o,(Et=n)&&!h?xr(e,a,(a.subtreeFlags&8772)!==0):vr(e,a),gr=u,Et=h}break;case 30:break;default:vr(e,a)}}function jp(e){var n=e.alternate;n!==null&&(e.alternate=null,jp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&ti(n)),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 ct=null,Kt=!1;function br(e,n,a){for(a=a.child;a!==null;)Tp(e,n,a),a=a.sibling}function Tp(e,n,a){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(vs,a)}catch{}switch(a.tag){case 26:Et||Xn(a,n),br(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Et||Xn(a,n);var o=ct,u=Kt;es(a.type)&&(ct=a.stateNode,Kt=!1),br(e,n,a),$a(a.stateNode),ct=o,Kt=u;break;case 5:Et||Xn(a,n);case 6:if(o=ct,u=Kt,ct=null,br(e,n,a),ct=o,Kt=u,ct!==null)if(Kt)try{(ct.nodeType===9?ct.body:ct.nodeName==="HTML"?ct.ownerDocument.body:ct).removeChild(a.stateNode)}catch(h){Ke(a,n,h)}else try{ct.removeChild(a.stateNode)}catch(h){Ke(a,n,h)}break;case 18:ct!==null&&(Kt?(e=ct,xy(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Di(e)):xy(ct,a.stateNode));break;case 4:o=ct,u=Kt,ct=a.stateNode.containerInfo,Kt=!0,br(e,n,a),ct=o,Kt=u;break;case 0:case 11:case 14:case 15:Yr(2,a,n),Et||Yr(4,a,n),br(e,n,a);break;case 1:Et||(Xn(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&_p(a,n,o)),br(e,n,a);break;case 21:br(e,n,a);break;case 22:Et=(o=Et)||a.memoizedState!==null,br(e,n,a),Et=o;break;default:br(e,n,a)}}function kp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Di(e)}catch(a){Ke(n,n.return,a)}}}function Np(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Di(e)}catch(a){Ke(n,n.return,a)}}function y_(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Op),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Op),n;default:throw Error(i(435,e.tag))}}function wl(e,n){var a=y_(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var u=O_.bind(null,e,o);o.then(u,u)}})}function Qt(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o],h=e,_=n,E=_;e:for(;E!==null;){switch(E.tag){case 27:if(es(E.type)){ct=E.stateNode,Kt=!1;break e}break;case 5:ct=E.stateNode,Kt=!1;break e;case 3:case 4:ct=E.stateNode.containerInfo,Kt=!0;break e}E=E.return}if(ct===null)throw Error(i(160));Tp(h,_,u),ct=null,Kt=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Cp(n,e),n=n.sibling}var Pn=null;function Cp(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Qt(n,e),Xt(e),o&4&&(Yr(3,e,e.return),Ma(3,e),Yr(5,e,e.return));break;case 1:Qt(n,e),Xt(e),o&512&&(Et||a===null||Xn(a,a.return)),o&64&&gr&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var u=Pn;if(Qt(n,e),Xt(e),o&512&&(Et||a===null||Xn(a,a.return)),o&4){var h=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":h=u.getElementsByTagName("title")[0],(!h||h[At]||h[nt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(o),u.head.insertBefore(h,u.querySelector("head > title"))),qt(h,o,a),h[nt]=e,D(h),o=h;break e;case"link":var _=Cy("link","href",u).get(o+(a.href||""));if(_){for(var E=0;E<_.length;E++)if(h=_[E],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(E,1);break t}}h=u.createElement(o),qt(h,o,a),u.head.appendChild(h);break;case"meta":if(_=Cy("meta","content",u).get(o+(a.content||""))){for(E=0;E<_.length;E++)if(h=_[E],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(E,1);break t}}h=u.createElement(o),qt(h,o,a),u.head.appendChild(h);break;default:throw Error(i(468,o))}h[nt]=e,D(h),o=h}e.stateNode=o}else My(u,e.type,e.stateNode);else e.stateNode=Ny(u,o,e.memoizedProps);else h!==o?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,o===null?My(u,e.type,e.stateNode):Ny(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Kf(e,e.memoizedProps,a.memoizedProps)}break;case 27:Qt(n,e),Xt(e),o&512&&(Et||a===null||Xn(a,a.return)),a!==null&&o&4&&Kf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Qt(n,e),Xt(e),o&512&&(Et||a===null||Xn(a,a.return)),e.flags&32){u=e.stateNode;try{ri(u,"")}catch(ye){Ke(e,e.return,ye)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,Kf(e,u,a!==null?a.memoizedProps:u)),o&1024&&(Jf=!0);break;case 6:if(Qt(n,e),Xt(e),o&4){if(e.stateNode===null)throw Error(i(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(ye){Ke(e,e.return,ye)}}break;case 3:if(Ul=null,u=Pn,Pn=Ll(n.containerInfo),Qt(n,e),Pn=u,Xt(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Di(n.containerInfo)}catch(ye){Ke(e,e.return,ye)}Jf&&(Jf=!1,Mp(e));break;case 4:o=Pn,Pn=Ll(e.stateNode.containerInfo),Qt(n,e),Xt(e),Pn=o;break;case 12:Qt(n,e),Xt(e);break;case 31:Qt(n,e),Xt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 13:Qt(n,e),Xt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(El=lt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 22:u=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,H=gr,J=Et;if(gr=H||u,Et=J||R,Qt(n,e),Et=J,gr=H,Xt(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(a===null||R||gr||Et||Ps(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,u)_=h.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{E=R.stateNode;var ne=R.memoizedProps.style,G=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;E.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(ye){Ke(R,R.return,ye)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(ye){Ke(R,R.return,ye)}}}else if(n.tag===18){if(a===null){R=n;try{var Q=R.stateNode;u?_y(Q,!0):_y(R.stateNode,!1)}catch(ye){Ke(R,R.return,ye)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,wl(e,a))));break;case 19:Qt(n,e),Xt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 30:break;case 21:break;default:Qt(n,e),Xt(e)}}function Xt(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(Sp(o)){a=o;break}o=o.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var u=a.stateNode,h=Qf(e);_l(e,h,u);break;case 5:var _=a.stateNode;a.flags&32&&(ri(_,""),a.flags&=-33);var E=Qf(e);_l(e,E,_);break;case 3:case 4:var R=a.stateNode.containerInfo,H=Qf(e);Xf(e,H,R);break;default:throw Error(i(161))}}catch(J){Ke(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Mp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Mp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function vr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Ap(e,n.alternate,n),n=n.sibling}function Ps(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Yr(4,n,n.return),Ps(n);break;case 1:Xn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&_p(n,n.return,a),Ps(n);break;case 27:$a(n.stateNode);case 26:case 5:Xn(n,n.return),Ps(n);break;case 22:n.memoizedState===null&&Ps(n);break;case 30:Ps(n);break;default:Ps(n)}e=e.sibling}}function xr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,h=n,_=h.flags;switch(h.tag){case 0:case 11:case 15:xr(u,h,a),Ma(4,h);break;case 1:if(xr(u,h,a),o=h,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(H){Ke(o,o.return,H)}if(o=h,u=o.updateQueue,u!==null){var E=o.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)c0(R[u],E)}catch(H){Ke(o,o.return,H)}}a&&_&64&&xp(h),Ra(h,h.return);break;case 27:Ep(h);case 26:case 5:xr(u,h,a),a&&o===null&&_&4&&wp(h),Ra(h,h.return);break;case 12:xr(u,h,a);break;case 31:xr(u,h,a),a&&_&4&&kp(u,h);break;case 13:xr(u,h,a),a&&_&4&&Np(u,h);break;case 22:h.memoizedState===null&&xr(u,h,a),Ra(h,h.return);break;case 30:break;default:xr(u,h,a)}n=n.sibling}}function Zf(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&va(a))}function Wf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&va(e))}function zn(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Rp(e,n,a,o),n=n.sibling}function Rp(e,n,a,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:zn(e,n,a,o),u&2048&&Ma(9,n);break;case 1:zn(e,n,a,o);break;case 3:zn(e,n,a,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&va(e)));break;case 12:if(u&2048){zn(e,n,a,o),e=n.stateNode;try{var h=n.memoizedProps,_=h.id,E=h.onPostCommit;typeof E=="function"&&E(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Ke(n,n.return,R)}}else zn(e,n,a,o);break;case 31:zn(e,n,a,o);break;case 13:zn(e,n,a,o);break;case 23:break;case 22:h=n.stateNode,_=n.alternate,n.memoizedState!==null?h._visibility&2?zn(e,n,a,o):Da(e,n):h._visibility&2?zn(e,n,a,o):(h._visibility|=2,Si(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&Zf(_,n);break;case 24:zn(e,n,a,o),u&2048&&Wf(n.alternate,n);break;default:zn(e,n,a,o)}}function Si(e,n,a,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,_=n,E=a,R=o,H=_.flags;switch(_.tag){case 0:case 11:case 15:Si(h,_,E,R,u),Ma(8,_);break;case 23:break;case 22:var J=_.stateNode;_.memoizedState!==null?J._visibility&2?Si(h,_,E,R,u):Da(h,_):(J._visibility|=2,Si(h,_,E,R,u)),u&&H&2048&&Zf(_.alternate,_);break;case 24:Si(h,_,E,R,u),u&&H&2048&&Wf(_.alternate,_);break;default:Si(h,_,E,R,u)}n=n.sibling}}function Da(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,u=o.flags;switch(o.tag){case 22:Da(a,o),u&2048&&Zf(o.alternate,o);break;case 24:Da(a,o),u&2048&&Wf(o.alternate,o);break;default:Da(a,o)}n=n.sibling}}var qa=8192;function Ei(e,n,a){if(e.subtreeFlags&qa)for(e=e.child;e!==null;)Dp(e,n,a),e=e.sibling}function Dp(e,n,a){switch(e.tag){case 26:Ei(e,n,a),e.flags&qa&&e.memoizedState!==null&&nw(a,Pn,e.memoizedState,e.memoizedProps);break;case 5:Ei(e,n,a);break;case 3:case 4:var o=Pn;Pn=Ll(e.stateNode.containerInfo),Ei(e,n,a),Pn=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=qa,qa=16777216,Ei(e,n,a),qa=o):Ei(e,n,a));break;default:Ei(e,n,a)}}function qp(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function La(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Tt=o,Bp(o,e)}qp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lp(e),e=e.sibling}function Lp(e){switch(e.tag){case 0:case 11:case 15:La(e),e.flags&2048&&Yr(9,e,e.return);break;case 3:La(e);break;case 12:La(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Sl(e)):La(e);break;default:La(e)}}function Sl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Tt=o,Bp(o,e)}qp(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Yr(8,n,n.return),Sl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Sl(n));break;default:Sl(n)}e=e.sibling}}function Bp(e,n){for(;Tt!==null;){var a=Tt;switch(a.tag){case 0:case 11:case 15:Yr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:va(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Tt=o;else e:for(a=e;Tt!==null;){o=Tt;var u=o.sibling,h=o.return;if(jp(o),o===a){Tt=null;break e}if(u!==null){u.return=h,Tt=u;break e}Tt=h}}}var g_={getCacheForType:function(e){var n=Rt(_t),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Rt(_t).controller.signal}},b_=typeof WeakMap=="function"?WeakMap:Map,Fe=0,rt=null,De=null,Le=0,Ye=0,on=null,Kr=!1,Oi=!1,eh=!1,_r=0,mt=0,Qr=0,zs=0,th=0,ln=0,Ai=0,Ba=null,Jt=null,nh=!1,El=0,Up=0,Ol=1/0,Al=null,Xr=null,jt=0,Jr=null,ji=null,wr=0,rh=0,sh=null,Pp=null,Ua=0,ih=null;function cn(){return(Fe&2)!==0&&Le!==0?Le&-Le:Y.T!==null?fh():aa()}function zp(){if(ln===0)if((Le&536870912)===0||Ue){var e=sr;sr<<=1,(sr&3932160)===0&&(sr=262144),ln=e}else ln=536870912;return e=sn.current,e!==null&&(e.flags|=32),ln}function Zt(e,n,a){(e===rt&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)&&(Ti(e,0),Zr(e,Le,ln,!1)),Ln(e,a),((Fe&2)===0||e!==rt)&&(e===rt&&((Fe&2)===0&&(zs|=a),mt===4&&Zr(e,Le,ln,!1)),Jn(e))}function Ip(e,n,a){if((Fe&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||_s(e,n),u=o?__(e,n):oh(e,n,!0),h=o;do{if(u===0){Oi&&!o&&Zr(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!v_(a)){u=oh(e,n,!1),h=!1;continue}if(u===2){if(h=n,e.errorRecoveryDisabledLanes&h)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var E=e;u=Ba;var R=E.current.memoizedState.isDehydrated;if(R&&(Ti(E,_).flags|=256),_=oh(E,_,!1),_!==2){if(eh&&!R){E.errorRecoveryDisabledLanes|=h,zs|=h,u=4;break e}h=Jt,Jt=u,h!==null&&(Jt===null?Jt=h:Jt.push.apply(Jt,h))}u=_}if(h=!1,u!==2)continue}}if(u===1){Ti(e,0),Zr(e,n,0,!0);break}e:{switch(o=e,h=u,h){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Zr(o,n,ln,!Kr);break e;case 2:Jt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(u=El+300-lt(),10<u)){if(Zr(o,n,ln,!Kr),xs(o,0,!0)!==0)break e;wr=n,o.timeoutHandle=by($p.bind(null,o,a,Jt,Al,nh,n,ln,zs,Ai,Kr,h,"Throttled",-0,0),u);break e}$p(o,a,Jt,Al,nh,n,ln,zs,Ai,Kr,h,null,-0,0)}}break}while(!0);Jn(e)}function $p(e,n,a,o,u,h,_,E,R,H,J,ne,G,Q){if(e.timeoutHandle=-1,ne=n.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:or},Dp(n,h,ne);var ye=(h&62914560)===h?El-lt():(h&4194048)===h?Up-lt():0;if(ye=rw(ne,ye),ye!==null){wr=h,e.cancelPendingCommit=ye(Xp.bind(null,e,n,h,a,o,u,_,E,R,J,ne,null,G,Q)),Zr(e,h,_,!H);return}}Xp(e,n,h,a,o,u,_,E,R)}function v_(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],h=u.getSnapshot;u=u.value;try{if(!nn(h(),u))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Zr(e,n,a,o){n&=~th,n&=~zs,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var h=31-Bt(u),_=1<<h;o[h]=-1,u&=~_}a!==0&&qr(e,a,n)}function jl(){return(Fe&6)===0?(Pa(0),!1):!0}function ah(){if(De!==null){if(Ye===0)var e=De.return;else e=De,fr=Cs=null,wf(e),bi=null,_a=0,e=De;for(;e!==null;)vp(e.alternate,e),e=e.return;De=null}}function Ti(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,P_(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),wr=0,ah(),rt=e,De=a=cr(e.current,null),Le=n,Ye=0,on=null,Kr=!1,Oi=_s(e,n),eh=!1,Ai=ln=th=zs=Qr=mt=0,Jt=Ba=null,nh=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Bt(o),h=1<<u;n|=e[u],o&=~h}return _r=n,Ko(),a}function Hp(e,n){Ce=null,Y.H=ka,n===gi||n===nl?(n=i0(),Ye=3):n===uf?(n=i0(),Ye=4):Ye=n===Uf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,on=n,De===null&&(mt=1,yl(e,On(n,e.current)))}function Gp(){var e=sn.current;return e===null?!0:(Le&4194048)===Le?kn===null:(Le&62914560)===Le||(Le&536870912)!==0?e===kn:!1}function Fp(){var e=Y.H;return Y.H=ka,e===null?ka:e}function Vp(){var e=Y.A;return Y.A=g_,e}function Tl(){mt=4,Kr||(Le&4194048)!==Le&&sn.current!==null||(Oi=!0),(Qr&134217727)===0&&(zs&134217727)===0||rt===null||Zr(rt,Le,ln,!1)}function oh(e,n,a){var o=Fe;Fe|=2;var u=Fp(),h=Vp();(rt!==e||Le!==n)&&(Al=null,Ti(e,n)),n=!1;var _=mt;e:do try{if(Ye!==0&&De!==null){var E=De,R=on;switch(Ye){case 8:ah(),_=6;break e;case 3:case 2:case 9:case 6:sn.current===null&&(n=!0);var H=Ye;if(Ye=0,on=null,ki(e,E,R,H),a&&Oi){_=0;break e}break;default:H=Ye,Ye=0,on=null,ki(e,E,R,H)}}x_(),_=mt;break}catch(J){Hp(e,J)}while(!0);return n&&e.shellSuspendCounter++,fr=Cs=null,Fe=o,Y.H=u,Y.A=h,De===null&&(rt=null,Le=0,Ko()),_}function x_(){for(;De!==null;)Yp(De)}function __(e,n){var a=Fe;Fe|=2;var o=Fp(),u=Vp();rt!==e||Le!==n?(Al=null,Ol=lt()+500,Ti(e,n)):Oi=_s(e,n);e:do try{if(Ye!==0&&De!==null){n=De;var h=on;t:switch(Ye){case 1:Ye=0,on=null,ki(e,n,h,1);break;case 2:case 9:if(r0(h)){Ye=0,on=null,Kp(n);break}n=function(){Ye!==2&&Ye!==9||rt!==e||(Ye=7),Jn(e)},h.then(n,n);break e;case 3:Ye=7;break e;case 4:Ye=5;break e;case 7:r0(h)?(Ye=0,on=null,Kp(n)):(Ye=0,on=null,ki(e,n,h,7));break;case 5:var _=null;switch(De.tag){case 26:_=De.memoizedState;case 5:case 27:var E=De;if(_?Ry(_):E.stateNode.complete){Ye=0,on=null;var R=E.sibling;if(R!==null)De=R;else{var H=E.return;H!==null?(De=H,kl(H)):De=null}break t}}Ye=0,on=null,ki(e,n,h,5);break;case 6:Ye=0,on=null,ki(e,n,h,6);break;case 8:ah(),mt=6;break e;default:throw Error(i(462))}}w_();break}catch(J){Hp(e,J)}while(!0);return fr=Cs=null,Y.H=o,Y.A=u,Fe=a,De!==null?0:(rt=null,Le=0,Ko(),mt)}function w_(){for(;De!==null&&!Co();)Yp(De)}function Yp(e){var n=gp(e.alternate,e,_r);e.memoizedProps=e.pendingProps,n===null?kl(e):De=n}function Kp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=fp(a,n,n.pendingProps,n.type,void 0,Le);break;case 11:n=fp(a,n,n.pendingProps,n.type.render,n.ref,Le);break;case 5:wf(n);default:vp(a,n),n=De=Vm(n,_r),n=gp(a,n,_r)}e.memoizedProps=e.pendingProps,n===null?kl(e):De=n}function ki(e,n,a,o){fr=Cs=null,wf(n),bi=null,_a=0;var u=n.return;try{if(u_(e,u,n,a,Le)){mt=1,yl(e,On(a,e.current)),De=null;return}}catch(h){if(u!==null)throw De=u,h;mt=1,yl(e,On(a,e.current)),De=null;return}n.flags&32768?(Ue||o===1?e=!0:Oi||(Le&536870912)!==0?e=!1:(Kr=e=!0,(o===2||o===9||o===3||o===6)&&(o=sn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Qp(n,e)):kl(n)}function kl(e){var n=e;do{if((n.flags&32768)!==0){Qp(n,Kr);return}e=n.return;var a=d_(n.alternate,n,_r);if(a!==null){De=a;return}if(n=n.sibling,n!==null){De=n;return}De=n=e}while(n!==null);mt===0&&(mt=5)}function Qp(e,n){do{var a=m_(e.alternate,e);if(a!==null){a.flags&=32767,De=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){De=e;return}De=e=a}while(e!==null);mt=6,De=null}function Xp(e,n,a,o,u,h,_,E,R){e.cancelPendingCommit=null;do Nl();while(jt!==0);if((Fe&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(h=n.lanes|n.childLanes,h|=Ku,Dr(e,a,h,_,E,R),e===rt&&(De=rt=null,Le=0),ji=n,Jr=e,wr=a,rh=h,sh=u,Pp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,A_(Zs,function(){return ty(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=Y.T,Y.T=null,u=ae.p,ae.p=2,_=Fe,Fe|=4;try{p_(e,n,a)}finally{Fe=_,ae.p=u,Y.T=o}}jt=1,Jp(),Zp(),Wp()}}function Jp(){if(jt===1){jt=0;var e=Jr,n=ji,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var o=ae.p;ae.p=2;var u=Fe;Fe|=4;try{Cp(n,e);var h=vh,_=Bm(e.containerInfo),E=h.focusedElem,R=h.selectionRange;if(_!==E&&E&&E.ownerDocument&&Lm(E.ownerDocument.documentElement,E)){if(R!==null&&Hu(E)){var H=R.start,J=R.end;if(J===void 0&&(J=H),"selectionStart"in E)E.selectionStart=H,E.selectionEnd=Math.min(J,E.value.length);else{var ne=E.ownerDocument||document,G=ne&&ne.defaultView||window;if(G.getSelection){var Q=G.getSelection(),ye=E.textContent.length,Ee=Math.min(R.start,ye),Ze=R.end===void 0?Ee:Math.min(R.end,ye);!Q.extend&&Ee>Ze&&(_=Ze,Ze=Ee,Ee=_);var z=qm(E,Ee),q=qm(E,Ze);if(z&&q&&(Q.rangeCount!==1||Q.anchorNode!==z.node||Q.anchorOffset!==z.offset||Q.focusNode!==q.node||Q.focusOffset!==q.offset)){var $=ne.createRange();$.setStart(z.node,z.offset),Q.removeAllRanges(),Ee>Ze?(Q.addRange($),Q.extend(q.node,q.offset)):($.setEnd(q.node,q.offset),Q.addRange($))}}}}for(ne=[],Q=E;Q=Q.parentNode;)Q.nodeType===1&&ne.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ne.length;E++){var Z=ne[E];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}$l=!!bh,vh=bh=null}finally{Fe=u,ae.p=o,Y.T=a}}e.current=n,jt=2}}function Zp(){if(jt===2){jt=0;var e=Jr,n=ji,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var o=ae.p;ae.p=2;var u=Fe;Fe|=4;try{Ap(e,n.alternate,n)}finally{Fe=u,ae.p=o,Y.T=a}}jt=3}}function Wp(){if(jt===4||jt===3){jt=0,Js();var e=Jr,n=ji,a=wr,o=Pp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?jt=5:(jt=0,ji=Jr=null,ey(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Xr=null),Ss(a),n=n.stateNode,gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(vs,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Y.T,u=ae.p,ae.p=2,Y.T=null;try{for(var h=e.onRecoverableError,_=0;_<o.length;_++){var E=o[_];h(E.value,{componentStack:E.stack})}}finally{Y.T=n,ae.p=u}}(wr&3)!==0&&Nl(),Jn(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===ih?Ua++:(Ua=0,ih=e):Ua=0,Pa(0)}}function ey(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,va(n)))}function Nl(){return Jp(),Zp(),Wp(),ty()}function ty(){if(jt!==5)return!1;var e=Jr,n=rh;rh=0;var a=Ss(wr),o=Y.T,u=ae.p;try{ae.p=32>a?32:a,Y.T=null,a=sh,sh=null;var h=Jr,_=wr;if(jt=0,ji=Jr=null,wr=0,(Fe&6)!==0)throw Error(i(331));var E=Fe;if(Fe|=4,Lp(h.current),Rp(h,h.current,_,a),Fe=E,Pa(0,!1),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(vs,h)}catch{}return!0}finally{ae.p=u,Y.T=o,ey(e,n)}}function ny(e,n,a){n=On(a,n),n=Bf(e.stateNode,n,2),e=Gr(e,n,2),e!==null&&(Ln(e,2),Jn(e))}function Ke(e,n,a){if(e.tag===3)ny(e,e,a);else for(;n!==null;){if(n.tag===3){ny(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Xr===null||!Xr.has(o))){e=On(a,e),a=rp(2),o=Gr(n,a,2),o!==null&&(sp(a,o,n,e),Ln(o,2),Jn(o));break}}n=n.return}}function lh(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new b_;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(eh=!0,u.add(a),e=S_.bind(null,e,n,a),n.then(e,e))}function S_(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,rt===e&&(Le&a)===a&&(mt===4||mt===3&&(Le&62914560)===Le&&300>lt()-El?(Fe&2)===0&&Ti(e,0):th|=a,Ai===Le&&(Ai=0)),Jn(e)}function ry(e,n){n===0&&(n=ei()),e=Ts(e,n),e!==null&&(Ln(e,n),Jn(e))}function E_(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),ry(e,a)}function O_(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),ry(e,a)}function A_(e,n){return na(e,n)}var Cl=null,Ni=null,ch=!1,Ml=!1,uh=!1,Wr=0;function Jn(e){e!==Ni&&e.next===null&&(Ni===null?Cl=Ni=e:Ni=Ni.next=e),Ml=!0,ch||(ch=!0,T_())}function Pa(e,n){if(!uh&&Ml){uh=!0;do for(var a=!1,o=Cl;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var _=o.suspendedLanes,E=o.pingedLanes;h=(1<<31-Bt(42|e)+1)-1,h&=u&~(_&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,oy(o,h))}else h=Le,h=xs(o,o===rt?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||_s(o,h)||(a=!0,oy(o,h));o=o.next}while(a);uh=!1}}function j_(){sy()}function sy(){Ml=ch=!1;var e=0;Wr!==0&&U_()&&(e=Wr);for(var n=lt(),a=null,o=Cl;o!==null;){var u=o.next,h=iy(o,n);h===0?(o.next=null,a===null?Cl=u:a.next=u,u===null&&(Ni=a)):(a=o,(e!==0||(h&3)!==0)&&(Ml=!0)),o=u}jt!==0&&jt!==5||Pa(e),Wr!==0&&(Wr=0)}function iy(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var _=31-Bt(h),E=1<<_,R=u[_];R===-1?((E&a)===0||(E&o)!==0)&&(u[_]=ia(E,n)):R<=n&&(e.expiredLanes|=E),h&=~E}if(n=rt,a=Le,a=xs(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&rr(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||_s(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&rr(o),Ss(a)){case 2:case 8:a=Ro;break;case 32:a=Zs;break;case 268435456:a=Do;break;default:a=Zs}return o=ay.bind(null,e),a=na(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&rr(o),e.callbackPriority=2,e.callbackNode=null,2}function ay(e,n){if(jt!==0&&jt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Nl()&&e.callbackNode!==a)return null;var o=Le;return o=xs(e,e===rt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Ip(e,o,n),iy(e,lt()),e.callbackNode!=null&&e.callbackNode===a?ay.bind(null,e):null)}function oy(e,n){if(Nl())return null;Ip(e,n,!0)}function T_(){z_(function(){(Fe&6)!==0?na(Mo,j_):sy()})}function fh(){if(Wr===0){var e=pi;e===0&&(e=Cr,Cr<<=1,(Cr&261888)===0&&(Cr=256)),Wr=e}return Wr}function ly(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:zo(""+e)}function cy(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function k_(e,n,a,o,u){if(n==="submit"&&a&&a.stateNode===u){var h=ly((u[ht]||null).action),_=o.submitter;_&&(n=(n=_[ht]||null)?ly(n.formAction):_.getAttribute("formAction"),n!==null&&(h=n,_=null));var E=new Go("action","action",null,o,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Wr!==0){var R=_?cy(u,_):new FormData(u);Cf(a,{pending:!0,data:R,method:u.method,action:h},null,R)}}else typeof h=="function"&&(E.preventDefault(),R=_?cy(u,_):new FormData(u),Cf(a,{pending:!0,data:R,method:u.method,action:h},h,R))},currentTarget:u}]})}}for(var hh=0;hh<Yu.length;hh++){var dh=Yu[hh],N_=dh.toLowerCase(),C_=dh[0].toUpperCase()+dh.slice(1);Un(N_,"on"+C_)}Un(zm,"onAnimationEnd"),Un(Im,"onAnimationIteration"),Un($m,"onAnimationStart"),Un("dblclick","onDoubleClick"),Un("focusin","onFocus"),Un("focusout","onBlur"),Un(Yx,"onTransitionRun"),Un(Kx,"onTransitionStart"),Un(Qx,"onTransitionCancel"),Un(Hm,"onTransitionEnd"),V("onMouseEnter",["mouseout","mouseover"]),V("onMouseLeave",["mouseout","mouseover"]),V("onPointerEnter",["pointerout","pointerover"]),V("onPointerLeave",["pointerout","pointerover"]),ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var za="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(" "),M_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(za));function uy(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],u=o.event;o=o.listeners;e:{var h=void 0;if(n)for(var _=o.length-1;0<=_;_--){var E=o[_],R=E.instance,H=E.currentTarget;if(E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){Yo(J)}u.currentTarget=null,h=R}else for(_=0;_<o.length;_++){if(E=o[_],R=E.instance,H=E.currentTarget,E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){Yo(J)}u.currentTarget=null,h=R}}}}function qe(e,n){var a=n[Es];a===void 0&&(a=n[Es]=new Set);var o=e+"__bubble";a.has(o)||(fy(n,e,2,!1),a.add(o))}function mh(e,n,a){var o=0;n&&(o|=4),fy(a,e,o,n)}var Rl="_reactListening"+Math.random().toString(36).slice(2);function ph(e){if(!e[Rl]){e[Rl]=!0,I.forEach(function(a){a!=="selectionchange"&&(M_.has(a)||mh(a,!1,e),mh(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Rl]||(n[Rl]=!0,mh("selectionchange",!1,n))}}function fy(e,n,a,o){switch(zy(n)){case 2:var u=aw;break;case 8:u=ow;break;default:u=Nh}a=u.bind(null,n,a,e),u=void 0,!Du||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,a,{capture:!0,passive:u}):e.addEventListener(n,a,!0):u!==void 0?e.addEventListener(n,a,{passive:u}):e.addEventListener(n,a,!1)}function yh(e,n,a,o,u){var h=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var _=o.tag;if(_===3||_===4){var E=o.stateNode.containerInfo;if(E===u)break;if(_===4)for(_=o.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===u)return;_=_.return}for(;E!==null;){if(_=O(E),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){o=h=_;continue e}E=E.parentNode}}o=o.return}ym(function(){var H=h,J=Mu(a),ne=[];e:{var G=Gm.get(e);if(G!==void 0){var Q=Go,ye=e;switch(e){case"keypress":if($o(a)===0)break e;case"keydown":case"keyup":Q=Ox;break;case"focusin":ye="focus",Q=Uu;break;case"focusout":ye="blur",Q=Uu;break;case"beforeblur":case"afterblur":Q=Uu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=vm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=dx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=Tx;break;case zm:case Im:case $m:Q=yx;break;case Hm:Q=Nx;break;case"scroll":case"scrollend":Q=fx;break;case"wheel":Q=Mx;break;case"copy":case"cut":case"paste":Q=bx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=_m;break;case"toggle":case"beforetoggle":Q=Dx}var Ee=(n&4)!==0,Ze=!Ee&&(e==="scroll"||e==="scrollend"),z=Ee?G!==null?G+"Capture":null:G;Ee=[];for(var q=H,$;q!==null;){var Z=q;if($=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||$===null||z===null||(Z=la(q,z),Z!=null&&Ee.push(Ia(q,Z,$))),Ze)break;q=q.return}0<Ee.length&&(G=new Q(G,ye,null,a,J),ne.push({event:G,listeners:Ee}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",G&&a!==Cu&&(ye=a.relatedTarget||a.fromElement)&&(O(ye)||ye[tn]))break e;if((Q||G)&&(G=J.window===J?J:(G=J.ownerDocument)?G.defaultView||G.parentWindow:window,Q?(ye=a.relatedTarget||a.toElement,Q=H,ye=ye?O(ye):null,ye!==null&&(Ze=c(ye),Ee=ye.tag,ye!==Ze||Ee!==5&&Ee!==27&&Ee!==6)&&(ye=null)):(Q=null,ye=H),Q!==ye)){if(Ee=vm,Z="onMouseLeave",z="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=_m,Z="onPointerLeave",z="onPointerEnter",q="pointer"),Ze=Q==null?G:T(Q),$=ye==null?G:T(ye),G=new Ee(Z,q+"leave",Q,a,J),G.target=Ze,G.relatedTarget=$,Z=null,O(J)===H&&(Ee=new Ee(z,q+"enter",ye,a,J),Ee.target=$,Ee.relatedTarget=Ze,Z=Ee),Ze=Z,Q&&ye)t:{for(Ee=R_,z=Q,q=ye,$=0,Z=z;Z;Z=Ee(Z))$++;Z=0;for(var _e=q;_e;_e=Ee(_e))Z++;for(;0<$-Z;)z=Ee(z),$--;for(;0<Z-$;)q=Ee(q),Z--;for(;$--;){if(z===q||q!==null&&z===q.alternate){Ee=z;break t}z=Ee(z),q=Ee(q)}Ee=null}else Ee=null;Q!==null&&hy(ne,G,Q,Ee,!1),ye!==null&&Ze!==null&&hy(ne,Ze,ye,Ee,!0)}}e:{if(G=H?T(H):window,Q=G.nodeName&&G.nodeName.toLowerCase(),Q==="select"||Q==="input"&&G.type==="file")var He=km;else if(jm(G))if(Nm)He=Gx;else{He=$x;var be=Ix}else Q=G.nodeName,!Q||Q.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?H&&Nu(H.elementType)&&(He=km):He=Hx;if(He&&(He=He(e,H))){Tm(ne,He,a,J);break e}be&&be(e,G,H),e==="focusout"&&H&&G.type==="number"&&H.memoizedProps.value!=null&&ku(G,"number",G.value)}switch(be=H?T(H):window,e){case"focusin":(jm(be)||be.contentEditable==="true")&&(oi=be,Gu=H,ya=null);break;case"focusout":ya=Gu=oi=null;break;case"mousedown":Fu=!0;break;case"contextmenu":case"mouseup":case"dragend":Fu=!1,Um(ne,a,J);break;case"selectionchange":if(Vx)break;case"keydown":case"keyup":Um(ne,a,J)}var Me;if(zu)e:{switch(e){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else ai?Om(e,a)&&(Be="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Be="onCompositionStart");Be&&(wm&&a.locale!=="ko"&&(ai||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&ai&&(Me=gm()):(Br=J,qu="value"in Br?Br.value:Br.textContent,ai=!0)),be=Dl(H,Be),0<be.length&&(Be=new xm(Be,e,null,a,J),ne.push({event:Be,listeners:be}),Me?Be.data=Me:(Me=Am(a),Me!==null&&(Be.data=Me)))),(Me=Lx?Bx(e,a):Ux(e,a))&&(Be=Dl(H,"onBeforeInput"),0<Be.length&&(be=new xm("onBeforeInput","beforeinput",null,a,J),ne.push({event:be,listeners:Be}),be.data=Me)),k_(ne,e,H,a,J)}uy(ne,n)})}function Ia(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Dl(e,n){for(var a=n+"Capture",o=[];e!==null;){var u=e,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=la(e,a),u!=null&&o.unshift(Ia(e,u,h)),u=la(e,n),u!=null&&o.push(Ia(e,u,h))),e.tag===3)return o;e=e.return}return[]}function R_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function hy(e,n,a,o,u){for(var h=n._reactName,_=[];a!==null&&a!==o;){var E=a,R=E.alternate,H=E.stateNode;if(E=E.tag,R!==null&&R===o)break;E!==5&&E!==26&&E!==27||H===null||(R=H,u?(H=la(a,h),H!=null&&_.unshift(Ia(a,H,R))):u||(H=la(a,h),H!=null&&_.push(Ia(a,H,R)))),a=a.return}_.length!==0&&e.push({event:n,listeners:_})}var D_=/\r\n?/g,q_=/\u0000|\uFFFD/g;function dy(e){return(typeof e=="string"?e:""+e).replace(D_,`
26
+ `).replace(q_,"")}function my(e,n){return n=dy(n),dy(e)===n}function Je(e,n,a,o,u,h){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||ri(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&ri(e,""+o);break;case"className":Bn(e,"class",o);break;case"tabIndex":Bn(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Bn(e,a,o);break;case"style":mm(e,o,h);break;case"data":if(n!=="object"){Bn(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=zo(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"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 h=="function"&&(a==="formAction"?(n!=="input"&&Je(e,n,"name",u.name,u,null),Je(e,n,"formEncType",u.formEncType,u,null),Je(e,n,"formMethod",u.formMethod,u,null),Je(e,n,"formTarget",u.formTarget,u,null)):(Je(e,n,"encType",u.encType,u,null),Je(e,n,"method",u.method,u,null),Je(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=zo(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=or);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=zo(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":qe("beforetoggle",e),qe("toggle",e),Ut(e,"popover",o);break;case"xlinkActuate":ar(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":ar(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":ar(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":ar(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":ar(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":ar(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":ar(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":ar(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":ar(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Ut(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=cx.get(a)||a,Ut(e,a,o))}}function gh(e,n,a,o,u,h){switch(a){case"style":mm(e,o,h);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof o=="string"?ri(e,o):(typeof o=="number"||typeof o=="bigint")&&ri(e,""+o);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=or);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!te.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),n=a.slice(2,u?a.length-7:void 0),h=e[ht]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,u),typeof o=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,u);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):Ut(e,a,o)}}}function qt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var o=!1,u=!1,h;for(h in a)if(a.hasOwnProperty(h)){var _=a[h];if(_!=null)switch(h){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Je(e,n,h,_,a,null)}}u&&Je(e,n,"srcSet",a.srcSet,a,null),o&&Je(e,n,"src",a.src,a,null);return;case"input":qe("invalid",e);var E=h=_=u=null,R=null,H=null;for(o in a)if(a.hasOwnProperty(o)){var J=a[o];if(J!=null)switch(o){case"name":u=J;break;case"type":_=J;break;case"checked":R=J;break;case"defaultChecked":H=J;break;case"value":h=J;break;case"defaultValue":E=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(i(137,n));break;default:Je(e,n,o,J,a,null)}}um(e,h,E,R,H,_,u,!1);return;case"select":qe("invalid",e),o=_=h=null;for(u in a)if(a.hasOwnProperty(u)&&(E=a[u],E!=null))switch(u){case"value":h=E;break;case"defaultValue":_=E;break;case"multiple":o=E;default:Je(e,n,u,E,a,null)}n=h,a=_,e.multiple=!!o,n!=null?ni(e,!!o,n,!1):a!=null&&ni(e,!!o,a,!0);return;case"textarea":qe("invalid",e),h=u=o=null;for(_ in a)if(a.hasOwnProperty(_)&&(E=a[_],E!=null))switch(_){case"value":o=E;break;case"defaultValue":u=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:Je(e,n,_,E,a,null)}hm(e,o,u,h);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(o=a[R],o!=null))switch(R){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Je(e,n,R,o,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(o=0;o<za.length;o++)qe(za[o],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("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(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Je(e,n,H,o,a,null)}return;default:if(Nu(n)){for(J in a)a.hasOwnProperty(J)&&(o=a[J],o!==void 0&&gh(e,n,J,o,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(o=a[E],o!=null&&Je(e,n,E,o,a,null))}function L_(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,_=null,E=null,R=null,H=null,J=null;for(Q in a){var ne=a[Q];if(a.hasOwnProperty(Q)&&ne!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":R=ne;default:o.hasOwnProperty(Q)||Je(e,n,Q,null,o,ne)}}for(var G in o){var Q=o[G];if(ne=a[G],o.hasOwnProperty(G)&&(Q!=null||ne!=null))switch(G){case"type":h=Q;break;case"name":u=Q;break;case"checked":H=Q;break;case"defaultChecked":J=Q;break;case"value":_=Q;break;case"defaultValue":E=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,n));break;default:Q!==ne&&Je(e,n,G,Q,o,ne)}}Tu(e,_,E,R,H,J,h,u);return;case"select":Q=_=E=G=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":Q=R;default:o.hasOwnProperty(h)||Je(e,n,h,null,o,R)}for(u in o)if(h=o[u],R=a[u],o.hasOwnProperty(u)&&(h!=null||R!=null))switch(u){case"value":G=h;break;case"defaultValue":E=h;break;case"multiple":_=h;default:h!==R&&Je(e,n,u,h,o,R)}n=E,a=_,o=Q,G!=null?ni(e,!!a,G,!1):!!o!=!!a&&(n!=null?ni(e,!!a,n,!0):ni(e,!!a,a?[]:"",!1));return;case"textarea":Q=G=null;for(E in a)if(u=a[E],a.hasOwnProperty(E)&&u!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Je(e,n,E,null,o,u)}for(_ in o)if(u=o[_],h=a[_],o.hasOwnProperty(_)&&(u!=null||h!=null))switch(_){case"value":G=u;break;case"defaultValue":Q=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(i(91));break;default:u!==h&&Je(e,n,_,u,o,h)}fm(e,G,Q);return;case"option":for(var ye in a)if(G=a[ye],a.hasOwnProperty(ye)&&G!=null&&!o.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:Je(e,n,ye,null,o,G)}for(R in o)if(G=o[R],Q=a[R],o.hasOwnProperty(R)&&G!==Q&&(G!=null||Q!=null))switch(R){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:Je(e,n,R,G,o,Q)}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 Ee in a)G=a[Ee],a.hasOwnProperty(Ee)&&G!=null&&!o.hasOwnProperty(Ee)&&Je(e,n,Ee,null,o,G);for(H in o)if(G=o[H],Q=a[H],o.hasOwnProperty(H)&&G!==Q&&(G!=null||Q!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(i(137,n));break;default:Je(e,n,H,G,o,Q)}return;default:if(Nu(n)){for(var Ze in a)G=a[Ze],a.hasOwnProperty(Ze)&&G!==void 0&&!o.hasOwnProperty(Ze)&&gh(e,n,Ze,void 0,o,G);for(J in o)G=o[J],Q=a[J],!o.hasOwnProperty(J)||G===Q||G===void 0&&Q===void 0||gh(e,n,J,G,o,Q);return}}for(var z in a)G=a[z],a.hasOwnProperty(z)&&G!=null&&!o.hasOwnProperty(z)&&Je(e,n,z,null,o,G);for(ne in o)G=o[ne],Q=a[ne],!o.hasOwnProperty(ne)||G===Q||G==null&&Q==null||Je(e,n,ne,G,o,Q)}function py(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function B_(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],h=u.transferSize,_=u.initiatorType,E=u.duration;if(h&&E&&py(_)){for(_=0,E=u.responseEnd,o+=1;o<a.length;o++){var R=a[o],H=R.startTime;if(H>E)break;var J=R.transferSize,ne=R.initiatorType;J&&py(ne)&&(R=R.responseEnd,_+=J*(R<E?1:(E-H)/(R-H)))}if(--o,n+=8*(h+_)/(u.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var bh=null,vh=null;function ql(e){return e.nodeType===9?e:e.ownerDocument}function yy(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 gy(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function xh(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var _h=null;function U_(){var e=window.event;return e&&e.type==="popstate"?e===_h?!1:(_h=e,!0):(_h=null,!1)}var by=typeof setTimeout=="function"?setTimeout:void 0,P_=typeof clearTimeout=="function"?clearTimeout:void 0,vy=typeof Promise=="function"?Promise:void 0,z_=typeof queueMicrotask=="function"?queueMicrotask:typeof vy<"u"?function(e){return vy.resolve(null).then(e).catch(I_)}:by;function I_(e){setTimeout(function(){throw e})}function es(e){return e==="head"}function xy(e,n){var a=n,o=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(u),Di(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")$a(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,$a(a);for(var h=a.firstChild;h;){var _=h.nextSibling,E=h.nodeName;h[At]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=_}}else a==="body"&&$a(e.ownerDocument.body);a=u}while(a);Di(n)}function _y(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function wh(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":wh(a),ti(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function $_(e,n,a,o){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[At])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Nn(e.nextSibling),e===null)break}return null}function H_(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Nn(e.nextSibling),e===null))return null;return e}function wy(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Nn(e.nextSibling),e===null))return null;return e}function Sh(e){return e.data==="$?"||e.data==="$~"}function Eh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function G_(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function Nn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Oh=null;function Sy(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Nn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Ey(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function Oy(e,n,a){switch(n=ql(a),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function $a(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);ti(e)}var Cn=new Map,Ay=new Set;function Ll(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Sr=ae.d;ae.d={f:F_,r:V_,D:Y_,C:K_,L:Q_,m:X_,X:Z_,S:J_,M:W_};function F_(){var e=Sr.f(),n=jl();return e||n}function V_(e){var n=k(e);n!==null&&n.tag===5&&n.type==="form"?H0(n):Sr.r(e)}var Ci=typeof document>"u"?null:document;function jy(e,n,a){var o=Ci;if(o&&typeof n=="string"&&n){var u=Sn(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),Ay.has(u)||(Ay.add(u),e={rel:e,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),qt(n,"link",e),D(n),o.head.appendChild(n)))}}function Y_(e){Sr.D(e),jy("dns-prefetch",e,null)}function K_(e,n){Sr.C(e,n),jy("preconnect",e,n)}function Q_(e,n,a){Sr.L(e,n,a);var o=Ci;if(o&&e&&n){var u='link[rel="preload"][as="'+Sn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Sn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Sn(a.imageSizes)+'"]')):u+='[href="'+Sn(e)+'"]';var h=u;switch(n){case"style":h=Mi(e);break;case"script":h=Ri(e)}Cn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Cn.set(h,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(Ha(h))||n==="script"&&o.querySelector(Ga(h))||(n=o.createElement("link"),qt(n,"link",e),D(n),o.head.appendChild(n)))}}function X_(e,n){Sr.m(e,n);var a=Ci;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+Sn(o)+'"][href="'+Sn(e)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ri(e)}if(!Cn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Cn.set(h,e),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ga(h)))return}o=a.createElement("link"),qt(o,"link",e),D(o),a.head.appendChild(o)}}}function J_(e,n,a){Sr.S(e,n,a);var o=Ci;if(o&&e){var u=N(o).hoistableStyles,h=Mi(e);n=n||"default";var _=u.get(h);if(!_){var E={loading:0,preload:null};if(_=o.querySelector(Ha(h)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Cn.get(h))&&Ah(e,a);var R=_=o.createElement("link");D(R),qt(R,"link",e),R._p=new Promise(function(H,J){R.onload=H,R.onerror=J}),R.addEventListener("load",function(){E.loading|=1}),R.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Bl(_,n,o)}_={type:"stylesheet",instance:_,count:1,state:E},u.set(h,_)}}}function Z_(e,n){Sr.X(e,n);var a=Ci;if(a&&e){var o=N(a).hoistableScripts,u=Ri(e),h=o.get(u);h||(h=a.querySelector(Ga(u)),h||(e=b({src:e,async:!0},n),(n=Cn.get(u))&&jh(e,n),h=a.createElement("script"),D(h),qt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function W_(e,n){Sr.M(e,n);var a=Ci;if(a&&e){var o=N(a).hoistableScripts,u=Ri(e),h=o.get(u);h||(h=a.querySelector(Ga(u)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Cn.get(u))&&jh(e,n),h=a.createElement("script"),D(h),qt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function Ty(e,n,a,o){var u=(u=Ie.current)?Ll(u):null;if(!u)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=Mi(a.href),a=N(u).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Mi(a.href);var h=N(u).hoistableStyles,_=h.get(e);if(_||(u=u.ownerDocument||u,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,_),(h=u.querySelector(Ha(e)))&&!h._p&&(_.instance=h,_.state.loading=5),Cn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Cn.set(e,a),h||ew(u,e,a,_.state))),n&&o===null)throw Error(i(528,""));return _}if(n&&o!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ri(a),a=N(u).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mi(e){return'href="'+Sn(e)+'"'}function Ha(e){return'link[rel="stylesheet"]['+e+"]"}function ky(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function ew(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),qt(n,"link",a),D(n),e.head.appendChild(n))}function Ri(e){return'[src="'+Sn(e)+'"]'}function Ga(e){return"script[async]"+e}function Ny(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+Sn(a.href)+'"]');if(o)return n.instance=o,D(o),o;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),D(o),qt(o,"style",u),Bl(o,a.precedence,e),n.instance=o;case"stylesheet":u=Mi(a.href);var h=e.querySelector(Ha(u));if(h)return n.state.loading|=4,n.instance=h,D(h),h;o=ky(a),(u=Cn.get(u))&&Ah(o,u),h=(e.ownerDocument||e).createElement("link"),D(h);var _=h;return _._p=new Promise(function(E,R){_.onload=E,_.onerror=R}),qt(h,"link",o),n.state.loading|=4,Bl(h,a.precedence,e),n.instance=h;case"script":return h=Ri(a.src),(u=e.querySelector(Ga(h)))?(n.instance=u,D(u),u):(o=a,(u=Cn.get(h))&&(o=b({},a),jh(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),D(u),qt(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Bl(o,a.precedence,e));return n.instance}function Bl(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,_=0;_<o.length;_++){var E=o[_];if(E.dataset.precedence===n)h=E;else if(h!==u)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Ah(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function jh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Ul=null;function Cy(e,n,a){if(Ul===null){var o=new Map,u=Ul=new Map;u.set(a,o)}else u=Ul,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var h=a[u];if(!(h[At]||h[nt]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var _=h.getAttribute(n)||"";_=e+_;var E=o.get(_);E?E.push(h):o.set(_,[h])}}return o}function My(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function tw(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Ry(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function nw(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Mi(o.href),h=n.querySelector(Ha(u));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Pl.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,D(h);return}h=n.ownerDocument||n,o=ky(o),(u=Cn.get(u))&&Ah(o,u),h=h.createElement("link"),D(h);var _=h;_._p=new Promise(function(E,R){_.onload=E,_.onerror=R}),qt(h,"link",o),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Pl.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Th=0;function rw(e,n){return e.stylesheets&&e.count===0&&Il(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Th===0&&(Th=62500*B_());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Th?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Pl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Il(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zl=null;function Il(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zl=new Map,n.forEach(sw,e),zl=null,Pl.call(e))}function sw(e,n){if(!(n.state.loading&4)){var a=zl.get(e);if(a)var o=a.get(null);else{a=new Map,zl.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var _=u[h];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),o=_)}o&&a.set(null,o)}u=n.instance,_=u.getAttribute("data-precedence"),h=a.get(_)||o,h===o&&a.set(null,u),a.set(_,u),this.count++,o=Pl.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),h?h.parentNode.insertBefore(u,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),n.state.loading|=4}}var Fa={$$typeof:se,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function iw(e,n,a,o,u,h,_,E,R){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=Rr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rr(0),this.hiddenUpdates=Rr(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Dy(e,n,a,o,u,h,_,E,R,H,J,ne){return e=new iw(e,n,a,_,R,H,J,ne,E),n=1,h===!0&&(n|=24),h=rn(3,null,null,n),e.current=h,h.stateNode=e,n=of(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:o,isDehydrated:a,cache:n},ff(h),e}function qy(e){return e?(e=ui,e):ui}function Ly(e,n,a,o,u,h){u=qy(u),o.context===null?o.context=u:o.pendingContext=u,o=Hr(n),o.payload={element:a},h=h===void 0?null:h,h!==null&&(o.callback=h),a=Gr(e,o,n),a!==null&&(Zt(a,e,n),Sa(a,e,n))}function By(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function kh(e,n){By(e,n),(e=e.alternate)&&By(e,n)}function Uy(e){if(e.tag===13||e.tag===31){var n=Ts(e,67108864);n!==null&&Zt(n,e,67108864),kh(e,67108864)}}function Py(e){if(e.tag===13||e.tag===31){var n=cn();n=ir(n);var a=Ts(e,n);a!==null&&Zt(a,e,n),kh(e,n)}}var $l=!0;function aw(e,n,a,o){var u=Y.T;Y.T=null;var h=ae.p;try{ae.p=2,Nh(e,n,a,o)}finally{ae.p=h,Y.T=u}}function ow(e,n,a,o){var u=Y.T;Y.T=null;var h=ae.p;try{ae.p=8,Nh(e,n,a,o)}finally{ae.p=h,Y.T=u}}function Nh(e,n,a,o){if($l){var u=Ch(o);if(u===null)yh(e,n,o,Hl,a),Iy(e,o);else if(cw(u,e,n,a,o))o.stopPropagation();else if(Iy(e,o),n&4&&-1<lw.indexOf(e)){for(;u!==null;){var h=k(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var _=qn(h.pendingLanes);if(_!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;_;){var R=1<<31-Bt(_);E.entanglements[1]|=R,_&=~R}Jn(h),(Fe&6)===0&&(Ol=lt()+500,Pa(0))}}break;case 31:case 13:E=Ts(h,2),E!==null&&Zt(E,h,2),jl(),kh(h,2)}if(h=Ch(o),h===null&&yh(e,n,o,Hl,a),h===u)break;u=h}u!==null&&o.stopPropagation()}else yh(e,n,o,null,a)}}function Ch(e){return e=Mu(e),Mh(e)}var Hl=null;function Mh(e){if(Hl=null,e=O(e),e!==null){var n=c(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=m(n),e!==null)return e;e=null}else if(a===31){if(e=y(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Hl=e,null}function zy(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(Eu()){case Mo:return 2;case Ro:return 8;case Zs:case Ou:return 32;case Do:return 268435456;default:return 32}default:return 32}}var Rh=!1,ts=null,ns=null,rs=null,Va=new Map,Ya=new Map,ss=[],lw="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 Iy(e,n){switch(e){case"focusin":case"focusout":ts=null;break;case"dragenter":case"dragleave":ns=null;break;case"mouseover":case"mouseout":rs=null;break;case"pointerover":case"pointerout":Va.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ya.delete(n.pointerId)}}function Ka(e,n,a,o,u,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:h,targetContainers:[u]},n!==null&&(n=k(n),n!==null&&Uy(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),e)}function cw(e,n,a,o,u){switch(n){case"focusin":return ts=Ka(ts,e,n,a,o,u),!0;case"dragenter":return ns=Ka(ns,e,n,a,o,u),!0;case"mouseover":return rs=Ka(rs,e,n,a,o,u),!0;case"pointerover":var h=u.pointerId;return Va.set(h,Ka(Va.get(h)||null,e,n,a,o,u)),!0;case"gotpointercapture":return h=u.pointerId,Ya.set(h,Ka(Ya.get(h)||null,e,n,a,o,u)),!0}return!1}function $y(e){var n=O(e.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=m(a),n!==null){e.blockedOn=n,Lo(e.priority,function(){Py(a)});return}}else if(n===31){if(n=y(a),n!==null){e.blockedOn=n,Lo(e.priority,function(){Py(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Gl(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Ch(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Cu=o,a.target.dispatchEvent(o),Cu=null}else return n=k(a),n!==null&&Uy(n),e.blockedOn=a,!1;n.shift()}return!0}function Hy(e,n,a){Gl(e)&&a.delete(n)}function uw(){Rh=!1,ts!==null&&Gl(ts)&&(ts=null),ns!==null&&Gl(ns)&&(ns=null),rs!==null&&Gl(rs)&&(rs=null),Va.forEach(Hy),Ya.forEach(Hy)}function Fl(e,n){e.blockedOn===n&&(e.blockedOn=null,Rh||(Rh=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,uw)))}var Vl=null;function Gy(e){Vl!==e&&(Vl=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){Vl===e&&(Vl=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(Mh(o||a)===null)continue;break}var h=k(a);h!==null&&(e.splice(n,3),n-=3,Cf(h,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Di(e){function n(R){return Fl(R,e)}ts!==null&&Fl(ts,e),ns!==null&&Fl(ns,e),rs!==null&&Fl(rs,e),Va.forEach(n),Ya.forEach(n);for(var a=0;a<ss.length;a++){var o=ss[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<ss.length&&(a=ss[0],a.blockedOn===null);)$y(a),a.blockedOn===null&&ss.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],h=a[o+1],_=u[ht]||null;if(typeof h=="function")_||Gy(a);else if(_){var E=null;if(h&&h.hasAttribute("formAction")){if(u=h,_=h[ht]||null)E=_.formAction;else if(Mh(u)!==null)continue}else E=_.action;typeof E=="function"?a[o+1]=E:(a.splice(o,3),o-=3),Gy(a)}}}function Fy(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(_){return u=_})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function Dh(e){this._internalRoot=e}Yl.prototype.render=Dh.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=cn();Ly(a,o,e,n,null,null)},Yl.prototype.unmount=Dh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Ly(e.current,2,null,e,null,null),jl(),n[tn]=null}};function Yl(e){this._internalRoot=e}Yl.prototype.unstable_scheduleHydration=function(e){if(e){var n=aa();e={blockedOn:null,target:e,priority:n};for(var a=0;a<ss.length&&n!==0&&n<ss[a].priority;a++);ss.splice(a,0,e),a===0&&$y(e)}};var Vy=t.version;if(Vy!=="19.2.4")throw Error(i(527,Vy,"19.2.4"));ae.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=f(n),e=e!==null?d(e):null,e=e===null?null:e.stateNode,e};var fw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{vs=Kl.inject(fw),gt=Kl}catch{}}return Qa.createRoot=function(e,n){if(!l(e))throw Error(i(299));var a=!1,o="",u=W0,h=ep,_=tp;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=Dy(e,1,!1,null,null,a,o,null,u,h,_,Fy),e[tn]=n.current,ph(e),new Dh(n)},Qa.hydrateRoot=function(e,n,a){if(!l(e))throw Error(i(299));var o=!1,u="",h=W0,_=ep,E=tp,R=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=Dy(e,1,!0,n,a??null,o,u,R,h,_,E,Fy),n.context=qy(null),a=n.current,o=cn(),o=ir(o),u=Hr(o),u.callback=null,Gr(a,u,o),a=o,n.current.lanes=a,Ln(n,a),Jn(n),e[tn]=n.current,ph(e),new Yl(n)},Qa.version="19.2.4",Qa}var eg;function Jw(){if(eg)return qh.exports;eg=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(t){console.error(t)}}return r(),qh.exports=Xw(),qh.exports}var Zw=Jw();const Ww="modulepreload",eS=function(r,t){return new URL(r,t).href},tg={},Se=function(t,s,i){let l=Promise.resolve();if(s&&s.length>0){let m=function(d){return Promise.all(d.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const y=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),f=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));l=m(s.map(d=>{if(d=eS(d,i),d in tg)return;tg[d]=!0;const b=d.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(!!i)for(let S=y.length-1;S>=0;S--){const M=y[S];if(M.href===d&&(!b||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${v}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":Ww,b||(w.as="script"),w.crossOrigin="",w.href=d,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((S,M)=>{w.addEventListener("load",S),w.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${d}`)))})}))}function c(m){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=m,window.dispatchEvent(y),!y.defaultPrevented)throw m}return l.then(m=>{for(const y of m||[])y.status==="rejected"&&c(y.reason);return t().catch(c)})};function du(r){try{const t=r.split(".");if(t.length!==3)return null;const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function Eb(r){const t=du(r);return!t||typeof t.exp!="number"?null:t.exp}function Md(r,t=0){const s=Eb(r);return s===null?!0:Date.now()/1e3>=s-t}const Nt=window.__LT_BASE__??"",nd=`${Nt}/api`;class ng extends Error{constructor(t,s,i){super(t),this.status=s,this.body=i,this.name="ApiError"}}let cs=null;function Ql(r){cs=r}function Ob(){return cs}const tS="X-LT-Acting-Token";let Gc=null,Fc=null;function rg(r){Gc=r}function sg(r){Fc=r}function nS(r){const t=r==null?void 0:r.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function ig(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:t,password:s}=JSON.parse(r),i=await fetch(`${nd}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:s})});if(!i.ok)return null;const l=await i.json();return l.token&&l.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:l.user.display_name,username:l.user.external_id})),l.token??null}catch{return null}}let as=null;async function ge(r,t={}){const s={"Content-Type":"application/json",...t.headers};if(cs){if(Md(cs)){as||(as=ig().finally(()=>{as=null}));const c=await as;if(c)cs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${cs}`}const i=(Gc==null?void 0:Gc())??null;i&&(s[tS]=i);let l=await fetch(`${nd}${r}`,{...t,headers:s});if(l.status===401&&i){const c=await l.clone().json().catch(()=>null);if(nS(c))throw Fc==null||Fc(),new ng(c.error,401,c)}if(l.status===401&&cs){as||(as=ig().finally(()=>{as=null}));const c=await as;if(c&&(cs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),s.Authorization=`Bearer ${c}`,l=await fetch(`${nd}${r}`,{...t,headers:s})),l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!l.ok){const c=await l.json().catch(()=>({error:l.statusText}));throw new ng(c.message||c.error||l.statusText,l.status,c)}return l.json()}const rS="lt_ai_override";function sS(){return ge("/settings")}function iS(){try{if(localStorage.getItem(rS)==="off")return!1}catch{}return null}function nr(){var s;const r=st({queryKey:["settings"],queryFn:sS,staleTime:1/0}),t=iS();return r.data&&t===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function aS(r){var f,d,b;const{data:t}=nr(),s=((f=t==null?void 0:t.auth)==null?void 0:f.ssoKeepaliveSeconds)??0,i=((d=t==null?void 0:t.auth)==null?void 0:d.ssoKeepaliveIdleTimeoutSeconds)??0,l=j.useRef(Date.now()),c=j.useRef(Date.now()),m=j.useRef(!1),g=!!r&&((b=du(r))==null?void 0:b.sso)===!0&&s>0;j.useEffect(()=>{if(!g)return;const v=()=>{l.current=Date.now()};window.addEventListener("pointerdown",v,{passive:!0}),window.addEventListener("keydown",v,{passive:!0}),window.addEventListener("wheel",v,{passive:!0});const x=async()=>{if(!m.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-l.current>i*1e3)){m.current=!0;try{const M=await fetch(`${Nt}/api/auth/sso`,{method:"POST"});if(M.status===401||M.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!M.ok)return;const B=await M.json().catch(()=>null);B!=null&&B.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:B.token}})))}catch{}finally{m.current=!1}}},w=setInterval(x,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&x()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",v),window.removeEventListener("wheel",v)}},[g,s,i])}const Ab=j.createContext(null),oS=300;function Uh(r,t){if(Md(r))return null;const s=du(r);if(!s)return null;const i=t??(()=>{try{const l=sessionStorage.getItem("lt_user_info");return l?JSON.parse(l):null}catch{return null}})();return{userId:s.userId,displayName:(i==null?void 0:i.displayName)??null,username:(i==null?void 0:i.username)??null,roles:s.roles??[]}}function lS({children:r}){const[t,s]=j.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Md(b)?(sessionStorage.removeItem("lt_token"),null):(Ql(b),Uh(b)):null}),i=j.useRef(void 0),l=j.useCallback(b=>{clearTimeout(i.current);const v=Eb(b);if(!v)return;const x=(v-oS)*1e3-Date.now();x<=0||(i.current=setTimeout(async()=>{try{const w=du(b);if(w!=null&&w.sso){const fe=await fetch(`${Nt}/api/auth/sso`,{method:"POST"});if(!fe.ok)return;const C=await fe.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:M,password:B}=JSON.parse(S),P=await fetch(`${Nt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:M,password:B})});if(!P.ok)return;const se=await P.json();se.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:se.token}}))}catch{}},x))},[]),c=j.useCallback((b,v,x)=>{const w={displayName:(x==null?void 0:x.displayName)??null,username:(x==null?void 0:x.username)??(v==null?void 0:v.username)??null},S=Uh(b,w);S&&(Ql(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),v&&sessionStorage.setItem("lt_credentials",JSON.stringify(v)),s(S),l(b))},[l]),m=j.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");Ql(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),b&&(window.location.href=b)},[]);j.useEffect(()=>{const b=()=>m(),v=x=>{var M;const w=(M=x.detail)==null?void 0:M.token;if(!w)return;const S=Uh(w);S&&(Ql(w),sessionStorage.setItem("lt_token",w),s(S),l(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",v),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",v)}},[m,l]),j.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&l(b),()=>clearTimeout(i.current)},[]);const y=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.role===b))??!1,[t]),f=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.type===b))??!1,[t]),d=(t==null?void 0:t.roles.map(b=>b.role))??[];return p.jsxs(Ab.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:y,login:c,logout:m,hasRole:g,hasRoleType:f,userRoleNames:d},children:[p.jsx(cS,{authenticated:t!==null}),r]})}function cS({authenticated:r}){return aS(r?sessionStorage.getItem("lt_token"):null),null}function Vt(){const r=j.useContext(Ab);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const gn=new Uint8Array(0),Ys=new TextEncoder,mn=new TextDecoder;function uS(...r){let t=0;for(let l=0;l<r.length;l++)t+=r[l].length;const s=new Uint8Array(t);let i=0;for(let l=0;l<r.length;l++)s.set(r[l],i),i+=r[l].length;return s}function uo(...r){const t=[];for(let s=0;s<r.length;s++)t.push(Ys.encode(r[s]));return t.length===0?gn:t.length===1?t[0]:uS(...t)}function ag(r){return!r||r.length===0?"":mn.decode(r)}const og="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",lg=36,fS=0xcfd41b9100000,cg=33,hS=333,ug=22;function dS(r){for(let t=0;t<r.length;t++)r[t]=Math.floor(Math.random()*255)}function mS(r){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(r):dS(r)}class pS{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(this,"inited");this.buf=new Uint8Array(ug),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*fS),this.inc=Math.floor(Math.random()*(hS-cg)+cg)}setPre(){const t=new Uint8Array(12);mS(t);for(let s=0;s<12;s++){const i=t[s]%36;this.buf[s]=og.charCodeAt(i)}}fillSeq(){let t=this.seq;for(let s=ug-1;s>=12;s--)this.buf[s]=og.charCodeAt(t%lg),t=Math.floor(t/lg)}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 ps=new pS;var Or;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Or||(Or={}));var Hi;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(Hi||(Hi={}));var le;(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"})(le||(le={}));function yS(r){return typeof r.code=="string"}class jb{constructor(){A(this,"messages");this.messages=new Map,this.messages.set(le.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(le.BadJson,"Bad JSON"),this.messages.set(le.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return gS.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const gS=new jb;class me extends Error{constructor(s,i,l){super(s);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=l}static errorForCode(s,i){const l=jb.getMessage(s);return new me(l,s,i)}isAuthError(){return this.code===le.AuthenticationExpired||this.code===le.AuthorizationViolation||this.code===le.AccountExpired}isAuthTimeout(){return this.code===le.AuthenticationTimeout}isPermissionError(){return this.code===le.PermissionsViolation}isProtocolError(){return this.code===le.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var hn;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(hn||(hn={}));var Fn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Fn||(Fn={}));var fo;(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"})(fo||(fo={}));const Wc="Nats-Service-Error",eu="Nats-Service-Error-Code";class tu extends Error{constructor(s,i){super(i);A(this,"code");this.code=s}static isServiceError(s){return tu.toServiceError(s)!==null}static toServiceError(s){var l,c;const i=((l=s==null?void 0:s.headers)==null?void 0:l.get(eu))||"";if(i!==""){const m=parseInt(i)||400,y=((c=s==null?void 0:s.headers)==null?void 0:c.get(Wc))||"";return new tu(m,y.length?y:i)}return null}}function Ar(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${ps.next()}`}const rd="127.0.0.1";var us;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(us||(us={}));function mu(r,...t){for(let s=0;s<t.length;s++){const i=t[s];Object.keys(i).forEach(function(l){r[l]=i[l]})}return r}function Xl(r){return mn.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Qi(r,t=!0){const s=t?me.errorForCode(le.Timeout):null;let i,l;const c=new Promise((m,y)=>{i={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{y(s===null?me.errorForCode(le.Timeout):s)},r)});return Object.assign(c,i)}function Zi(r=0){let t;const s=new Promise(i=>{const l=setTimeout(()=>{i()},r);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(s,t)}function ft(){let r={};const t=new Promise((s,i)=>{r={resolve:s,reject:i}});return Object.assign(t,r)}function Tb(r){for(let t=r.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[r[t],r[s]]=[r[s],r[t]]}return r}function bS(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Rd(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const t=r.length-1;return{backoff(s){return bS(s>t?r[t]:r[s])}}}function ut(r){return r*1e6}function Dd(r){return Math.floor(r/1e6)}function fg(r){let i=!0;const l=new Array(r.length);for(let c=0;c<r.length;c++){let m=r.charCodeAt(c);if(m===58||m<33||m>126)throw new me(`'${r[c]}' is not a valid character for a header key`,le.BadHeader);i&&97<=m&&m<=122?m-=32:!i&&65<=m&&m<=90&&(m+=32),l[c]=m,i=m==45}return String.fromCharCode(...l)}function jr(r=0,t=""){if(r===0&&t!==""||r>0&&t==="")throw new Error("setting status requires both code and description");return new fs(r,t)}const Ph="NATS/1.0";class fs{constructor(t=0,s=""){A(this,"_code");A(this,"headers");A(this,"_description");this._code=t,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[s,i]of this.headers){const l=t.values(s);if(i.length!==l.length)return!1;const c=[...i].sort(),m=[...l].sort();for(let y=0;y<c.length;y++)if(c[y]!==m[y])return!1}return!0}return!1}static decode(t){const s=new fs,l=mn.decode(t).split(`\r
27
+ `),c=l[0];if(c!==Ph){let m=c.replace(Ph,"").trim();if(m.length>0){s._code=parseInt(m,10),isNaN(s._code)&&(s._code=0);const y=s._code.toString();m=m.replace(y,""),s._description=m.trim()}}return l.length>=1&&l.slice(1).map(m=>{if(m){const y=m.indexOf(":");if(y>-1){const g=m.slice(0,y),f=m.slice(y+1).trim();s.append(g,f)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Ph;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let l=0;l<i.length;l++)t=`${t}\r
28
+ ${s}: ${i[l]}`;return`${t}\r
29
+ \r
30
+ `}encode(){return Ys.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new me("invalid header value - \\r and \\n are not allowed.",le.BadHeader);return t.trim()}keys(){const t=[];for(const s of this.headers.keys())t.push(s);return t}findKeys(t,s=hn.Exact){const i=this.keys();switch(s){case hn.Exact:return i.filter(l=>l===t);case hn.CanonicalMIME:return t=fg(t),i.filter(l=>l===t);default:{const l=t.toLowerCase();return i.filter(c=>l===c.toLowerCase())}}}get(t,s=hn.Exact){const i=this.findKeys(t,s);if(i.length){const l=this.headers.get(i[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,s=hn.Exact){const i=this.findKeys(t,s);if(i.length){const l=this.headers.get(i[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,s=hn.Exact){return this.findKeys(t,s).length>0}set(t,s,i=hn.Exact){this.delete(t,i),this.append(t,s,i)}append(t,s,i=hn.Exact){const l=fg(t);i===hn.CanonicalMIME&&(t=l);const c=this.findKeys(t,i);t=c.length>0?c[0]:t;const m=fs.validHeaderValue(s);let y=this.headers.get(t);y||(y=[],this.headers.set(t,y)),y.push(m)}values(t,s=hn.Exact){const i=[];return this.findKeys(t,s).forEach(c=>{const m=this.headers.get(c);m&&i.push(...m)}),i}delete(t,s=hn.Exact){this.findKeys(t,s).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(s=>{t[s]=this.values(s)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const s=new fs;for(const i in t)s.headers.set(i,t[i]);return s}}function sd(){return{encode(r){return Ys.encode(r)},decode(r){return mn.decode(r)}}}function Vn(r){return{encode(t){try{return t===void 0&&(t=null),Ys.encode(JSON.stringify(t))}catch(s){throw me.errorForCode(le.BadJson,s)}},decode(t){try{return JSON.parse(mn.decode(t),r)}catch(s){throw me.errorForCode(le.BadJson,s)}}}}function kb(r){var t;return r&&r.data.length===0&&((t=r.headers)==null?void 0:t.code)===503?me.errorForCode(le.NoResponders):null}class qd{constructor(t,s,i){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=t,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=mn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=mn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=fs.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=gn,s){return this.reply?(this.publisher.publish(this.reply,t,s),!0):!1}size(){var l;const t=this._msg.subject.length,s=((l=this._msg.reply)==null?void 0:l.length)||0,i=this._msg.size===-1?0:this._msg.size;return t+s+i}json(t){return Vn(t).decode(this.data)}string(){return mn.decode(this.data)}requestInfo(){var s;const t=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return t?JSON.parse(t,function(i,l){return(i==="start"||i==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}A(qd,"jc");function Gi(r){return pu("durable",r)}function It(r){return pu("stream",r)}function pu(r,t=""){if(t==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
31
+ `,"\r"].forEach(i=>{if(t.indexOf(i)!==-1){switch(i){case`
32
+ `:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${i}'`)}}),""}function oo(r,t=""){if(t==="")throw Error(`${r} name required`);const s=vS(t);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function vS(r=""){if(r==="")throw Error("name required");const t=/^[-\w]+$/g;if(r.match(t)===null){for(const i of r.split(""))if(i.match(t)===null)return`cannot contain '${i}'`}return""}function id(r){if(r.data.length>0)return!1;const t=r.headers;return t?t.code>=100&&t.code<200:!1}function ad(r){var t;return id(r)&&((t=r.headers)==null?void 0:t.description)==="Idle Heartbeat"}function xS(r,t,s){const i=jr(r,t),l={hdr:1,sid:0,size:0},c=new qd(l,gn,{});return c._headers=i,c._subject=s,c}function Fi(r){if(r.data.length!==0)return null;const t=r.headers;return t?Nb(t.code,t.description):null}var Rn;(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"})(Rn||(Rn={}));function _S(r){return r.code!==le.JetStream409?!1:[Rn.MaxBatchExceeded,Rn.MaxExpiresExceeded,Rn.MaxBytesExceeded,Rn.MaxMessageSizeExceeded,Rn.PushConsumer,Rn.IdleHeartbeatMissed,Rn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function Nb(r,t=""){if(r<300)return null;switch(t=t.toLowerCase(),r){case 404:return new me(t,le.JetStream404NoMessages);case 408:return new me(t,le.JetStream408RequestTimeout);case 409:{const s=t.startsWith(Rn.IdleHeartbeatMissed)?le.JetStreamIdleHeartBeat:le.JetStream409;return new me(t,s)}case 503:return me.errorForCode(le.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=le.Unknown),new me(t,`${r}`)}}class Ct{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(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=ft(),this.yields=[],this.iterClosed=ft(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new me("unsupported iterator",le.ApiError);if(this.yielding)throw new me("already yielding",le.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let s=0;s<t.length;s++){if(typeof t[s]=="function"){const l=t[s];try{l()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[s]):!0){this.processed++;const l=Date.now();yield t[s],this.time=Date.now()-l,this.dispatchedFn&&t[s]&&this.dispatchedFn(t[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=ft())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Ld{constructor(t,s,i={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(this,"callback");this.interval=t,this.maxOut=(i==null?void 0:i.maxOut)||2,this.cancelAfter=(i==null?void 0:i.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(t,s=0,i=2){this.interval=t,this.maxOut=i,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(t){console.log(t)}},this.interval)}}var od;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(od||(od={}));var yo;(function(r){r.Old="old",r.New="new"})(yo||(yo={}));var ld;(function(r){r.File="file",r.Memory="memory"})(ld||(ld={}));var xt;(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"})(xt||(xt={}));var kt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(kt||(kt={}));var Xi;(function(r){r.Instant="instant",r.Original="original"})(Xi||(Xi={}));var ys;(function(r){r.None="none",r.S2="s2"})(ys||(ys={}));var nu;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(nu||(nu={}));function wS(r,t={}){return Object.assign({name:r,deliver_policy:xt.All,ack_policy:kt.Explicit,ack_wait:ut(30*1e3),replay_policy:Xi.Instant},t)}var hg;(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"})(hg||(hg={}));var Gt;(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"})(Gt||(Gt={}));var $n;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})($n||($n={}));var Ii;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(Ii||(Ii={}));var dg;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(dg||(dg={}));const dn="KV_";class SS{constructor(t){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=wS("",t||{})}getOpts(){var s;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((s=t.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?kt.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Gi(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=xt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=xt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=xt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=xt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=xt.Last,this}deliverNew(){return this.config.deliver_policy=xt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=kt.None,this}ackAll(){return this.config.ack_policy=kt.All,this}ackExplicit(){return this.config.ack_policy=kt.Explicit,this}ackWait(t){return this.config.ack_wait=ut(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=Xi.Instant,this}replayOriginal(){return this.config.replay_policy=Xi.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=ut(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,s){return this.stream=t,this.config.durable_name=s,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=ut(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=ut(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function hs(r){return new SS(r)}function mg(r){return typeof r.getOpts=="function"}class ES{static encode(t){if(typeof t=="string")return btoa(t);const s=Array.from(t);return btoa(String.fromCharCode(...s))}static decode(t,s=!1){const i=atob(t);return s?Uint8Array.from(i,l=>l.charCodeAt(0)):i}}class Vi{static encode(t){return Vi.toB64URLEncoding(ES.encode(t))}static decode(t,s=!1){return Vi.decode(Vi.fromB64URLEncoding(t),s)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Ji{constructor(){A(this,"buffers");A(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let s=0;for(let c=0;c<t.length;c++)s+=t[c].length;const i=new Uint8Array(s);let l=0;for(let c=0;c<t.length;c++)i.set(t[c],l),l+=t[c].length;return i}static fromAscii(t){return t||(t=""),Ys.encode(t)}static toAscii(t){return mn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)t.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(t===void 0||t>i)&&(t=i);const l=s.subarray(0,t);return i>t&&this.buffers.push(s.subarray(t)),this.byteLength=i-t,l}}return new Uint8Array(0)}fill(t,...s){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let i=0;i<s.length;i++)s[i]&&s[i].length&&(this.buffers.push(s[i]),this.byteLength+=s[i].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function OS(r,t){return t.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in r)){var l=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(r,i,l.get?l:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(r)}var AS=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Xa=AS.performance||{};Xa.now||Xa.mozNow||Xa.msNow||Xa.oNow||Xa.webkitNow;var pg={versions:{}},jS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function TS(r){if(r.__esModule)return r;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),t}var zh,yu={exports:{}},yg={},gg=TS(OS({__proto__:null,default:yg},[yg]));zh=yu,(function(){var r="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",l=!s.JS_SHA256_NO_NODE_JS&&pg.versions&&pg.versions.node;l?s=jS:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&zh.exports,m=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",y="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],f=[24,16,8,0],d=[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],b=["hex","array","digest","arrayBuffer"],v=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!m||!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 x=function(C,U){return function(re){return new P(U,!0).update(re)[C]()}},w=function(C){var U=x("hex",C);l&&(U=S(U,C)),U.create=function(){return new P(C)},U.update=function(L){return U.create().update(L)};for(var re=0;re<b.length;++re){var K=b[re];U[K]=x(K,C)}return U},S=function(C,U){var re,K=gg,L=gg.Buffer,F=U?"sha224":"sha256";return re=L.from&&!s.JS_SHA256_NO_BUFFER_FROM?L.from:function(ee){return new L(ee)},function(ee){if(typeof ee=="string")return K.createHash(F).update(ee,"utf8").digest("hex");if(ee==null)throw new Error(r);return ee.constructor===ArrayBuffer&&(ee=new Uint8Array(ee)),Array.isArray(ee)||ArrayBuffer.isView(ee)||ee.constructor===L?K.createHash(F).update(re(ee)).digest("hex"):C(ee)}},M=function(C,U){return function(re,K){return new se(re,U,!0).update(K)[C]()}},B=function(C){var U=M("hex",C);U.create=function(L){return new se(L,C)},U.update=function(L,F){return U.create(L).update(F)};for(var re=0;re<b.length;++re){var K=b[re];U[K]=M(K,C)}return U};function P(C,U){U?(v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0,this.blocks=v):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 se(C,U,re){var K,L=typeof C;if(L==="string"){var F,ee=[],X=C.length,he=0;for(K=0;K<X;++K)(F=C.charCodeAt(K))<128?ee[he++]=F:F<2048?(ee[he++]=192|F>>>6,ee[he++]=128|63&F):F<55296||F>=57344?(ee[he++]=224|F>>>12,ee[he++]=128|F>>>6&63,ee[he++]=128|63&F):(F=65536+((1023&F)<<10|1023&C.charCodeAt(++K)),ee[he++]=240|F>>>18,ee[he++]=128|F>>>12&63,ee[he++]=128|F>>>6&63,ee[he++]=128|63&F);C=ee}else{if(L!=="object")throw new Error(r);if(C===null)throw new Error(r);if(m&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||m&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new P(U,!0).update(C).array());var ve=[],Te=[];for(K=0;K<64;++K){var Y=C[K]||0;ve[K]=92^Y,Te[K]=54^Y}P.call(this,U,re),this.update(Te),this.oKeyPad=ve,this.inner=!0,this.sharedMemory=re}P.prototype.update=function(C){if(!this.finalized){var U,re=typeof C;if(re!=="string"){if(re!=="object")throw new Error(r);if(C===null)throw new Error(r);if(m&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||m&&ArrayBuffer.isView(C)))throw new Error(r);U=!0}for(var K,L,F=0,ee=C.length,X=this.blocks;F<ee;){if(this.hashed&&(this.hashed=!1,X[0]=this.block,this.block=X[16]=X[1]=X[2]=X[3]=X[4]=X[5]=X[6]=X[7]=X[8]=X[9]=X[10]=X[11]=X[12]=X[13]=X[14]=X[15]=0),U)for(L=this.start;F<ee&&L<64;++F)X[L>>>2]|=C[F]<<f[3&L++];else for(L=this.start;F<ee&&L<64;++F)(K=C.charCodeAt(F))<128?X[L>>>2]|=K<<f[3&L++]:K<2048?(X[L>>>2]|=(192|K>>>6)<<f[3&L++],X[L>>>2]|=(128|63&K)<<f[3&L++]):K<55296||K>=57344?(X[L>>>2]|=(224|K>>>12)<<f[3&L++],X[L>>>2]|=(128|K>>>6&63)<<f[3&L++],X[L>>>2]|=(128|63&K)<<f[3&L++]):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++F)),X[L>>>2]|=(240|K>>>18)<<f[3&L++],X[L>>>2]|=(128|K>>>12&63)<<f[3&L++],X[L>>>2]|=(128|K>>>6&63)<<f[3&L++],X[L>>>2]|=(128|63&K)<<f[3&L++]);this.lastByteIndex=L,this.bytes+=L-this.start,L>=64?(this.block=X[16],this.start=L-64,this.hash(),this.hashed=!0):this.start=L}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,U=this.lastByteIndex;C[16]=this.block,C[U>>>2]|=g[3&U],this.block=C[16],U>=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()}},P.prototype.hash=function(){var C,U,re,K,L,F,ee,X,he,ve=this.h0,Te=this.h1,Y=this.h2,ae=this.h3,de=this.h4,Oe=this.h5,we=this.h6,Ne=this.h7,Ae=this.blocks;for(C=16;C<64;++C)U=((L=Ae[C-15])>>>7|L<<25)^(L>>>18|L<<14)^L>>>3,re=((L=Ae[C-2])>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,Ae[C]=Ae[C-16]+U+Ae[C-7]+re|0;for(he=Te&Y,C=0;C<64;C+=4)this.first?(this.is224?(F=300032,Ne=(L=Ae[0]-1413257819)-150054599|0,ae=L+24177077|0):(F=704751109,Ne=(L=Ae[0]-210244248)-1521486534|0,ae=L+143694565|0),this.first=!1):(U=(ve>>>2|ve<<30)^(ve>>>13|ve<<19)^(ve>>>22|ve<<10),K=(F=ve&Te)^ve&Y^he,Ne=ae+(L=Ne+(re=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&Oe^~de&we)+d[C]+Ae[C])|0,ae=L+(U+K)|0),U=(ae>>>2|ae<<30)^(ae>>>13|ae<<19)^(ae>>>22|ae<<10),K=(ee=ae&ve)^ae&Te^F,we=Y+(L=we+(re=(Ne>>>6|Ne<<26)^(Ne>>>11|Ne<<21)^(Ne>>>25|Ne<<7))+(Ne&de^~Ne&Oe)+d[C+1]+Ae[C+1])|0,U=((Y=L+(U+K)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),K=(X=Y&ae)^Y&ve^ee,Oe=Te+(L=Oe+(re=(we>>>6|we<<26)^(we>>>11|we<<21)^(we>>>25|we<<7))+(we&Ne^~we&de)+d[C+2]+Ae[C+2])|0,U=((Te=L+(U+K)|0)>>>2|Te<<30)^(Te>>>13|Te<<19)^(Te>>>22|Te<<10),K=(he=Te&Y)^Te&ae^X,de=ve+(L=de+(re=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&we^~Oe&Ne)+d[C+3]+Ae[C+3])|0,ve=L+(U+K)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+ve|0,this.h1=this.h1+Te|0,this.h2=this.h2+Y|0,this.h3=this.h3+ae|0,this.h4=this.h4+de|0,this.h5=this.h5+Oe|0,this.h6=this.h6+we|0,this.h7=this.h7+Ne|0},P.prototype.hex=function(){this.finalize();var C=this.h0,U=this.h1,re=this.h2,K=this.h3,L=this.h4,F=this.h5,ee=this.h6,X=this.h7,he=y[C>>>28&15]+y[C>>>24&15]+y[C>>>20&15]+y[C>>>16&15]+y[C>>>12&15]+y[C>>>8&15]+y[C>>>4&15]+y[15&C]+y[U>>>28&15]+y[U>>>24&15]+y[U>>>20&15]+y[U>>>16&15]+y[U>>>12&15]+y[U>>>8&15]+y[U>>>4&15]+y[15&U]+y[re>>>28&15]+y[re>>>24&15]+y[re>>>20&15]+y[re>>>16&15]+y[re>>>12&15]+y[re>>>8&15]+y[re>>>4&15]+y[15&re]+y[K>>>28&15]+y[K>>>24&15]+y[K>>>20&15]+y[K>>>16&15]+y[K>>>12&15]+y[K>>>8&15]+y[K>>>4&15]+y[15&K]+y[L>>>28&15]+y[L>>>24&15]+y[L>>>20&15]+y[L>>>16&15]+y[L>>>12&15]+y[L>>>8&15]+y[L>>>4&15]+y[15&L]+y[F>>>28&15]+y[F>>>24&15]+y[F>>>20&15]+y[F>>>16&15]+y[F>>>12&15]+y[F>>>8&15]+y[F>>>4&15]+y[15&F]+y[ee>>>28&15]+y[ee>>>24&15]+y[ee>>>20&15]+y[ee>>>16&15]+y[ee>>>12&15]+y[ee>>>8&15]+y[ee>>>4&15]+y[15&ee];return this.is224||(he+=y[X>>>28&15]+y[X>>>24&15]+y[X>>>20&15]+y[X>>>16&15]+y[X>>>12&15]+y[X>>>8&15]+y[X>>>4&15]+y[15&X]),he},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var C=this.h0,U=this.h1,re=this.h2,K=this.h3,L=this.h4,F=this.h5,ee=this.h6,X=this.h7,he=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,U>>>24&255,U>>>16&255,U>>>8&255,255&U,re>>>24&255,re>>>16&255,re>>>8&255,255&re,K>>>24&255,K>>>16&255,K>>>8&255,255&K,L>>>24&255,L>>>16&255,L>>>8&255,255&L,F>>>24&255,F>>>16&255,F>>>8&255,255&F,ee>>>24&255,ee>>>16&255,ee>>>8&255,255&ee];return this.is224||he.push(X>>>24&255,X>>>16&255,X>>>8&255,255&X),he},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),U=new DataView(C);return U.setUint32(0,this.h0),U.setUint32(4,this.h1),U.setUint32(8,this.h2),U.setUint32(12,this.h3),U.setUint32(16,this.h4),U.setUint32(20,this.h5),U.setUint32(24,this.h6),this.is224||U.setUint32(28,this.h7),C},se.prototype=new P,se.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),P.prototype.finalize.call(this)}};var fe=w();fe.sha256=fe,fe.sha224=w(!0),fe.sha256.hmac=B(),fe.sha224.hmac=B(!0),c?zh.exports=fe:(s.sha256=fe.sha256,s.sha224=fe.sha224)})();yu.exports;yu.exports.sha224;var bg=yu.exports.sha256;function cd(r){return DS(r)}function kS(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),i=/^[0-9a-f]+$/.test(r);return s||i?r.length%2===0:!1}function NS(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function CS(r){return kS(r)?"hex":NS(r)?"b64":""}function MS(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)t[s/2]=parseInt(r.substring(s,s+2),16);return t}function RS(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const t=atob(r);return Uint8Array.from(t,s=>s.charCodeAt(0))}function DS(r){switch(CS(r)){case"hex":return MS(r);case"b64":return RS(r)}return null}function qS(r,t){const s=typeof r=="string"?cd(r):r,i=typeof t=="string"?cd(t):t;if(s===null||i===null||s.length!==i.length)return!1;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return!1;return!0}class Cb{constructor(t,s,i=!0){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=t,this.requestSubject=s,this.received=0,this.token=ps.next(),i&&(this.ctx=new Error)}}class LS extends Cb{constructor(s,i,l={maxWait:1e3}){super(s,i);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=ft(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,i){s?(this.ctx&&(s.stack+=`
33
+
34
+ ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Fn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Fn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Fn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class Mb extends Cb{constructor(s,i,l={timeout:1e3},c=!0){super(s,i,c);A(this,"deferred");A(this,"timer");this.deferred=ft(),this.timer=Qi(l.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
+
36
+ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||me.errorForCode(le.Cancelled))}}const BS="$JS.API";function US(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),mu({apiPrefix:BS,timeout:5e3},r)}class wo{constructor(t,s){A(this,"nc");A(this,"opts");A(this,"prefix");A(this,"timeout");A(this,"jc");this.nc=t,this.opts=US(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Vn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,s=null,i){i=i||{},i.timeout=this.timeout;let l=gn;s&&(l=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const m=Rd();for(let y=0;y<c;y++)try{const g=await this.nc.request(t,l,i);return this.parseJsResponse(g)}catch(g){const f=g;if((f.code==="503"||f.code===le.Timeout)&&y+1<c)await Zi(m.backoff(y));else throw g}}async findStream(t){const s={subject:t},l=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const s=this.jc.decode(t.data),i=s;if(i.error){const l=Nb(i.error.code,i.error.description);if(l!==null)throw l.api_error=i.error,l}return s}}class lo{constructor(t,s,i,l){A(this,"err");A(this,"offset");A(this,"pageInfo");A(this,"subject");A(this,"jsm");A(this,"filter");A(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const s=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=s;const i=this.countResponse(s);return i===0?[]:(this.offset+=i,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(t){var s,i,l;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=t.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=t.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((l=t.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const s of t)yield s;t=await this.next()}}}function Vs(r=""){const t=r.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${r}' is not a semver value`)}function ud(r,t){return r.major<t.major?-1:r.major>t.major?1:r.minor<t.minor?-1:r.minor>t.minor?1:r.micro<t.micro?-1:r.micro>t.micro?1:0}var $e;(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"})($e||($e={}));class PS{constructor(t){A(this,"server");A(this,"features");A(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=Vs(t)),this.server=t,this.set($e.JS_KV,"2.6.2"),this.set($e.JS_OBJECTSTORE,"2.6.3"),this.set($e.JS_PULL_MAX_BYTES,"2.8.3"),this.set($e.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set($e.JS_ALLOW_DIRECT,"2.9.0"),this.set($e.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set($e.JS_SIMPLIFICATION,"2.9.4"),this.set($e.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set($e.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set($e.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set($e.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set($e.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set($e.JS_STREAM_COMPRESSION,"2.10.0"),this.set($e.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set($e.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(t,s){this.features.set(t,{min:s,ok:ud(this.server,Vs(s))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var s;return((s=this.get(t))==null?void 0:s.ok)||!1}require(t){return typeof t=="string"&&(t=Vs(t)),ud(this.server,t)>=0}}class ru extends wo{constructor(t,s){super(t,s)}async add(t,s,i=nu.Create){if(It(t),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 l={};l.config=s,l.stream_name=t,l.action=i,l.config.durable_name&&Gi(l.config.durable_name);const c=this.nc;let{min:m,ok:y}=c.features.get($e.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!y)throw new Error(`consumer 'name' requires server ${m}`);if(g)try{pu("name",g)}catch(v){const x=v.message,w=x.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${x.substring(w)}`):v}let f,d="";if(Array.isArray(s.filter_subjects)){const{min:v,ok:x}=c.features.get($e.JS_MULTIPLE_CONSUMER_FILTER);if(!x)throw new Error(`consumer 'filter_subjects' requires server ${v}`);y=!1}if(s.metadata){const{min:v,ok:x}=c.features.get($e.JS_STREAM_CONSUMER_METADATA);if(!x)throw new Error(`consumer 'metadata' requires server ${v}`)}if(y&&(d=s.name??s.durable_name??""),d!==""){let v=s.filter_subject??void 0;v===">"&&(v=void 0),f=v!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${d}.${v}`:`${this.prefix}.CONSUMER.CREATE.${t}.${d}`}else f=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(f,l)}async update(t,s,i){const l=await this.info(t,s),c=i;return this.add(t,Object.assign(l.config,c),nu.Update)}async info(t,s){return It(t),Gi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${s}`)}async delete(t,s){return It(t),Gi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${s}`)).success}list(t){It(t);const s=l=>l.consumers,i=`${this.prefix}.CONSUMER.LIST.${t}`;return new lo(i,s,this)}pause(t,s,i){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${s}`,c={pause_until:i.toISOString()};return this._request(l,c)}resume(t,s){return this.pause(t,s,new Date(0))}}function qi(r,t,s=!1){if(s===!0&&!r)throw me.errorForCode(le.ApiError,new Error(`${t} is not a function`));if(r&&typeof r!="function")throw me.errorForCode(le.ApiError,new Error(`${t} is not a function`))}class zS extends Ct{constructor(s,i,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");qi(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&qi(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(qi(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(qi(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(qi(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&qi(l.cleanupFn,"cleanupFn");let c=(d,b)=>{this.callback(d,b)};if(l.callback){const d=l.callback;c=(b,v)=>{const[x,w]=this.adapter(b,v);if(x){d(x,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(d(x,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:m,queue:y,timeout:g}=l,f={queue:y,timeout:g,callback:c};m&&m>0&&(f.max=m),this.sub=s.subscribe(i,f),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=ft(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async d=>{await d.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,i){this.sub.cancelTimeout();const[l,c]=this.adapter(s,i);l&&this.stop(l),c&&this.push(c)}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 pn;function IS(r){pn=r}function Rb(){return pn!==void 0&&pn.defaultPort!==void 0?pn.defaultPort:4222}function Ih(){return pn!==void 0&&pn.urlParseFn?pn.urlParseFn:void 0}function $S(){if(!pn||typeof pn.factory!="function")throw new Error("transport fn is not set");return pn.factory()}function fd(){return pn!==void 0&&pn.dnsResolveFn?pn.dnsResolveFn:void 0}const Vc=`\r
37
+ `,su=Ji.fromAscii(Vc),HS=new Uint8Array(su)[0],GS=new Uint8Array(su)[1];function FS(r){for(let t=0;t<r.length;t++){const s=t+1;if(r.byteLength>s&&r[t]===HS&&r[s]===GS)return s+1}return 0}function VS(r){const t=FS(r);if(t>0){const i=new Uint8Array(r).slice(0,t);return mn.decode(i)}return""}const YS=4,Db=48,KS=65,QS=97;function XS(r,t,s,i){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((m,y)=>{l[y]=m}),l[12]=r,l[13]=t,l[14]=s,l[15]=i,l}function hd(r){return JS(r)!==void 0}function JS(r){for(let t=0;t<r.length;t++)switch(r[t]){case".":return qb(r);case":":return ZS(r)}}function qb(r){const t=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:i,c:l,ok:c}=WS(r);if(!c||i>255)return;r=r.substring(l),t[s]=i}return XS(t[0],t[1],t[2],t[3])}function ZS(r){const t=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return t;let i=0;for(;i<16;){const{n:l,c,ok:m}=eE(r);if(!m||l>65535)return;if(c<r.length&&r[c]==="."){if(s<0&&i!=12||i+4>16)return;const y=qb(r);if(y===void 0)return;t[i]=y[12],t[i+1]=y[13],t[i+2]=y[14],t[i+3]=y[15],r="",i+=YS;break}if(t[i]=l>>8,t[i+1]=l,i+=2,r=r.substring(c),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=i,r=r.substring(1),r.length===0)break}}if(r.length===0){if(i<16){if(s<0)return;const l=16-i;for(let c=i-1;c>=s;c--)t[c+l]=t[c];for(let c=s+l-1;c>=s;c--)t[c]=0}else if(s>=0)return;return t}}function WS(r){let t=0,s=0;for(t=0;t<r.length&&48<=r.charCodeAt(t)&&r.charCodeAt(t)<=57;t++)if(s=s*10+(r.charCodeAt(t)-Db),s>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:s,c:t,ok:!0}}function eE(r){let t=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)t*=16,t+=r.charCodeAt(s)-Db;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)t*=16,t+=r.charCodeAt(s)-QS+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)t*=16,t+=r.charCodeAt(s)-KS+10;else break;if(t>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:t,c:s,ok:!0}}function tE(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function dd(r){return!tE(r)}function nE(r){const t="::FFFF:",s=r.toUpperCase().indexOf(t);if(s!==-1&&r.indexOf(".")!==-1){let i=r.substring(s+t.length);return i=i.replace("[",""),i.replace("]","")}return r}function rE(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=nE(r),dd(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const t=dd(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,i=s===80?"https":"http",l=new URL(`${i}://${r}`);l.port=`${s}`;let c=l.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:l.host,hostname:c,port:s}}class ho{constructor(t,s=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=t,this.tlsName="";const i=rE(t);this.listen=i.listen,this.hostname=i.hostname,this.port=i.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const s=[];if(hd(this.hostname))return[this];{const i=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const l of i){const c=this.port===80?"https":"http",m=new URL(`${c}://${dd(l)?"["+l+"]":l}`);m.port=`${this.port}`;const y=new ho(m.host,!1);y.tlsName=this.hostname,s.push(y)}}return t.randomize&&Tb(s),this.resolves=s,s}}class sE{constructor(t=[],s={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=Ih();t&&(t.forEach(l=>{l=i?i(l):l,this.servers.push(new ho(l))}),this.randomize&&(this.servers=Tb(this.servers))),this.servers.length===0&&this.addServer(`${rd}:${Rb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();hd(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,s=!1){const i=Ih();t=i?i(t):t;const l=new ho(t,s);hd(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const s=this.servers.indexOf(t);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(t,s){const i=[];let l=[];const c=Ih(),m=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,s):g;const f=new ho(g,!0);m.set(g,f)});const y=[];return this.servers.forEach((g,f)=>{const d=g.listen;g.gossiped&&this.currentServer.listen!==d&&m.get(d)===void 0&&y.push(f),m.delete(d)}),y.reverse(),y.forEach(g=>{const f=this.servers.splice(g,1);l=l.concat(f[0].listen)}),m.forEach((g,f)=>{this.servers.push(g),i.push(f)}),{added:i,deleted:l}}}class iE{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Ar(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const s=t.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,s){if(s&&s.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const l=this.all().find(c=>c.requestSubject===i.subject);if(l)return l.resolver(s,{}),!0}}return!1}dispatcher(){return(t,s)=>{const i=this.getToken(s);if(i){const l=this.get(i);l&&(t===null&&s.headers&&(t=kb(s)),l.resolver(t,s))}}}close(){const t=me.errorForCode(le.Timeout);this.reqs.forEach(s=>{s.resolver(t,{})})}}class aE{constructor(t,s,i){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(this,"pendings");this.ph=t,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Hi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=ft();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class oE extends Error{constructor(t){super(t),this.name="AssertionError"}}function lE(r,t="Assertion failed."){if(!r)throw new oE(t)}const vg=32*1024,$h=2**32-2;function Jl(r,t,s=0){const i=t.byteLength-s;return r.byteLength>i&&(r=r.subarray(0,i)),t.set(r,s),r.byteLength}class Hh{constructor(t){A(this,"_buf");A(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.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(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const s=this._buf.byteLength;return t<=this.capacity-s?(this._reslice(s+t),s):-1}_reslice(t){lE(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const s=Jl(this._buf.subarray(this._off),t);return this._off+=s,s}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Ys.encode(t))}write(t){const s=this._grow(t.byteLength);return Jl(t,this._buf,s)}_grow(t){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(t);if(i>=0)return i;const l=this.capacity;if(t<=Math.floor(l/2)-s)Jl(this._buf.subarray(this._off),this._buf);else{if(l+t>$h)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*l+t,$h));Jl(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+t,$h)),s}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const s=this._grow(t);this._reslice(s)}readFrom(t){let s=0;const i=new Uint8Array(vg);for(;;){const l=this.capacity-this.length<vg,c=l?i:new Uint8Array(this._buf.buffer,this.length),m=t.read(c);if(m===null)return s;l?this.write(c.subarray(0,m)):this._reslice(this.length+m),s+=m}}}var $t;(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"})($t||($t={}));function xg(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const cE=48;class _g{constructor(t){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=t,this.state=ce.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let s;for(s=0;s<t.length;s++){const i=t[s];switch(this.state){case ce.OP_START:switch(i){case ue.M:case ue.m:this.state=ce.OP_M,this.hdr=-1,this.ma=xg();break;case ue.H:case ue.h:this.state=ce.OP_H,this.hdr=0,this.ma=xg();break;case ue.P:case ue.p:this.state=ce.OP_P;break;case ue.PLUS:this.state=ce.OP_PLUS;break;case ue.MINUS:this.state=ce.OP_MINUS;break;case ue.I:case ue.i:this.state=ce.OP_I;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_H:switch(i){case ue.M:case ue.m:this.state=ce.OP_M;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_M:switch(i){case ue.S:case ue.s:this.state=ce.OP_MS;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_MS:switch(i){case ue.G:case ue.g:this.state=ce.OP_MSG;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_MSG:switch(i){case ue.SPACE:case ue.TAB:this.state=ce.OP_MSG_SPC;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_MSG_SPC:switch(i){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.MSG_ARG,this.as=s}break;case ce.MSG_ARG:switch(i){case ue.CR:this.drop=1;break;case ue.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,s-this.drop);this.processMsgArgs(l),this.drop=0,this.as=s+1,this.state=ce.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case ce.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:$t.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ce.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const c=t.length-s;c<l&&(l=c),l>0?(this.msgBuf.write(t.subarray(s,s+l)),s=s+l-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:$t.MSG,msg:this.ma,data:t.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ce.MSG_END);break;case ce.MSG_END:switch(i){case ue.NL:this.drop=0,this.as=s+1,this.state=ce.OP_START;break;default:continue}break;case ce.OP_PLUS:switch(i){case ue.O:case ue.o:this.state=ce.OP_PLUS_O;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_PLUS_O:switch(i){case ue.K:case ue.k:this.state=ce.OP_PLUS_OK;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_PLUS_OK:switch(i){case ue.NL:this.dispatcher.push({kind:$t.OK}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_MINUS:switch(i){case ue.E:case ue.e:this.state=ce.OP_MINUS_E;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_MINUS_E:switch(i){case ue.R:case ue.r:this.state=ce.OP_MINUS_ER;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_MINUS_ER:switch(i){case ue.R:case ue.r:this.state=ce.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_MINUS_ERR:switch(i){case ue.SPACE:case ue.TAB:this.state=ce.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_MINUS_ERR_SPC:switch(i){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.MINUS_ERR_ARG,this.as=s}break;case ce.MINUS_ERR_ARG:switch(i){case ue.CR:this.drop=1;break;case ue.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:$t.ERR,data:l}),this.drop=0,this.as=s+1,this.state=ce.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case ce.OP_P:switch(i){case ue.I:case ue.i:this.state=ce.OP_PI;break;case ue.O:case ue.o:this.state=ce.OP_PO;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_PO:switch(i){case ue.N:case ue.n:this.state=ce.OP_PON;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_PON:switch(i){case ue.G:case ue.g:this.state=ce.OP_PONG;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_PONG:switch(i){case ue.NL:this.dispatcher.push({kind:$t.PONG}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_PI:switch(i){case ue.N:case ue.n:this.state=ce.OP_PIN;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_PIN:switch(i){case ue.G:case ue.g:this.state=ce.OP_PING;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_PING:switch(i){case ue.NL:this.dispatcher.push({kind:$t.PING}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_I:switch(i){case ue.N:case ue.n:this.state=ce.OP_IN;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_IN:switch(i){case ue.F:case ue.f:this.state=ce.OP_INF;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_INF:switch(i){case ue.O:case ue.o:this.state=ce.OP_INFO;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_INFO:switch(i){case ue.SPACE:case ue.TAB:this.state=ce.OP_INFO_SPC;break;default:throw this.fail(t.subarray(s))}break;case ce.OP_INFO_SPC:switch(i){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.INFO_ARG,this.as=s}break;case ce.INFO_ARG:switch(i){case ue.CR:this.drop=1;break;case ue.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:$t.INFO,data:l}),this.drop=0,this.as=s+1,this.state=ce.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(t.subarray(s))}}(this.state===ce.MSG_ARG||this.state===ce.MINUS_ERR_ARG||this.state===ce.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Hh(t.subarray(this.as,s-this.drop))),this.state===ce.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Hh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(t+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,t),this.argBuf=new Hh(i),this.ma.subject=i.subarray(0,t),this.ma.reply&&(this.ma.reply=i.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const s=[];let i=-1;for(let l=0;l<t.length;l++)switch(t[l]){case ue.SPACE:case ue.TAB:case ue.CR:case ue.NL:i>=0&&(s.push(t.subarray(i,l)),i=-1);break;default:i<0&&(i=l)}switch(i>=0&&s.push(t.subarray(i)),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(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${mn.decode(t)}`)}processHeaderMsgArgs(t){const s=[];let i=-1;for(let l=0;l<t.length;l++)switch(t[l]){case ue.SPACE:case ue.TAB:case ue.CR:case ue.NL:i>=0&&(s.push(t.subarray(i,l)),i=-1);break;default:i<0&&(i=l)}switch(i>=0&&s.push(t.subarray(i)),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(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let s=0;for(let i=0;i<t.length;i++){if(t[i]<48||t[i]>57)return-1;s=s*10+(t[i]-cE)}return s}}var ce;(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"})(ce||(ce={}));var ue;(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"})(ue||(ue={}));(function(r){var t=function(O,k){this.hi=O|0,this.lo=k|0},s=function(O){var k,T=new Float64Array(16);if(O)for(k=0;k<O.length;k++)T[k]=O[k];return T},i=function(){throw new Error("no PRNG")},l=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var m=s(),y=s([1]),g=s([56129,1]),f=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),x=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(O,k){return O<<k|O>>>32-k}function S(O,k){var T=O[k+3]&255;return T=T<<8|O[k+2]&255,T=T<<8|O[k+1]&255,T<<8|O[k+0]&255}function M(O,k){var T=O[k]<<24|O[k+1]<<16|O[k+2]<<8|O[k+3],N=O[k+4]<<24|O[k+5]<<16|O[k+6]<<8|O[k+7];return new t(T,N)}function B(O,k,T){var N;for(N=0;N<4;N++)O[k+N]=T&255,T>>>=8}function P(O,k,T){O[k]=T.hi>>24&255,O[k+1]=T.hi>>16&255,O[k+2]=T.hi>>8&255,O[k+3]=T.hi&255,O[k+4]=T.lo>>24&255,O[k+5]=T.lo>>16&255,O[k+6]=T.lo>>8&255,O[k+7]=T.lo&255}function se(O,k,T,N,D){var I,te=0;for(I=0;I<D;I++)te|=O[k+I]^T[N+I];return(1&te-1>>>8)-1}function fe(O,k,T,N){return se(O,k,T,N,16)}function C(O,k,T,N){return se(O,k,T,N,32)}function U(O,k,T,N,D){var I=new Uint32Array(16),te=new Uint32Array(16),ie=new Uint32Array(16),V=new Uint32Array(4),W,pe,Re;for(W=0;W<4;W++)te[5*W]=S(N,4*W),te[1+W]=S(T,4*W),te[6+W]=S(k,4*W),te[11+W]=S(T,16+4*W);for(W=0;W<16;W++)ie[W]=te[W];for(W=0;W<20;W++){for(pe=0;pe<4;pe++){for(Re=0;Re<4;Re++)V[Re]=te[(5*pe+4*Re)%16];for(V[1]^=w(V[0]+V[3]|0,7),V[2]^=w(V[1]+V[0]|0,9),V[3]^=w(V[2]+V[1]|0,13),V[0]^=w(V[3]+V[2]|0,18),Re=0;Re<4;Re++)I[4*pe+(pe+Re)%4]=V[Re]}for(Re=0;Re<16;Re++)te[Re]=I[Re]}if(D){for(W=0;W<16;W++)te[W]=te[W]+ie[W]|0;for(W=0;W<4;W++)te[5*W]=te[5*W]-S(N,4*W)|0,te[6+W]=te[6+W]-S(k,4*W)|0;for(W=0;W<4;W++)B(O,4*W,te[5*W]),B(O,16+4*W,te[6+W])}else for(W=0;W<16;W++)B(O,4*W,te[W]+ie[W]|0)}function re(O,k,T,N){return U(O,k,T,N,!1),0}function K(O,k,T,N){return U(O,k,T,N,!0),0}var L=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function F(O,k,T,N,D,I,te){var ie=new Uint8Array(16),V=new Uint8Array(64),W,pe;if(!D)return 0;for(pe=0;pe<16;pe++)ie[pe]=0;for(pe=0;pe<8;pe++)ie[pe]=I[pe];for(;D>=64;){for(re(V,ie,te,L),pe=0;pe<64;pe++)O[k+pe]=(T?T[N+pe]:0)^V[pe];for(W=1,pe=8;pe<16;pe++)W=W+(ie[pe]&255)|0,ie[pe]=W&255,W>>>=8;D-=64,k+=64,T&&(N+=64)}if(D>0)for(re(V,ie,te,L),pe=0;pe<D;pe++)O[k+pe]=(T?T[N+pe]:0)^V[pe];return 0}function ee(O,k,T,N,D){return F(O,k,null,0,T,N,D)}function X(O,k,T,N,D){var I=new Uint8Array(32);return K(I,N,D,L),ee(O,k,T,N.subarray(16),I)}function he(O,k,T,N,D,I,te){var ie=new Uint8Array(32);return K(ie,I,te,L),F(O,k,T,N,D,I.subarray(16),ie)}function ve(O,k){var T,N=0;for(T=0;T<17;T++)N=N+(O[T]+k[T]|0)|0,O[T]=N&255,N>>>=8}var Te=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(O,k,T,N,D,I){var te,ie,V,W,pe=new Uint32Array(17),Re=new Uint32Array(17),it=new Uint32Array(17),Ut=new Uint32Array(17),Bn=new Uint32Array(17);for(V=0;V<17;V++)Re[V]=it[V]=0;for(V=0;V<16;V++)Re[V]=I[V];for(Re[3]&=15,Re[4]&=252,Re[7]&=15,Re[8]&=252,Re[11]&=15,Re[12]&=252,Re[15]&=15;D>0;){for(V=0;V<17;V++)Ut[V]=0;for(V=0;V<16&&V<D;++V)Ut[V]=T[N+V];for(Ut[V]=1,N+=V,D-=V,ve(it,Ut),ie=0;ie<17;ie++)for(pe[ie]=0,V=0;V<17;V++)pe[ie]=pe[ie]+it[V]*(V<=ie?Re[ie-V]:320*Re[ie+17-V]|0)|0|0;for(ie=0;ie<17;ie++)it[ie]=pe[ie];for(W=0,V=0;V<16;V++)W=W+it[V]|0,it[V]=W&255,W>>>=8;for(W=W+it[16]|0,it[16]=W&3,W=5*(W>>>2)|0,V=0;V<16;V++)W=W+it[V]|0,it[V]=W&255,W>>>=8;W=W+it[16]|0,it[16]=W}for(V=0;V<17;V++)Bn[V]=it[V];for(ve(it,Te),te=-(it[16]>>>7)|0,V=0;V<17;V++)it[V]^=te&(Bn[V]^it[V]);for(V=0;V<16;V++)Ut[V]=I[V+16];for(Ut[16]=0,ve(it,Ut),V=0;V<16;V++)O[k+V]=it[V];return 0}function ae(O,k,T,N,D,I){var te=new Uint8Array(16);return Y(te,0,T,N,D,I),fe(O,k,te,0)}function de(O,k,T,N,D){var I;if(T<32)return-1;for(he(O,0,k,0,T,N,D),Y(O,16,O,32,T-32,O),I=0;I<16;I++)O[I]=0;return 0}function Oe(O,k,T,N,D){var I,te=new Uint8Array(32);if(T<32||(X(te,0,32,N,D),ae(k,16,k,32,T-32,te)!==0))return-1;for(he(O,0,k,0,T,N,D),I=0;I<32;I++)O[I]=0;return 0}function we(O,k){var T;for(T=0;T<16;T++)O[T]=k[T]|0}function Ne(O){var k,T;for(T=0;T<16;T++)O[T]+=65536,k=Math.floor(O[T]/65536),O[(T+1)*(T<15?1:0)]+=k-1+37*(k-1)*(T===15?1:0),O[T]-=k*65536}function Ae(O,k,T){for(var N,D=~(T-1),I=0;I<16;I++)N=D&(O[I]^k[I]),O[I]^=N,k[I]^=N}function ke(O,k){var T,N,D,I=s(),te=s();for(T=0;T<16;T++)te[T]=k[T];for(Ne(te),Ne(te),Ne(te),N=0;N<2;N++){for(I[0]=te[0]-65517,T=1;T<15;T++)I[T]=te[T]-65535-(I[T-1]>>16&1),I[T-1]&=65535;I[15]=te[15]-32767-(I[14]>>16&1),D=I[15]>>16&1,I[14]&=65535,Ae(te,I,1-D)}for(T=0;T<16;T++)O[2*T]=te[T]&255,O[2*T+1]=te[T]>>8}function et(O,k){var T=new Uint8Array(32),N=new Uint8Array(32);return ke(T,O),ke(N,k),C(T,0,N,0)}function oe(O){var k=new Uint8Array(32);return ke(k,O),k[0]&1}function Ie(O,k){var T;for(T=0;T<16;T++)O[T]=k[2*T]+(k[2*T+1]<<8);O[15]&=32767}function tt(O,k,T){var N;for(N=0;N<16;N++)O[N]=k[N]+T[N]|0}function yt(O,k,T){var N;for(N=0;N<16;N++)O[N]=k[N]-T[N]|0}function je(O,k,T){var N,D,I=new Float64Array(31);for(N=0;N<31;N++)I[N]=0;for(N=0;N<16;N++)for(D=0;D<16;D++)I[N+D]+=k[N]*T[D];for(N=0;N<15;N++)I[N]+=38*I[N+16];for(N=0;N<16;N++)O[N]=I[N];Ne(O),Ne(O)}function Lt(O,k){je(O,k,k)}function gs(O,k){var T=s(),N;for(N=0;N<16;N++)T[N]=k[N];for(N=253;N>=0;N--)Lt(T,T),N!==2&&N!==4&&je(T,T,k);for(N=0;N<16;N++)O[N]=T[N]}function Qs(O,k){var T=s(),N;for(N=0;N<16;N++)T[N]=k[N];for(N=250;N>=0;N--)Lt(T,T),N!==1&&je(T,T,k);for(N=0;N<16;N++)O[N]=T[N]}function bs(O,k,T){var N=new Uint8Array(32),D=new Float64Array(80),I,te,ie=s(),V=s(),W=s(),pe=s(),Re=s(),it=s();for(te=0;te<31;te++)N[te]=k[te];for(N[31]=k[31]&127|64,N[0]&=248,Ie(D,T),te=0;te<16;te++)V[te]=D[te],pe[te]=ie[te]=W[te]=0;for(ie[0]=pe[0]=1,te=254;te>=0;--te)I=N[te>>>3]>>>(te&7)&1,Ae(ie,V,I),Ae(W,pe,I),tt(Re,ie,W),yt(ie,ie,W),tt(W,V,pe),yt(V,V,pe),Lt(pe,Re),Lt(it,ie),je(ie,W,ie),je(W,V,Re),tt(Re,ie,W),yt(ie,ie,W),Lt(V,ie),yt(W,pe,it),je(ie,W,g),tt(ie,ie,pe),je(W,W,ie),je(ie,pe,it),je(pe,V,D),Lt(V,Re),Ae(ie,V,I),Ae(W,pe,I);for(te=0;te<16;te++)D[te+16]=ie[te],D[te+32]=W[te],D[te+48]=V[te],D[te+64]=pe[te];var Ut=D.subarray(32),Bn=D.subarray(16);return gs(Ut,Ut),je(Bn,Bn,Ut),ke(O,Bn),0}function _n(O,k){return bs(O,k,c)}function Xs(O,k){return i(k,32),_n(O,k)}function Nr(O,k,T){var N=new Uint8Array(32);return bs(N,T,k),K(O,l,N,L)}var ko=de,No=Oe;function ta(O,k,T,N,D,I){var te=new Uint8Array(32);return Nr(te,D,I),ko(O,k,T,N,te)}function na(O,k,T,N,D,I){var te=new Uint8Array(32);return Nr(te,D,I),No(O,k,T,N,te)}function rr(){var O=0,k=0,T=0,N=0,D=65535,I,te,ie;for(ie=0;ie<arguments.length;ie++)I=arguments[ie].lo,te=arguments[ie].hi,O+=I&D,k+=I>>>16,T+=te&D,N+=te>>>16;return k+=O>>>16,T+=k>>>16,N+=T>>>16,new t(T&D|N<<16,O&D|k<<16)}function Co(O,k){return new t(O.hi>>>k,O.lo>>>k|O.hi<<32-k)}function Js(){var O=0,k=0,T;for(T=0;T<arguments.length;T++)O^=arguments[T].lo,k^=arguments[T].hi;return new t(k,O)}function lt(O,k){var T,N,D=32-k;return k<32?(T=O.hi>>>k|O.lo<<D,N=O.lo>>>k|O.hi<<D):k<64&&(T=O.lo>>>k|O.hi<<D,N=O.hi>>>k|O.lo<<D),new t(T,N)}function Eu(O,k,T){var N=O.hi&k.hi^~O.hi&T.hi,D=O.lo&k.lo^~O.lo&T.lo;return new t(N,D)}function Mo(O,k,T){var N=O.hi&k.hi^O.hi&T.hi^k.hi&T.hi,D=O.lo&k.lo^O.lo&T.lo^k.lo&T.lo;return new t(N,D)}function Ro(O){return Js(lt(O,28),lt(O,34),lt(O,39))}function Zs(O){return Js(lt(O,14),lt(O,18),lt(O,41))}function Ou(O){return Js(lt(O,1),lt(O,8),Co(O,7))}function Do(O){return Js(lt(O,19),lt(O,61),Co(O,6))}var Au=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function qo(O,k,T){var N=[],D=[],I=[],te=[],ie,V,W;for(V=0;V<8;V++)N[V]=I[V]=M(O,8*V);for(var pe=0;T>=128;){for(V=0;V<16;V++)te[V]=M(k,8*V+pe);for(V=0;V<80;V++){for(W=0;W<8;W++)D[W]=I[W];for(ie=rr(I[7],Zs(I[4]),Eu(I[4],I[5],I[6]),Au[V],te[V%16]),D[7]=rr(ie,Ro(I[0]),Mo(I[0],I[1],I[2])),D[3]=rr(D[3],ie),W=0;W<8;W++)I[(W+1)%8]=D[W];if(V%16===15)for(W=0;W<16;W++)te[W]=rr(te[W],te[(W+9)%16],Ou(te[(W+1)%16]),Do(te[(W+14)%16]))}for(V=0;V<8;V++)I[V]=rr(I[V],N[V]),N[V]=I[V];pe+=128,T-=128}for(V=0;V<8;V++)P(O,8*V,N[V]);return T}var vs=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 gt(O,k,T){var N=new Uint8Array(64),D=new Uint8Array(256),I,te=T;for(I=0;I<64;I++)N[I]=vs[I];for(qo(N,k,T),T%=128,I=0;I<256;I++)D[I]=0;for(I=0;I<T;I++)D[I]=k[te-T+I];for(D[T]=128,T=256-128*(T<112?1:0),D[T-9]=0,P(D,T-8,new t(te/536870912|0,te<<3)),qo(N,D,T),I=0;I<64;I++)O[I]=N[I];return 0}function en(O,k){var T=s(),N=s(),D=s(),I=s(),te=s(),ie=s(),V=s(),W=s(),pe=s();yt(T,O[1],O[0]),yt(pe,k[1],k[0]),je(T,T,pe),tt(N,O[0],O[1]),tt(pe,k[0],k[1]),je(N,N,pe),je(D,O[3],k[3]),je(D,D,d),je(I,O[2],k[2]),tt(I,I,I),yt(te,N,T),yt(ie,I,D),tt(V,I,D),tt(W,N,T),je(O[0],te,ie),je(O[1],W,V),je(O[2],V,ie),je(O[3],te,W)}function Bt(O,k,T){var N;for(N=0;N<4;N++)Ae(O[N],k[N],T)}function ra(O,k){var T=s(),N=s(),D=s();gs(D,k[2]),je(T,k[0],D),je(N,k[1],D),ke(O,N),O[31]^=oe(T)<<7}function sa(O,k,T){var N,D;for(we(O[0],m),we(O[1],y),we(O[2],y),we(O[3],m),D=255;D>=0;--D)N=T[D/8|0]>>(D&7)&1,Bt(O,k,N),en(k,O),en(O,O),Bt(O,k,N)}function Ws(O,k){var T=[s(),s(),s(),s()];we(T[0],b),we(T[1],v),we(T[2],y),je(T[3],b,v),sa(O,T,k)}function Cr(O,k,T){var N=new Uint8Array(64),D=[s(),s(),s(),s()],I;for(T||i(k,32),gt(N,k,32),N[0]&=248,N[31]&=127,N[31]|=64,Ws(D,N),ra(O,D),I=0;I<32;I++)k[I+32]=O[I];return 0}var sr=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 Mr(O,k){var T,N,D,I;for(N=63;N>=32;--N){for(T=0,D=N-32,I=N-12;D<I;++D)k[D]+=T-16*k[N]*sr[D-(N-32)],T=Math.floor((k[D]+128)/256),k[D]-=T*256;k[D]+=T,k[N]=0}for(T=0,D=0;D<32;D++)k[D]+=T-(k[31]>>4)*sr[D],T=k[D]>>8,k[D]&=255;for(D=0;D<32;D++)k[D]-=T*sr[D];for(N=0;N<32;N++)k[N+1]+=k[N]>>8,O[N]=k[N]&255}function qn(O){var k=new Float64Array(64),T;for(T=0;T<64;T++)k[T]=O[T];for(T=0;T<64;T++)O[T]=0;Mr(O,k)}function xs(O,k,T,N){var D=new Uint8Array(64),I=new Uint8Array(64),te=new Uint8Array(64),ie,V,W=new Float64Array(64),pe=[s(),s(),s(),s()];gt(D,N,32),D[0]&=248,D[31]&=127,D[31]|=64;var Re=T+64;for(ie=0;ie<T;ie++)O[64+ie]=k[ie];for(ie=0;ie<32;ie++)O[32+ie]=D[32+ie];for(gt(te,O.subarray(32),T+32),qn(te),Ws(pe,te),ra(O,pe),ie=32;ie<64;ie++)O[ie]=N[ie];for(gt(I,O,T+64),qn(I),ie=0;ie<64;ie++)W[ie]=0;for(ie=0;ie<32;ie++)W[ie]=te[ie];for(ie=0;ie<32;ie++)for(V=0;V<32;V++)W[ie+V]+=I[ie]*D[V];return Mr(O.subarray(32),W),Re}function _s(O,k){var T=s(),N=s(),D=s(),I=s(),te=s(),ie=s(),V=s();return we(O[2],y),Ie(O[1],k),Lt(D,O[1]),je(I,D,f),yt(D,D,O[2]),tt(I,O[2],I),Lt(te,I),Lt(ie,te),je(V,ie,te),je(T,V,D),je(T,T,I),Qs(T,T),je(T,T,D),je(T,T,I),je(T,T,I),je(O[0],T,I),Lt(N,O[0]),je(N,N,I),et(N,D)&&je(O[0],O[0],x),Lt(N,O[0]),je(N,N,I),et(N,D)?-1:(oe(O[0])===k[31]>>7&&yt(O[0],m,O[0]),je(O[3],O[0],O[1]),0)}function ia(O,k,T,N){var D,I=new Uint8Array(32),te=new Uint8Array(64),ie=[s(),s(),s(),s()],V=[s(),s(),s(),s()];if(T<64||_s(V,N))return-1;for(D=0;D<T;D++)O[D]=k[D];for(D=0;D<32;D++)O[D+32]=N[D];if(gt(te,O,T),qn(te),sa(ie,V,te),Ws(V,k.subarray(32)),en(ie,V),ra(I,ie),T-=64,C(k,0,I,0)){for(D=0;D<T;D++)O[D]=0;return-1}for(D=0;D<T;D++)O[D]=k[D+64];return T}var ei=32,Rr=24,Ln=32,Dr=16,qr=32,ws=32,Lr=32,ir=32,Ss=32,aa=Rr,Lo=Ln,Yn=Dr,nt=64,ht=32,tn=64,Es=32,oa=64;r.lowlevel={crypto_core_hsalsa20:K,crypto_stream_xor:he,crypto_stream:X,crypto_stream_salsa20_xor:F,crypto_stream_salsa20:ee,crypto_onetimeauth:Y,crypto_onetimeauth_verify:ae,crypto_verify_16:fe,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:Oe,crypto_scalarmult:bs,crypto_scalarmult_base:_n,crypto_box_beforenm:Nr,crypto_box_afternm:ko,crypto_box:ta,crypto_box_open:na,crypto_box_keypair:Xs,crypto_hash:gt,crypto_sign:xs,crypto_sign_keypair:Cr,crypto_sign_open:ia,crypto_secretbox_KEYBYTES:ei,crypto_secretbox_NONCEBYTES:Rr,crypto_secretbox_ZEROBYTES:Ln,crypto_secretbox_BOXZEROBYTES:Dr,crypto_scalarmult_BYTES:qr,crypto_scalarmult_SCALARBYTES:ws,crypto_box_PUBLICKEYBYTES:Lr,crypto_box_SECRETKEYBYTES:ir,crypto_box_BEFORENMBYTES:Ss,crypto_box_NONCEBYTES:aa,crypto_box_ZEROBYTES:Lo,crypto_box_BOXZEROBYTES:Yn,crypto_sign_BYTES:nt,crypto_sign_PUBLICKEYBYTES:ht,crypto_sign_SECRETKEYBYTES:tn,crypto_sign_SEEDBYTES:Es,crypto_hash_BYTES:oa,gf:s,D:f,L:sr,pack25519:ke,unpack25519:Ie,M:je,A:tt,S:Lt,Z:yt,pow2523:Qs,add:en,set25519:we,modL:Mr,scalarmult:sa,scalarbase:Ws};function Bo(O,k){if(O.length!==ei)throw new Error("bad key size");if(k.length!==Rr)throw new Error("bad nonce size")}function Uo(O,k){if(O.length!==Lr)throw new Error("bad public key size");if(k.length!==ir)throw new Error("bad secret key size")}function At(){for(var O=0;O<arguments.length;O++)if(!(arguments[O]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ti(O){for(var k=0;k<O.length;k++)O[k]=0}r.randomBytes=function(O){var k=new Uint8Array(O);return i(k,O),k},r.secretbox=function(O,k,T){At(O,k,T),Bo(T,k);for(var N=new Uint8Array(Ln+O.length),D=new Uint8Array(N.length),I=0;I<O.length;I++)N[I+Ln]=O[I];return de(D,N,N.length,k,T),D.subarray(Dr)},r.secretbox.open=function(O,k,T){At(O,k,T),Bo(T,k);for(var N=new Uint8Array(Dr+O.length),D=new Uint8Array(N.length),I=0;I<O.length;I++)N[I+Dr]=O[I];return N.length<32||Oe(D,N,N.length,k,T)!==0?null:D.subarray(Ln)},r.secretbox.keyLength=ei,r.secretbox.nonceLength=Rr,r.secretbox.overheadLength=Dr,r.scalarMult=function(O,k){if(At(O,k),O.length!==ws)throw new Error("bad n size");if(k.length!==qr)throw new Error("bad p size");var T=new Uint8Array(qr);return bs(T,O,k),T},r.scalarMult.base=function(O){if(At(O),O.length!==ws)throw new Error("bad n size");var k=new Uint8Array(qr);return _n(k,O),k},r.scalarMult.scalarLength=ws,r.scalarMult.groupElementLength=qr,r.box=function(O,k,T,N){var D=r.box.before(T,N);return r.secretbox(O,k,D)},r.box.before=function(O,k){At(O,k),Uo(O,k);var T=new Uint8Array(Ss);return Nr(T,O,k),T},r.box.after=r.secretbox,r.box.open=function(O,k,T,N){var D=r.box.before(T,N);return r.secretbox.open(O,k,D)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var O=new Uint8Array(Lr),k=new Uint8Array(ir);return Xs(O,k),{publicKey:O,secretKey:k}},r.box.keyPair.fromSecretKey=function(O){if(At(O),O.length!==ir)throw new Error("bad secret key size");var k=new Uint8Array(Lr);return _n(k,O),{publicKey:k,secretKey:new Uint8Array(O)}},r.box.publicKeyLength=Lr,r.box.secretKeyLength=ir,r.box.sharedKeyLength=Ss,r.box.nonceLength=aa,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(O,k){if(At(O,k),k.length!==tn)throw new Error("bad secret key size");var T=new Uint8Array(nt+O.length);return xs(T,O,O.length,k),T},r.sign.open=function(O,k){if(At(O,k),k.length!==ht)throw new Error("bad public key size");var T=new Uint8Array(O.length),N=ia(T,O,O.length,k);if(N<0)return null;for(var D=new Uint8Array(N),I=0;I<D.length;I++)D[I]=T[I];return D},r.sign.detached=function(O,k){for(var T=r.sign(O,k),N=new Uint8Array(nt),D=0;D<N.length;D++)N[D]=T[D];return N},r.sign.detached.verify=function(O,k,T){if(At(O,k,T),k.length!==nt)throw new Error("bad signature size");if(T.length!==ht)throw new Error("bad public key size");var N=new Uint8Array(nt+O.length),D=new Uint8Array(nt+O.length),I;for(I=0;I<nt;I++)N[I]=k[I];for(I=0;I<O.length;I++)N[I+nt]=O[I];return ia(D,N,N.length,T)>=0},r.sign.keyPair=function(){var O=new Uint8Array(ht),k=new Uint8Array(tn);return Cr(O,k),{publicKey:O,secretKey:k}},r.sign.keyPair.fromSecretKey=function(O){if(At(O),O.length!==tn)throw new Error("bad secret key size");for(var k=new Uint8Array(ht),T=0;T<k.length;T++)k[T]=O[32+T];return{publicKey:k,secretKey:new Uint8Array(O)}},r.sign.keyPair.fromSeed=function(O){if(At(O),O.length!==Es)throw new Error("bad seed size");for(var k=new Uint8Array(ht),T=new Uint8Array(tn),N=0;N<32;N++)T[N]=O[N];return Cr(k,T,!0),{publicKey:k,secretKey:T}},r.sign.publicKeyLength=ht,r.sign.secretKeyLength=tn,r.sign.seedLength=Es,r.sign.signatureLength=nt,r.hash=function(O){At(O);var k=new Uint8Array(oa);return gt(k,O,O.length),k},r.hash.hashLength=oa,r.verify=function(O,k){return At(O,k),O.length===0||k.length===0||O.length!==k.length?!1:se(O,0,k,0,O.length)===0},r.setPRNG=function(O){i=O},(function(){var O=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(O&&O.getRandomValues){var k=65536;r.setPRNG(function(T,N){var D,I=new Uint8Array(N);for(D=0;D<N;D+=k)O.getRandomValues(I.subarray(D,D+Math.min(N-D,k)));for(D=0;D<N;D++)T[D]=I[D];ti(I)})}else typeof require<"u"&&(O=require("crypto"),O&&O.randomBytes&&r.setPRNG(function(T,N){var D,I=O.randomBytes(N);for(D=0;D<N;D++)T[D]=I[D];ti(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Zl=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Zl.sign.keyPair.fromSeed,Zl.sign.detached,Zl.sign.detached.verify,Zl.randomBytes;var wg;(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"})(wg||(wg={}));var Sg;(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"})(Sg||(Sg={}));function uE(r){return t=>{let s={};return r.forEach(i=>{const l=i(t)||{};s=Object.assign(s,l)}),s}}function fE(){return()=>{}}function hE(r,t){return()=>{const s=typeof r=="function"?r():r,i=typeof t=="function"?t():t;return{user:s,pass:i}}}function dE(r){return()=>({auth_token:typeof r=="function"?r():r})}const Lb=120*1e3,mE=2,Bb=2*1e3;function pE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Lb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Bb,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function yE(r){const t=[];return typeof r.authenticator=="function"&&t.push(r.authenticator),Array.isArray(r.authenticator)&&t.push(...r.authenticator),r.token&&t.push(dE(r.token)),r.user&&t.push(hE(r.user,r.pass)),t.length===0?fE():uE(t)}function gE(r){const t=`${rd}:${Rb()}`;if(r=r||{servers:[t]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new me("port and servers options are mutually exclusive",le.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${rd}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[t]);const s=mu(pE(),r);if(s.authenticator=yE(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new me(`${i} option should be a function`,le.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let i=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return i&&(i++,i=Math.floor(Math.random()*i)),s.reconnectTimeWait+i}),s.inboxPrefix)try{Ar(s.inboxPrefix)}catch(i){throw new me(i.message,le.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof fd()=="function"),s.resolve&&typeof fd()!="function")throw new me("'resolve' is not supported on this client",le.InvalidOption);return s}function bE(r,t){const{proto:s,tls_required:i,tls_available:l}=r;if((s===void 0||s<1)&&t.noEcho)throw new me("noEcho",le.ServerOptionNotAvailable);const c=i||l||!1;if(t.tls&&!c)throw new me("tls",le.ServerOptionNotAvailable)}const vE=1024*32,xE=/^INFO\s+([^\r\n]+)\r\n/i,_E=uo(`PONG\r
38
+ `),Eg=uo(`PING\r
39
+ `);class wE{constructor(t,s,i){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.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 l=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};mu(this,l)}}class Ub extends Ct{constructor(s,i,l={}){var m;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");mu(this,l),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=ft();const c=!((m=s.options)!=null&&m.noAsyncTraces);l.timeout&&(this.timer=Qi(l.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(y=>{this.stop(y),this.noIterator&&this.callback(y,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,l=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,m=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(y,g)=>{const{ingest:f}=l(g);f&&c(g)&&(i(y,g),m(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,i){this.cancelTimeout(),s?this.stop(s):this.push(i)}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(me.errorForCode(le.ConnectionClosed)):this.isClosed()?Promise.reject(me.errorForCode(le.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(ft()).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 SE{constructor(){A(this,"mux");A(this,"subs");A(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const s=t.permissionContext,i=this.all();let l;if(s.operation==="subscription"&&(l=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(l=i.find(c=>c.requestSubject===s.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class iu{constructor(t,s){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=vE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=s,this.subscriptions=new SE,this.muxSubscriptions=new iE,this.outbound=new Ji,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new PS({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new sE(i,{randomize:!t.noRandomize}),this.closed=ft(),this.parser=new _g(this),this.heartbeats=new aE(this,this.options.pingInterval||Lb,this.options.maxPingOut||mE)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const s=me.errorForCode(le.Disconnect);s.stack="",t.forEach(i=>{i.reject(s)}),this.parser=new _g(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(s=>{s.push(t)})}status(){const t=new Ct;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=ft();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=s=>{t.reject(s)},this.transport=$S(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:Hi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Hi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:Or.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Or.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===le.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(t)}async dial(t){const s=this.prepare();let i;try{i=Qi(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(l){s.reject(l)}try{await Promise.race([i,s]),i&&i.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(l){throw i&&i.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:s}=this.options,i=await t.resolve({fn:fd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let l=null;for(const c of i)try{l=null,this.dispatchStatus({type:Hi.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(m){l=m}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Bb;let i=s;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:me.errorForCode(le.ConnectionRefused));const c=Date.now();if(l.lastConnect===0||l.lastConnect+s<=c){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(m){if(t=m,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const y=this.options.maxReconnectAttempts||0;y!==-1&&l.reconnects>=y&&this.servers.removeCurrentServer()}}else i=Math.min(i,l.lastConnect+s-c),await Zi(i)}}static async connect(t,s){const i=new iu(t,s);return await i.dialLoop(),i}static toError(t){const s=t?t.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new me(t,le.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){i.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new me(t,le.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new me(t,le.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new me(t,le.AccountExpired):s.indexOf("authentication timeout")!==-1?new me(t,le.AuthenticationTimeout):new me(t,le.ProtocolError)}processMsg(t,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(t.sid);i&&(i.received+=1,i.callback&&i.callback(null,new qd(t,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(t){const s=ag(t),i=iu.toError(s),l={type:Or.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){l.permissionContext=i.permissionContext;const m=this.subscriptions.getMux();c=(m==null?void 0:m.subject)===i.permissionContext.subject}this.subscriptions.handleError(i),this.muxSubscriptions.handleError(c,i),c&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(i)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(_E)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const s=JSON.parse(ag(t));this.info=s;const i=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Vs(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:m}=this.transport;try{const y=new wE({version:c,lang:m},this.options,s.nonce);s.headers&&(y.headers=!0,y.no_responders=!0);const g=JSON.stringify(y);this.transport.send(uo(`CONNECT ${g}${Vc}`)),this.transport.send(Eg)}catch(y){this._close(y)}}i&&this.dispatchStatus({type:Or.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Or.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case $t.MSG:{const{msg:s,data:i}=t;this.processMsg(s,i);break}case $t.OK:break;case $t.ERR:this.processError(t.data);break;case $t.PING:this.processPing();break;case $t.PONG:this.processPong();break;case $t.INFO:this.processInfo(t.data);break}}sendCommand(t,...s){const i=this.outbound.length();let l;typeof t=="string"?l=uo(t):l=t,this.outbound.fill(l,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,s=gn,i){let l;if(s instanceof Uint8Array)l=s;else if(typeof s=="string")l=Ys.encode(s);else throw me.errorForCode(le.BadPayload);let c=l.length;i=i||{},i.reply=i.reply||"";let m=gn,y=0;if(i.headers){if(this.info&&!this.info.headers)throw new me("headers",le.ServerOptionNotAvailable);m=i.headers.encode(),y=m.length,c=l.length+y}if(this.info&&c>this.info.max_payload)throw me.errorForCode(le.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${t} ${i.reply} ${y} ${c}\r
40
+ `:g=`HPUB ${t} ${y} ${c}\r
41
+ `,this.sendCommand(g,m,l,su)):(i.reply?g=`PUB ${t} ${i.reply} ${c}\r
42
+ `:g=`PUB ${t} ${c}\r
43
+ `,this.sendCommand(g,l,su))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
44
+ `):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
45
+ `)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,s){this.unsub(t,s),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,s){!t||this.isClosed()||(s?this.sendCommand(`UNSUB ${t.sid} ${s}\r
46
+ `):this.sendCommand(`UNSUB ${t.sid}\r
47
+ `),t.max=s)}resub(t,s){!t||this.isClosed()||(this.unsub(t),t.subject=s,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=ft()),this.pongs.push(t),this.outbound.fill(Eg),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?t.push(`SUB ${i.subject} ${i.queue} ${i.sid}${Vc}`):t.push(`SUB ${i.subject} ${i.sid}${Vc}`)}),t.length&&this.transport.send(uo(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),s=[];return t.forEach(i=>{s.push(i.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 t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new Ub(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const EE="$SRV";class Og{constructor(t){A(this,"msg");this.msg=t}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(t,s){return this.msg.respond(t,s)}respondError(t,s,i,l){var c,m;return l=l||{},l.headers=l.headers||jr(),(c=l.headers)==null||c.set(eu,`${t}`),(m=l.headers)==null||m.set(Wc,s),this.msg.respond(i,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class go{constructor(t,s="",i=""){A(this,"subject");A(this,"queue");A(this,"srv");s!==""&&AE("service group",s);let l="";if(t instanceof So)this.srv=t,l="";else if(t instanceof go){const c=t;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),l=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,s),this.queue=i}calcSubject(t,s=""){return s===""?t:t!==""?`${t}.${s}`:s}addEndpoint(t="",s){s=s||{subject:t};const i=typeof s=="function"?{handler:s,subject:t}:s;oo("endpoint",t);let{subject:l,handler:c,metadata:m,queue:y}=i;l=l||t,y=y||this.queue,OE("endpoint subject",l),l=this.calcSubject(this.subject,l);const g={name:t,subject:l,queue:y,handler:c,metadata:m};return this.srv._addEndpoint(g)}addGroup(t="",s=""){return new go(this,t,s)}}function OE(r,t){if(t==="")throw new Error(`${r} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${t}'`);const s=t.split(".");s.forEach((i,l)=>{if(i===">"&&l!==s.length-1)throw new Error(`${r} cannot have internal '>': '${t}'`)})}function AE(r,t){if(t.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${t}'`);t.split(".").forEach(i=>{if(i===">")throw new Error(`${r} name cannot contain internal '>': '${t}'`)})}class So{constructor(t,s={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=t,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),oo("name",this.config.name),oo("queue",this.config.queue),Vs(this.config.version),this._id=ps.next(),this.internal=[],this._done=ft(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(i=>{this.close(i).catch()})}static controlSubject(t,s="",i="",l){const c=l??EE;return s===""&&i===""?`${c}.${t}`:(oo("control subject name",s),i!==""?(oo("control subject id",i),`${c}.${t}.${s}.${i}`):`${c}.${t}.${s}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.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(t){const s=jr();if(t instanceof tu){const i=t;s.set(Wc,i.message),s.set(eu,`${i.code}`)}else s.set(Wc,t.message),s.set(eu,"500");return s}setupHandler(t,s=!1){const i=s?"":t.queue?t.queue:this.config.queue,{name:l,subject:c,handler:m}=t,y=t;y.internal=s,s&&this.internal.push(y),y.stats=new jE(l,c,i),y.queue=i;const g=m?(f,d)=>{if(f){this.close(f);return}const b=Date.now();try{m(f,new Og(d))}catch(v){y.stats.countError(v),d==null||d.respond(gn,{headers:this.errorToHeader(v)})}finally{y.stats.countLatency(b)}}:void 0;return y.sub=this.nc.subscribe(c,{callback:g,queue:i}),y.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(f=>{if(!this._stopped){const d=new Error(`required subscription ${t.subject} errored: ${f.message}`);d.stack=f.stack,this.close(d).catch()}}),y}info(){return{type:fo.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:s,metadata:i,name:l,queue:c}=t;return{subject:s,metadata:i,name:l,queue_group:c}})}async stats(){const t=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(i){s.stats.countError(i)}t.push(s.stats.stats(s.qi))}return{type:fo.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,s){const i=`${t}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,t,s),this._doAddInternalHandler(`${i}-kind`,t,s,this.name),this._doAddInternalHandler(`${i}`,t,s,this.name,this.id)}_doAddInternalHandler(t,s,i,l="",c=""){const m={};m.name=t,m.subject=So.controlSubject(s,l,c),m.handler=i,this.setupHandler(m,!0)}start(){const t=Vn(),s=(m,y)=>m?(this.close(m),Promise.reject(m)):this.stats().then(g=>(y==null||y.respond(t.encode(g)),Promise.resolve())),i=(m,y)=>m?(this.close(m),Promise.reject(m)):(y==null||y.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),c=(m,y)=>m?(this.close(m).then().catch(),Promise.reject(m)):(y.respond(l),Promise.resolve());return this.addInternalHandler(us.PING,c),this.addInternalHandler(us.STATS,s),this.addInternalHandler(us.INFO,i),this.handlers.forEach(m=>{const{subject:y}=m;typeof y=="string"&&m.handler!==null&&this.setupHandler(m)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(i=>i.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:fo.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,s){return new go(this,t,s)}addEndpoint(t,s){return new go(this).addEndpoint(t,s)}_addEndpoint(t){const s=new Ct;s.noIterator=typeof t.handler=="function",s.noIterator||(t.handler=(l,c)=>{l?this.stop(l).catch():s.push(new Og(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(t,!1);return i.qi=s,this.handlers.push(i),s}}class jE{constructor(t,s,i=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(this,"queue");this.name=t,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(t){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=t;s&&(s.time=0,s.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=ut(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:s,average_processing_time:i,num_errors:l,num_requests:c,processing_time:m,last_error:y,data:g,queue:f}=this;return{name:t,subject:s,average_processing_time:i,num_errors:l,num_requests:c,processing_time:m,last_error:y,data:g,queue_group:f}}stats(t){const s=t;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=ut(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 TE{constructor(t,s={strategy:Fn.JitterTimer,maxWait:2e3},i){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=t,this.prefix=i,this.opts=s}ping(t="",s=""){return this.q(us.PING,t,s)}stats(t="",s=""){return this.q(us.STATS,t,s)}info(t="",s=""){return this.q(us.INFO,t,s)}async q(t,s="",i=""){const l=new Ct,c=Vn(),m=So.controlSubject(t,s,i,this.prefix),y=await this.nc.requestMany(m,gn,this.opts);return(async()=>{for await(const g of y)try{const f=c.decode(g.data);l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(g=>{l.stop(g)}),l}}function Pb(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function kE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Pb(),storage:ld.File}}const au="KV-Operation",Ag="$KV",NE=/^[-/=.\w]+$/,CE=/^[-/=.>*\w]+$/,ME=/^[-\w]+$/;function RE(r){if(r.startsWith(".")||r.endsWith(".")||!NE.test(r))throw new Error(`invalid key: ${r}`)}function DE(r){if(r.startsWith(".")||r.endsWith(".")||!CE.test(r))throw new Error(`invalid key: ${r}`)}function qE(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const t=r.split(".");let s=!1;for(let i=0;i<t.length;i++)switch(t[i]){case"*":s=!0;break;case">":if(i!==t.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Yc(r){if(!ME.test(r))throw new Error(`invalid bucket name: ${r}`)}var Zn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Zn||(Zn={}));class bo{constructor(t,s,i){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",RE);A(this,"validateSearchKey",DE);A(this,"hasWildcards",qE);Yc(t),this.js=s,this.jsm=i,this.bucket=t,this.prefix=Ag,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,s,i={}){Yc(s);const l=await t.jetstreamManager(),c=new bo(s,t,l);return await c.init(i),c}static async bind(t,s,i={}){const l=await t.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};Yc(s);const m=new bo(s,t,l);return c.config.name=i.streamName??m.bucketName(),Object.assign(m,c),m.stream=c.config.name,m.codec=i.codec||Pb(),m.direct=c.config.allow_direct??!1,m.initializePrefixes(c),m}async init(t={}){const s=Object.assign(kE(),t);this.codec=s.codec;const i={};this.stream=i.name=t.streamName??this.bucketName(),i.retention=od.Limits,i.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(i.max_bytes=s.max_bytes),i.max_msg_size=s.maxValueSize,i.storage=s.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(i.placement=t.placement),t.republish&&(i.republish=t.republish),t.description&&(i.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(dn)||(b.name=`${dn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(t.sources){const b=t.sources.map(v=>{const x=Object.assign({},v),w=x.name.startsWith(dn)?x.name.substring(dn.length):x.name;return x.name.startsWith(dn)||(x.name=`${dn}${x.name}`),!v.external&&w!==this.bucket&&(x.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),x});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?ys.S2:ys.None);const c=this.js.nc,m=c.getServerVersion(),y=m?ud(m,Vs("2.7.2"))>=0:!1;i.discard=y?yo.New:yo.Old;const{ok:g,min:f}=c.features.get($e.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=m?`${m.major}.${m.minor}.${m.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${f}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,i.allow_direct=t.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=ut(s.ttl)),i.allow_rollup_hdrs=!0;let d;try{d=await this.jsm.streams.info(i.name),!d.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")d=await this.jsm.streams.add(i);else throw b}this.initializePrefixes(d)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=t.config;if(s){let i=s.name;if(i.startsWith(dn)&&(i=i.substring(dn.length)),s.external&&s.external.api!==""){const l=s.name.substring(dn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${dn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,s=!1){const i=[];return s?(this.useJsPrefix&&i.push(this.js.apiPrefix),this.editPrefix!==""?i.push(this.editPrefix):i.push(this.prefix)):this.prefix&&i.push(this.prefix),i.push(t),i.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${Ag}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.decode(i));break}return s.join(".")}close(){return Promise.resolve()}dataLen(t,s){const i=s&&s.get(Gt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):t.length}smToEntry(t){return new XE(this.bucket,this.prefixLen,t)}jmToEntry(t){const s=this.decodeKey(t.subject.substring(this.prefixLen));return new JE(this.bucket,s,t)}async create(t,s){var c;let i;try{const m=await this.put(t,s,{previousSeq:0});return Promise.resolve(m)}catch(m){if(i=m,((c=m==null?void 0:m.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(m)}let l=0;try{const m=await this.get(t);return(m==null?void 0:m.operation)==="DEL"||(m==null?void 0:m.operation)==="PURGE"?(l=m!==null?m.revision:0,this.update(t,s,l)):Promise.reject(i)}catch(m){return Promise.reject(m)}}update(t,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(t,s,{previousSeq:i})}async put(t,s,i={}){var m,y;const l=this.encodeKey(t);this.validateKey(l);const c={};if(i.previousSeq!==void 0){const g=jr();c.headers=g,g.set(Zn.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),s,c)).seq}catch(g){const f=g;return f.isJetStreamError()?(f.message=(m=f.api_error)==null?void 0:m.description,f.code=`${(y=f.api_error)==null?void 0:y.code}`,Promise.reject(f)):Promise.reject(g)}}async get(t,s){const i=this.encodeKey(t);this.validateKey(i);let l={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(l={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),l):c=await this.jsm.streams.getMessage(this.bucketName(),l);const m=this.smToEntry(c);return m.key!==i?null:m}catch(m){if(m.code===le.JetStream404NoMessages)return null;throw m}}purge(t,s){return this._deleteOrPurge(t,"PURGE",s)}delete(t,s){return this._deleteOrPurge(t,"DEL",s)}async purgeDeletes(t=1800*1e3){const s=ft(),i=[],l=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of l)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,l.stop();const c=Date.now()-t,m=i.map(g=>{const f=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:f,keep:1}):this.jsm.streams.purge(this.stream,{filter:f,keep:0})}),y=await Promise.all(m);return y.unshift({success:!0,purged:0}),y.reduce((g,f)=>(g.purged+=f.purged,g))}async _deleteOrPurge(t,s,i){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,s,i);const l=await this.keys(t),c=[];for await(const m of l)c.push(this._doDeleteOrPurge(m,s)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,s,i){const l=this.encodeKey(t);this.validateKey(l);const c=jr();c.set(au,s),s==="PURGE"&&c.set(Gt.RollupHdr,Gt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(Zn.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),gn,{headers:c})}_buildCC(t,s,i={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const f=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(f)}),m=xt.LastPerSubject;s===$n.AllHistory&&(m=xt.All),s===$n.UpdatesOnly&&(m=xt.New);let y;return c.length===1&&(y=c[0],c=void 0),Object.assign({deliver_policy:m,ack_policy:kt.None,filter_subjects:c,filter_subject:y,flow_control:!0,idle_heartbeat:ut(5*1e3)},i)}remove(t){return this.purge(t)}async history(t={}){const s=t.key??">",i=new Ct,l={};l.headers_only=t.headers_only||!1;let c;c=()=>{i.stop()};let m=0;const y=this._buildCC(s,$n.AllHistory,l),g=y.filter_subject,f=hs(y);f.bindStream(this.stream),f.orderedConsumer(),f.callback((b,v)=>{if(b){i.stop(b);return}if(v){const x=this.jmToEntry(v);i.push(x),i.received++,(c&&m>0&&i.received>=m||v.info.pending===0)&&(i.push(c),c=void 0)}});const d=await this.js.subscribe(g,f);if(c){const{info:{last:b}}=d,v=b.num_pending+b.delivered.consumer_seq;if(v===0||i.received>=v)try{c()}catch(x){i.stop(x)}finally{c=void 0}else m=v}return i._data=d,i.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{i.stop()}).catch(b=>{i.stop(b)}),i}canSetWatcherName(){const s=this.js.nc,{ok:i}=s.features.get($e.JS_NEW_CONSUMER_CREATE_API);return i}async watch(t={}){const s=t.key??">",i=new Ct,l={};l.headers_only=t.headers_only||!1;let c=$n.LastValue;t.include===$n.AllHistory?c=$n.AllHistory:t.include===$n.UpdatesOnly&&(c=$n.UpdatesOnly);const m=t.ignoreDeletes===!0;let y=t.initializedFn,g=0;const f=this._buildCC(s,c,l),d=f.filter_subject,b=hs(f);this.canSetWatcherName()&&b.consumerName(ps.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((x,w)=>{if(x){i.stop(x);return}if(w){const S=this.jmToEntry(w);if(m&&S.operation==="DEL")return;i.push(S),i.received++,y&&(g>0&&i.received>=g||w.info.pending===0)&&(i.push(y),y=void 0)}});const v=await this.js.subscribe(d,b);if(y){const{info:{last:x}}=v,w=x.num_pending+x.delivered.consumer_seq;if(w===0||i.received>=w)try{y()}catch(S){i.stop(S)}finally{y=void 0}else g=w}return i._data=v,i.iterClosed.then(()=>{v.unsubscribe()}),v.closed.then(()=>{i.stop()}).catch(x=>{i.stop(x)}),i}async keys(t=">"){const s=new Ct,i=this._buildCC(t,$n.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":i.filter_subject,c=hs(i);c.bindStream(this.stream),c.orderedConsumer();const m=await this.js.subscribe(l,c);return(async()=>{var g;for await(const f of m){const d=(g=f.headers)==null?void 0:g.get(au);if(d!=="DEL"&&d!=="PURGE"){const b=this.decodeKey(f.subject.substring(this.prefixLen));s.push(b)}f.info.pending===0&&m.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),m.info.last.num_pending===0&&m.unsubscribe(),s}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const s=((c=this.js.nc.info)==null?void 0:c.cluster)??"",i=this.bucketName(),l=await this.jsm.streams.info(i);return new zb(l,s)}}class zb{constructor(t,s=""){A(this,"si");A(this,"cluster");this.si=t,this.cluster=s}get bucket(){return this.si.config.name.startsWith(dn)?this.si.config.name.substring(dn.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 Dd(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 t;return((t=this.si.config.placement)==null?void 0:t.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!==ys.None:!1}}const Bd="OBJ_",jg="SHA-256=";function LE(r){return Yc(r),`${Bd}${r}`}function BE(r){return r.startsWith(Bd)?r.substring(4):r}class md{constructor(t){A(this,"si");A(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return BE(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!==ys.None:!1}}function Wl(r){if(r===void 0)return;const{domain:t}=r;if(t===void 0)return r;const s=Object.assign({},r);if(delete s.domain,t==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${t}.API`},s}var Mn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(Mn||(Mn={}));var Wn;(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"})(Wn||(Wn={}));var Yi;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Yi||(Yi={}));const Tg=Uint8Array.of(43,65,67,75),UE=Uint8Array.of(45,78,65,75),Ja=Uint8Array.of(43,87,80,73),PE=Uint8Array.of(43,78,88,84),zE=Uint8Array.of(43,84,69,82,77),IE=Uint8Array.of(32);function vo(r,t=5e3){return new s2(r,t)}class Gh extends Ct{constructor(s,i,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,l),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=Ar(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:i,idle_heartbeat:l,threshold_bytes:c,threshold_messages:m}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:y}=this;y&&y.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,f)=>{var b,v,x,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),f.subject===this.inbox){if(ad(f))return;const S=(v=f.headers)==null?void 0:v.code,M=((w=(x=f.headers)==null?void 0:x.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:B,bytesLeft:P}=this.parseDiscard(f.headers);if(B>0||P>0)this.pending.msgs-=B,this.pending.bytes-=P,this.pending.requests--,this.notify(Yi.Discard,{msgsLeft:B,bytesLeft:P});else if(S===400){this.stop(new me(M,`${S}`));return}else if(S===409&&M==="consumer deleted"){if(this.notify(Wn.ConsumerDeleted,`${S} ${M}`),!this.refilling||this.abortOnMissingResource){const se=new me(M,`${S}`);this.stop(se);return}}else if(S===503){if(this.notify(Wn.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const se=new me("no responders",`${S}`);this.stop(se);return}}else this.notify(Yi.DebugEvent,`${S} ${M}`)}else this._push(vo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=m||i&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Ld(l,g=>(this.notify(Wn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var f;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const d of g)switch(d.type){case Or.Disconnect:(f=this.monitor)==null||f.cancel();break;case Or.Reconnect:this.resetPending().then(b=>{var v;b&&((v=this.monitor)==null||v.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const i=typeof s=="function"?s:null;try{i?i():this.callback(s)}catch(l){this.stop(l)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:s,data:i})})}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,i=0;const l=Rd([this.opts.expires]);let c=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(m){if(m.message==="stream not found"){if(i++,this.notify(Wn.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(m),!1}else if(m.message==="consumer not found"){if(s++,this.notify(Wn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(m),!1;if(this.forOrderedConsumer)return!1}else s=0,i=0;this.inBackOff=!0;const y=l.backoff(c),g=Zi(y);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const i=this.consumer.api.nc;this._push(()=>{i.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(Yi.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,l=ut(this.opts.idle_heartbeat),c=ut(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:l,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},l=s==null?void 0:s.get(Gt.PendingMessagesHdr);l&&(i.msgsLeft=parseInt(l));const c=s==null?void 0:s.get(Gt.PendingBytesHdr);return c&&(i.bytesLeft=parseInt(c)),i}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,i;(s=this.monitor)==null||s.cancel(),this.monitor=null,(i=this.timeout)==null||i.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var i,l;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!1){const l=s||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,i){const c=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||c;const m=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||m}return l}status(){const s=new Ct;return this.listeners.push(s),Promise.resolve(s)}}class $E extends Ct{constructor(){super();A(this,"src");A(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(i=>{this.stop(i||void 0)}),(async()=>{const i=await this.src.status();for await(const l of i)this.notify(l.type,l.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.stop(s),super.stop(s),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new Ct;return this.listeners.push(s),Promise.resolve(s)}}class pd{constructor(t,s){A(this,"api");A(this,"_info");A(this,"stream");A(this,"name");this.api=t,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Gh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const s=new Gh(this,t,!1),i=Math.round(s.opts.expires*1.05),l=Qi(i);return s.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{s.close().catch()}),s.trackTimeout(l),Promise.resolve(s)}next(t={expires:3e4}){const s=ft(),i=t;i.max_messages=1;const l=new Gh(this,i,!1),c=Math.round(l.opts.expires*1.05);c>=6e4&&(async()=>{for await(const y of await l.status())if(y.type===Wn.HeartbeatsMissed&&y.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const y of l){s.resolve(y);break}})().catch(()=>{});const m=Qi(c);return l.closed().then(y=>{y?s.reject(y):s.resolve(null)}).catch(y=>{s.reject(y)}).finally(()=>{m.cancel()}),m.catch(y=>{s.resolve(null),l.close().catch()}),l.trackTimeout(m),s}delete(){const{stream_name:t,name:s}=this._info;return this.api.delete(t,s)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(l=>(this._info=l,this._info))}}class HE{constructor(t,s,i={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=t,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=ps.next(),typeof i.name_prefix=="string"&&(pu("name_prefix",i.name_prefix),this.namePrefix=i.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Mn.Unset,this.consumerOpts=i,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const s=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const i={name:s,deliver_policy:xt.StartSequence,opt_start_seq:t,ack_policy:kt.None,inactive_threshold:ut(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(i.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(i.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(i.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(i.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||xt.StartSequence,(this.consumerOpts.deliver_policy===xt.LastPerSubject||this.consumerOpts.deliver_policy===xt.New||this.consumerOpts.deliver_policy===xt.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===xt.LastPerSubject&&typeof i.filter_subjects>"u"&&typeof i.filter_subject>"u"&&(i.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete i.opt_start_seq,i.deliver_policy=xt.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=ut(this.consumerOpts.inactive_threshold))),i}async resetConsumer(t=0){var m,y,g,f,d;ps.next();const s=this.serial===0;(m=this.consumer)==null||m.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(t);i.max_deliver=1,i.mem_storage=!0;const l=Rd([((y=this.opts)==null?void 0:y.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(Wn.OrderedConsumerRecreated,c.name);break}catch(v){if(v.message==="stream not found"&&((f=this.iter)==null||f.notify(Wn.StreamNotFound,b),this.type===Mn.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(v),Promise.reject(v);if(s&&b>=this.maxInitialReset)throw v;await Zi(l.backoff(b+1))}return c}internalHandler(t){return s=>{var l;if(this.serial!==t)return;const i=s.info.deliverySequence;if(i!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=i,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(l=this.iter)==null||l.push(s)}}async reset(t={max_messages:100,expires:3e4},s){var g,f;s=s||{};const i=s.fromFetch||!1,l=s.orderedReset||!1;if(this.type===Mn.Fetch&&l){(g=this.iter)==null||g.src.stop(),await((f=this.iter)==null?void 0:f.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new $E),this.consumer=new pd(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let m=null;this.type===Mn.Fetch&&i?m=await this.consumer.fetch(t):this.type===Mn.Consume&&(m=await this.consumer.consume(t));const y=m;y.forOrderedConsumer=!0,y.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(y)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(Yi.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Mn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Mn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=Mn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Mn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=Mn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const s=t;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=ft();return s.callback=c=>{this.userCallback=null,i.resolve(c)},(await this.fetch(s)).iterClosed.then(c=>{c&&i.reject(c),i.resolve(null)}).catch(c=>{i.reject(c)}),i}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class yd{constructor(t){A(this,"api");A(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get($e.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new pd(this.api,t)}async get(t,s={}){return typeof s=="object"?this.ordered(t,s):(await this.checkVersion(),this.api.info(t,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new pd(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(t,s){await this.checkVersion();const i=this.api;return new Ud(i.nc,i.opts).info(t).then(c=>Promise.resolve(new HE(this.api,t,s))).catch(c=>Promise.reject(c))}}class gu{constructor(t,s){A(this,"api");A(this,"_info");this.api=t,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new gu(this.api,t)}else return this}info(t=!1,s){return t?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(t){return new yd(new ru(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new yd(new ru(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,s){return this.api.deleteMessage(this.name,t,s)}}class Ud extends wo{constructor(t,s){super(t,s)}checkStreamConfigVersions(t){const s=this.nc;if(t.metadata){const{min:l,ok:c}=s.features.get($e.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:c}=s.features.get($e.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:c}=s.features.get($e.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:c}=s.features.get($e.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:c}=s.features.get($e.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function i(l,c){var y;if((((y=c==null?void 0:c.subject_transforms)==null?void 0:y.length)||0)>0){const{min:g,ok:f}=s.features.get($e.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${l} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(l=>{i("stream sources",l)}),t.mirror&&i("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),It(t.name),t.mirror=Wl(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(Wl);const i=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(i),i}async delete(t){return It(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,s={}){var y;if(typeof t=="object"){const g=t;t=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),It(t);const i=await this.info(t),l=Object.assign(i.config,s);l.mirror=Wl(l.mirror),l.sources=(y=l.sources)==null?void 0:y.map(Wl);const m=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(m),m}async info(t,s){It(t);const i=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(i,s),{total:m,limit:y}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(m&&m>g){const f=[c],d=s||{};let b=0;for(;m>g;){b++,d.offset=y*b;const x=await this._request(i,d);m=x.total,f.push(x);const w=Object.getOwnPropertyNames(x.state.subjects).length;if(g+=w,w<y)break}let v={};for(let x=0;x<f.length;x++)c=f[x],c.state.subjects&&(v=Object.assign(v,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=v}return this._fixInfo(c),c}list(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>{const m=c;return m.streams.forEach(y=>{this._fixInfo(y)}),m.streams},l=`${this.prefix}.STREAM.LIST`;return new lo(l,i,this,s)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,s){if(s){const{keep:l,seq:c}=s;if(typeof l=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return It(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,s)}async deleteMessage(t,s,i=!0){It(t);const l={seq:s};return i||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,s){It(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,s);return new Ib(l)}find(t){return this.findStream(t)}listKvs(){const t=i=>{var g;const c=i.streams.filter(f=>f.config.name.startsWith(dn));c.forEach(f=>{this._fixInfo(f)});let m="";return c.length&&(m=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(f=>new zb(f,m))},s=`${this.prefix}.STREAM.LIST`;return new lo(s,t,this)}listObjectStores(){const t=i=>{const c=i.streams.filter(y=>y.config.name.startsWith(Bd));return c.forEach(y=>{this._fixInfo(y)}),c.map(y=>new md(y))},s=`${this.prefix}.STREAM.LIST`;return new lo(s,t,this)}names(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>c.streams,l=`${this.prefix}.STREAM.NAMES`;return new lo(l,i,this,s)}async get(t){const s=await this.info(t);return Promise.resolve(new gu(this,s))}}class GE extends wo{constructor(t,s){super(t,s)}async getMessage(t,s){It(t);let i=s;const{last_by_subj:l}=i;l&&(i=null);const c=i?this.jc.encode(i):gn,m=this.opts.apiPrefix||"$JS.API",y=l?`${m}.DIRECT.GET.${t}.${l}`:`${m}.DIRECT.GET.${t}`,g=await this.nc.request(y,c,{timeout:this.timeout}),f=Fi(g);if(f)return Promise.reject(f);const d=new gd(g);return Promise.resolve(d)}async getBatch(t,s){It(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,f)=>g==="up_to_time"&&f instanceof Date?f.toISOString():f),m=new Ct,y=await this.nc.requestMany(l,c,{strategy:Fn.SentinelMsg});return(async()=>{var b,v,x;let g=!1,f=!1,d;for await(const w of y){if(!g){g=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){d=(v=w.headers)==null?void 0:v.description.toLowerCase();break}if(((x=w.headers)==null?void 0:x.get("Nats-Num-Pending"))===""){f=!0;break}}if(w.data.length===0)break;m.push(new gd(w))}m.push(()=>{if(f)throw new Error("batch direct get not supported by the server");if(d)throw new Error(`bad request: ${d}`);m.stop()})})(),Promise.resolve(m)}}class gd{constructor(t){A(this,"data");A(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Ii.Subject)}get seq(){const t=this.header.last(Ii.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ii.TimeStamp)}get stream(){return this.header.last(Ii.Stream)}json(t){return Vn(t).decode(this.data)}string(){return mn.decode(this.data)}}A(gd,"jc");class FE extends wo{constructor(s,i){super(s,i);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new Ud(s,i),this.consumers=new ru(s,i),this.direct=new GE(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Ct;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,l)=>{if(i)throw i;try{const c=this.parseJsResponse(l),m=c.type.split("."),y=m[m.length-1];s.push({kind:y,data:c})}catch(c){s.stop(c)}}}),s}}class Ib{constructor(t){A(this,"_header");A(this,"smr");this.smr=t}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):gn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=fs.decode(t)}else this._header=jr();return this._header}_parse(t){const s=atob(t),i=s.length,l=new Uint8Array(i);for(let c=0;c<i;c++)l[c]=s.charCodeAt(c);return l}json(t){return Vn(t).decode(this.data)}string(){return mn.decode(this.data)}}A(Ib,"jc");class VE{constructor(t){A(this,"api");this.api=t}get(t){return this.api.info(t).then(s=>new gu(this.api,s))}}class Fh{constructor(t){A(this,"info");A(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=fs.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 t,s;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function kg(r){const t={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;t.headers=s.toRecord()}return t}function YE(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class mo{constructor(t,s,i){A(this,"jsm");A(this,"js");A(this,"stream");A(this,"name");this.name=t,this.jsm=s,this.js=i}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const s=await this.rawInfo(t);return s?new Fh(s):null}async list(){const t=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;t.push(i)}return Promise.resolve(t)}async rawInfo(t){const{name:s,error:i}=this._checkNotEmpty(t);if(i)return Promise.reject(i);const l=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),y=Vn().decode(c.data);return y.revision=c.seq,y}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new md(t)))}async status(t){const s=await this._si(t);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new md(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,s,i){var fe;const l=this.js.getOptions();i=i||{timeout:l.timeout},i.timeout=i.timeout||l.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:m}=i,y=this.js.nc.info,g=(y==null?void 0:y.max_payload)||1024;t=t||{},t.options=t.options||{};let f=((fe=t.options)==null?void 0:fe.max_chunk_size)||128*1024;f=f>g?g:f,t.options.max_chunk_size=f;const d=await this.info(t.name),{name:b,error:v}=this._checkNotEmpty(t.name);if(v)return Promise.reject(v);const x=ps.next(),w=this._chunkSubject(x),S=this._metaSubject(b),M=Object.assign({bucket:this.name,nuid:x,size:0,chunks:0},kg(t)),B=ft(),P=[],se=new Ji;try{const C=s?s.getReader():null,U=bg.create();for(;;){const{done:re,value:K}=C?await C.read():{done:!0,value:void 0};if(re){if(se.size()>0){const X=se.drain();U.update(X),M.chunks++,M.size+=X.length,P.push(this.js.publish(w,X,{timeout:c}))}await Promise.all(P),P.length=0,M.mtime=new Date().toISOString();const L=Vi.encode(U.digest());M.digest=`${jg}${L}`,M.deleted=!1;const F=jr();typeof m=="number"&&F.set(Zn.ExpectedLastSubjectSequenceHdr,`${m}`),F.set(Gt.RollupHdr,Gt.RollupValueSubject);const ee=await this.js.publish(S,Vn().encode(M),{headers:F,timeout:c});if(M.revision=ee.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}B.resolve(new Fh(M));break}if(K)for(se.fill(K);se.size()>f;){M.chunks++,M.size+=f;const L=se.drain(t.options.max_chunk_size);U.update(L),P.push(this.js.publish(w,L,{timeout:c}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:w}),B.reject(C)}return B}putBlob(t,s,i){function l(c){return new ReadableStream({pull(m){m.enqueue(c),m.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(t,l(s),i)}put(t,s,i){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,s,i)}async getBlob(t){async function s(c){const m=new Ji,y=c.getReader();for(;;){const{done:g,value:f}=await y.read();if(g)return m.drain();f&&f.length&&m.fill(f)}}const i=await this.get(t);if(i===null)return Promise.resolve(null);const l=await Promise.all([i.error,s(i.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const s=await this.rawInfo(t);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const b=s.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await mo.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(jg))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=cd(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const l=ft(),c={info:new Fh(s),error:l};if(s.size===0)return c.data=YE(),l.resolve(null),Promise.resolve(c);let m;const y=hs();y.orderedConsumer();const g=bg.create(),f=`$O.${this.name}.C.${s.nuid}`,d=await this.js.subscribe(f,y);return(async()=>{for await(const b of d)b.data.length>0&&(g.update(b.data),m.enqueue(b.data)),b.info.pending===0&&(qS(i,g.digest())?m.close():m.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${i}`)),d.unsubscribe())})().then(()=>{l.resolve()}).catch(b=>{m.error(b),l.reject(b)}),c.data=new ReadableStream({start(b){m=b},cancel(){d.unsubscribe()}}),c}linkStore(t,s){if(!(s instanceof mo))return Promise.reject("bucket required");const i=s,{name:l,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const m={name:l,options:{link:{bucket:i.name}}};return this._put(m,null)}async link(t,s){const{name:i,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);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 c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const m={bucket:s.bucket,name:s.name},y={name:i,bucket:s.bucket,options:{link:m}};await this.js.publish(this._metaSubject(t),JSON.stringify(y));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const s=await this.rawInfo(t);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Vn(),l=jr();return l.set(Gt.RollupHdr,Gt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(t,s={}){const i=await this.rawInfo(t);if(i===null)return Promise.reject(new Error("object not found"));if(i.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??i.name;const{name:l,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(t!==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=l;const m=Object.assign({},i,kg(s)),y=await this.js.publish(this._metaSubject(m.name),JSON.stringify(m));return t!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(y)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let s=!1;const i=new Ct,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Vn(),m=hs();m.orderedConsumer(),t.includeHistory?m.deliverLastPerSubject():(s=!0,m.deliverNew()),m.callback((g,f)=>{var d;if(g){i.stop(g);return}if(f!==null){const b=c.decode(f.data);b.deleted&&t.ignoreDeletes===!0||i.push(b),((d=f.info)==null?void 0:d.pending)===0&&!s&&(s=!0,i.push(null))}});const y=await this.js.subscribe(l,m);return i._data=y,i.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Vi.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=LE(this.name)}catch(l){return Promise.reject(l)}const s=(t==null?void 0:t.ttl)||0;delete t.ttl;const i=Object.assign({max_age:s},t);i.name=this.stream,i.num_replicas=t.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=yo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(i.placement=t.placement),t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?ys.S2:ys.None);try{await this.jsm.streams.info(i.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(t,s,i={}){const l=await t.jetstreamManager(),c=new mo(s,l,t);return await c.init(i),Promise.resolve(c)}}class KE{constructor(t){A(this,"js");this.js=t}kv(t,s={}){const i=this.js,{ok:l,min:c}=i.nc.features.get($e.JS_KV);return l?s.bindOnly?bo.bind(this.js,t,s):bo.create(this.js,t,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,s={}){var m;if(typeof((m=crypto==null?void 0:crypto.subtle)==null?void 0:m.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const i=this.js,{ok:l,min:c}=i.nc.features.get($e.JS_OBJECTSTORE);return l?mo.create(this.js,t,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class Pd extends wo{constructor(s,i){super(s,i);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new ru(s,i),this.streamAPI=new Ud(s,i),this.consumers=new yd(this.consumerAPI),this.streams=new VE(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const i=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(i)}get apiPrefix(){return this.prefix}get views(){return new KE(this)}async publish(s,i=gn,l){l=l||{},l.expect=l.expect||{};const c=(l==null?void 0:l.headers)||jr();l&&(l.msgID&&c.set(Zn.MsgIdHdr,l.msgID),l.expect.lastMsgID&&c.set(Zn.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&c.set(Zn.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&c.set(Zn.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&c.set(Zn.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const m=l.timeout||this.timeout,y={};m&&(y.timeout=m),l&&(y.headers=c);let{retries:g,retry_delay:f}=l;g=g||1,f=f||250;let d;for(let v=0;v<g;v++)try{d=await this.nc.request(s,i,y);break}catch(x){if(x.code==="503"&&v+1<g)await Zi(f);else throw x}const b=this.parseJsResponse(d);if(b.stream==="")throw me.errorForCode(le.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,l=0){It(s),Gi(i);let c=this.timeout;l>c&&(c=l),l=l<0?0:ut(l);const m={batch:1,no_wait:l===0,expires:l},y=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{noMux:!0,timeout:c}),g=Fi(y);if(g)throw g;return vo(y,this.timeout)}fetch(s,i,l={}){It(s),Gi(i);let c=null;const m=(l.max_bytes??0)>0;let y=0;const g=m?l.max_bytes:0;let f=null;const d={};if(d.batch=l.batch||1,g){const P=this.nc.features.get($e.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.min} or better`);d.max_bytes=g}d.no_wait=l.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const b=l.expires||0;if(b&&(d.expires=ut(b)),b===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const v=l.idle_heartbeat||0;v&&(d.idle_heartbeat=ut(v),l.delay_heartbeat===!0&&(d.idle_heartbeat=ut(v*4)));const x=new Ct,w=d.batch;let S=0;x.protocolFilterFn=(P,se=!1)=>ad(P.msg)?(f==null||f.work(),!1):!0,x.dispatchedFn=P=>{if(P){if(m&&(y+=P.data.length),S++,c&&P.info.pending===0)return;(x.getPending()===1&&P.info.pending===0||w===S||g>0&&y>=g)&&x.stop()}};const M=Ar(this.nc.options.inboxPrefix),B=this.nc.subscribe(M,{max:l.batch,callback:(P,se)=>{P===null&&(P=Fi(se)),P!==null?(c&&(c.cancel(),c=null),yS(P)?x.stop(Hb(P)===null?void 0:P):x.stop(P)):(f==null||f.work(),x.received++,x.push(vo(se,this.timeout)))}});return b&&(c=Qi(b),c.catch(()=>{B.isClosed()||(B.drain().catch(()=>{}),c=null),f&&f.cancel()})),(async()=>{try{v&&(f=new Ld(v,P=>(x.push(()=>{x.err=new me(`${Rn.IdleHeartbeatMissed}: ${P}`,le.JetStreamIdleHeartBeat)}),!0)))}catch{}await B.closed,c!==null&&(c.cancel(),c=null),f&&f.cancel(),x.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{reply:M}),x}async pullSubscribe(s,i=hs()){const l=await this._processOptions(s,i);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=l.config.ack_policy;if(c===kt.None||c===kt.All)throw new Error("ack policy for pull consumers must be explicit");const m=this._buildTypedSubscriptionOpts(l),y=new ZE(this,l.deliver,m);y.info=l;try{await this._maybeCreateConsumer(l)}catch(g){throw y.unsubscribe(),g}return y}async subscribe(s,i=hs()){const l=await this._processOptions(s,i);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(l),m=new $b(this,l.deliver,c);m.info=l;try{await this._maybeCreateConsumer(l)}catch(y){throw m.unsubscribe(),y}return m._maybeSetupHbMonitoring(),m}async _processOptions(s,i=hs()){const l=mg(i)?i.getOpts():i;if(l.isBind=mg(i)?i.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==kt.NotSet&&l.config.ack_policy!==kt.None)throw new me("ordered consumer: ack_policy can only be set to 'none'",le.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new me("ordered consumer: durable_name cannot be set",le.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new me("ordered consumer: deliver_subject cannot be set",le.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new me("ordered consumer: max_deliver cannot be set",le.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new me("ordered consumer: deliver_group cannot be set",le.ApiError);l.config.deliver_subject=Ar(this.nc.options.inboxPrefix),l.config.ack_policy=kt.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||ut(5e3),l.config.ack_wait=ut(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===kt.NotSet&&(l.config.ack_policy=kt.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(s),l.attached=!1,l.config.durable_name)try{const c=await this.consumerAPI.info(l.stream,l.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==s)throw new Error("subject does not match consumer");const m=l.config.deliver_group??"";if(m===""&&c.push_bound===!0)throw new Error("duplicate subscription");const y=c.config.deliver_group??"";if(m!==y)throw y===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${y}'`);l.last=c,l.config=c.config,l.attached=!0,l.config.durable_name||(l.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=s),l.deliver=l.config.deliver_subject||Ar(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=WE(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=Pd.ingestionFn(s.ordered),i.protocolFilterFn=(l,c=!1)=>{const m=l;return id(m.msg)?(c||m.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==kt.None&&(i.dispatchedFn=n2),s.callbackFn&&(i.callback=s.callbackFn),i.max=s.max||0,i.queue=s.queue,i}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:xt.All,ack_policy:kt.Explicit,ack_wait:ut(30*1e3),replay_policy:Xi.Instant},s.config);const i=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(i.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=i.name,s.config=i.config,s.last=i}static ingestionFn(s){return(i,l)=>{var g;const c=l;if(!i)return{ingest:!1,protocol:!1};const m=i;if(Fi(m.msg)||(g=c.monitor)==null||g.work(),ad(m.msg)){const f=s?c._checkHbOrderConsumer(m.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:f,protocol:!0}}else if(id(m.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class zd{constructor(t){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=gE(t),this.listeners=[]}static connect(t={}){return new Promise((s,i)=>{const l=new zd(t);iu.connect(l.options,l).then(c=>{l.protocol=c,(async function(){for await(const m of c.status())l.listeners.forEach(y=>{y.push(m)})})(),s(l)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,s,i){if(this.isClosed())throw me.errorForCode(le.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw me.errorForCode(le.ConnectionDraining);if(t=t||"",t.length===0)throw me.errorForCode(le.BadSubject)}publish(t,s,i){this._check(t,!1,!0),this.protocol.publish(t,s,i)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,s={}){this._check(t,!0,!1);const i=new Ub(this.protocol,t,s);return this.protocol.subscribe(i),i}_resub(t,s,i){this._check(s,!0,!1);const l=t;l.max=i,i&&(l.max=i+l.received),this.protocol.resub(l,s)}requestMany(t,s=gn,i={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Fn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new me("timeout",le.InvalidOption));const c=new Ct;function m(g){c.push(()=>{c.stop(g)})}function y(g,f){g||f===null?m(g===null?void 0:g):c.push(f)}if(i.noMux){const g=l?new Error().stack:null;let f=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const d=this.subscribe(Ar(this.options.inboxPrefix),{callback:(w,S)=>{var M,B;if(((M=S==null?void 0:S.data)==null?void 0:M.length)===0&&((B=S==null?void 0:S.headers)==null?void 0:B.status)===le.NoResponders&&(w=me.errorForCode(le.NoResponders)),w){g&&(w.stack+=`
48
+
49
+ ${g}`),b(w);return}y(null,S),i.strategy===Fn.Count&&(f--,f===0&&b()),i.strategy===Fn.JitterTimer&&(x(),v=setTimeout(()=>{b()},300)),i.strategy===Fn.SentinelMsg&&S&&S.data.length===0&&b()}});d.requestSubject=t,d.closed.then(()=>{m()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),x(),d.drain().then(()=>{m()}).catch(S=>{m()})};c.iterClosed.then(()=>{x(),d==null||d.unsubscribe()}).catch(w=>{x(),d==null||d.unsubscribe()});try{this.publish(t,s,{reply:d.getSubject()})}catch(w){b(w)}let v=setTimeout(()=>{b()},i.maxWait);const x=()=>{v&&clearTimeout(v)}}else{const g=i;g.callback=y,c.iterClosed.then(()=>{f.cancel()}).catch(d=>{f.cancel(d)});const f=new LS(this.protocol.muxSubscriptions,t,g);this.protocol.request(f);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:i.headers})}catch(d){f.cancel(d)}}return Promise.resolve(c)}request(t,s,i={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const l=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new me("timeout",le.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new me("reply can only be used with noMux",le.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Ar(this.options.inboxPrefix),m=ft(),y=l?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(f,d)=>{f?(y&&f.code!==le.Timeout&&(f.stack+=`
50
+
51
+ ${y.stack}`),g.unsubscribe(),m.reject(f)):(f=kb(d),f?(y&&(f.stack+=`
52
+
53
+ ${y.stack}`),m.reject(f)):m.resolve(d))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:c,headers:i.headers}),m}else{const c=new Mb(this.protocol.muxSubscriptions,t,i,l);this.protocol.request(c);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(y){c.cancel(y)}const m=Promise.race([c.timer,c.deferred]);return m.catch(()=>{c.cancel()}),m}}flush(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new Ct;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,i)=>s==="time"?new Date(Date.parse(i)):i)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new FE(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const l=i;throw l.code===le.NoResponders&&(l.code=le.JetStreamNotEnabled),l}return s}jetstream(t={}){return new Pd(this,t)}getServerVersion(){const t=this.info;return t?Vs(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw me.errorForCode(le.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new QE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):this.protocol.reconnect()}}class QE{constructor(t){A(this,"nc");this.nc=t}add(t){try{return new So(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new TE(this.nc,t,s)}}class XE{constructor(t,s,i){A(this,"bucket");A(this,"sm");A(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=i}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(au)||"PUT"}get length(){const t=this.sm.header.get(Gt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class JE{constructor(t,s,i){A(this,"bucket");A(this,"key");A(this,"sm");this.bucket=t,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(Dd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(au))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Gt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class $b extends zS{constructor(s,i,l){super(s.nc,i,l);A(this,"js");A(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 i=Ar(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=ps.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=i,c.config.deliver_subject=i,c.config.deliver_policy=xt.StartSequence,c.config.opt_start_seq=s;const m={};m.stream_name=this.info.stream,m.config=c.config;const y=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(y,m,{retries:-1}).then(g=>{const f=g,d=this.sub.info;d.last=f,this.info.config=f.config,this.info.name=f.name}).catch(g=>{const f=new me(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,le.RequestError,g);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){var i,l;const s=((l=(i=this.info)==null?void 0:i.config)==null?void 0:l.idle_heartbeat)||0;s&&this._setupHbMonitoring(Dd(s))}_setupHbMonitoring(s,i=0){const l={cancelAfter:0,maxOut:2};i&&(l.cancelAfter=i);const c=this.sub,m=y=>{var d,b,v,x;const g=xS(409,`${Rn.IdleHeartbeatMissed}: ${y}`,this.sub.subject);if(!((d=this.info)==null?void 0:d.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const w=((v=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:v.stream_seq)||0;return this._resetOrderedConsumer(w+1),(x=this.monitor)==null||x.restart(),!1}return!c.noIterator};this.monitor=new Ld(s,m,l)}_checkHbOrderConsumer(s){const i=s.headers.get(Gt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const l=parseInt(s.headers.get(Gt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,l=s.info.streamSequence,c=s.info.deliverySequence;return c!=i.delivery_seq+1?(this._resetOrderedConsumer(i.stream_seq+1),!1):(i.delivery_seq=c,i.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,l=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(l)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,l=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(l);return s.last=c,c}}class ZE extends $b{constructor(t,s,i){super(t,s,i)}pull(t={batch:1}){const{stream:s,config:i,name:l}=this.sub.info,c=i.durable_name??l,m={};if(m.batch=t.batch||1,m.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const f=this.js.nc.features.get($e.JS_PULL_MAX_BYTES);if(!f.ok)throw new Error(`max_bytes is only supported on servers ${f.min} or better`);m.max_bytes=t.max_bytes}let y=0;t.expires&&t.expires>0&&(y=t.expires,m.expires=ut(y));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,m.idle_heartbeat=ut(g)),g&&y===0)throw new Error("idle_heartbeat requires expires");if(g>y)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),y&&g&&(this.monitor?this.monitor._change(g,y):this._setupHbMonitoring(g,y));const f=this.info.api,d=`${f.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;f.nc.publish(d,f.jc.encode(m),{reply:b})}}}function WE(r,t){return r?t2(t):e2(t)}function e2(r){return(t,s)=>t?[t,null]:(t=Fi(s),t?[t,null]:[null,vo(s,r)])}function t2(r){return(t,s)=>{if(t)return[t,null];const i=Fi(s);return i!==null?[Hb(i),null]:[null,vo(s,r)]}}function Hb(r){if(r!==null)switch(r.code){case le.JetStream404NoMessages:case le.JetStream408RequestTimeout:return null;case le.JetStream409:return _S(r)?r:null;default:return r}return null}function n2(r){r&&r.ack()}function r2(r){const t=r.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class s2{constructor(t,s){A(this,"msg");A(this,"di");A(this,"didAck");A(this,"timeout");this.msg=t,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=r2(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Ja[0]&&t[1]===Ja[1]&&t[2]===Ja[2]&&t[3]===Ja[3]}async ackAck(t){var i;t=t||{},t.timeout=t.timeout||this.timeout;const s=ft();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,m=!((i=c.options)!=null&&i.noAsyncTraces),y=new Mb(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},m);c.request(y);try{c.publish(this.msg.reply,Tg,{reply:`${c.muxSubscriptions.baseInbox}${y.token}`})}catch(g){y.cancel(g)}try{await Promise.race([y.timer,y.deferred]),s.resolve(!0)}catch(g){y.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(Tg)}nak(t){let s=UE;t&&(s=sd().encode(`-NAK ${JSON.stringify({delay:ut(t)})}`)),this.doAck(s)}working(){this.doAck(Ja)}next(t,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=ut(s.expires));const l=Vn().encode(i),c=Ji.concat(PE,IE,l),m=t?{reply:t}:void 0;this.msg.respond(c,m)}term(t=""){let s=zE;(t==null?void 0:t.length)>0&&(s=sd().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const i2="1.30.3",a2="nats.ws";class o2{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=i2,this.lang=a2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=ft(),this.closedNotification=ft()}async connect(t,s){const i=ft();if(s.tls)return i.reject(new me("tls",le.InvalidOption)),i;this.options=s;const l=t.src;if(s.wsFactory){const{socket:c,encrypted:m}=await s.wsFactory(t.src,s);this.socket=c,this.encrypted=m}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const m=Ji.concat(...this.yields),y=VS(m);if(y!==""){const g=xE.exec(y);if(!g){s.debug&&console.error("!!!",Xl(m)),i.reject(new Error("unexpected response from server"));return}try{const f=JSON.parse(g[1]);bE(f,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(f){i.reject(f);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let m;this.done||(c.wasClean||(m=new Error(c.reason)),this._closed(m))},this.socket.onerror=c=>{if(this.isDiscarded())return;const m=c,y=new me(m.message,le.Unknown,new Error(m.error));i.reject(y)},i}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Zi(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}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 t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${Xl(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=ft())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${Xl(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${Xl(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function l2(r,t){/^(.*:\/\/)(.*)/.test(r)||(typeof t=="boolean"?r=`${t===!0?"https":"http"}://${r}`:r=`https://${r}`);let i=new URL(r);const l=i.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${r}`));let c,m;const y=i.hostname,g=i.pathname,f=i.search||"";switch(l){case"http:":case"ws:":case"nats:":m=i.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":m=i.port||"443",c="wss:";break;default:m=i.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${y}:${m}${g}${f}`}function c2(r={}){return IS({defaultPort:443,urlParseFn:l2,factory:()=>new o2}),zd.connect(r)}const u2=null,f2=null,Ht="lt.events";function Gb(r,t){const s=r.split("."),i=t.split(".");for(let l=0;l<i.length;l++){const c=i[l];if(c===">")return!0;if(l>=s.length||c!=="*"&&c!==s[l])return!1}return s.length===i.length}const Wi=j.createContext({connected:!1,subscribe:()=>()=>{}});function h2(){const{connected:r}=j.useContext(Wi);return{connected:r}}function yn(r,t){const{subscribe:s}=j.useContext(Wi),i=j.useRef(t);i.current=t,j.useEffect(()=>s(r,c=>i.current(c)),[s,r])}function Ks(r,t){const{subscribe:s}=j.useContext(Wi),i=j.useRef(t);i.current=t;const l=r.join(","),c=j.useMemo(()=>l.split(",").filter(Boolean),[l]);j.useEffect(()=>{const m=g=>i.current(g),y=c.map(g=>s(g,m));return()=>y.forEach(g=>g())},[s,c])}const d2=j.createContext({connected:!1,subscribe:()=>()=>{}}),m2=sd();function p2({children:r,url:t,token:s}){const i=j.useRef(null),[l,c]=j.useState(!1),m=j.useRef(null),y=j.useRef(new Map),g=j.useRef(new Map),f=j.useCallback((x,w)=>{(async()=>{for await(const S of w)try{if(!Gb(S.subject,x))continue;const M=JSON.parse(m2.decode(S.data)),B=y.current.get(x);if(!B)continue;for(const P of B)try{P(M)}catch{}}catch{}})()},[]),d=j.useCallback(x=>{var S;const w=i.current;if(!(!w||(S=w.isClosed)!=null&&S.call(w)||g.current.has(x)))try{const M=w.subscribe(x);g.current.set(x,M),f(x,M)}catch{}},[f]),b=j.useCallback((x,w)=>{const S=y.current;return S.has(x)||S.set(x,new Set),S.get(x).add(w),d(x),()=>{const M=S.get(x);if(M&&(M.delete(w),M.size===0)){S.delete(x);const B=g.current.get(x);if(B){g.current.delete(x);try{B.unsubscribe()}catch{}}}}},[d]),v=j.useCallback(async()=>{try{if(i.current)return;const x=t||u2;if(!x){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const w=await c2({servers:x,token:s||f2||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});i.current=w,c(!0);for(const S of y.current.keys())d(S);(async()=>{for await(const S of w.status())S.type==="disconnect"||S.type==="error"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),m.current=setTimeout(v,3e3)}},[d]);return j.useEffect(()=>(v(),()=>{m.current&&clearTimeout(m.current);for(const x of g.current.values())try{x.unsubscribe()}catch{}g.current.clear(),i.current&&(i.current.close().catch(()=>{}),i.current=null),c(!1)}),[v]),p.jsx(d2.Provider,{value:{connected:l,subscribe:b},children:p.jsx(Wi.Provider,{value:{connected:l,subscribe:b},children:r})})}const tr=Object.create(null);tr.open="0";tr.close="1";tr.ping="2";tr.pong="3";tr.message="4";tr.upgrade="5";tr.noop="6";const Kc=Object.create(null);Object.keys(tr).forEach(r=>{Kc[tr[r]]=r});const bd={type:"error",data:"parser error"},Fb=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Vb=typeof ArrayBuffer=="function",Yb=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,Id=({type:r,data:t},s,i)=>Fb&&t instanceof Blob?s?i(t):Ng(t,i):Vb&&(t instanceof ArrayBuffer||Yb(t))?s?i(t):Ng(new Blob([t]),i):i(tr[r]+(t||"")),Ng=(r,t)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];t("b"+(i||""))},s.readAsDataURL(r)};function Cg(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let Vh;function y2(r,t){if(Fb&&r.data instanceof Blob)return r.data.arrayBuffer().then(Cg).then(t);if(Vb&&(r.data instanceof ArrayBuffer||Yb(r.data)))return t(Cg(r.data));Id(r,!1,s=>{Vh||(Vh=new TextEncoder),t(Vh.encode(s))})}const Mg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",co=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Mg.length;r++)co[Mg.charCodeAt(r)]=r;const g2=r=>{let t=r.length*.75,s=r.length,i,l=0,c,m,y,g;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);const f=new ArrayBuffer(t),d=new Uint8Array(f);for(i=0;i<s;i+=4)c=co[r.charCodeAt(i)],m=co[r.charCodeAt(i+1)],y=co[r.charCodeAt(i+2)],g=co[r.charCodeAt(i+3)],d[l++]=c<<2|m>>4,d[l++]=(m&15)<<4|y>>2,d[l++]=(y&3)<<6|g&63;return f},b2=typeof ArrayBuffer=="function",$d=(r,t)=>{if(typeof r!="string")return{type:"message",data:Kb(r,t)};const s=r.charAt(0);return s==="b"?{type:"message",data:v2(r.substring(1),t)}:Kc[s]?r.length>1?{type:Kc[s],data:r.substring(1)}:{type:Kc[s]}:bd},v2=(r,t)=>{if(b2){const s=g2(r);return Kb(s,t)}else return{base64:!0,data:r}},Kb=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Qb="",x2=(r,t)=>{const s=r.length,i=new Array(s);let l=0;r.forEach((c,m)=>{Id(c,!1,y=>{i[m]=y,++l===s&&t(i.join(Qb))})})},_2=(r,t)=>{const s=r.split(Qb),i=[];for(let l=0;l<s.length;l++){const c=$d(s[l],t);if(i.push(c),c.type==="error")break}return i};function w2(){return new TransformStream({transform(r,t){y2(r,s=>{const i=s.length;let l;if(i<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,i);else if(i<65536){l=new Uint8Array(3);const c=new DataView(l.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{l=new Uint8Array(9);const c=new DataView(l.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(s)})}})}let Yh;function ec(r){return r.reduce((t,s)=>t+s.length,0)}function tc(r,t){if(r[0].length===t)return r.shift();const s=new Uint8Array(t);let i=0;for(let l=0;l<t;l++)s[l]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),s}function S2(r,t){Yh||(Yh=new TextDecoder);const s=[];let i=0,l=-1,c=!1;return new TransformStream({transform(m,y){for(s.push(m);;){if(i===0){if(ec(s)<1)break;const g=tc(s,1);c=(g[0]&128)===128,l=g[0]&127,l<126?i=3:l===126?i=1:i=2}else if(i===1){if(ec(s)<2)break;const g=tc(s,2);l=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(ec(s)<8)break;const g=tc(s,8),f=new DataView(g.buffer,g.byteOffset,g.length),d=f.getUint32(0);if(d>Math.pow(2,21)-1){y.enqueue(bd);break}l=d*Math.pow(2,32)+f.getUint32(4),i=3}else{if(ec(s)<l)break;const g=tc(s,l);y.enqueue($d(c?g:Yh.decode(g),t)),i=0}if(l===0||l>r){y.enqueue(bd);break}}}})}const Xb=4;function Ot(r){if(r)return E2(r)}function E2(r){for(var t in Ot.prototype)r[t]=Ot.prototype[t];return r}Ot.prototype.on=Ot.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};Ot.prototype.once=function(r,t){function s(){this.off(r,s),t.apply(this,arguments)}return s.fn=t,this.on(r,s),this};Ot.prototype.off=Ot.prototype.removeListener=Ot.prototype.removeAllListeners=Ot.prototype.removeEventListener=function(r,t){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 i,l=0;l<s.length;l++)if(i=s[l],i===t||i.fn===t){s.splice(l,1);break}return s.length===0&&delete this._callbacks["$"+r],this};Ot.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,l=s.length;i<l;++i)s[i].apply(this,t)}return this};Ot.prototype.emitReserved=Ot.prototype.emit;Ot.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};Ot.prototype.hasListeners=function(r){return!!this.listeners(r).length};const bu=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),Dn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),O2="arraybuffer";function Jb(r,...t){return t.reduce((s,i)=>(r.hasOwnProperty(i)&&(s[i]=r[i]),s),{})}const A2=Dn.setTimeout,j2=Dn.clearTimeout;function vu(r,t){t.useNativeTimers?(r.setTimeoutFn=A2.bind(Dn),r.clearTimeoutFn=j2.bind(Dn)):(r.setTimeoutFn=Dn.setTimeout.bind(Dn),r.clearTimeoutFn=Dn.clearTimeout.bind(Dn))}const T2=1.33;function k2(r){return typeof r=="string"?N2(r):Math.ceil((r.byteLength||r.size)*T2)}function N2(r){let t=0,s=0;for(let i=0,l=r.length;i<l;i++)t=r.charCodeAt(i),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(i++,s+=4);return s}function Zb(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function C2(r){let t="";for(let s in r)r.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return t}function M2(r){let t={},s=r.split("&");for(let i=0,l=s.length;i<l;i++){let c=s[i].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class R2 extends Error{constructor(t,s,i){super(t),this.description=s,this.context=i,this.type="TransportError"}}class Hd extends Ot{constructor(t){super(),this.writable=!1,vu(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,i){return super.emitReserved("error",new R2(t,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=$d(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_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(t){const s=C2(t);return s.length?"?"+s:""}}class D2 extends Hd{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||s()})),this.writable||(i++,this.once("drain",function(){--i||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};_2(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,x2(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Zb()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let Wb=!1;try{Wb=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const q2=Wb;function L2(){}class B2 extends D2{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,s){const i=this.request({method:"POST",data:t});i.on("success",s),i.on("error",(l,c)=>{this.onError("xhr post error",l,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=t}}class er extends Ot{constructor(t,s,i){super(),this.createRequest=t,vu(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const s=Jb(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&i.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var l;i.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=er.requestsCount++,er.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=L2,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete er.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}er.requestsCount=0;er.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Rg);else if(typeof addEventListener=="function"){const r="onpagehide"in Dn?"pagehide":"unload";addEventListener(r,Rg,!1)}}function Rg(){for(let r in er.requests)er.requests.hasOwnProperty(r)&&er.requests[r].abort()}const U2=(function(){const r=ev({xdomain:!1});return r&&r.responseType!==null})();class P2 extends B2{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=U2&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new er(ev,this.uri(),t)}}function ev(r){const t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||q2))return new XMLHttpRequest}catch{}if(!t)try{return new Dn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const tv=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class z2 extends Hd{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,i=tv?{}:Jb(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,i)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],l=s===t.length-1;Id(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}l&&bu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Zb()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const Kh=Dn.WebSocket||Dn.MozWebSocket;class I2 extends z2{createSocket(t,s,i){return tv?new Kh(t,s,i):s?new Kh(t,s):new Kh(t)}doWrite(t,s){this.ws.send(s)}}class $2 extends Hd{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=S2(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(s).getReader(),l=w2();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const c=()=>{i.read().then(({done:y,value:g})=>{y||(this.onPacket(g),c())}).catch(y=>{})};c();const m={type:"open"};this.query.sid&&(m.data=`{"sid":"${this.query.sid}"}`),this._writer.write(m).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],l=s===t.length-1;this._writer.write(i).then(()=>{l&&bu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const H2={websocket:I2,webtransport:$2,polling:P2},G2=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,F2=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function vd(r){if(r.length>8e3)throw"URI too long";const t=r,s=r.indexOf("["),i=r.indexOf("]");s!=-1&&i!=-1&&(r=r.substring(0,s)+r.substring(s,i).replace(/:/g,";")+r.substring(i,r.length));let l=G2.exec(r||""),c={},m=14;for(;m--;)c[F2[m]]=l[m]||"";return s!=-1&&i!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=V2(c,c.path),c.queryKey=Y2(c,c.query),c}function V2(r,t){const s=/\/{2,9}/g,i=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Y2(r,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,l,c){l&&(s[l]=c)}),s}const xd=typeof addEventListener=="function"&&typeof removeEventListener=="function",Qc=[];xd&&addEventListener("offline",()=>{Qc.forEach(r=>r())},!1);class ds extends Ot{constructor(t,s){if(super(),this.binaryType=O2,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const i=vd(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=vd(s.host).host);vu(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(i=>{const l=i.prototype.name;this.transports.push(l),this._transportsByName[l]=i}),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=M2(this.opts.query)),xd&&(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"})},Qc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=Xb,s.transport=t,this.id&&(s.sid=this.id);const i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ds.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.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",ds.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.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=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),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 t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){const l=this.writeBuffer[i].data;if(l&&(s+=k2(l)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,bu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,l){if(typeof s=="function"&&(l=s,s=void 0),typeof i=="function"&&(l=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:t,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{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?i():t()}):this.upgrading?i():t()),this}_onError(t){if(ds.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,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(),xd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=Qc.indexOf(this._offlineEventListener);i!==-1&&Qc.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}ds.protocol=Xb;class K2 extends ds{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),i=!1;ds.priorWebsocketSuccess=!1;const l=()=>{i||(s.send([{type:"ping",data:"probe"}]),s.once("packet",b=>{if(!i)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;ds.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(d(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=s.name,this.emitReserved("upgradeError",v)}}))};function c(){i||(i=!0,d(),s.close(),s=null)}const m=b=>{const v=new Error("probe error: "+b);v.transport=s.name,c(),this.emitReserved("upgradeError",v)};function y(){m("transport closed")}function g(){m("socket closed")}function f(b){s&&b.name!==s.name&&c()}const d=()=>{s.removeListener("open",l),s.removeListener("error",m),s.removeListener("close",y),this.off("close",g),this.off("upgrading",f)};s.once("open",l),s.once("error",m),s.once("close",y),this.once("close",g),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&s.push(t[i]);return s}}let Q2=class extends K2{constructor(t,s={}){const i=typeof t=="object"?t:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(l=>H2[l]).filter(l=>!!l)),super(t,i)}};function X2(r,t="",s){let i=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),i=vd(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const c=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+c+":"+i.port+t,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const J2=typeof ArrayBuffer=="function",Z2=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,nv=Object.prototype.toString,W2=typeof Blob=="function"||typeof Blob<"u"&&nv.call(Blob)==="[object BlobConstructor]",eO=typeof File=="function"||typeof File<"u"&&nv.call(File)==="[object FileConstructor]";function Gd(r){return J2&&(r instanceof ArrayBuffer||Z2(r))||W2&&r instanceof Blob||eO&&r instanceof File}function Xc(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,i=r.length;s<i;s++)if(Xc(r[s]))return!0;return!1}if(Gd(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Xc(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&Xc(r[s]))return!0;return!1}function tO(r){const t=[],s=r.data,i=r;return i.data=_d(s,t),i.attachments=t.length,{packet:i,buffers:t}}function _d(r,t){if(!r)return r;if(Gd(r)){const s={_placeholder:!0,num:t.length};return t.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let i=0;i<r.length;i++)s[i]=_d(r[i],t);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(s[i]=_d(r[i],t));return s}return r}function nO(r,t){return r.data=wd(r.data,t),delete r.attachments,r}function wd(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=wd(r[s],t);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=wd(r[s],t));return r}const rO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Pe;(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"})(Pe||(Pe={}));class sO{constructor(t){this.replacer=t}encode(t){return(t.type===Pe.EVENT||t.type===Pe.ACK)&&Xc(t)?this.encodeAsBinary({type:t.type===Pe.EVENT?Pe.BINARY_EVENT:Pe.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Pe.BINARY_EVENT||t.type===Pe.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=tO(t),i=this.encodeAsString(s.packet),l=s.buffers;return l.unshift(i),l}}class Fd extends Ot{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const i=s.type===Pe.BINARY_EVENT;i||s.type===Pe.BINARY_ACK?(s.type=i?Pe.EVENT:Pe.ACK,this.reconstructor=new iO(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(Gd(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),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: "+t)}decodeString(t){let s=0;const i={type:Number(t.charAt(0))};if(Pe[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Pe.BINARY_EVENT||i.type===Pe.BINARY_ACK){const c=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const m=t.substring(c,s);if(m!=Number(m)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const y=Number(m);if(!aO(y)||y<0)throw new Error("Illegal attachments");if(y>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=y}if(t.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););i.nsp=t.substring(c,s)}else i.nsp="/";const l=t.charAt(s+1);if(l!==""&&Number(l)==l){const c=s+1;for(;++s;){const m=t.charAt(s);if(m==null||Number(m)!=m){--s;break}if(s===t.length)break}i.id=Number(t.substring(c,s+1))}if(t.charAt(++s)){const c=this.tryParse(t.substr(s));if(Fd.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Pe.CONNECT:return Dg(s);case Pe.DISCONNECT:return s===void 0;case Pe.CONNECT_ERROR:return typeof s=="string"||Dg(s);case Pe.EVENT:case Pe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&rO.indexOf(s[0])===-1);case Pe.ACK:case Pe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class iO{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=nO(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const aO=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function Dg(r){return Object.prototype.toString.call(r)==="[object Object]"}const oO=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Fd,Encoder:sO,get PacketType(){return Pe}},Symbol.toStringTag,{value:"Module"}));function Hn(r,t,s){return r.on(t,s),function(){r.off(t,s)}}const lO=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class rv extends Ot{constructor(t,s,i){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=t,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Hn(t,"open",this.onopen.bind(this)),Hn(t,"packet",this.onpacket.bind(this)),Hn(t,"error",this.onerror.bind(this)),Hn(t,"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(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var i,l,c;if(lO.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const m={type:Pe.EVENT,data:s};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const d=this.ids++,b=s.pop();this._registerAckCallback(d,b),m.id=d}const y=(l=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||l===void 0?void 0:l.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!y||(g?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(t,s){var i;const l=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(l===void 0){this.acks[t]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===t&&this.sendBuffer.splice(y,1);s.call(this,new Error("operation has timed out"))},l),m=(...y)=>{this.io.clearTimeoutFn(c),s.apply(this,y)};m.withError=!0,this.acks[t]=m}emitWithAck(t,...s){return new Promise((i,l)=>{const c=(m,y)=>m?l(m):i(y);c.withError=!0,s.push(c),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...c)=>(this._queue[0],l!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(l)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Pe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Pe.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.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 Pe.EVENT:case Pe.BINARY_EVENT:this.onevent(t);break;case Pe.ACK:case Pe.BINARY_ACK:this.onack(t);break;case Pe.DISCONNECT:this.ondisconnect();break;case Pe.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let i=!1;return function(...l){i||(i=!0,s.packet({type:Pe.ACK,id:t,data:l}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Pe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,t.data)}}}function ea(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}ea.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};ea.prototype.reset=function(){this.attempts=0};ea.prototype.setMin=function(r){this.ms=r};ea.prototype.setMax=function(r){this.max=r};ea.prototype.setJitter=function(r){this.jitter=r};class Sd extends Ot{constructor(t,s){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,vu(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((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new ea({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const l=s.parser||oO;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Q2(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const l=Hn(s,"open",function(){i.onopen(),t&&t()}),c=y=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",y),t?t(y):this.maybeReconnectOnOpen()},m=Hn(s,"error",c);if(this._timeout!==!1){const y=this._timeout,g=this.setTimeoutFn(()=>{l(),c(new Error("timeout")),s.close()},y);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(l),this.subs.push(m),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Hn(t,"ping",this.onping.bind(this)),Hn(t,"data",this.ondata.bind(this)),Hn(t,"error",this.onerror.bind(this)),Hn(t,"close",this.onclose.bind(this)),Hn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){bu(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new rv(this,t,s),this.nsps[t]=i),i}_destroy(t){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let i=0;i<s.length;i++)this.engine.write(s[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=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 i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(l=>{l?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",l)):t.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Za={};function Jc(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};const s=X2(r,t.path||"/socket.io"),i=s.source,l=s.id,c=s.path,m=Za[l]&&c in Za[l].nsps,y=t.forceNew||t["force new connection"]||t.multiplex===!1||m;let g;return y?g=new Sd(i,t):(Za[l]||(Za[l]=new Sd(i,t)),g=Za[l]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(Jc,{Manager:Sd,Socket:rv,io:Jc,connect:Jc});const cO=j.createContext({connected:!1,subscribe:()=>()=>{}});function uO({children:r}){const t=j.useRef(null),[s,i]=j.useState(!1),l=j.useRef(new Map),c=j.useCallback((y,g)=>{var d;const f=l.current;return f.has(y)||(f.set(y,new Set),(d=t.current)==null||d.emit("lt.subscribe",y)),f.get(y).add(g),()=>{var v;const b=f.get(y);b&&(b.delete(g),b.size===0&&(f.delete(y),(v=t.current)==null||v.emit("lt.unsubscribe",y)))}},[]),m=j.useCallback((y,g)=>{for(const[f,d]of l.current)if(Gb(y,f))for(const b of d)try{b(g)}catch{}},[]);return j.useEffect(()=>{const y=Ob(),g=Jc({path:`${Nt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...y?{auth:{token:y}}:{}});return t.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),i(!0);for(const f of l.current.keys())g.emit("lt.subscribe",f)}),g.on("disconnect",f=>{console.log("[lt-socketio] disconnected:",f),i(!1)}),g.on("connect_error",f=>{console.warn("[lt-socketio] connect error:",f.message),i(!1)}),g.onAny((f,d)=>{if(f.startsWith("lt."))try{const b=typeof d=="string"?JSON.parse(d):d;m(f,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),t.current=null,i(!1)}},[m]),p.jsx(cO.Provider,{value:{connected:s,subscribe:c},children:p.jsx(Wi.Provider,{value:{connected:s,subscribe:c},children:r})})}function fO({children:r}){const[t,s]=j.useState(null),[i,l]=j.useState({url:null,token:null});return j.useEffect(()=>{let c=!1;async function m(){var y;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Nt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),c||s("socketio");return}const f=await g.json(),d=(y=f==null?void 0:f.events)==null?void 0:y.transport;if(console.log("[lt-transport] server reports:",d),!c){if(d==="nats"){let b=f.events.natsWsUrl??null,v=null;const x=Ob();if(x)try{const w=await fetch(`${Nt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${x}`}});if(w.ok){const S=await w.json();b=S.natsWsUrl??b,v=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}l({url:b,token:v})}s(d==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),c||s("socketio")}}return m(),()=>{c=!0}},[]),t==="nats"?p.jsx(p2,{url:i.url,token:i.token,children:r}):t==="socketio"?p.jsx(uO,{children:r}):p.jsx(p.Fragment,{children:r})}const Vd="lt_view_as",Yd="lt_ai_override",Ed="lt_graph_enabled",Kd="lt_scan_override";function sv(){try{const r=localStorage.getItem(Yd);if(r==="true")return!0;if(r==="false")return!1}catch{}return null}function hO(r){try{localStorage.setItem(Yd,String(r))}catch{}}function dO(){try{localStorage.removeItem(Yd)}catch{}}function Qd(){try{const r=localStorage.getItem(Vd);if(r==="admin"||r==="engineer"||r==="operator")return r}catch{}return null}function mO(r){try{localStorage.setItem(Vd,r)}catch{}window.location.reload()}function Od(){try{localStorage.removeItem(Vd)}catch{}window.location.reload()}function iv(){try{return localStorage.getItem(Ed)==="true"}catch{return!1}}function pO(r){try{r?localStorage.setItem(Ed,"true"):localStorage.removeItem(Ed)}catch{}}function av(){try{const r=localStorage.getItem(Kd);if(r==="true")return!0;if(r==="false")return!1}catch{}return null}function yO(r){try{localStorage.setItem(Kd,String(r))}catch{}}function gO(){try{localStorage.removeItem(Kd)}catch{}}function ov(){const{isSuperAdmin:r,hasRoleType:t,hasRole:s}=Vt(),i=Qd(),l=r||s("engineer"),c=t("admin"),m=r||t("admin");return{isBuilder:i?!1:l,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":m,viewAs:i,realIsBuilder:l}}function lv(){var f;const{isSuperAdmin:r,hasRoleType:t,hasRole:s}=Vt(),{data:i}=nr(),l=((f=i==null?void 0:i.features)==null?void 0:f.publicPaceBoard)!==!1,c=r?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",m=Qd(),y=m==="admin"||m==="engineer"||m==="operator"?m:null,g=y??c;return{tier:g,realTier:c,viewAs:y,canSeePaceBoard:l||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!l}}function cv(r){return(r??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function Tr(r={}){const t=r.role?cv(r.role):"*",s=r.id??"*",i=r.verb??">";return`${Ht}.system.escalation.${t}.${s}.${i}`}function Ad(r){return r.verbs.map(t=>Tr({role:r.role,verb:t}))}function Xd(r){const{user:t,isSuperAdmin:s,hasRoleType:i}=Vt(),l=s||i("admin"),c=((t==null?void 0:t.roles)??[]).map(y=>y.role).sort().join(","),m=(r??[]).join(",");return j.useMemo(()=>{const y=m?m.split(","):null;return l||!c?y?Ad({verbs:y}):[Tr({})]:c.split(",").flatMap(g=>y?Ad({role:g,verbs:y}):[Tr({role:g})])},[l,c,m])}const jd="/escalations/detail/";function bO(r){return r.startsWith(jd)&&r.slice(jd.length).split("/")[0]||void 0}function vO(){const{user:r}=Vt(),t=_o(),s=vn(),i=j.useRef(s.pathname);i.current=s.pathname;const l=j.useRef(r==null?void 0:r.userId);l.current=r==null?void 0:r.userId;const c=j.useCallback(m=>{var b,v,x;if((m==null?void 0:m.assignedAtCreation)!==!0)return;const y=(m==null?void 0:m.escalationId)??((b=m==null?void 0:m.data)==null?void 0:b.id),g=(v=m==null?void 0:m.data)==null?void 0:v.assigned_to,f=(x=m==null?void 0:m.data)==null?void 0:x.parent_id;if(!y||g!==l.current||!f||f!==bO(i.current))return;const d=`${jd}${y}`;i.current!==d&&t(d)},[t]);Ks(Xd(["claimed"]),c)}function $N(r={}){const t=new URLSearchParams;return r.role&&t.set("role",r.role),r.roleType&&t.set("roleType",r.roleType),r.status&&t.set("status",r.status),r.search&&t.set("search",r.search),r.limit&&t.set("limit",String(r.limit)),r.offset!==void 0&&t.set("offset",String(r.offset)),st({queryKey:["users",r],queryFn:()=>ge(`/users?${t}`)})}function HN(r){return st({queryKey:["users",r],queryFn:()=>ge(`/users/${r}`),enabled:!!r})}function xO(r){return st({queryKey:["users",r,"roles"],queryFn:async()=>(await ge(`/users/${r}/roles`)).roles??[],enabled:!!r})}function GN(){const r=Ve();return We({mutationFn:t=>ge("/users",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function FN(){const r=Ve();return We({mutationFn:({id:t,...s})=>ge(`/users/${t}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function VN(){const r=Ve();return We({mutationFn:({id:t,ops:s})=>ge(`/users/${t}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function YN(){return st({queryKey:["users","system-property-keys"],queryFn:()=>ge("/users/system-property-keys")})}function KN(){const r=Ve();return We({mutationFn:t=>ge(`/users/${t}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function QN(){const r=Ve();return We({mutationFn:({userId:t,role:s,type:i,read_scope:l,write_scope:c})=>ge(`/users/${t}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:l,write_scope:c})}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function XN(){const r=Ve();return We({mutationFn:({userId:t,role:s})=>ge(`/users/${t}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function _O(){return st({queryKey:["roles"],queryFn:()=>ge("/roles")})}function Jd(r){return st({queryKey:["roles","details"],queryFn:()=>ge("/roles/details"),enabled:(r==null?void 0:r.enabled)??!0})}function JN(r,t,s=!0){return st({queryKey:["roles",r,"schema",t??"latest"],queryFn:()=>ge(`/roles/${encodeURIComponent(r)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!r})}function ZN(r){return st({queryKey:["roles",r,"schema-versions"],queryFn:()=>ge(`/roles/${encodeURIComponent(r)}/schema/versions`),enabled:!!r})}function WN(r,t,s=!0){return st({queryKey:["roles",r,"list-schema",t??"latest"],queryFn:()=>ge(`/roles/${encodeURIComponent(r)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!r})}function e3(r){return st({queryKey:["roles",r,"list-schema-versions"],queryFn:()=>ge(`/roles/${encodeURIComponent(r)}/list-schema/versions`),enabled:!!r})}function t3(){const r=Ve();return We({mutationFn:t=>ge("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}function n3(){const r=Ve();return We({mutationFn:({role:t,...s})=>ge(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await r.cancelQueries({queryKey:["roles","details"]});const i=r.getQueryData(["roles","details"]);return i&&r.setQueryData(["roles","details"],{roles:i.roles.map(l=>l.role===t?{...l,...s}:l)}),{previous:i}},onError:(t,s,i)=>{i!=null&&i.previous&&r.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}function r3(){const r=Ve();return We({mutationFn:t=>ge(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}const uv="lt:station:kiosk-role:";function Td(r){return`${uv}${r}`}const kd=new Set;function wO(){for(const r of kd)r()}function SO(r){try{return localStorage.getItem(Td(r))}catch{return null}}function EO(r,t){try{t===null?localStorage.removeItem(Td(r)):localStorage.setItem(Td(r),t)}catch{}wO()}function OO(r){kd.add(r);const t=s=>{(s.key===null||s.key.startsWith(uv))&&r()};try{window.addEventListener("storage",t)}catch{}return()=>{kd.delete(r);try{window.removeEventListener("storage",t)}catch{}}}function AO(r){return j.useSyncExternalStore(OO,()=>r?SO(r):null)}function fv(){const{user:r}=Vt(),t=(r==null?void 0:r.userId)??null,{data:s}=xO(t),{data:i}=Jd(),l=AO(t),c=j.useCallback(m=>{t&&EO(t,m)},[t]);return j.useMemo(()=>{const m={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},y=s??[];if(y.length===0||y.some(x=>x.type!=="member"))return m;const g=x=>{var w,S,M;return((M=(S=(w=i==null?void 0:i.roles)==null?void 0:w.find(B=>B.role===x))==null?void 0:S.properties)==null?void 0:M.kiosk)===!0},f=y.map(x=>x.role).filter(g),d=x=>({kiosk:!0,role:x,homePath:`/escalations/available?role=${encodeURIComponent(x)}&status=available`,targets:f,selectable:f.length>=2,selectRole:c});if(y.length===1)return f.length===1?d(f[0]):m;if(!y.every(x=>x.write_scope==="none")||f.length===0)return m;const v=l&&f.includes(l)?l:f.length===1?f[0]:null;return v?d(v):{...m,targets:f,selectable:!0}},[s,i,l,c])}const jO=["/escalations","/scan","/login"];function TO(r){return jO.some(t=>r===t||r.startsWith(`${t}/`)||r.startsWith(`${t}?`))}const Zd=j.createContext(null),Qh="lt_sidebar_collapsed",hv="(max-width: 1023px)";function kO(){try{return window.matchMedia(hv).matches}catch{return!1}}function NO({children:r}){const[t,s]=j.useState(()=>{if(kO())return!0;try{return localStorage.getItem(Qh)==="true"}catch{return!1}});j.useEffect(()=>{let l;try{l=window.matchMedia(hv)}catch{return}const c=m=>{if(m.matches)s(!0);else try{s(localStorage.getItem(Qh)==="true")}catch{s(!1)}};return l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]);const i=j.useCallback(()=>{s(l=>{const c=!l;try{localStorage.setItem(Qh,String(c))}catch{}return c})},[]);return p.jsx(Zd.Provider,{value:{collapsed:t,toggle:i},children:r})}function CO({children:r}){return p.jsx(Zd.Provider,{value:{collapsed:!1,toggle:()=>{}},children:r})}function Wd(){const r=j.useContext(Zd);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}const qg=380,em=j.createContext(null);function MO({children:r}){const[t,s]=j.useState({node:null,width:qg,open:!1,ownerKey:null}),i=vn(),l=j.useRef(i.pathname),c=j.useCallback((y,g)=>{s({node:y,width:(g==null?void 0:g.width)??qg,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),m=j.useCallback(y=>{s(g=>typeof y=="string"&&g.ownerKey!==y?g:{...g,open:!1})},[]);return j.useEffect(()=>{i.pathname!==l.current&&(l.current=i.pathname,s(y=>y.open||y.node?{...y,node:null,open:!1,ownerKey:null}:y))},[i.pathname]),p.jsx(em.Provider,{value:{...t,setPanel:c,closePanel:m},children:r})}function tm(){const r=j.useContext(em);if(!r)throw new Error("useShellPanel must be used within ShellPanelProvider");return r}function s3(){return j.useContext(em)}function RO({open:r,width:t=380,children:s,className:i=""}){const[l,c]=j.useState(r);return j.useEffect(()=>{r&&c(!0)},[r]),p.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:r?t:0,maxWidth:"50%"},onTransitionEnd:m=>{!r&&m.propertyName==="width"&&c(!1)},children:p.jsx("div",{style:{width:t},className:"h-full",children:l?s:null})})}function i3({label:r,children:t}){return p.jsxs("div",{children:[p.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:r}),p.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function a3({views:r,activeId:t,onViewChange:s,onClose:i,headerActions:l,stickyClassName:c,labelInline:m}){const y=r.find(g=>g.id===t)??r[0];return y?p.jsx("div",{className:"h-full bg-surface-hover",children:p.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[p.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${m?"pt-10 pb-2":"pt-3"}`,children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:r.map(g=>{const f=g.icon,d=g.id===y.id;return p.jsx("button",{role:"radio","aria-checked":d,onClick:()=>s(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${d?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:p.jsx(f,{className:"w-3.5 h-3.5"})},g.id)})}),m&&p.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:y.label})]}),p.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l,i&&p.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:p.jsx(Ft,{className:"w-3.5 h-3.5"})})]})]}),!m&&p.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:y.label}),p.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${m?"pt-4 pb-8":"pb-5 pt-1"}`,children:y.content})]})}):null}function dv(r,t){var s,i,l,c,m;t.facets&&Object.keys(t.facets).length&&r.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&r.set("block",JSON.stringify(t.block)),(i=t.range)!=null&&i.length&&r.set("range",JSON.stringify(t.range)),(l=t.exists)!=null&&l.length&&r.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&r.set("roles",JSON.stringify(t.roles)),(m=t.orderBy)!=null&&m.length&&r.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&r.set("available",String(t.available)),t.jeopardy===!0&&r.set("jeopardy","1"),t.include&&r.set("include",t.include)}function o3(r,t){const s=r??"24h";return st({queryKey:["stationMetrics",s],queryFn:()=>ge(`/escalations/station-metrics?period=${s}`),staleTime:5e3,enabled:(t==null?void 0:t.enabled)??!0})}function l3(r){const t=r?`?period=${r}`:"";return st({queryKey:["escalationStats",r],queryFn:()=>ge(`/escalations/stats${t}`)})}function c3(){return st({queryKey:["escalationTypes"],queryFn:()=>ge("/escalations/types")})}function u3(r=!0){return st({queryKey:["escalationFacetKeys"],queryFn:()=>ge("/escalations/facet-keys"),enabled:r,staleTime:6e4})}function mv(r){const{enabled:t=!0,staleTime:s,...i}=r,l=new URLSearchParams;return i.status&&l.set("status",i.status),i.role&&l.set("role",i.role),i.type&&l.set("type",i.type),i.subtype&&l.set("subtype",i.subtype),i.assigned_to&&l.set("assigned_to",i.assigned_to),i.parent_id&&l.set("parent_id",i.parent_id),i.claimed&&l.set("claimed","true"),i.priority&&l.set("priority",String(i.priority)),i.limit&&l.set("limit",String(i.limit)),i.offset!==void 0&&l.set("offset",String(i.offset)),i.sort_by&&l.set("sort_by",i.sort_by),i.order&&l.set("order",i.order),i.search&&l.set("search",i.search),dv(l,i),st({queryKey:["escalations",i],queryFn:()=>ge(`/escalations?${l}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function pv(r){const{enabled:t=!0,staleTime:s,...i}=r,l=new URLSearchParams;return i.role&&l.set("role",i.role),i.type&&l.set("type",i.type),i.subtype&&l.set("subtype",i.subtype),i.priority&&l.set("priority",String(i.priority)),i.limit&&l.set("limit",String(i.limit)),i.offset!==void 0&&l.set("offset",String(i.offset)),i.sort_by&&l.set("sort_by",i.sort_by),i.order&&l.set("order",i.order),i.search&&l.set("search",i.search),dv(l,i),st({queryKey:["escalations","available",i],queryFn:()=>ge(`/escalations/available?${l}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function f3(r){return st({queryKey:["escalations","by-workflow",r],queryFn:()=>ge(`/escalations/by-workflow/${r}`),enabled:!!r})}function h3(r){return st({queryKey:["escalations",r],queryFn:()=>ge(`/escalations/${r}`),enabled:!!r})}function d3(r,t){return st({queryKey:["escalations",r,"lookups"],queryFn:()=>ge(`/escalations/${r}/lookups`),enabled:!!r&&t,staleTime:1/0})}function m3(){const r=Ve();return We({mutationFn:({id:t,durationMinutes:s})=>ge(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function p3(){const r=Ve();return We({mutationFn:t=>ge(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function y3(){const r=Ve();return We({mutationFn:({id:t,resolverPayload:s})=>ge(`/escalations/${t}/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 g3(){const r=Ve();return We({mutationFn:({id:t,targetRole:s})=>ge(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function b3(){const r=Ve();return We({mutationFn:({ids:t,priority:s})=>ge("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function v3(){const r=Ve();return We({mutationFn:({ids:t,durationMinutes:s})=>ge("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function x3(){const r=Ve();return We({mutationFn:({ids:t,targetUserId:s,durationMinutes:i,reassign:l})=>ge("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:i,...l?{reassign:!0}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function _3(){const r=Ve();return We({mutationFn:({ids:t})=>ge("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function w3(){const r=Ve();return We({mutationFn:({ids:t,hint:s})=>ge("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function S3(){const r=Ve();return We({mutationFn:t=>ge(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function E3(){const r=Ve();return We({mutationFn:({ids:t})=>ge("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function nm(r){const t=[],s=r.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":t.push(["tasks"]),t.push(["jobs"]),t.push(["processes"]),r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["workflowState",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId])),r.originId&&t.push(["processes",r.originId]);break;case"escalation":t.push(["escalations"]),t.push(["escalationStats"]),t.push(["stationMetrics"]),r.workflowId&&t.push(["workflowExecution",r.workflowId]);break;case"workflow":t.push(["jobs"]),t.push(["tasks"]),t.push(["processes"]),r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["workflowState",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId]),t.push(["mcpQueryResult",r.workflowId]),t.push(["builderResult",r.workflowId]));break;case"activity":r.workflowId&&t.push(["mcpRunExecution",r.workflowId]),t.push(["mcpRuns"]);break;case"milestone":r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId])),t.push(["tasks"]);break;case"knowledge":t.push(["knowledge"]);break;case"file":t.push(["files"]);break;case"agent":t.push(["agents"]);break;default:t.push(["jobs"]),t.push(["tasks"]);break}return t}const DO={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},O3=300,Lg={DETAIL:0,LIST:1,SUMMARY:2};function qO(r){const t=new Map,s={},i={};let l=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function m(d){delete s[d],i[d]=Date.now();const b=[];for(const[x,w]of t)w===d&&b.push(x);for(const x of b)t.delete(x);if(b.length===0)return;const v=c();v&&(l=!0);for(const x of b)r.invalidateQueries({queryKey:JSON.parse(x),...v?{refetchType:"none"}:{}})}function y(d){if(s[d])return;const{coalesceMs:b,minIntervalMs:v}=DO[d],x=i[d],w=x===void 0?0:x+v-Date.now(),S=Math.max(b,w);s[d]=setTimeout(()=>m(d),S)}function g(d,b){for(const v of b){const x=JSON.stringify(v),w=t.get(x);(w===void 0||Lg[d]<Lg[w])&&t.set(x,d)}y(d)}const f=()=>{typeof document>"u"||document.visibilityState==="visible"&&l&&(l=!1,r.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",f),{request:g,dispose(){for(const d of Object.keys(s)){const b=s[d];b&&clearTimeout(b),delete s[d]}t.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",f)}}}const Bg=new WeakMap;function LO(r){let t=Bg.get(r);return t||(t=qO(r),Bg.set(r,t)),t}function Wt(r){const t=Ve();return j.useCallback(s=>{LO(t).request(r,s)},[t,r])}function rm(r){return r?[`${Ht}.system.workflow.>`,`${Ht}.system.activity.>`,`${Ht}.system.milestone.>`,`${Ht}.system.task.>`,`${Ht}.system.escalation.>`]:[]}function A3(){const r=Wt("LIST");yn(`${Ht}.system.task.>`,()=>{r([["jobs"]])}),yn(`${Ht}.system.workflow.>`,()=>{r([["jobs"]])})}function j3(r){const t=Wt("DETAIL");Ks(rm(r),s=>{var y;if(!r||!(s.workflowId===r||((y=s.workflowId)==null?void 0:y.includes(r))))return;const l=s.type.split("."),c=l[0]==="system"?l[1]:l[0],m=nm(s);c==="escalation"&&m.push(["escalations","by-workflow",r]),t(m)})}function T3(r){const t=Wt("DETAIL");Ks(rm(r),s=>{var y;if(!r||!(s.workflowId===r||((y=s.workflowId)==null?void 0:y.includes(r))))return;const l=s.type.split("."),c=l[0]==="system"?l[1]:l[0],m=nm(s);c==="escalation"&&m.push(["escalations","by-workflow",r]),t(m)})}function k3(r){const t=Wt("DETAIL");Ks(rm(r),s=>{var c;if(!r||!(s.workflowId===r||((c=s.workflowId)==null?void 0:c.includes(r))))return;const l=nm(s);l.push(["workflowSets"]),l.push(["yamlWorkflows"]),t(l)})}function N3(r){const t=Wt("DETAIL"),s=j.useCallback(i=>{r&&(i.originId!==r&&i.workflowId!==r||t([["processes",r]]))},[r,t]);yn(`${Ht}.system.task.>`,s),yn(`${Ht}.system.workflow.>`,s),yn(`${Ht}.system.escalation.>`,s)}function C3(){const r=Wt("SUMMARY");yn(Tr({}),()=>{r([["escalationStats"]])})}function M3(){const r=Wt("SUMMARY");yn(Tr({}),()=>{r([["stationMetrics"]])})}function R3(){const r=Wt("SUMMARY");yn(Tr({}),()=>{r([["escAggregate"],["escTimeline"]])})}function D3(r){const t=Wt("LIST"),s=(r==null?void 0:r.role)??null,i=((r==null?void 0:r.verbs)??[]).join(","),l=j.useMemo(()=>{const c=i?i.split(","):null;return c?Ad({role:s,verbs:c}):[Tr({role:s})]},[s,i]);Ks(l,()=>{t([["escalations"]])})}function q3(r){const t=Wt("DETAIL");yn(Tr(r?{id:r}:{id:"__none__"}),s=>{!r||s.escalationId!==r||t([["escalations",r]])})}function L3(){const r=Wt("LIST");yn(`${Ht}.system.agent.>`,()=>{r([["agents"]])})}function B3(){const r=Wt("LIST");yn(`${Ht}.system.task.>`,()=>{r([["processes"]])}),yn(`${Ht}.system.workflow.>`,()=>{r([["processes"]])})}function BO(){const{user:r}=Vt(),t=r==null?void 0:r.userId,s=Wt("SUMMARY");Ks(Xd(),()=>{s([["escalations"]])});const{data:i}=pv({limit:1}),{data:l}=mv({assigned_to:t,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(l==null?void 0:l.total)??0}}function ou({size:r="sm",hideLabel:t=!1,className:s="",appName:i="LongTail",variant:l="full"}){const c=r==="lg";if(l==="comet")return p.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:p.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Nt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(l==="mark")return p.jsx("div",{className:`flex items-center ${s}`,children:p.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Nt}/logo512.png)`}})});const m=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",y=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return p.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[p.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${m}`,style:{"--logo-url":`url(${Nt}/logo512.png)`}}),p.jsx("span",{className:`z-[1] transition-opacity duration-300 ${y} ${t?"opacity-0":""}`,children:i})]})}const UO="system.surfaces.dashboard",PO=`${Ht}.${UO}`;function yv(r=!0){return st({queryKey:["announcements"],queryFn:()=>ge("/announcements"),enabled:r,staleTime:3e4})}function zO(){const r=Ve();return We({mutationFn:t=>ge("/announcements",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{r.invalidateQueries({queryKey:["announcements"]})}})}function IO(){const r=Ve();return We({mutationFn:t=>ge(`/announcements/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["announcements"]})}})}const gv=6048e5,$O=864e5,Ug=6e4,Pg=525600,zg=43200,Ig=1440,$g=Symbol.for("constructDateFrom");function kr(r,t){return typeof r=="function"?r(t):r&&typeof r=="object"&&$g in r?r[$g](t):r instanceof Date?new r.constructor(t):new Date(t)}function bn(r,t){return kr(t||r,r)}let HO={};function Eo(){return HO}function xo(r,t){var y,g,f,d;const s=Eo(),i=(t==null?void 0:t.weekStartsOn)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((d=(f=s.locale)==null?void 0:f.options)==null?void 0:d.weekStartsOn)??0,l=bn(r,t==null?void 0:t.in),c=l.getDay(),m=(c<i?7:0)+c-i;return l.setDate(l.getDate()-m),l.setHours(0,0,0,0),l}function lu(r,t){return xo(r,{...t,weekStartsOn:1})}function bv(r,t){const s=bn(r,t==null?void 0:t.in),i=s.getFullYear(),l=kr(s,0);l.setFullYear(i+1,0,4),l.setHours(0,0,0,0);const c=lu(l),m=kr(s,0);m.setFullYear(i,0,4),m.setHours(0,0,0,0);const y=lu(m);return s.getTime()>=c.getTime()?i+1:s.getTime()>=y.getTime()?i:i-1}function cu(r){const t=bn(r),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+r-+s}function vv(r,...t){const s=kr.bind(null,r||t.find(i=>typeof i=="object"));return t.map(s)}function Hg(r,t){const s=bn(r,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function GO(r,t,s){const[i,l]=vv(s==null?void 0:s.in,r,t),c=Hg(i),m=Hg(l),y=+c-cu(c),g=+m-cu(m);return Math.round((y-g)/$O)}function FO(r,t){const s=bv(r,t),i=kr(r,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),lu(i)}function VO(r,t){const s=+bn(r)-+bn(t);return s<0?-1:s>0?1:s}function YO(r){return kr(r,Date.now())}function KO(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function QO(r){return!(!KO(r)&&typeof r!="number"||isNaN(+bn(r)))}function XO(r){return t=>{const i=(r?Math[r]:Math.trunc)(t);return i===0?0:i}}function JO(r,t){const s=bn(r,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const ZO={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"}},WO=(r,t,s)=>{let i;const l=ZO[r];return typeof l=="string"?i=l:t===1?i=l.one:i=l.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function Xh(r){return(t={})=>{const s=t.width?String(t.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const eA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},tA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},nA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},rA={date:Xh({formats:eA,defaultWidth:"full"}),time:Xh({formats:tA,defaultWidth:"full"}),dateTime:Xh({formats:nA,defaultWidth:"full"})},sA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},iA=(r,t,s,i)=>sA[r];function Wa(r){return(t,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let l;if(i==="formatting"&&r.formattingValues){const m=r.defaultFormattingWidth||r.defaultWidth,y=s!=null&&s.width?String(s.width):m;l=r.formattingValues[y]||r.formattingValues[m]}else{const m=r.defaultWidth,y=s!=null&&s.width?String(s.width):r.defaultWidth;l=r.values[y]||r.values[m]}const c=r.argumentCallback?r.argumentCallback(t):t;return l[c]}}const aA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},oA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},lA={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"]},cA={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"]},uA={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"}},fA={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"}},hA=(r,t)=>{const s=Number(r),i=s%100;if(i>20||i<10)switch(i%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},dA={ordinalNumber:hA,era:Wa({values:aA,defaultWidth:"wide"}),quarter:Wa({values:oA,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Wa({values:lA,defaultWidth:"wide"}),day:Wa({values:cA,defaultWidth:"wide"}),dayPeriod:Wa({values:uA,defaultWidth:"wide",formattingValues:fA,defaultFormattingWidth:"wide"})};function eo(r){return(t,s={})=>{const i=s.width,l=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],c=t.match(l);if(!c)return null;const m=c[0],y=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(y)?pA(y,b=>b.test(m)):mA(y,b=>b.test(m));let f;f=r.valueCallback?r.valueCallback(g):g,f=s.valueCallback?s.valueCallback(f):f;const d=t.slice(m.length);return{value:f,rest:d}}}function mA(r,t){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&t(r[s]))return s}function pA(r,t){for(let s=0;s<r.length;s++)if(t(r[s]))return s}function yA(r){return(t,s={})=>{const i=t.match(r.matchPattern);if(!i)return null;const l=i[0],c=t.match(r.parsePattern);if(!c)return null;let m=r.valueCallback?r.valueCallback(c[0]):c[0];m=s.valueCallback?s.valueCallback(m):m;const y=t.slice(l.length);return{value:m,rest:y}}}const gA=/^(\d+)(th|st|nd|rd)?/i,bA=/\d+/i,vA={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},xA={any:[/^b/i,/^(a|c)/i]},_A={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},wA={any:[/1/i,/2/i,/3/i,/4/i]},SA={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},EA={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]},OA={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},AA={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]},jA={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},TA={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}},kA={ordinalNumber:yA({matchPattern:gA,parsePattern:bA,valueCallback:r=>parseInt(r,10)}),era:eo({matchPatterns:vA,defaultMatchWidth:"wide",parsePatterns:xA,defaultParseWidth:"any"}),quarter:eo({matchPatterns:_A,defaultMatchWidth:"wide",parsePatterns:wA,defaultParseWidth:"any",valueCallback:r=>r+1}),month:eo({matchPatterns:SA,defaultMatchWidth:"wide",parsePatterns:EA,defaultParseWidth:"any"}),day:eo({matchPatterns:OA,defaultMatchWidth:"wide",parsePatterns:AA,defaultParseWidth:"any"}),dayPeriod:eo({matchPatterns:jA,defaultMatchWidth:"any",parsePatterns:TA,defaultParseWidth:"any"})},xv={code:"en-US",formatDistance:WO,formatLong:rA,formatRelative:iA,localize:dA,match:kA,options:{weekStartsOn:0,firstWeekContainsDate:1}};function NA(r,t){const s=bn(r,t==null?void 0:t.in);return GO(s,JO(s))+1}function CA(r,t){const s=bn(r,t==null?void 0:t.in),i=+lu(s)-+FO(s);return Math.round(i/gv)+1}function _v(r,t){var d,b,v,x;const s=bn(r,t==null?void 0:t.in),i=s.getFullYear(),l=Eo(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??l.firstWeekContainsDate??((x=(v=l.locale)==null?void 0:v.options)==null?void 0:x.firstWeekContainsDate)??1,m=kr((t==null?void 0:t.in)||r,0);m.setFullYear(i+1,0,c),m.setHours(0,0,0,0);const y=xo(m,t),g=kr((t==null?void 0:t.in)||r,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const f=xo(g,t);return+s>=+y?i+1:+s>=+f?i:i-1}function MA(r,t){var y,g,f,d;const s=Eo(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((d=(f=s.locale)==null?void 0:f.options)==null?void 0:d.firstWeekContainsDate)??1,l=_v(r,t),c=kr((t==null?void 0:t.in)||r,0);return c.setFullYear(l,0,i),c.setHours(0,0,0,0),xo(c,t)}function RA(r,t){const s=bn(r,t==null?void 0:t.in),i=+xo(s,t)-+MA(s,t);return Math.round(i/gv)+1}function Qe(r,t){const s=r<0?"-":"",i=Math.abs(r).toString().padStart(t,"0");return s+i}const os={y(r,t){const s=r.getFullYear(),i=s>0?s:1-s;return Qe(t==="yy"?i%100:i,t.length)},M(r,t){const s=r.getMonth();return t==="M"?String(s+1):Qe(s+1,2)},d(r,t){return Qe(r.getDate(),t.length)},a(r,t){const s=r.getHours()/12>=1?"pm":"am";switch(t){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,t){return Qe(r.getHours()%12||12,t.length)},H(r,t){return Qe(r.getHours(),t.length)},m(r,t){return Qe(r.getMinutes(),t.length)},s(r,t){return Qe(r.getSeconds(),t.length)},S(r,t){const s=t.length,i=r.getMilliseconds(),l=Math.trunc(i*Math.pow(10,s-3));return Qe(l,t.length)}},Li={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Gg={G:function(r,t,s){const i=r.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(i,{width:"abbreviated"});case"GGGGG":return s.era(i,{width:"narrow"});case"GGGG":default:return s.era(i,{width:"wide"})}},y:function(r,t,s){if(t==="yo"){const i=r.getFullYear(),l=i>0?i:1-i;return s.ordinalNumber(l,{unit:"year"})}return os.y(r,t)},Y:function(r,t,s,i){const l=_v(r,i),c=l>0?l:1-l;if(t==="YY"){const m=c%100;return Qe(m,2)}return t==="Yo"?s.ordinalNumber(c,{unit:"year"}):Qe(c,t.length)},R:function(r,t){const s=bv(r);return Qe(s,t.length)},u:function(r,t){const s=r.getFullYear();return Qe(s,t.length)},Q:function(r,t,s){const i=Math.ceil((r.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return Qe(i,2);case"Qo":return s.ordinalNumber(i,{unit:"quarter"});case"QQQ":return s.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(i,{width:"wide",context:"formatting"})}},q:function(r,t,s){const i=Math.ceil((r.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return Qe(i,2);case"qo":return s.ordinalNumber(i,{unit:"quarter"});case"qqq":return s.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(i,{width:"wide",context:"standalone"})}},M:function(r,t,s){const i=r.getMonth();switch(t){case"M":case"MM":return os.M(r,t);case"Mo":return s.ordinalNumber(i+1,{unit:"month"});case"MMM":return s.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(i,{width:"wide",context:"formatting"})}},L:function(r,t,s){const i=r.getMonth();switch(t){case"L":return String(i+1);case"LL":return Qe(i+1,2);case"Lo":return s.ordinalNumber(i+1,{unit:"month"});case"LLL":return s.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(i,{width:"wide",context:"standalone"})}},w:function(r,t,s,i){const l=RA(r,i);return t==="wo"?s.ordinalNumber(l,{unit:"week"}):Qe(l,t.length)},I:function(r,t,s){const i=CA(r);return t==="Io"?s.ordinalNumber(i,{unit:"week"}):Qe(i,t.length)},d:function(r,t,s){return t==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):os.d(r,t)},D:function(r,t,s){const i=NA(r);return t==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):Qe(i,t.length)},E:function(r,t,s){const i=r.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(i,{width:"short",context:"formatting"});case"EEEE":default:return s.day(i,{width:"wide",context:"formatting"})}},e:function(r,t,s,i){const l=r.getDay(),c=(l-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return Qe(c,2);case"eo":return s.ordinalNumber(c,{unit:"day"});case"eee":return s.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(l,{width:"short",context:"formatting"});case"eeee":default:return s.day(l,{width:"wide",context:"formatting"})}},c:function(r,t,s,i){const l=r.getDay(),c=(l-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return Qe(c,t.length);case"co":return s.ordinalNumber(c,{unit:"day"});case"ccc":return s.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(l,{width:"narrow",context:"standalone"});case"cccccc":return s.day(l,{width:"short",context:"standalone"});case"cccc":default:return s.day(l,{width:"wide",context:"standalone"})}},i:function(r,t,s){const i=r.getDay(),l=i===0?7:i;switch(t){case"i":return String(l);case"ii":return Qe(l,t.length);case"io":return s.ordinalNumber(l,{unit:"day"});case"iii":return s.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(i,{width:"short",context:"formatting"});case"iiii":default:return s.day(i,{width:"wide",context:"formatting"})}},a:function(r,t,s){const l=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(r,t,s){const i=r.getHours();let l;switch(i===12?l=Li.noon:i===0?l=Li.midnight:l=i/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(r,t,s){const i=r.getHours();let l;switch(i>=17?l=Li.evening:i>=12?l=Li.afternoon:i>=4?l=Li.morning:l=Li.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(r,t,s){if(t==="ho"){let i=r.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return os.h(r,t)},H:function(r,t,s){return t==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):os.H(r,t)},K:function(r,t,s){const i=r.getHours()%12;return t==="Ko"?s.ordinalNumber(i,{unit:"hour"}):Qe(i,t.length)},k:function(r,t,s){let i=r.getHours();return i===0&&(i=24),t==="ko"?s.ordinalNumber(i,{unit:"hour"}):Qe(i,t.length)},m:function(r,t,s){return t==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):os.m(r,t)},s:function(r,t,s){return t==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):os.s(r,t)},S:function(r,t){return os.S(r,t)},X:function(r,t,s){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Vg(i);case"XXXX":case"XX":return Hs(i);case"XXXXX":case"XXX":default:return Hs(i,":")}},x:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"x":return Vg(i);case"xxxx":case"xx":return Hs(i);case"xxxxx":case"xxx":default:return Hs(i,":")}},O:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Fg(i,":");case"OOOO":default:return"GMT"+Hs(i,":")}},z:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Fg(i,":");case"zzzz":default:return"GMT"+Hs(i,":")}},t:function(r,t,s){const i=Math.trunc(+r/1e3);return Qe(i,t.length)},T:function(r,t,s){return Qe(+r,t.length)}};function Fg(r,t=""){const s=r>0?"-":"+",i=Math.abs(r),l=Math.trunc(i/60),c=i%60;return c===0?s+String(l):s+String(l)+t+Qe(c,2)}function Vg(r,t){return r%60===0?(r>0?"-":"+")+Qe(Math.abs(r)/60,2):Hs(r,t)}function Hs(r,t=""){const s=r>0?"-":"+",i=Math.abs(r),l=Qe(Math.trunc(i/60),2),c=Qe(i%60,2);return s+l+t+c}const Yg=(r,t)=>{switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},wv=(r,t)=>{switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},DA=(r,t)=>{const s=r.match(/(P+)(p+)?/)||[],i=s[1],l=s[2];if(!l)return Yg(r,t);let c;switch(i){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",Yg(i,t)).replace("{{time}}",wv(l,t))},qA={p:wv,P:DA},LA=/^D+$/,BA=/^Y+$/,UA=["D","DD","YY","YYYY"];function PA(r){return LA.test(r)}function zA(r){return BA.test(r)}function IA(r,t,s){const i=$A(r,t,s);if(console.warn(i),UA.includes(r))throw new RangeError(i)}function $A(r,t,s){const i=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${t}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const HA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,GA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,FA=/^'([^]*?)'?$/,VA=/''/g,YA=/[a-zA-Z]/;function sm(r,t,s){var d,b,v,x;const i=Eo(),l=i.locale??xv,c=i.firstWeekContainsDate??((b=(d=i.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??1,m=i.weekStartsOn??((x=(v=i.locale)==null?void 0:v.options)==null?void 0:x.weekStartsOn)??0,y=bn(r,s==null?void 0:s.in);if(!QO(y))throw new RangeError("Invalid time value");let g=t.match(GA).map(w=>{const S=w[0];if(S==="p"||S==="P"){const M=qA[S];return M(w,l.formatLong)}return w}).join("").match(HA).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:KA(w)};if(Gg[S])return{isToken:!0,value:w};if(S.match(YA))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});l.localize.preprocessor&&(g=l.localize.preprocessor(y,g));const f={firstWeekContainsDate:c,weekStartsOn:m,locale:l};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(zA(S)||PA(S))&&IA(S,t,String(r));const M=Gg[S[0]];return M(y,S,l.localize,f)}).join("")}function KA(r){const t=r.match(FA);return t?t[1].replace(VA,"'"):r}function QA(r,t,s){const i=Eo(),l=(s==null?void 0:s.locale)??i.locale??xv,c=VO(r,t);if(isNaN(c))throw new RangeError("Invalid time value");const m=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[y,g]=vv(s==null?void 0:s.in,...c>0?[t,r]:[r,t]),f=XO((s==null?void 0:s.roundingMethod)??"round"),d=g.getTime()-y.getTime(),b=d/Ug,v=cu(g)-cu(y),x=(d-v)/Ug,w=s==null?void 0:s.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<Ig?S="hour":x<zg?S="day":x<Pg?S="month":S="year",S==="second"){const M=f(d/1e3);return l.formatDistance("xSeconds",M,m)}else if(S==="minute"){const M=f(b);return l.formatDistance("xMinutes",M,m)}else if(S==="hour"){const M=f(b/60);return l.formatDistance("xHours",M,m)}else if(S==="day"){const M=f(x/Ig);return l.formatDistance("xDays",M,m)}else if(S==="month"){const M=f(x/zg);return M===12&&w!=="month"?l.formatDistance("xYears",1,m):l.formatDistance("xMonths",M,m)}else{const M=f(x/Pg);return l.formatDistance("xYears",M,m)}}function XA(r,t){return QA(r,YO(r),t)}function U3(r){return r.toLocaleString()}function P3(r){return r>=1e9?`${(r/1e9).toFixed(1).replace(/\.0$/,"")}B`:r>=1e6?`${(r/1e6).toFixed(1).replace(/\.0$/,"")}M`:r>=1e4?`${(r/1e3).toFixed(1).replace(/\.0$/,"")}K`:r.toLocaleString()}function JA(r){const t=new Date(r);return t.getTime()>Date.now()?"just now":XA(t,{addSuffix:!0})}function z3(r){const t=Date.now()-new Date(r).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const l=Math.floor(i/60);if(l<24)return`${l}h`;const c=Math.floor(l/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function I3(r){return r<=0?"Expired":im(r)}function ZA(r){return r==null?"--":im(r)}function $3(r){return r?sm(new Date(r),"MMM d, yyyy h:mm a"):"--"}function im(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const m=r/1e3;return Number.isInteger(m)?`${m}s`:`${m.toFixed(1)}s`}const t=Math.floor(r/1e3),s=Math.floor(t/86400),i=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),c=t%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?l>0?`${i}h ${l}m`:`${i}h`:c>0?`${l}m ${c}s`:`${l}m`}function H3(r,t){const s=new Date(r).getTime(),i=t?new Date(t).getTime():Date.now();return im(i-s)}function Sv({options:r,children:t,className:s=""}){const[i,l]=j.useState(!1),[c,m]=j.useState(null),[y,g]=j.useState(null),f=j.useRef(null),d=j.useRef(void 0),b=j.useRef(void 0),v=220,x=j.useCallback(()=>{if(!f.current)return;const B=f.current.getBoundingClientRect(),P=window.innerWidth-v-8,se=Math.max(8,Math.min(B.left,P));g({top:B.bottom+4,left:se})},[]),w=j.useCallback(async(B,P)=>{try{await navigator.clipboard.writeText(B),m(P),clearTimeout(d.current),d.current=setTimeout(()=>m(null),1200)}catch{}},[]),S=j.useCallback(()=>{clearTimeout(b.current),x(),l(!0)},[x]),M=j.useCallback(()=>{b.current=setTimeout(()=>l(!1),150)},[]);return j.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(b.current)},[]),p.jsxs("span",{ref:f,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:M,children:[t,i&&y&&mb.createPortal(p.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:y.top,left:y.left},onMouseEnter:S,onMouseLeave:M,children:r.map(B=>p.jsxs("button",{onClick:P=>{P.stopPropagation(),w(B.value,B.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[p.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:B.label}),p.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===B.label?"✓":B.value})]},B.label))}),document.body)]})}function WA(r,t){const s=new Date(r);switch(t){case"relative":return JA(r);case"datetime":return sm(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function ej(r){const t=new Date(r);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:sm(t,"MMM d, yyyy h:mm:ss a")}]}function Ev({date:r,format:t="relative",className:s=""}){const[,i]=j.useState(0);j.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>i(m=>m+1),3e4);return()=>clearInterval(c)},[t]);const l=j.useMemo(()=>ej(r),[r]);return p.jsx(Sv,{options:l,children:p.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:WA(r,t)})})}function tj({values:r,options:t,onChange:s,addLabel:i,emptyText:l,ariaLabel:c}){const m=t.filter(y=>!r.includes(y));return p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.map(y=>p.jsxs("button",{type:"button",onClick:()=>s(r.filter(g=>g!==y)),className:"inline-flex items-center gap-1 text-2xs font-mono text-text-primary border border-surface-border px-1.5 py-0.5 hover:text-status-error hover:border-status-error/50 transition-colors",title:`Remove ${y}`,children:[y,p.jsx(Ft,{className:"w-3 h-3",strokeWidth:1.5})]},y)),r.length===0&&l&&p.jsx("span",{className:"text-2xs text-text-tertiary italic",children:l}),m.length>0&&p.jsxs("select",{value:"",onChange:y=>y.target.value&&s([...r,y.target.value]),className:"select font-mono","aria-label":c??i,children:[p.jsx("option",{value:"",children:i}),m.map(y=>p.jsx("option",{value:y,children:y},y))]})]})}const nj=[{minutes:1,label:"1 minute"},{minutes:15,label:"15 minutes"},{minutes:30,label:"30 minutes"},{minutes:60,label:"1 hour"},{minutes:240,label:"4 hours"},{minutes:1440,label:"24 hours"},{minutes:4320,label:"3 days"},{minutes:10080,label:"7 days"}];function rj(){const{data:r}=yv(),{data:t}=_O(),s=zO(),i=IO(),[l,c]=j.useState(""),[m,y]=j.useState(""),[g,f]=j.useState(1440),[d,b]=j.useState([]),v=(r==null?void 0:r.announcements)??[],x=()=>{m.trim()&&s.mutate({body:m.trim(),...l.trim()?{title:l.trim()}:{},...d.length?{roles:d}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),y(""),b([])}})};return p.jsxs("div",{children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"block",children:[p.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),p.jsx("input",{type:"text",value:l,onChange:w=>c(w.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),p.jsxs("label",{className:"block",children:[p.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),p.jsx("textarea",{value:m,onChange:w=>y(w.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),p.jsxs("label",{className:"block",children:[p.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),p.jsx("select",{value:g,onChange:w=>f(Number(w.target.value)),className:"select text-xs w-full",children:nj.map(w=>p.jsx("option",{value:w.minutes,children:w.label},w.minutes))})]}),p.jsxs("div",{className:"block",children:[p.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),p.jsx(tj,{values:d,options:(t==null?void 0:t.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&p.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),p.jsx("button",{onClick:x,disabled:!m.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),v.length>0&&p.jsxs("div",{className:"mt-6",children:[p.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),p.jsx("div",{className:"space-y-1",children:v.map(w=>p.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[p.jsxs("span",{className:"min-w-0 flex-1",children:[p.jsx("span",{className:"block text-xs text-text-primary truncate",children:w.title??w.body.split(`
54
+ `)[0]}),p.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",p.jsx(Ev,{date:w.expires_at,format:"relative"})]})]}),p.jsx("button",{onClick:()=>i.mutate(w.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${w.title??"announcement"}`,children:p.jsx(Ft,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},w.id))})]})]})}const sj=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],ij=["operator","engineer","admin","superadmin"];function Kg(r){return ij.indexOf(r)}function aj(r,t){return Kg(r)>=Kg(t)}function oj({onClose:r}){var de,Oe,we,Ne,Ae,ke,et;const{isSuperAdmin:t,hasRoleType:s,hasRole:i}=Vt(),{data:l}=nr(),c=Qd(),m=!!((de=l==null?void 0:l.ai)!=null&&de.enabled),y=sv(),g=y!==null?y:m,[f,d]=j.useState(g),b=(Oe=l==null?void 0:l.features)==null?void 0:Oe.graphWorkflows,v=b==null,[x,w]=j.useState(b===!0||v&&iv()),S=!!((we=l==null?void 0:l.features)!=null&&we.scanCodes),M=av(),[B,P]=j.useState(M!==null?M:S),se=t?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",fe=((Ne=l==null?void 0:l.branding)==null?void 0:Ne.appName)??"LongTail",C=(Ae=l==null?void 0:l.environment)==null?void 0:Ae.longTailVersion,U=(ke=l==null?void 0:l.environment)==null?void 0:ke.hotmeshVersion,re=(et=l==null?void 0:l.environment)==null?void 0:et.nodeEnv;j.useEffect(()=>{const oe=Ie=>{Ie.key==="Escape"&&r()};return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[r]);const K=sj.filter(oe=>aj(se,oe.minTier)),L=K.length>1,F=se!=="operator",ee=[...L?[{id:"viewas",label:"View As",icon:ww}]:[],{id:"features",label:"Features",icon:Sw},...F?[{id:"alerts",label:"Alerts",icon:Ew}]:[]],[X,he]=j.useState(ee[0].id),ve=oe=>{oe===null?Od():mO(oe)},Te=()=>{const oe=!f;d(oe),oe===m?dO():hO(oe),window.location.reload()},Y=()=>{const oe=!x;w(oe),pO(oe),window.location.reload()},ae=()=>{const oe=!B;P(oe),oe===S?gO():yO(oe),window.location.reload()};return p.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:r,children:p.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:oe=>oe.stopPropagation(),children:[p.jsx("button",{onClick:r,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:p.jsx(Ft,{className:"w-4 h-4",strokeWidth:1.5})}),p.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[p.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Nt}/logo512.png)`}}),p.jsxs("div",{className:"text-center",children:[p.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:fe}),C&&p.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",C,U&&p.jsxs(p.Fragment,{children:[" · HotMesh v",U]}),re&&re!=="production"&&p.jsx("span",{className:"ml-1 text-status-warning",children:re})]})]})]}),p.jsx("hr",{className:"border-surface-border/50 mb-6"}),ee.length>1&&p.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:ee.map(oe=>{const Ie=X===oe.id;return p.jsxs("button",{role:"tab","aria-selected":Ie,onClick:()=>he(oe.id),title:oe.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Ie?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[p.jsx(oe.icon,{className:"w-5 h-5",strokeWidth:1.5,...Ie?{fill:"currentColor",fillOpacity:.15}:{}}),p.jsx("span",{className:"text-2xs font-medium",children:oe.label})]},oe.id)})}),X==="viewas"&&L&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),K.map(oe=>{const Ie=c===oe.id,tt=oe.id===null?`Your view · ${se}`:oe.label;return p.jsxs("button",{onClick:()=>ve(oe.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[p.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${Ie?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Ie&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),p.jsxs("span",{children:[p.jsx("span",{className:`block text-sm font-medium transition-colors ${Ie?"text-accent":"text-text-primary group-hover:text-accent"}`,children:tt}),p.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:oe.description})]})]},String(oe.id))})]}),X==="features"&&p.jsxs("div",{children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),p.jsxs("button",{onClick:Te,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[p.jsxs("span",{children:[p.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),p.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:f?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),p.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${f?"bg-accent":"bg-surface-border"}`,children:p.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),v&&p.jsxs("button",{onClick:Y,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[p.jsxs("span",{children:[p.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),p.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:x?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),p.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${x?"bg-accent":"bg-surface-border"}`,children:p.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${x?"translate-x-4":"translate-x-0"}`})})]}),p.jsxs("button",{onClick:ae,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[p.jsxs("span",{children:[p.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),p.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:B?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),p.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${B?"bg-accent":"bg-surface-border"}`,children:p.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${B?"translate-x-4":"translate-x-0"}`})})]})]}),X==="alerts"&&F&&p.jsx(rj,{}),p.jsx("hr",{className:"border-surface-border/50 mt-8"}),p.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const Ov=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],Qg="blue",Av="lt.theme";let jv=[];function lj(r){const t=new Set(Ov.map(i=>i.id)),s=new Set;jv=r.filter(i=>!(i!=null&&i.id)||t.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function cj(){return[...Ov,...jv]}function Tv(){try{return localStorage.getItem(Av)||Qg}catch{return Qg}}function kv(r){document.documentElement.dataset.theme=r}function uj(r){try{localStorage.setItem(Av,r)}catch{}kv(r)}const Nv=j.createContext(null);function fj(){const r=j.useContext(Nv);if(!r)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return r}function hj({children:r}){const[t,s]=j.useState(null),i=j.useRef(t);i.current=t,j.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const g=new Date(t.expiresAt).getTime()-Date.now();if(g<=0){s(null);return}const f=setTimeout(()=>s(null),g);return()=>clearTimeout(f)},[t]);const l=j.useCallback(g=>{var d;if(!g.actingToken||!g.actor)return null;const f=((d=i.current)==null?void 0:d.actingToken)??null;return s({actingToken:g.actingToken,actorId:g.actor.id,displayName:g.actor.displayName,expiresAt:g.expiresAt??null}),f},[]),c=j.useCallback(()=>s(null),[]);j.useEffect(()=>(rg(()=>{var g;return((g=i.current)==null?void 0:g.actingToken)??null}),sg(c),()=>{rg(null),sg(null)}),[c]);const m=j.useCallback(()=>{var f;const g=(f=i.current)==null?void 0:f.expiresAt;return g?Math.max(0,Math.floor((new Date(g).getTime()-Date.now())/1e3)):0},[]),y=j.useMemo(()=>({identity:t,prime:l,clear:c,remainingSeconds:m}),[t,l,c,m]);return p.jsx(Nv.Provider,{value:y,children:r})}const Zc={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},Cv="lt_scan_wedge_config";function Mv(){try{const r=localStorage.getItem(Cv);return r?{...Zc,...JSON.parse(r)}:Zc}catch{return Zc}}function dj(r){const t={...Mv(),...r};return localStorage.setItem(Cv,JSON.stringify(t)),t}const mj=[/[1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+$/,/[1-9][0-9]{7,}$/];function Xg(r){let t=null;for(const s of mj){const i=r.match(s);i&&(!t||i[0].length>t.length)&&(t=i[0])}return t}const pj=new Set(["Shift","CapsLock"]),nc={suppress:!1,emit:null};function yj(r=Zc){let t={buffer:"",times:[],lastKeyMs:0};function s(){t={buffer:"",times:[],lastKeyMs:0}}function i(m){const{key:y,timeMs:g,hasModifier:f,isRepeat:d}=m;if(pj.has(y))return nc;if(r.terminators.includes(y)){const S=Xg(t.buffer);return s(),S&&S.length>=r.minLength?{suppress:!0,emit:S,consumedLength:S.length}:nc}if(f||d||y.length!==1)return s(),nc;const b=g-t.lastKeyMs,v=t.lastKeyMs>0&&b<=r.maxKeyGapMs,x=(v?t.buffer+y:y).slice(-128),w=(v?[...t.times,g]:[g]).slice(-128);return t={buffer:x,times:w,lastKeyMs:g},nc}function l(){return{buffer:t.buffer}}function c(){const m=Xg(t.buffer);if(!m||m.length<r.minLength)return null;const y=t.times.slice(-m.length);return y.length<2||(y[y.length-1]-y[0])/(y.length-1)>r.autoFireMaxAvgKeyMs?null:{code:m,consumedLength:m.length}}return{step:i,reset:s,snapshot:l,pendingAutoFire:c}}function gj(){const r=document.activeElement;return r instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(r.type)?r:null:r instanceof HTMLTextAreaElement?r:null}function bj(r,t,s){var c;const i=r instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,l=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;l?l.call(r,t):r.value=t;try{r.setSelectionRange(s,s)}catch{}r.dispatchEvent(new Event("input",{bubbles:!0}))}function Jg(r){if(r<=0)return;const t=gj();if(!t)return;const s=t.selectionStart??t.value.length,i=Math.max(0,s-r);bj(t,t.value.slice(0,i)+t.value.slice(s),i)}function vj({active:r,wedgeConfig:t,diagnosticsOn:s,onScan:i,onDiag:l}){const c=j.useRef({diagnosticsOn:s,onScan:i,onDiag:l});c.current={diagnosticsOn:s,onScan:i,onDiag:l};const m=j.useRef(0),y=j.useRef(0);j.useEffect(()=>{if(!r)return;const g=yj(t);let f=null;const d=()=>{f&&(clearTimeout(f),f=null)},b=(w,S,M)=>{S&&Jg(S),c.current.diagnosticsOn&&(console.debug("[scan]",M),c.current.onDiag({seq:++m.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:M})),c.current.onScan(w)},v=()=>{d(),g.pendingAutoFire()&&(f=setTimeout(()=>{f=null;const w=g.pendingAutoFire();w&&(g.reset(),b(w.code,w.consumedLength,`capture → ${w.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},x=w=>{const S=g.snapshot().buffer,{suppress:M,emit:B,consumedLength:P}=g.step({key:w.key,timeMs:w.timeStamp,hasModifier:w.ctrlKey||w.metaKey||w.altKey,isRepeat:w.repeat});if(M&&(w.preventDefault(),w.stopPropagation()),c.current.diagnosticsOn){const se=g.snapshot().buffer,fe=t.terminators.includes(w.key),C=B?`capture → ${B}`:fe?`terminator — no code tail in "${S.slice(-24)}"`:se===S?S?"neutral (chord key)":"ignored":se===""?"reset (edit/chord/non-printable)":se.length<=1&&S.length>1?"gap — new episode":"accumulate",U=y.current?Math.round(w.timeStamp-y.current):0,re={seq:++m.current,key:w.key,code:w.code!==w.key?w.code:"",deltaMs:U,buffer:se.slice(-24),note:C};console.debug("[scan]",re.key,re.code,`${re.deltaMs}ms`,re.note),c.current.onDiag(re)}y.current=w.timeStamp,B?(d(),P&&Jg(P),c.current.onScan(B)):v()};return window.addEventListener("keydown",x,{capture:!0}),()=>{d(),window.removeEventListener("keydown",x,{capture:!0})}},[r,t])}const ze={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices"},rc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",PRESENT:"present"},G3={ACTION:"action",IDENTITY:"identity"};function xj(r,t){return ge("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:r,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{}})})}function F3(r){return ge("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(r)})}function V3(){return st({queryKey:["scan-schemes"],queryFn:()=>ge("/scan-codes/schemes")})}function Y3(r){return st({queryKey:["scan-schemes",r],queryFn:()=>ge(`/scan-codes/schemes/${r}`),enabled:r!=null})}function K3(){const r=Ve();return We({mutationFn:t=>ge(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>r.invalidateQueries({queryKey:["scan-schemes"]})})}function Q3(){const r=Ve();return We({mutationFn:t=>ge(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>r.invalidateQueries({queryKey:["scan-schemes"]})})}function X3(){const r=Ve();return We({mutationFn:t=>ge(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,s)=>r.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function J3(){const r=Ve();return We({mutationFn:t=>ge(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,s)=>r.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const Zg={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual"},Bi=r=>{if(r)try{return JSON.parse(r)}catch{return}},Gs=r=>r==null||Array.isArray(r)&&r.length===0||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0;function _j(r){const t={},s=Bi(r.get("facets"));Gs(s)||(t.facets=s);const i=Bi(r.get("block"));Gs(i)||(t.block=i);const l=Bi(r.get("range"));Gs(l)||(t.range=l);const c=Bi(r.get("exists"));Gs(c)||(t.exists=c);const m=Bi(r.get("roles"));Gs(m)||(t.roles=m);const y=Bi(r.get("orderBy"));Gs(y)||(t.orderBy=y),r.get("available")!=null&&(t.available=r.get("available")==="true");const g=r.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function Z3(r,t){const s=(i,l)=>Gs(l)?r.delete(i):r.set(i,JSON.stringify(l));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?r.delete("available"):r.set("available",String(t.available)),t.jeopardy===!0?r.set("jeopardy","1"):r.delete("jeopardy")}const Wg=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function Rv(r,t){const s={};for(const[l,c]of Object.entries(r))s[l]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${i}${Wg}`:`/escalations/available?facets=${i}${Wg}`}function W3(r,t,s){return Rv({[r]:t},s)}function eC(r){var t,s,i;return Object.keys(r.facets??{}).length+(((t=r.block)==null?void 0:t.length)??0)+(((s=r.range)==null?void 0:s.length)??0)+(((i=r.exists)==null?void 0:i.length)??0)+(r.available!=null?1:0)+(r.jeopardy===!0?1:0)}function Dv(){var s;const{data:r}=nr(),t=av();return t!==null?t:!!((s=r==null?void 0:r.features)!=null&&s.scanCodes)}const qv=j.createContext(null);function Lv(){const r=j.useContext(qv);if(!r)throw new Error("useScanInput must be used within ScanInputProvider");return r}const wj="scanPendingAction",Sj="scanChoices",Ej="/scan/station";function Oj({children:r}){const{user:t}=Vt(),s=Dv(),i=_o(),{identity:l,prime:c}=fj(),[m,y]=j.useState(null),[g,f]=j.useState(!1),[d,b]=j.useState(()=>Mv()),[v,x]=j.useState([]),[w,S]=j.useState(!1),M=j.useCallback(L=>{var ee;const{outcome:F}=L;if(F===ze.CONFIRM_REQUIRED&&L.pendingAction)return i(`/escalations/detail/${L.pendingAction.escalationId}`,{state:{[wj]:L.pendingAction}}),!0;if(F===ze.EXECUTED&&L.escalation){const X=[rc.SHOW_DETAIL,rc.CLAIM_SHOW_DETAIL,rc.CLAIM,rc.ESCALATE];return L.verb&&X.includes(L.verb)?(i(`/escalations/detail/${L.escalation.id}`),!0):!1}if(F===ze.MATCHED_LIST&&L.listQuery){const{targetFacet:X,target:he,roles:ve}=L.listQuery;return i(Rv({[X]:he},(ve==null?void 0:ve[0])??null)),!0}return F===ze.CHOICES&&L.choices?(i(Ej,{state:{[Sj]:L}}),!0):F===ze.NO_MATCH_FALLBACK&&((ee=L.fallback)!=null&&ee.route)?(i(L.fallback.route),!0):!1},[i]),B=j.useRef(null);B.current=(l==null?void 0:l.actingToken)??null;const P=j.useRef(null),se=j.useRef(null),fe=j.useCallback(L=>{se.current=L},[]),C=j.useCallback(async(L,F=Zg.MANUAL)=>{var X;if((X=se.current)!=null&&X.call(se,L))return;f(!0);const ee=Date.now();try{const he=await xj(L,{actingToken:B.current??void 0,previousActingToken:P.current??void 0});he.outcome===ze.IDENTITY_PRIMED&&(P.current=c(he));const ve=M(he);y({code:L,source:F,at:ee,response:he,error:null,navigated:ve})}catch(he){y({code:L,source:F,at:ee,response:null,error:he.message,navigated:!1})}finally{f(!1)}},[M,c]),U=j.useRef(C);U.current=C,vj({active:!!t&&s,wedgeConfig:d,diagnosticsOn:w,onScan:L=>void U.current(L,Zg.KEYBOARD_WEDGE),onDiag:L=>x(F=>[...F.slice(-29),L])});const re=j.useCallback(L=>{b(dj(L))},[]),K=j.useMemo(()=>({submitCode:C,setCodeInterceptor:fe,lastResult:m,busy:g,wedgeConfig:d,updateWedgeConfig:re,diagnostics:v,diagnosticsOn:w,setDiagnosticsOn:S}),[C,fe,m,g,d,re,v,w]);return p.jsx(qv.Provider,{value:K,children:r})}var sc={},to={},ic={},e1;function xn(){if(e1)return ic;e1=1,Object.defineProperty(ic,"__esModule",{value:!0});function r(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var t=function s(i,l){r(this,s),this.data=i,this.text=l.text||i,this.options=l};return ic.default=t,ic}var t1;function Aj(){if(t1)return to;t1=1,Object.defineProperty(to,"__esModule",{value:!0}),to.CODE39=void 0;var r=(function(){function S(M,B){for(var P=0;P<B.length;P++){var se=B[P];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(M,se.key,se)}}return function(M,B,P){return B&&S(M.prototype,B),P&&S(M,P),M}})(),t=xn(),s=i(t);function i(S){return S&&S.__esModule?S:{default:S}}function l(S,M){if(!(S instanceof M))throw new TypeError("Cannot call a class as a function")}function c(S,M){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:S}function m(S,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);S.prototype=Object.create(M&&M.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(S,M):S.__proto__=M)}var y=(function(S){m(M,S);function M(B,P){return l(this,M),B=B.toUpperCase(),P.mod43&&(B+=v(w(B))),c(this,(M.__proto__||Object.getPrototypeOf(M)).call(this,B,P))}return r(M,[{key:"encode",value:function(){for(var P=d("*"),se=0;se<this.data.length;se++)P+=d(this.data[se])+"0";return P+=d("*"),{data:P,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),M})(s.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],f=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function d(S){return b(x(S))}function b(S){return f[S].toString(2)}function v(S){return g[S]}function x(S){return g.indexOf(S)}function w(S){for(var M=0,B=0;B<S.length;B++)M+=x(S[B]);return M=M%43,M}return to.CODE39=y,to}var In={},ac={},oc={},pt={},n1;function Oo(){if(n1)return pt;n1=1,Object.defineProperty(pt,"__esModule",{value:!0});var r;function t(g,f,d){return f in g?Object.defineProperty(g,f,{value:d,enumerable:!0,configurable:!0,writable:!0}):g[f]=d,g}var s=pt.SET_A=0,i=pt.SET_B=1,l=pt.SET_C=2;pt.SHIFT=98;var c=pt.START_A=103,m=pt.START_B=104,y=pt.START_C=105;return pt.MODULO=103,pt.STOP=106,pt.FNC1=207,pt.SET_BY_CODE=(r={},t(r,c,s),t(r,m,i),t(r,y,l),r),pt.SWAP={101:s,100:i,99:l},pt.A_START_CHAR="Ð",pt.B_START_CHAR="Ñ",pt.C_START_CHAR="Ò",pt.A_CHARS="[\0-_È-Ï]",pt.B_CHARS="[ -È-Ï]",pt.C_CHARS="(Ï*[0-9]{2}Ï*)",pt.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],pt}var r1;function xu(){if(r1)return oc;r1=1,Object.defineProperty(oc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xn(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){c(this,d);var x=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b.substring(1),v));return x.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),x}return r(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.bytes,x=v.shift()-105,w=i.SET_BY_CODE[x];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&v.unshift(i.FNC1);var S=d.next(v,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(x)+S.result+d.getBar((S.checksum+x)%i.MODULO)+d.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var v=this.options.ean128||!1;return typeof v=="string"&&(v=v.toLowerCase()==="true"),v}}],[{key:"getBar",value:function(v){return i.BARS[v]?i.BARS[v].toString():""}},{key:"correctIndex",value:function(v,x){if(x===i.SET_A){var w=v.shift();return w<32?w+64:w-32}else return x===i.SET_B?v.shift()-32:(v.shift()-48)*10+v.shift()-48}},{key:"next",value:function(v,x,w){if(!v.length)return{result:"",checksum:0};var S=void 0,M=void 0;if(v[0]>=200){M=v.shift()-105;var B=i.SWAP[M];B!==void 0?S=d.next(v,x+1,B):((w===i.SET_A||w===i.SET_B)&&M===i.SHIFT&&(v[0]=w===i.SET_A?v[0]>95?v[0]-96:v[0]:v[0]<32?v[0]+96:v[0]),S=d.next(v,x+1,w))}else M=d.correctIndex(v,w),S=d.next(v,x+1,w);var P=d.getBar(M),se=M*x;return{result:P+S.result,checksum:se+S.checksum}}}]),d})(s.default);return oc.default=g,oc}var lc={},s1;function jj(){if(s1)return lc;s1=1,Object.defineProperty(lc,"__esModule",{value:!0});var r=Oo(),t=function(y){return y.match(new RegExp("^"+r.A_CHARS+"*"))[0].length},s=function(y){return y.match(new RegExp("^"+r.B_CHARS+"*"))[0].length},i=function(y){return y.match(new RegExp("^"+r.C_CHARS+"*"))[0]};function l(m,y){var g=y?r.A_CHARS:r.B_CHARS,f=m.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(f)return f[1]+"Ì"+c(m.substring(f[1].length));var d=m.match(new RegExp("^"+g+"+"))[0];return d.length===m.length?m:d+String.fromCharCode(y?205:206)+l(m.substring(d.length),!y)}function c(m){var y=i(m),g=y.length;if(g===m.length)return m;m=m.substring(g);var f=t(m)>=s(m);return y+String.fromCharCode(f?206:205)+l(m,f)}return lc.default=function(m){var y=void 0,g=i(m).length;if(g>=2)y=r.C_START_CHAR+c(m);else{var f=t(m)>s(m);y=(f?r.A_START_CHAR:r.B_START_CHAR)+l(m,f)}return y.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,b){return"Ë"+b})},lc}var i1;function Tj(){if(i1)return ac;i1=1,Object.defineProperty(ac,"__esModule",{value:!0});var r=xu(),t=l(r),s=jj(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){if(c(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var x=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,i.default)(b),v));else var x=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v));return m(x)}return d})(t.default);return ac.default=g,ac}var cc={},a1;function kj(){if(a1)return cc;a1=1,Object.defineProperty(cc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.A_START_CHAR+b,v))}return r(d,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),d})(s.default);return cc.default=g,cc}var uc={},o1;function Nj(){if(o1)return uc;o1=1,Object.defineProperty(uc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.B_START_CHAR+b,v))}return r(d,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),d})(s.default);return uc.default=g,uc}var fc={},l1;function Cj(){if(l1)return fc;l1=1,Object.defineProperty(fc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.C_START_CHAR+b,v))}return r(d,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),d})(s.default);return fc.default=g,fc}var c1;function Mj(){if(c1)return In;c1=1,Object.defineProperty(In,"__esModule",{value:!0}),In.CODE128C=In.CODE128B=In.CODE128A=In.CODE128=void 0;var r=Tj(),t=g(r),s=kj(),i=g(s),l=Nj(),c=g(l),m=Cj(),y=g(m);function g(f){return f&&f.__esModule?f:{default:f}}return In.CODE128=t.default,In.CODE128A=i.default,In.CODE128B=c.default,In.CODE128C=y.default,In}var zt={},hc={},Er={},u1;function Ao(){return u1||(u1=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.SIDE_BIN="101",Er.MIDDLE_BIN="01010",Er.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},Er.EAN2_STRUCTURE=["LL","LG","GL","GG"],Er.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Er.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Er}var dc={},mc={},f1;function jo(){if(f1)return mc;f1=1,Object.defineProperty(mc,"__esModule",{value:!0});var r=Ao(),t=function(i,l,c){var m=i.split("").map(function(g,f){return r.BINARIES[l[f]]}).map(function(g,f){return g?g[i[f]]:""});if(c){var y=i.length-1;m=m.map(function(g,f){return f<y?g+c:g})}return m.join("")};return mc.default=t,mc}var h1;function Bv(){if(h1)return dc;h1=1,Object.defineProperty(dc,"__esModule",{value:!0});var r=(function(){function b(v,x){for(var w=0;w<x.length;w++){var S=x[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,x,w){return x&&b(v.prototype,x),w&&b(v,w),v}})(),t=Ao(),s=jo(),i=m(s),l=xn(),c=m(l);function m(b){return b&&b.__esModule?b:{default:b}}function y(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var d=(function(b){f(v,b);function v(x,w){y(this,v);var S=g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,x,w));return S.fontSize=!w.flat&&w.fontSize>w.width*10?w.width*10:w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return r(v,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(w,S){return this.text.substr(w,S)}},{key:"leftEncode",value:function(w,S){return(0,i.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,i.default)(w,S)}},{key:"encodeGuarded",value:function(){var w={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),v})(c.default);return dc.default=d,dc}var d1;function Rj(){if(d1)return hc;d1=1,Object.defineProperty(hc,"__esModule",{value:!0});var r=(function(){function b(v,x){for(var w=0;w<x.length;w++){var S=x[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,x,w){return x&&b(v.prototype,x),w&&b(v,w),v}})(),t=function b(v,x,w){v===null&&(v=Function.prototype);var S=Object.getOwnPropertyDescriptor(v,x);if(S===void 0){var M=Object.getPrototypeOf(v);return M===null?void 0:b(M,x,w)}else{if("value"in S)return S.value;var B=S.get;return B===void 0?void 0:B.call(w)}},s=Ao(),i=Bv(),l=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function y(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=function(v){var x=v.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,M){return M%2?w+S*3:w+S},0);return(10-x%10)%10},d=(function(b){g(v,b);function v(x,w){m(this,v),x.search(/^[0-9]{12}$/)!==-1&&(x+=f(x));var S=y(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,x,w));return S.lastChar=w.lastChar,S}return r(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===f(this.data)}},{key:"leftText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(w.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(w.push({data:"00"}),w.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),w}}]),v})(l.default);return hc.default=d,hc}var pc={},m1;function Dj(){if(m1)return pc;m1=1,Object.defineProperty(pc,"__esModule",{value:!0});var r=(function(){function d(b,v){for(var x=0;x<v.length;x++){var w=v[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,v,x){return v&&d(b.prototype,v),x&&d(b,x),b}})(),t=function d(b,v,x){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,v);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:d(S,v,x)}else{if("value"in w)return w.value;var M=w.get;return M===void 0?void 0:M.call(x)}},s=Bv(),i=l(s);function l(d){return d&&d.__esModule?d:{default:d}}function c(d,b){if(!(d instanceof b))throw new TypeError("Cannot call a class as a function")}function m(d,b){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:d}function y(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);d.prototype=Object.create(b&&b.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(d,b):d.__proto__=b)}var g=function(b){var v=b.substr(0,7).split("").map(function(x){return+x}).reduce(function(x,w,S){return S%2?x+w:x+w*3},0);return(10-v%10)%10},f=(function(d){y(b,d);function b(v,x){return c(this,b),v.search(/^[0-9]{7}$/)!==-1&&(v+=g(v)),m(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,v,x))}return r(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var x=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,x,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var x=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,x,"RRRR")}}]),b})(i.default);return pc.default=f,pc}var yc={},p1;function qj(){if(p1)return yc;p1=1,Object.defineProperty(yc,"__esModule",{value:!0});var r=(function(){function v(x,w){for(var S=0;S<w.length;S++){var M=w[S];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(x,M.key,M)}}return function(x,w,S){return w&&v(x.prototype,w),S&&v(x,S),x}})(),t=Ao(),s=jo(),i=m(s),l=xn(),c=m(l);function m(v){return v&&v.__esModule?v:{default:v}}function y(v,x){if(!(v instanceof x))throw new TypeError("Cannot call a class as a function")}function g(v,x){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:v}function f(v,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);v.prototype=Object.create(x&&x.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(v,x):v.__proto__=x)}var d=function(x){var w=x.split("").map(function(S){return+S}).reduce(function(S,M,B){return B%2?S+M*9:S+M*3},0);return w%10},b=(function(v){f(x,v);function x(w,S){return y(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,w,S))}return r(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),x})(c.default);return yc.default=b,yc}var gc={},y1;function Lj(){if(y1)return gc;y1=1,Object.defineProperty(gc,"__esModule",{value:!0});var r=(function(){function b(v,x){for(var w=0;w<x.length;w++){var S=x[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,x,w){return x&&b(v.prototype,x),w&&b(v,w),v}})(),t=Ao(),s=jo(),i=m(s),l=xn(),c=m(l);function m(b){return b&&b.__esModule?b:{default:b}}function y(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var d=(function(b){f(v,b);function v(x,w){return y(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,x,w))}return r(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,w,"01"),text:this.text}}}]),v})(c.default);return gc.default=d,gc}var no={},g1;function Uv(){if(g1)return no;g1=1,Object.defineProperty(no,"__esModule",{value:!0});var r=(function(){function b(v,x){for(var w=0;w<x.length;w++){var S=x[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,x,w){return x&&b(v.prototype,x),w&&b(v,w),v}})();no.checksum=d;var t=jo(),s=c(t),i=xn(),l=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function y(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=(function(b){g(v,b);function v(x,w){m(this,v),x.search(/^[0-9]{11}$/)!==-1&&(x+=d(x));var S=y(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,x,w));return S.displayValue=w.displayValue,w.fontSize>w.width*10?S.fontSize=w.width*10:S.fontSize=w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return r(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==d(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var w="";return w+="101",w+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),w+="101",{data:w,text:this.text}}},{key:"guardedEncoding",value:function(){var w=[];return this.displayValue&&w.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),w.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),w.push({data:"01010",options:{height:this.guardHeight}}),w.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&w.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),w}}]),v})(l.default);function d(b){var v=0,x;for(x=1;x<11;x+=2)v+=parseInt(b[x]);for(x=0;x<11;x+=2)v+=parseInt(b[x])*3;return(10-v%10)%10}return no.default=f,no}var bc={},b1;function Bj(){if(b1)return bc;b1=1,Object.defineProperty(bc,"__esModule",{value:!0});var r=(function(){function w(S,M){for(var B=0;B<M.length;B++){var P=M[B];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(S,P.key,P)}}return function(S,M,B){return M&&w(S.prototype,M),B&&w(S,B),S}})(),t=jo(),s=m(t),i=xn(),l=m(i),c=Uv();function m(w){return w&&w.__esModule?w:{default:w}}function y(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")}function g(w,S){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:w}function f(w,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);w.prototype=Object.create(S&&S.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(w,S):w.__proto__=S)}var d=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],v=(function(w){f(S,w);function S(M,B){y(this,S);var P=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,M,B));if(P.isValid=!1,M.search(/^[0-9]{6}$/)!==-1)P.middleDigits=M,P.upcA=x(M,"0"),P.text=B.text||""+P.upcA[0]+M+P.upcA[P.upcA.length-1],P.isValid=!0;else if(M.search(/^[01][0-9]{7}$/)!==-1)if(P.middleDigits=M.substring(1,M.length-1),P.upcA=x(P.middleDigits,M[0]),P.upcA[P.upcA.length-1]===M[M.length-1])P.isValid=!0;else return g(P);else return g(P);return P.displayValue=B.displayValue,B.fontSize>B.width*10?P.fontSize=B.width*10:P.fontSize=B.fontSize,P.guardHeight=B.height+P.fontSize/2+B.textMargin,P}return r(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var B="";return B+="101",B+=this.encodeMiddleDigits(),B+="010101",{data:B,text:this.text}}},{key:"guardedEncoding",value:function(){var B=[];return this.displayValue&&B.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),B.push({data:"101",options:{height:this.guardHeight}}),B.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),B.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&B.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),B}},{key:"encodeMiddleDigits",value:function(){var B=this.upcA[0],P=this.upcA[this.upcA.length-1],se=b[parseInt(P)][parseInt(B)];return(0,s.default)(this.middleDigits,se)}}]),S})(l.default);function x(w,S){for(var M=parseInt(w[w.length-1]),B=d[M],P="",se=0,fe=0;fe<B.length;fe++){var C=B[fe];C==="X"?P+=w[se++]:P+=C}return P=""+S+P,""+P+(0,c.checksum)(P)}return bc.default=v,bc}var v1;function Uj(){if(v1)return zt;v1=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.UPCE=zt.UPC=zt.EAN2=zt.EAN5=zt.EAN8=zt.EAN13=void 0;var r=Rj(),t=v(r),s=Dj(),i=v(s),l=qj(),c=v(l),m=Lj(),y=v(m),g=Uv(),f=v(g),d=Bj(),b=v(d);function v(x){return x&&x.__esModule?x:{default:x}}return zt.EAN13=t.default,zt.EAN8=i.default,zt.EAN5=c.default,zt.EAN2=y.default,zt.UPC=f.default,zt.UPCE=b.default,zt}var Is={},vc={},Ui={},x1;function Pj(){return x1||(x1=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.START_BIN="1010",Ui.END_BIN="11101",Ui.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Ui}var _1;function Pv(){if(_1)return vc;_1=1,Object.defineProperty(vc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=Pj(),s=xn(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return r(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var v=this,x=this.data.match(/.{2}/g).map(function(w){return v.encodePair(w)}).join("");return{data:t.START_BIN+x+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(v){var x=t.BINARIES[v[1]];return t.BINARIES[v[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(x[S]==="1"?"000":"0")}).join("")}}]),d})(i.default);return vc.default=g,vc}var xc={},w1;function zj(){if(w1)return xc;w1=1,Object.defineProperty(xc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=Pv(),s=i(t);function i(f){return f&&f.__esModule?f:{default:f}}function l(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function c(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function m(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var y=function(d){var b=d.substr(0,13).split("").map(function(v){return parseInt(v,10)}).reduce(function(v,x,w){return v+x*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(f){m(d,f);function d(b,v){return l(this,d),b.search(/^[0-9]{13}$/)!==-1&&(b+=y(b)),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return r(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===y(this.data)}}]),d})(s.default);return xc.default=g,xc}var S1;function Ij(){if(S1)return Is;S1=1,Object.defineProperty(Is,"__esModule",{value:!0}),Is.ITF14=Is.ITF=void 0;var r=Pv(),t=l(r),s=zj(),i=l(s);function l(c){return c&&c.__esModule?c:{default:c}}return Is.ITF=t.default,Is.ITF14=i.default,Is}var un={},_c={},E1;function To(){if(E1)return _c;E1=1,Object.defineProperty(_c,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xn(),s=i(t);function i(f){return f&&f.__esModule?f:{default:f}}function l(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function c(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function m(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var y=(function(f){m(d,f);function d(b,v){return l(this,d),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return r(d,[{key:"encode",value:function(){for(var v="110",x=0;x<this.data.length;x++){var w=parseInt(this.data[x]),S=w.toString(2);S=g(S,4-S.length);for(var M=0;M<S.length;M++)v+=S[M]=="0"?"100":"110"}return v+="1001",{data:v,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(s.default);function g(f,d){for(var b=0;b<d;b++)f="0"+f;return f}return _c.default=y,_c}var wc={},ro={},O1;function _u(){if(O1)return ro;O1=1,Object.defineProperty(ro,"__esModule",{value:!0}),ro.mod10=r,ro.mod11=t;function r(s){for(var i=0,l=0;l<s.length;l++){var c=parseInt(s[l]);(l+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function t(s){for(var i=0,l=[2,3,4,5,6,7],c=0;c<s.length;c++){var m=parseInt(s[s.length-1-c]);i+=l[c%l.length]*m}return(11-i%11)%11}return ro}var A1;function $j(){if(A1)return wc;A1=1,Object.defineProperty(wc,"__esModule",{value:!0});var r=To(),t=i(r),s=_u();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d+(0,s.mod10)(d),b))}return f})(t.default);return wc.default=y,wc}var Sc={},j1;function Hj(){if(j1)return Sc;j1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var r=To(),t=i(r),s=_u();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d+(0,s.mod11)(d),b))}return f})(t.default);return Sc.default=y,Sc}var Ec={},T1;function Gj(){if(T1)return Ec;T1=1,Object.defineProperty(Ec,"__esModule",{value:!0});var r=To(),t=i(r),s=_u();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),d+=(0,s.mod10)(d),d+=(0,s.mod10)(d),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return f})(t.default);return Ec.default=y,Ec}var Oc={},k1;function Fj(){if(k1)return Oc;k1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var r=To(),t=i(r),s=_u();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),d+=(0,s.mod11)(d),d+=(0,s.mod10)(d),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return f})(t.default);return Oc.default=y,Oc}var N1;function Vj(){if(N1)return un;N1=1,Object.defineProperty(un,"__esModule",{value:!0}),un.MSI1110=un.MSI1010=un.MSI11=un.MSI10=un.MSI=void 0;var r=To(),t=d(r),s=$j(),i=d(s),l=Hj(),c=d(l),m=Gj(),y=d(m),g=Fj(),f=d(g);function d(b){return b&&b.__esModule?b:{default:b}}return un.MSI=t.default,un.MSI10=i.default,un.MSI11=c.default,un.MSI1010=y.default,un.MSI1110=f.default,un}var so={},C1;function Yj(){if(C1)return so;C1=1,Object.defineProperty(so,"__esModule",{value:!0}),so.pharmacode=void 0;var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=xn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){l(this,f);var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b));return v.number=parseInt(d,10),v}return r(f,[{key:"encode",value:function(){for(var b=this.number,v="";!isNaN(b)&&b!=0;)b%2===0?(v="11100"+v,b=(b-2)/2):(v="100"+v,b=(b-1)/2);return v=v.slice(0,-2),{data:v,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),f})(s.default);return so.pharmacode=y,so}var io={},M1;function Kj(){if(M1)return io;M1=1,Object.defineProperty(io,"__esModule",{value:!0}),io.codabar=void 0;var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=xn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){l(this,f),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d.toUpperCase(),b));return v.text=v.options.text||v.text.replace(/[A-D]/g,""),v}return r(f,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],v=this.getEncodings(),x=0;x<this.data.length;x++)b.push(v[this.data.charAt(x)]),x!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),f})(s.default);return io.codabar=y,io}var $s={},Ac={},Pi={},R1;function Qj(){return R1||(R1=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Pi.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Pi.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Pi}var D1;function zv(){if(D1)return Ac;D1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=Qj(),s=xn(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return r(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.data.split("").flatMap(function(M){return t.MULTI_SYMBOLS[M]||M}),x=v.map(function(M){return d.getEncoding(M)}).join(""),w=d.checksum(v,20),S=d.checksum(v.concat(w),15);return{text:this.text,data:d.getEncoding("ÿ")+x+d.getEncoding(w)+d.getEncoding(S)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(v){return t.BINARIES[d.symbolValue(v)]}},{key:"getSymbol",value:function(v){return t.SYMBOLS[v]}},{key:"symbolValue",value:function(v){return t.SYMBOLS.indexOf(v)}},{key:"checksum",value:function(v,x){var w=v.slice().reverse().reduce(function(S,M,B){var P=B%x+1;return S+d.symbolValue(M)*P},0);return d.getSymbol(w%47)}}]),d})(i.default);return Ac.default=g,Ac}var jc={},q1;function Xj(){if(q1)return jc;q1=1,Object.defineProperty(jc,"__esModule",{value:!0});var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=zv(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return r(f,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),f})(s.default);return jc.default=y,jc}var L1;function Jj(){if(L1)return $s;L1=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.CODE93FullASCII=$s.CODE93=void 0;var r=zv(),t=l(r),s=Xj(),i=l(s);function l(c){return c&&c.__esModule?c:{default:c}}return $s.CODE93=t.default,$s.CODE93FullASCII=i.default,$s}var ao={},B1;function Zj(){if(B1)return ao;B1=1,Object.defineProperty(ao,"__esModule",{value:!0}),ao.GenericBarcode=void 0;var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=xn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return r(f,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),f})(s.default);return ao.GenericBarcode=y,ao}var U1;function Wj(){if(U1)return sc;U1=1,Object.defineProperty(sc,"__esModule",{value:!0});var r=Aj(),t=Mj(),s=Uj(),i=Ij(),l=Vj(),c=Yj(),m=Kj(),y=Jj(),g=Zj();return sc.default={CODE39:r.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:s.EAN13,EAN8:s.EAN8,EAN5:s.EAN5,EAN2:s.EAN2,UPC:s.UPC,UPCE:s.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:l.MSI,MSI10:l.MSI10,MSI11:l.MSI11,MSI1010:l.MSI1010,MSI1110:l.MSI1110,pharmacode:c.pharmacode,codabar:m.codabar,CODE93:y.CODE93,CODE93FullASCII:y.CODE93FullASCII,GenericBarcode:g.GenericBarcode},sc}var Tc={},P1;function wu(){if(P1)return Tc;P1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var r=Object.assign||function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(t[l]=i[l])}return t};return Tc.default=function(t,s){return r({},t,s)},Tc}var kc={},z1;function eT(){if(z1)return kc;z1=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.default=r;function r(t){var s=[];function i(l){if(Array.isArray(l))for(var c=0;c<l.length;c++)i(l[c]);else l.text=l.text||"",l.data=l.data||"",s.push(l)}return i(t),s}return kc}var Nc={},I1;function tT(){if(I1)return Nc;I1=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.default=r;function r(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return Nc}var Cc={},Mc={},Rc={},$1;function Iv(){if($1)return Rc;$1=1,Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.default=r;function r(t){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof t[i]=="string"&&(t[i]=parseInt(t[i],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Rc}var Dc={},H1;function $v(){if(H1)return Dc;H1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var r={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return Dc.default=r,Dc}var G1;function nT(){if(G1)return Mc;G1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var r=Iv(),t=l(r),s=$v(),i=l(s);function l(m){return m&&m.__esModule?m:{default:m}}function c(m){var y={};for(var g in i.default)i.default.hasOwnProperty(g)&&(m.hasAttribute("jsbarcode-"+g.toLowerCase())&&(y[g]=m.getAttribute("jsbarcode-"+g.toLowerCase())),m.hasAttribute("data-"+g.toLowerCase())&&(y[g]=m.getAttribute("data-"+g.toLowerCase())));return y.value=m.getAttribute("jsbarcode-value")||m.getAttribute("data-value"),y=(0,t.default)(y),y}return Mc.default=c,Mc}var qc={},Lc={},fn={},F1;function Hv(){if(F1)return fn;F1=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.getTotalWidthOfEncodings=fn.calculateEncodingAttributes=fn.getBarcodePadding=fn.getEncodingHeight=fn.getMaximumHeightOfEncodings=void 0;var r=wu(),t=s(r);function s(f){return f&&f.__esModule?f:{default:f}}function i(f,d){return d.height+(d.displayValue&&f.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function l(f,d,b){if(b.displayValue&&d<f){if(b.textAlign=="center")return Math.floor((f-d)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(f-d)}return 0}function c(f,d,b){for(var v=0;v<f.length;v++){var x=f[v],w=(0,t.default)(d,x.options),S;w.displayValue?S=g(x.text,w,b):S=0;var M=x.data.length*w.width;x.width=Math.ceil(Math.max(S,M)),x.height=i(x,w),x.barcodePadding=l(S,M,w)}}function m(f){for(var d=0,b=0;b<f.length;b++)d+=f[b].width;return d}function y(f){for(var d=0,b=0;b<f.length;b++)f[b].height>d&&(d=f[b].height);return d}function g(f,d,b){var v;if(b)v=b;else if(typeof document<"u")v=document.createElement("canvas").getContext("2d");else return 0;v.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var x=v.measureText(f);if(!x)return 0;var w=x.width;return w}return fn.getMaximumHeightOfEncodings=y,fn.getEncodingHeight=i,fn.getBarcodePadding=l,fn.calculateEncodingAttributes=c,fn.getTotalWidthOfEncodings=m,fn}var V1;function rT(){if(V1)return Lc;V1=1,Object.defineProperty(Lc,"__esModule",{value:!0});var r=(function(){function y(g,f){for(var d=0;d<f.length;d++){var b=f[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,f,d){return f&&y(g.prototype,f),d&&y(g,d),g}})(),t=wu(),s=l(t),i=Hv();function l(y){return y&&y.__esModule?y:{default:y}}function c(y,g){if(!(y instanceof g))throw new TypeError("Cannot call a class as a function")}var m=(function(){function y(g,f,d){c(this,y),this.canvas=g,this.encodings=f,this.options=d}return r(y,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var f=0;f<this.encodings.length;f++){var d=(0,s.default)(this.options,this.encodings[f].options);this.drawCanvasBarcode(d,this.encodings[f]),this.drawCanvasText(d,this.encodings[f]),this.moveCanvasDrawing(this.encodings[f])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var f=this.canvas.getContext("2d");f.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,f);var d=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=d+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(f.fillStyle=this.options.background,f.fillRect(0,0,this.canvas.width,this.canvas.height)),f.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(f,d){var b=this.canvas.getContext("2d"),v=d.data,x;f.textPosition=="top"?x=f.marginTop+f.fontSize+f.textMargin:x=f.marginTop,b.fillStyle=f.lineColor;for(var w=0;w<v.length;w++){var S=w*f.width+d.barcodePadding;v[w]==="1"?b.fillRect(S,x,f.width,f.height):v[w]&&b.fillRect(S,x,f.width,f.height*v[w])}}},{key:"drawCanvasText",value:function(f,d){var b=this.canvas.getContext("2d"),v=f.fontOptions+" "+f.fontSize+"px "+f.font;if(f.displayValue){var x,w;f.textPosition=="top"?w=f.marginTop+f.fontSize-f.textMargin:w=f.height+f.textMargin+f.marginTop+f.fontSize,b.font=v,f.textAlign=="left"||d.barcodePadding>0?(x=0,b.textAlign="left"):f.textAlign=="right"?(x=d.width-1,b.textAlign="right"):(x=d.width/2,b.textAlign="center"),b.fillText(d.text,x,w)}}},{key:"moveCanvasDrawing",value:function(f){var d=this.canvas.getContext("2d");d.translate(f.width,0)}},{key:"restoreCanvas",value:function(){var f=this.canvas.getContext("2d");f.restore()}}]),y})();return Lc.default=m,Lc}var Bc={},Y1;function sT(){if(Y1)return Bc;Y1=1,Object.defineProperty(Bc,"__esModule",{value:!0});var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=wu(),s=l(t),i=Hv();function l(g){return g&&g.__esModule?g:{default:g}}function c(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}var m="http://www.w3.org/2000/svg",y=(function(){function g(f,d,b){c(this,g),this.svg=f,this.encodings=d,this.options=b,this.document=b.xmlDocument||document}return r(g,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var v=this.encodings[b],x=(0,s.default)(this.options,v.options),w=this.createGroup(d,x.marginTop,this.svg);this.setGroupOptions(w,x),this.drawSvgBarcode(w,x,v),this.drawSVGText(w,x,v),d+=v.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,i.calculateEncodingAttributes)(this.encodings,this.options);var d=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings),v=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(v,b),this.options.background&&this.drawRect(0,0,v,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,b,v){var x=v.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,M=0,B=0;B<x.length;B++)M=B*b.width+v.barcodePadding,x[B]==="1"?S++:S>0&&(this.drawRect(M-b.width*S,w,b.width*S,b.height,d),S=0);S>0&&this.drawRect(M-b.width*(S-1),w,b.width*S,b.height,d)}},{key:"drawSVGText",value:function(d,b,v){var x=this.document.createElementNS(m,"text");if(b.displayValue){var w,S;x.setAttribute("font-family",b.font),x.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&x.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&x.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||v.barcodePadding>0?(w=0,x.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=v.width-1,x.setAttribute("text-anchor","end")):(w=v.width/2,x.setAttribute("text-anchor","middle")),x.setAttribute("x",w),x.setAttribute("y",S),x.appendChild(this.document.createTextNode(v.text)),d.appendChild(x)}}},{key:"setSvgAttributes",value:function(d,b){var v=this.svg;v.setAttribute("width",d+"px"),v.setAttribute("height",b+"px"),v.setAttribute("x","0px"),v.setAttribute("y","0px"),v.setAttribute("viewBox","0 0 "+d+" "+b),v.setAttribute("xmlns",m),v.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,b,v){var x=this.document.createElementNS(m,"g");return x.setAttribute("transform","translate("+d+", "+b+")"),v.appendChild(x),x}},{key:"setGroupOptions",value:function(d,b){d.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(d,b,v,x,w){var S=this.document.createElementNS(m,"rect");return S.setAttribute("x",d),S.setAttribute("y",b),S.setAttribute("width",v),S.setAttribute("height",x),w.appendChild(S),S}}]),g})();return Bc.default=y,Bc}var Uc={},K1;function iT(){if(K1)return Uc;K1=1,Object.defineProperty(Uc,"__esModule",{value:!0});var r=(function(){function i(l,c){for(var m=0;m<c.length;m++){var y=c[m];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}return function(l,c,m){return c&&i(l.prototype,c),m&&i(l,m),l}})();function t(i,l){if(!(i instanceof l))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(l,c,m){t(this,i),this.object=l,this.encodings=c,this.options=m}return r(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Uc.default=s,Uc}var Q1;function aT(){if(Q1)return qc;Q1=1,Object.defineProperty(qc,"__esModule",{value:!0});var r=rT(),t=m(r),s=sT(),i=m(s),l=iT(),c=m(l);function m(y){return y&&y.__esModule?y:{default:y}}return qc.default={CanvasRenderer:t.default,SVGRenderer:i.default,ObjectRenderer:c.default},qc}var zi={},X1;function Gv(){if(X1)return zi;X1=1,Object.defineProperty(zi,"__esModule",{value:!0});function r(m,y){if(!(m instanceof y))throw new TypeError("Cannot call a class as a function")}function t(m,y){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:m}function s(m,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);m.prototype=Object.create(y&&y.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(m,y):m.__proto__=y)}var i=(function(m){s(y,m);function y(g,f){r(this,y);var d=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return d.name="InvalidInputException",d.symbology=g,d.input=f,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return y})(Error),l=(function(m){s(y,m);function y(){r(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return y})(Error),c=(function(m){s(y,m);function y(){r(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return y})(Error);return zi.InvalidInputException=i,zi.InvalidElementException=l,zi.NoElementException=c,zi}var J1;function oT(){if(J1)return Cc;J1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},t=nT(),s=m(t),i=aT(),l=m(i),c=Gv();function m(d){return d&&d.__esModule?d:{default:d}}function y(d){if(typeof d=="string")return g(d);if(Array.isArray(d)){for(var b=[],v=0;v<d.length;v++)b.push(y(d[v]));return b}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return f(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,s.default)(d),renderer:l.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,s.default)(d),renderer:l.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:l.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":r(d))==="object"&&!d.nodeName)return{element:d,renderer:l.default.ObjectRenderer};throw new c.InvalidElementException}}function g(d){var b=document.querySelectorAll(d);if(b.length!==0){for(var v=[],x=0;x<b.length;x++)v.push(y(b[x]));return v}}function f(d){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(d),renderer:l.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",b.toDataURL())}}}return Cc.default=y,Cc}var Pc={},Z1;function lT(){if(Z1)return Pc;Z1=1,Object.defineProperty(Pc,"__esModule",{value:!0});var r=(function(){function i(l,c){for(var m=0;m<c.length;m++){var y=c[m];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}return function(l,c,m){return c&&i(l.prototype,c),m&&i(l,m),l}})();function t(i,l){if(!(i instanceof l))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(l){t(this,i),this.api=l}return r(i,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var m=c.apply(void 0,arguments);return this.api._options.valid(!0),m}catch(y){return this.handleCatch(y),this.api}}}]),i})();return Pc.default=s,Pc}var Jh,W1;function cT(){if(W1)return Jh;W1=1;var r=Wj(),t=B(r),s=wu(),i=B(s),l=eT(),c=B(l),m=tT(),y=B(m),g=oT(),f=B(g),d=Iv(),b=B(d),v=lT(),x=B(v),w=Gv(),S=$v(),M=B(S);function B(L){return L&&L.__esModule?L:{default:L}}var P=function(){},se=function(F,ee,X){var he=new P;if(typeof F>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,f.default)(F),he._encodings=[],he._options=M.default,he._errorHandler=new x.default(he),typeof ee<"u"&&(X=X||{},X.format||(X.format=re()),he.options(X)[X.format](ee,X).render()),he};se.getModule=function(L){return t.default[L]};for(var fe in t.default)t.default.hasOwnProperty(fe)&&C(t.default,fe);function C(L,F){P.prototype[F]=P.prototype[F.toUpperCase()]=P.prototype[F.toLowerCase()]=function(ee,X){var he=this;return he._errorHandler.wrapBarcodeCall(function(){X.text=typeof X.text>"u"?void 0:""+X.text;var ve=(0,i.default)(he._options,X);ve=(0,b.default)(ve);var Te=L[F],Y=U(ee,Te,ve);return he._encodings.push(Y),he})}}function U(L,F,ee){L=""+L;var X=new F(L,ee);if(!X.valid())throw new w.InvalidInputException(X.constructor.name,L);var he=X.encode();he=(0,c.default)(he);for(var ve=0;ve<he.length;ve++)he[ve].options=(0,i.default)(ee,he[ve].options);return he}function re(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}P.prototype.options=function(L){return this._options=(0,i.default)(this._options,L),this},P.prototype.blank=function(L){var F=new Array(L+1).join("0");return this._encodings.push({data:F}),this},P.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var L;for(var F in this._renderProperties){L=this._renderProperties[F];var ee=(0,i.default)(this._options,L.options);ee.format=="auto"&&(ee.format=re()),this._errorHandler.wrapBarcodeCall(function(){var X=ee.value,he=t.default[ee.format.toUpperCase()],ve=U(X,he,ee);K(L,ve,ee)})}}},P.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var L=0;L<this._renderProperties.length;L++)K(this._renderProperties[L],this._encodings,this._options);else K(this._renderProperties,this._encodings,this._options);return this},P.prototype._defaults=M.default;function K(L,F,ee){F=(0,c.default)(F);for(var X=0;X<F.length;X++)F[X].options=(0,i.default)(ee,F[X].options),(0,y.default)(F[X].options);(0,y.default)(ee);var he=L.renderer,ve=new he(L.element,F,ee);ve.render(),L.afterRender&&L.afterRender()}return typeof window<"u"&&(window.JsBarcode=se),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(L,F){var ee=[];return jQuery(this).each(function(){ee.push(this)}),se(ee,L,F)}),Jh=se,Jh}var uT=cT();const fT=yw(uT),hT={[ze.EXECUTED]:"Executed",[ze.MATCHED_LIST]:"Matched list",[ze.CONFIRM_REQUIRED]:"Awaiting confirmation",[ze.NO_MATCH_FALLBACK]:"No match",[ze.UNCONFIGURED]:"Not configured",[ze.INVALID_CODE]:"Invalid code",[ze.FORBIDDEN]:"Not permitted",[ze.CONFLICT]:"Conflict",[ze.IDENTITY_PRIMED]:"Identity primed",[ze.IDENTITY_UNKNOWN]:"Badge not recognized",[ze.NOT_PRIMED]:"Badge required",[ze.CHOICES]:"Choices presented"},Fv={[ze.EXECUTED]:"text-status-success",[ze.MATCHED_LIST]:"text-status-success",[ze.CONFIRM_REQUIRED]:"text-status-warning",[ze.NO_MATCH_FALLBACK]:"text-text-secondary",[ze.UNCONFIGURED]:"text-status-warning",[ze.INVALID_CODE]:"text-status-error",[ze.FORBIDDEN]:"text-status-error",[ze.CONFLICT]:"text-status-warning",[ze.IDENTITY_PRIMED]:"text-status-success",[ze.IDENTITY_UNKNOWN]:"text-status-warning",[ze.NOT_PRIMED]:"text-status-warning",[ze.CHOICES]:"text-status-success"};function Vv(r){return r.outcome===ze.IDENTITY_PRIMED&&r.actor?`Hi ${r.actor.displayName}`:`${hT[r.outcome]}${r.rule?` — ${r.rule.name}`:""}`}function uu(r){var t,s,i;return r.outcome===ze.NO_MATCH_FALLBACK?((t=r.fallback)==null?void 0:t.markdown)??null:r.outcome===ze.IDENTITY_UNKNOWN?((s=r.fallback)==null?void 0:s.markdown)??null:r.outcome===ze.NOT_PRIMED?((i=r.notPrimed)==null?void 0:i.markdown)??null:null}function ls(r){return r.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function Yv({content:r,compact:t}){const s=[],i=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,c;for(;(c=i.exec(r))!==null;)c.index>l&&s.push({type:"text",text:r.slice(l,c.index)}),s.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),l=c.index+c[0].length;l<r.length&&s.push({type:"text",text:r.slice(l)});const m=t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},y=[];for(const g of s){if(g.type==="code"){const f=g.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");y.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${m.code} font-mono text-text-secondary leading-relaxed">${f}</code></pre>`);continue}y.push(...dT(g.text,m))}return p.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:y.join(`
55
+ `)}})}function dT(r,t){const s=r.split(`
56
+ `),i=[];let l=!1,c=!1,m=[];for(const y of s){const g=y.trim();if(g.startsWith("|")&&g.endsWith("|")){const f=g.slice(1,-1).split("|").map(d=>d.trim());if(f.every(d=>/^[-:]+$/.test(d)))continue;c||(c=!0,m=[]),m.push(f);continue}if(c){c=!1;const[f,...d]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of f)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ls(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of d){i.push("<tr>");for(const v of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${ls(v)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),m=[]}if(!g){l&&(i.push("</ul>"),l=!1);continue}if(g.startsWith("### ")){l&&(i.push("</ul>"),l=!1),i.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ls(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){l&&(i.push("</ul>"),l=!1),i.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ls(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){l&&(i.push("</ul>"),l=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){l||(i.push('<ul class="space-y-1 my-1">'),l=!0),i.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ls(g.slice(2))}</span></li>`);continue}l&&(i.push("</ul>"),l=!1),i.push(`<p class="${t.text} text-text-secondary my-1">${ls(g)}</p>`)}if(c&&m.length){const[y,...g]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const f of y)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ls(f)}</th>`);i.push("</tr></thead><tbody>");for(const f of g){i.push("<tr>");for(const d of f)i.push(`<td class="py-1 px-2 border-b border-border/50">${ls(d)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return l&&i.push("</ul>"),i}function mT(r){return r.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function pT(r){const t=new Set;for(const s of r){const i=s.codePointAt(0);(i>127||i<32)&&t.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function yT({value:r}){const t=j.useRef(null),[s,i]=j.useState(!1);return j.useEffect(()=>{if(!(!t.current||!r))try{fT(t.current,r,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[r]),r?p.jsxs("div",{children:[p.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?p.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",p.jsx("span",{className:"font-mono",children:pT(r).join(", ")||"unknown"})]}):p.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:p.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function gT({onClose:r}){const{submitCode:t,lastResult:s,busy:i,wedgeConfig:l,updateWedgeConfig:c,diagnostics:m,diagnosticsOn:y,setDiagnosticsOn:g}=Lv(),[f,d]=j.useState(""),[b,v]=j.useState(!1),x=S=>{S.preventDefault();const M=f.trim();M&&(d(""),t(M))},w=(s==null?void 0:s.response)??null;return p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[p.jsx(hu,{className:"w-4 h-4"}),"Scan"]}),p.jsx("button",{type:"button",onClick:r,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:p.jsx(Ft,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[p.jsxs("form",{onSubmit:x,className:"space-y-2",children:[p.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{value:f,onChange:S=>d(mT(S.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),p.jsx("button",{type:"submit",disabled:i||!f.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),p.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),p.jsx(yT,{value:f.trim()}),s&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),p.jsx("div",{className:"text-sm font-mono text-text-primary",children:s.code}),w?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`text-sm font-medium ${Fv[w.outcome]}`,children:Vv(w)}),w.error&&p.jsx("div",{className:"text-xs text-text-tertiary",children:w.error}),uu(w)&&p.jsx("div",{className:"text-sm border-t border-surface-border pt-2",children:p.jsx(Yv,{content:uu(w),compact:!0})})]}):p.jsx("div",{className:"text-sm text-status-error",children:s.error})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("button",{type:"button",onClick:()=>v(S=>!S),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"block text-sm text-text-primary",children:[p.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),p.jsx("input",{type:"number",min:100,max:2e3,step:50,value:l.maxKeyGapMs,onChange:S=>c({maxKeyGapMs:Number(S.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),p.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[p.jsx("input",{type:"checkbox",checked:y,onChange:S=>g(S.target.checked)}),p.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),y&&p.jsxs("div",{className:"border border-surface-border rounded",children:[p.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),p.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[m.length===0&&p.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),m.map(S=>p.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${S.buffer}`,children:[p.jsxs("span",{className:"text-text-tertiary",children:[String(S.deltaMs).padStart(4),"ms "]}),p.jsx("span",{className:"text",children:JSON.stringify(S.key)}),S.code&&p.jsxs("span",{className:"text-text-tertiary",children:[" (",S.code,")"]}),p.jsxs("span",{className:"text-text-tertiary",children:[" — ",S.note]})]},S.seq))]}),p.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",p.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",p.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",p.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}function bT(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Kv(r){var t;return((t=r.title)==null?void 0:t.trim())||bT(r.role)}const Qv="lt:bookmarks",zc="scan";function vT(){try{const r=localStorage.getItem(Qv);if(!r)return[];const t=JSON.parse(r);return Array.isArray(t)?t:[]}catch{return[]}}function eb(r){try{localStorage.setItem(Qv,JSON.stringify(r))}catch{}}function xT({onToggleEventFeed:r,onToggleDocs:t,onToggleNav:s}){var ke,et;const i=_o(),{user:l,logout:c}=Vt(),{viewAs:m,realIsBuilder:y}=ov(),{available:g,mine:f}=BO();lv();const{connected:d}=h2(),{data:b}=nr(),{role:v,targets:x,selectable:w,selectRole:S}=fv(),{data:M}=Jd({enabled:w}),{setPanel:B,closePanel:P,open:se,ownerKey:fe}=tm(),C=Dv(),U=vn(),re=()=>{se&&fe===zc?P(zc):B(p.jsx(gT,{onClose:()=>P(zc)}),{width:360,key:zc})},[K,L]=j.useState(!1),[F,ee]=j.useState(!1),[X,he]=j.useState(Tv),[ve,Te]=j.useState(vT),Y=j.useRef(null),ae=(ke=b==null?void 0:b.branding)==null?void 0:ke.appName,de=(et=b==null?void 0:b.branding)==null?void 0:et.themes,Oe=j.useMemo(()=>(lj(de??[]),cj()),[de]),we=oe=>{uj(oe),he(oe)},Ne=()=>{const oe=window.prompt("Bookmark label:");if(!(oe!=null&&oe.trim()))return;const Ie=U.pathname+U.search,tt=[...ve,{label:oe.trim(),url:Ie}].sort((yt,je)=>yt.label.localeCompare(je.label));Te(tt),eb(tt),L(!1)},Ae=oe=>{const Ie=ve.filter(tt=>!(tt.label===oe.label&&tt.url===oe.url));Te(Ie),eb(Ie)};return j.useEffect(()=>{if(!K)return;const oe=Ie=>{Y.current&&!Y.current.contains(Ie.target)&&L(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[K]),p.jsxs(p.Fragment,{children:[p.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${K?"z-[100]":"z-30"}`,children:[p.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[s&&p.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:p.jsx(Ow,{className:"w-5 h-5",strokeWidth:1.5})}),p.jsxs(Fs,{to:"/","aria-label":"Home",className:"shrink-0",onClick:oe=>{(oe.ctrlKey||oe.metaKey)&&(oe.preventDefault(),ee(!0))},children:[p.jsx(ou,{appName:ae,className:"hidden lg:flex"}),p.jsx(ou,{appName:ae,variant:"comet",className:"flex lg:hidden"})]}),p.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),p.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:p.jsx(pb,{className:"w-5 h-5",strokeWidth:2})}),p.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:p.jsx(ed,{className:"w-5 h-5",strokeWidth:2})})]}),p.jsxs("div",{className:"flex items-center gap-5",children:[p.jsxs(Fs,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${g>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[p.jsx(td,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx("span",{className:"hidden lg:inline",children:"all"}),g>0&&p.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),p.jsxs(Fs,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${f>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[p.jsx(td,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx("span",{className:"hidden lg:inline",children:"mine"}),f>0&&p.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),p.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),C&&p.jsxs("button",{type:"button",onClick:re,className:"flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Scan a code",children:[p.jsx(hu,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx("span",{className:"hidden lg:inline",children:"scan"})]}),p.jsxs("button",{type:"button",onClick:()=>{d?r==null||r():window.location.reload()},className:`hidden lg:flex items-center gap-1.5 text-xs transition-colors ${d?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:d?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[p.jsx(yb,{className:"w-4 h-4",strokeWidth:1.5}),"events"]}),y&&p.jsx(p.Fragment,{children:p.jsxs("button",{onClick:t,className:"hidden lg:flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[p.jsx(gb,{className:"w-4 h-4",strokeWidth:1.5}),"docs"]})}),m&&p.jsx(p.Fragment,{children:p.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[p.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[m," View"]}),p.jsx("button",{onClick:Od,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:p.jsx(Ft,{className:"w-2.5 h-2.5"})})]})}),p.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),l&&p.jsxs("div",{className:"relative",ref:Y,children:[p.jsxs("button",{onClick:()=>L(oe=>!oe),className:"btn-ghost flex items-center gap-1",children:[p.jsxs("span",{className:"relative",children:[p.jsx(Aw,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),m&&p.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),p.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:l.displayName||l.username||l.userId}),p.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),K&&p.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[p.jsx(Fs,{to:"/credentials",onClick:()=>L(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),p.jsx("button",{onClick:()=>{L(!1),d?r==null||r():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:d?"Events":"Reconnect events"}),y&&p.jsx("button",{onClick:()=>{L(!1),t==null||t()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Docs"}),m&&p.jsxs("button",{onClick:()=>{L(!1),Od()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",m," view"]}),p.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),p.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Oe.map(oe=>p.jsx("button",{type:"button",onClick:()=>we(oe.id),title:oe.label,"aria-label":`${oe.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${X===oe.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:oe.swatch}},oe.id))})]}),w&&p.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("button",{type:"button",onClick:()=>{L(!1),S(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${v?"text-text-secondary":"text-accent"}`,children:[p.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${v?"bg-surface-border":"bg-accent"}`}),p.jsx("span",{className:"truncate",children:"Full dashboard"})]}),x.map(oe=>{var yt;const Ie=(yt=M==null?void 0:M.roles)==null?void 0:yt.find(je=>je.role===oe),tt=oe===v;return p.jsxs("button",{type:"button",onClick:()=>{L(!1),S(oe),i(`/escalations/available?role=${encodeURIComponent(oe)}&status=available`)},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${tt?"text-accent":"text-text-secondary"}`,children:[p.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${tt?"bg-accent":"bg-surface-border"}`}),p.jsx("span",{className:"truncate",children:Kv({role:oe,title:Ie==null?void 0:Ie.title})})]},oe)})]})]}),p.jsx("button",{onClick:()=>{L(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),p.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[ve.map(oe=>p.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[p.jsx(Fs,{to:oe.url,onClick:()=>L(!1),title:oe.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:oe.label}),p.jsx("button",{type:"button",onClick:()=>Ae(oe),title:`Remove "${oe.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:p.jsx(Ft,{className:"w-3 h-3"})})]},`${oe.label}::${oe.url}`)),p.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),p.jsxs("button",{type:"button",onClick:Ne,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[p.jsx(jw,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),F&&p.jsx(oj,{onClose:()=>ee(!1)})]})}function am({open:r,children:t}){const[s,i]=j.useState(r);return j.useEffect(()=>{r&&i(!0)},[r]),p.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||i(!1)},children:p.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function Nd(r){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",l="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${t?i:l}`:`${s} gap-3 px-4 py-2 text-sm ${t?i:l}`}}function _T(){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 wT({group:r,collapsed:t}){const{pathname:s}=vn(),i=r.matchPaths.some(y=>s.startsWith(y)),[l,c]=j.useState(i),m=l||i;return t?p.jsx(p.Fragment,{children:r.items.map(y=>p.jsx(Ki,{to:y.to,className:Nd(!0),title:y.label,children:y.icon&&p.jsx(y.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},y.to))}):p.jsxs("div",{children:[p.jsxs("button",{onClick:()=>c(y=>!y),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[p.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:r.label})]}),p.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${m?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),p.jsx(am,{open:m,children:r.items.map(y=>p.jsxs(Ki,{to:y.to,end:y.end,className:_T(),children:[y.icon&&p.jsx(y.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:y.label})]},y.to))})]})}function ST(r){return r.kind==="group"}function ET({entry:r,collapsed:t}){const{pathname:s,search:i}=vn(),l=r.to.includes("?"),c=r.icon&&p.jsx(r.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${r.iconClassName??""}`,strokeWidth:1.5,...r.solid?{fill:"currentColor"}:{}});if(l){const[m,y]=r.to.split("?"),g=s===m&&i===`?${y}`,f=Nd(t)({isActive:g});return p.jsxs(Ki,{to:r.to,className:f,title:t?r.label:void 0,children:[c,!t&&p.jsx("span",{children:r.label})]})}return p.jsxs(Ki,{to:r.to,end:r.end,className:Nd(t),title:t?r.label:void 0,children:[c,!t&&p.jsx("span",{children:r.label})]})}function ms({heading:r,entries:t}){const{collapsed:s}=Wd();return p.jsxs("div",{className:"space-y-1",children:[s?p.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):p.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:r}),t.map(i=>ST(i)?p.jsx(wT,{group:i,collapsed:s},i.label):p.jsx(ET,{entry:i,collapsed:s},i.to))]})}function OT({aiEnabled:r=!1,isBuilder:t=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:l=!1}){const c={to:"/operations",label:"Pace Board",icon:Tw};if(!t&&(!s||i==="engineer"||i==="operator"))return l?p.jsx(ms,{heading:"Monitor",entries:[c]}):null;if(!t)return p.jsx(ms,{heading:"Monitor",entries:l?[c]:[]});const m=[...l?[c]:[],{to:"/topics",label:"Event Topics",icon:yb},{to:"/agents",label:r?"Agents":"Automations",icon:kw},{to:"/capabilities",label:"Capabilities",icon:Nw}];return p.jsx(ms,{heading:"Monitor",entries:m})}function AT(){return st({queryKey:["me","preferences"],queryFn:()=>ge("/me/preferences"),staleTime:6e4})}function jT(){const r=Ve();return We({mutationFn:t=>ge("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{r.setQueryData(["me","preferences"],t)}})}function TT(r,t){const s=(r==null?void 0:r.pinnedViews)??[],i=new Set((r==null?void 0:r.hiddenRolePins)??[]),l=new Set(s.map(y=>y.label)),c=[...s],m=new Set;for(const{role:y,pins:g}of t)for(const f of g)l.has(f.label)||i.has(f.label)||m.has(f.label)||(m.add(f.label),c.push({...f,id:`role:${y}:${f.label}`,fromRole:y}));return c}function kT(r){let t;try{t=new URL(r,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const s=t.searchParams,i=_j(s),l=s.get("status")||void 0,c=t.pathname==="/escalations/available"&&(l===void 0||l==="available");return{available:c,params:{...i,role:s.get("role")||void 0,type:s.get("type")||void 0,priority:s.get("priority")?parseInt(s.get("priority"),10):void 0,status:c||l==="all"?void 0:l,search:s.get("search")||void 0}}}function NT(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function CT(){var C;const{collapsed:r}=Wd(),{user:t}=Vt(),s=AT(),i=jT(),l=j.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(U=>U.role)),[t]),{data:c}=Jd({enabled:l.size>0}),m=Wt("SUMMARY");Ks(Xd(),()=>{m([["escalations"]])});const y=(C=s.data)==null?void 0:C.preferences,g=j.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(U=>l.has(U.role)&&Array.isArray(U.default_pins)&&U.default_pins.length>0).map(U=>({role:U.role,pins:U.default_pins})),[c,l]),f=j.useMemo(()=>TT(y,g),[y,g]),d=j.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(U=>[U.role,Kv(U)])),[c]),b=j.useMemo(()=>f.filter(U=>!U.fromRole),[f]),v=j.useMemo(()=>g.map(({role:U})=>({role:U,title:d.get(U)??U,pins:f.filter(re=>re.fromRole===U)})).filter(U=>U.pins.length>0),[g,d,f]),x=(y==null?void 0:y.pinnedViews)??[],w=j.useRef(null),S=U=>i.mutate({pinnedViews:U}),M=U=>S(x.filter(re=>re.id!==U)),B=U=>S([...x,{id:NT(),label:U.label,url:U.url,badge:U.badge}]),P=U=>i.mutate({hiddenRolePins:[...(y==null?void 0:y.hiddenRolePins)??[],U]}),se=(U,re)=>{if(U===re)return;const K=[...x],[L]=K.splice(U,1);K.splice(re,0,L),S(K)};if(f.length===0)return null;const fe="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return p.jsxs("div",{className:"space-y-1",children:[r&&p.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!r&&b.length>0&&p.jsx("p",{className:fe,children:"Pinned"}),b.map(U=>{const re=x.findIndex(K=>K.id===U.id);return p.jsx(tb,{pin:U,collapsed:r,draggable:re!==-1,onDragStart:()=>{w.current=re},onDropOn:()=>{w.current!==null&&re!==-1&&se(w.current,re),w.current=null},onRemove:()=>M(U.id)},U.id)}),v.map(U=>p.jsxs("div",{children:[!r&&p.jsx("p",{className:fe,title:`${U.title} — pins from the ${U.role} role`,"data-testid":"pin-group-label",children:U.title}),U.pins.map(re=>p.jsx(tb,{pin:re,collapsed:r,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>B(re),onHide:()=>P(re.label)},re.id))]},U.role))]})}function tb({pin:r,collapsed:t,draggable:s,onDragStart:i,onDropOn:l,onRemove:c,onPromote:m,onHide:y}){const{pathname:g,search:f}=vn(),[d,b=""]=r.url.split("?"),v=g===d&&f===(b?`?${b}`:""),x="group flex items-center rounded-md transition-colors duration-150",w=v?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?p.jsx(Ki,{to:r.url,className:`${x} ${w} justify-center w-10 h-10 mx-auto`,title:r.label,children:p.jsx(Yy,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):p.jsxs("div",{className:`${x} ${w} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:l,children:[p.jsxs(Ki,{to:r.url,title:r.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[p.jsx(Yy,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...r.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),p.jsx("span",{className:"truncate flex-1 min-w-0",children:r.label}),r.badge&&p.jsx(MT,{url:r.url})]}),p.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[m&&p.jsx("button",{onClick:m,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:p.jsx(bb,{className:"w-3 h-3"})}),y&&p.jsx("button",{onClick:y,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:p.jsx(Cw,{className:"w-3 h-3"})}),c&&p.jsx("button",{onClick:c,title:`Remove "${r.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:p.jsx(Ft,{className:"w-3 h-3"})})]})]})}function MT({url:r}){var m;const t=j.useMemo(()=>kT(r),[r]),s={limit:1,staleTime:15e3},i=pv({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),l=mv({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?i:l;return c.isError||((m=c.data)==null?void 0:m.total)===void 0?null:p.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function RT(){var c;const{data:r}=nr(),t=(c=r==null?void 0:r.features)==null?void 0:c.graphWorkflows,s=t===!0||t!==!1&&iv(),i=[{to:"/workflows/registry",label:"Registry",icon:Ky},{to:"/workflows/durable/invoke",label:"Invoke",icon:Qy},{to:"/workflows/executions",label:"Executions",icon:Xy}],l=s?[{kind:"group",label:"Procedural",icon:Mw,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:Cd,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Ky,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:Qy},{to:"/mcp/executions",label:"Executions",icon:Xy}]}]:i;return p.jsx(ms,{heading:"Orchestrate",entries:l})}const DT=[{to:"/mcp/queries",label:"Designer",icon:Rw},{to:"/mcp/servers",label:"Servers & Tools",icon:Dw}];function qT(){return p.jsx(ms,{heading:"Design",entries:DT})}const LT=[{to:"/files",label:"Files",icon:qw},{to:"/knowledge",label:"Knowledge Base",icon:vb}];function BT(){return p.jsx(ms,{heading:"Storage",entries:LT})}function UT({isBuilder:r=!1,isOps:t=!1}){var m;const{data:s}=nr(),i=((m=s==null?void 0:s.features)==null?void 0:m.dbMaintenance)!==!1,l=[{to:"/admin/users",label:"Accounts",icon:Lw},...r||t?[{to:"/admin/roles",label:"Roles",icon:td},{to:"/admin/personas",label:"Personas",icon:Bw},{to:"/admin/scan-codes",label:"Scan Codes",icon:hu}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:Uw},{to:"/admin/streams",label:"Messages",icon:vb},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:Pw}]:[]];return p.jsxs(p.Fragment,{children:[p.jsx(ms,{heading:"Identity & Access",entries:l}),r&&p.jsx(ms,{heading:"Infrastructure",entries:c})]})}function Xv({aiEnabled:r,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:l}){return p.jsxs(p.Fragment,{children:[p.jsx(OT,{aiEnabled:r,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:l}),p.jsx(CT,{}),t&&p.jsx(RT,{}),t&&r&&p.jsx(qT,{}),t&&p.jsx(BT,{}),(t||s)&&p.jsx(UT,{isBuilder:t,isOps:s})]})}function PT({open:r,onClose:t,...s}){const i=vn();return j.useEffect(()=>{t()},[i.pathname]),p.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${r?"":"pointer-events-none"}`,children:[p.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${r?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),p.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${r?"translate-x-0":"-translate-x-full"}`,children:[p.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:p.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:p.jsx(Ft,{className:"w-4 h-4"})})}),p.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:p.jsx(CO,{children:p.jsx(Xv,{...s})})})]})]})}const Jv="lt_event_feed_patterns";function zT(r,t){if(r.startsWith("/topics/")){const m=decodeURIComponent(r.replace("/topics/",""));if(m&&!m.includes("/"))return`lt.events.${m}`}const s=r.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(r.startsWith("/escalations")){const m=new URLSearchParams(t).get("role");return m?`lt.events.system.escalation.${cv(m)}.>`:"lt.events.system.escalation.>"}const i=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const l=r.match(/^\/agents\/([^/]+)$/);if(l&&l[1]!=="new")return`lt.events.system.agent.${l[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 c=r.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(r.startsWith("/mcp"),"lt.events.system.>")}function IT(){try{const r=localStorage.getItem(Jv);return r?JSON.parse(r):[]}catch{return[]}}function Zh(r){try{localStorage.setItem(Jv,JSON.stringify(r))}catch{}}function $T(){const{pathname:r,search:t}=vn(),[s,i]=j.useState(IT),l=j.useMemo(()=>zT(r,t),[r,t]),c=j.useMemo(()=>{const f=new Set([l,...s]);return Array.from(f)},[l,s]),m=j.useCallback(f=>{const d=f.startsWith("lt.events.")?f:`lt.events.${f}`;i(b=>{if(b.includes(d))return b;const v=[...b,d];return Zh(v),v})},[]),y=j.useCallback(f=>{i(d=>{const b=d.filter(v=>v!==f);return Zh(b),b})},[]),g=j.useCallback(()=>{i([]),Zh([])},[]);return{patterns:c,pagePattern:l,userPatterns:s,addPattern:m,removePattern:y,clearUserPatterns:g}}function HT({children:r,className:t=""}){return p.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:r})}const Wh=280,nb="cubic-bezier(0.4, 0, 0.2, 1)",Ic=40;function GT(r){if(!r)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,i=t-Ic*2,l=s-Ic*2,c=r.width/i,m=r.height/l,y=r.left+r.width/2-(Ic+i/2),g=r.top+r.height/2-(Ic+l/2);return`translate(${y}px, ${g}px) scale(${c}, ${m})`}function Zv({open:r,onClose:t,sourceRef:s,children:i}){const[l,c]=j.useState(null),m=j.useRef(null),y=j.useRef(!1);j.useEffect(()=>{var v,x;r&&!y.current?(m.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("entering")):!r&&y.current&&l==="open"&&(m.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("exiting")),y.current=r},[r,s,l]),j.useEffect(()=>{if(l!=="entering")return;const v=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(v)},[l]),j.useEffect(()=>{if(l)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[l]),j.useEffect(()=>{if(!l)return;const v=x=>{x.key==="Escape"&&t()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l,t]);const g=j.useCallback(v=>{v.propertyName==="transform"&&l==="exiting"&&c(null)},[l]);if(j.useEffect(()=>{if(l!=="exiting")return;const v=setTimeout(()=>c(null),Wh+50);return()=>clearTimeout(v)},[l]),!l)return null;const f=l==="entering"||l==="exiting",d=f?GT(m.current):"none",b=f?0:1;return mb.createPortal(p.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Wh}ms ${nb}, opacity ${Wh}ms ${nb}`,transform:d,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function FT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function VT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function YT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function KT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function QT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function XT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function JT(r){const t=r.trim().split(`
57
+ `);if(t.length<2)return r;const s=y=>y.split("|").map(g=>g.trim()).filter(Boolean),i=s(t[0]),l=t.slice(2),c=i.map(y=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${y}</th>`).join(""),m=l.map(y=>`<tr class="border-t border-surface-border">${s(y).map(d=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${d}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${m}</tbody></table>`}function $c(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function ZT(r){const t=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,f,d)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${d}</code></pre>`),`\0CODE${b}\0`});const i=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(i,(g,f,d,b)=>JT(`${f}
58
+ ${d}
59
+ ${b.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,f)=>`<h4 id="${$c(f)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${f}</h4>`).replace(/^### (.+)$/gm,(g,f)=>`<h3 id="${$c(f)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${f}</h3>`).replace(/^## (.+)$/gm,(g,f)=>`<h2 id="${$c(f)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${f}</h2>`).replace(/^# (.+)$/gm,(g,f)=>`<h1 id="${$c(f)}" class="text-lg font-bold text-text-primary mb-3">${f}</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 f=g.replace(/^> /gm,"").trim(),d=/⚠️|warning|caution/i.test(f),b=/note:|ℹ️|info/i.test(f);return`<div class="${d?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${d?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${f}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const l=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${l(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,f)=>t[parseInt(f,10)]);const m="text-xs leading-relaxed text-text-secondary mb-2",y=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const f=g.trim();if(!f)return"";const d=[];let b=f,v;for(;(v=y.exec(b))!==null;){const x=v.index+v[0].length;d.push(b.slice(0,x)),b=b.slice(x).replace(/^<br\/>/,"").trim(),y.lastIndex=0}return b&&d.push(b),d.map(x=>{const w=x.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${m}">${w}</p>`:""}).join("")}).join(""),s}const WT=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function ek(r){return WT.test(r)}function Su({content:r,className:t,onClick:s}){const i=j.useMemo(()=>ZT(r),[r]);return p.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function fu({data:r,depth:t=0,generation:s}){const l=s!==void 0&&s>0&&s%2===1?!1:t>0,[c,m]=j.useState(l),[y,g]=j.useState(s);if(s!==void 0&&s!==y&&(g(s),m(s%2===0&&t>0)),r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return p.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?p.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((f,d)=>p.jsxs("div",{children:[p.jsx(fu,{data:f,depth:t+1,generation:s}),d<r.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),p.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const f=Object.entries(r);return f.length===0?p.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?p.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:f.map(([d,b],v)=>p.jsxs("div",{children:[p.jsx("span",{className:"text-text-secondary",children:d}),p.jsx("span",{className:"text-text-tertiary",children:": "}),p.jsx(fu,{data:b,depth:t+1,generation:s}),v<f.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),p.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return p.jsx("span",{children:String(r)})}function po({data:r,depth:t=0}){if(r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&ek(r)?p.jsx(Su,{content:r}):p.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):p.jsx("div",{className:"space-y-2",children:r.map((s,i)=>p.jsxs("div",{className:"flex items-baseline gap-2",children:[p.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),p.jsx("div",{className:"flex-1",children:p.jsx(po,{data:s,depth:t+1})})]},i))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):p.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,l])=>{const c=l===null||typeof l!="object";return p.jsxs("div",{children:[p.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?p.jsx("p",{className:"text-sm text-text-primary",children:p.jsx(po,{data:l,depth:t+1})}):p.jsx(po,{data:l,depth:t+1})]},i)})})}return p.jsx("span",{children:String(r)})}function rb({mode:r,setMode:t,isCollapsed:s,onToggleCollapse:i,onCopy:l,copied:c,onFullscreen:m,onClose:y,large:g}){const f=g?"w-5 h-5":"w-3.5 h-3.5",d=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return p.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&p.jsx("button",{onClick:i,className:d,title:s?"Expand all":"Collapse all",children:s?p.jsx(XT,{className:f}):p.jsx(QT,{className:f})}),p.jsx("button",{onClick:()=>t(r==="json"?"tree":"json"),className:d,title:r==="json"?"Outline view":"JSON view",children:r==="json"?p.jsx(FT,{className:f}):p.jsx(VT,{className:f})}),p.jsx("button",{onClick:l,className:d,title:"Copy to clipboard",children:c?p.jsx(KT,{className:`${f} text-status-success`}):p.jsx(YT,{className:f})}),m&&p.jsx("button",{onClick:m,className:d,title:"Fullscreen",children:p.jsx(xb,{className:f})}),y&&p.jsx("button",{onClick:y,className:d,title:"Close (Esc)",children:p.jsx(_b,{className:f})})]})}function tk({data:r,label:t,variant:s,defaultCollapsed:i=!1,defaultMode:l}){const c=j.useRef(null),[m,y]=j.useState(l??"json"),[g,f]=j.useState(!1),[d,b]=j.useState(!1),[v,x]=j.useState(i?0:1),[w,S]=j.useState(1),M=v%2===0,B=w%2===0,P=j.useCallback(()=>x(F=>F+1),[]),se=j.useCallback(()=>S(F=>F+1),[]);let fe=r;if(typeof r=="string")try{fe=JSON.parse(r)}catch{}const C=async()=>{const F=typeof r=="string"?r:JSON.stringify(fe,null,2);await navigator.clipboard.writeText(F),f(!0),setTimeout(()=>f(!1),2e3)},U=j.useCallback(()=>{S(1),b(!0)},[]),re=s==="panel",K=re?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",L=re?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return p.jsxs("div",{className:K,children:[t&&p.jsx(HT,{children:t}),p.jsxs("div",{ref:c,className:"relative",children:[p.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:p.jsx(rb,{mode:m,setMode:y,isCollapsed:M,onToggleCollapse:P,onCopy:C,copied:g,onFullscreen:U})}),p.jsx("div",{className:L,children:m==="json"?p.jsx(fu,{data:fe,generation:v}):p.jsx(po,{data:fe})})]}),p.jsxs(Zv,{open:d,onClose:()=>b(!1),sourceRef:c,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx(rb,{mode:m,setMode:y,isCollapsed:B,onToggleCollapse:se,onCopy:C,copied:g,onClose:()=>b(!1),large:!0})}),p.jsx("div",{className:"font-mono text-sm leading-relaxed",children:m==="json"?p.jsx(fu,{data:fe,generation:w}):p.jsx(po,{data:fe})})]})]})}const nk=100,sb=500;let rk=0;const Wv={"escalation.created":"text-status-active","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-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function ex(r){const t=r.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:r}function ib({event:r,forceExpanded:t=!1}){var v,x;const[s,i]=j.useState(t),l=Wv[ex(r.type)]||"text-text-tertiary";j.useEffect(()=>{i(t)},[t]);const c=t,m=c?"text-xs":"text-2xs",y=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",f=c?"w-3.5 h-3.5":"w-2.5 h-2.5",d=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return p.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[p.jsxs("button",{onClick:()=>i(!s),className:`flex items-center gap-2 ${d} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[p.jsx("span",{className:`${m} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),p.jsx("span",{className:`${y} font-medium px-1 py-0.5 rounded ${l} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),p.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(v=r.data)!=null&&v.workflowId?String(r.data.workflowId):"",(x=r.data)!=null&&x.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),p.jsx("svg",{className:`${f} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),p.jsx(am,{open:s,children:p.jsx("div",{className:b,children:p.jsx(tk,{data:r.data})})})]})}function sk({open:r,onToggle:t,configOpen:s,onToggleConfig:i}){const[l,c]=j.useState([]),[m,y]=j.useState(!1),[g,f]=j.useState(""),d=j.useRef(null),b=j.useRef(new Map),{subscribe:v}=j.useContext(Wi),{patterns:x,pagePattern:w,userPatterns:S,addPattern:M,removePattern:B}=$T(),P=j.useCallback(C=>{const U=String(C.type||"unknown");if(U.startsWith("mesh."))return;const re=`${U}:${C.timestamp||""}:${C.escalationId||C.workflowId||C.taskId||""}`,K=Date.now(),L=b.current.get(re);if(!(L&&K-L<sb)){if(b.current.set(re,K),b.current.size>200)for(const[F,ee]of b.current)K-ee>sb*2&&b.current.delete(F);c(F=>[{id:++rk,type:U,timestamp:C.timestamp||new Date().toISOString(),data:C},...F].slice(0,nk))}},[]),se=j.useRef(P);se.current=P;const fe=r||m||s;return j.useEffect(()=>{if(!fe)return;const C=x.map(U=>v(U,re=>se.current(re)));return()=>C.forEach(U=>U())},[v,x.join(","),fe]),j.useEffect(()=>{r&&d.current&&(d.current.scrollTop=0)},[l.length,r]),p.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[p.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?p.jsx(wb,{className:"w-3 h-3 text-text-tertiary"}):p.jsx(Sb,{className:"w-3 h-3 text-text-tertiary"}),p.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),l.length>0&&p.jsxs("span",{className:"text-2xs text-text-tertiary",children:[l.length," events"]}),l.length>0&&!r&&p.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Wv[ex(l[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:l[0].type}),p.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[p.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:C=>{C.stopPropagation(),i()},children:p.jsx(zw,{className:"w-3 h-3"})}),l.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:C=>{C.stopPropagation(),y(!0)},children:p.jsx(xb,{className:"w-3 h-3"})}),p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:C=>{C.stopPropagation(),c([])},children:p.jsx(Iw,{className:"w-3 h-3"})})]})]})]}),s&&p.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[p.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),p.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:w.replace("lt.events.","")}),S.map(C=>p.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[C.replace("lt.events.",""),p.jsx("button",{onClick:()=>B(C),className:"text-text-quaternary hover:text-status-error",children:p.jsx(Ft,{className:"w-2 h-2"})})]},C))]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:g,onChange:C=>f(C.target.value),onKeyDown:C=>{C.key==="Enter"&&g.trim()&&(M(g.trim()),f(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),p.jsxs("button",{onClick:()=>{g.trim()&&(M(g.trim()),f(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[p.jsx(bb,{className:"w-2.5 h-2.5"})," Add"]})]})]}),p.jsx(am,{open:r,children:p.jsx("div",{ref:d,className:"h-48 overflow-y-auto",children:l.length===0?p.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):l.map(C=>p.jsx(ib,{event:C},C.id))})}),p.jsxs(Zv,{open:m,onClose:()=>y(!1),sourceRef:d,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx("button",{onClick:()=>y(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:p.jsx(_b,{className:"w-5 h-5"})})}),l.length===0?p.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):l.map(C=>p.jsx(ib,{event:C,forceExpanded:!0},C.id))]})]})}function ik(){return st({queryKey:["docs"],queryFn:()=>ge("/docs"),staleTime:5*6e4})}function ak(r){return st({queryKey:["docs",r],queryFn:()=>ge(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function ok(){const[r,t]=j.useState([]),[s,i]=j.useState([]),[l,c]=j.useState(null),m=j.useRef(l),y=j.useRef(r),g=j.useRef(s);m.current=l,y.current=r,g.current=s;const f=j.useCallback((w,S)=>{var B;const M=m.current;if(M){const P=((B=S==null?void 0:S.current)==null?void 0:B.scrollTop)??0;t([...y.current,{...M,scrollTop:P}])}i([]),c({path:w,scrollTop:0})},[]),d=j.useCallback(w=>{var P;const S=y.current;if(S.length===0)return;const M=S[S.length-1],B=m.current;if(B){const se=((P=w==null?void 0:w.current)==null?void 0:P.scrollTop)??0;i([...g.current,{...B,scrollTop:se}])}t(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),b=j.useCallback(w=>{var P;const S=g.current;if(S.length===0)return;const M=S[S.length-1],B=m.current;if(B){const se=((P=w==null?void 0:w.current)==null?void 0:P.scrollTop)??0;t([...y.current,{...B,scrollTop:se}])}i(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),v=j.useCallback(w=>{var B,P;const S=m.current;if(!S)return;const M=((B=w==null?void 0:w.current)==null?void 0:B.scrollTop)??0;t([...y.current,{...S,scrollTop:M}]),i([]),c({...S,scrollTop:((P=w==null?void 0:w.current)==null?void 0:P.scrollTop)??0})},[]),x=j.useCallback(()=>{t([]),i([]),c(null)},[]);return{current:l,backStack:r,forwardStack:s,navigate:f,goBack:d,goForward:b,pushScrollPosition:v,reset:x}}function lk(r,t){const[s,i]=r.split("#");let l=s;if(l.startsWith("./")||l.startsWith("../")){const m=((t?t.replace(/[^/]+$/,""):"")+l).split("/"),y=[];for(const g of m)g===".."?y.pop():g&&g!=="."&&y.push(g);l=y.join("/")}return{path:l,anchor:i}}function ck(r){if(!r.startsWith("#docs"))return null;const t=r.slice(1).split(":"),s=t[1]||"README.md",i=t[2]||void 0;return{path:s,anchor:i}}function uk(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function fk({content:r,currentPath:t,onNavigate:s,onAnchorClick:i}){const l=c=>{var f;const m=c.target,y=m.closest("[data-anchor]");if(y){c.preventDefault(),i();const d=y.dataset.anchor,b=(f=y.closest(".docs-content"))==null?void 0:f.querySelector(`#${CSS.escape(d)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=m.closest("[data-doc-link]");if(g){c.preventDefault();const{path:d,anchor:b}=lk(g.dataset.docLink,t);s(d,b);return}};return p.jsx(Su,{content:r,className:"docs-content",onClick:l})}function hk(r){const t=[],s=new Map;for(const i of r){const l=i.path.split("/");if(l.length===1){t.push(i);continue}let c=s;for(let m=0;m<l.length-1;m++){const y=l[m];c.has(y)||c.set(y,{label:y,children:[],subdirs:new Map});const g=c.get(y);m===l.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:t,dirs:s}}function dk({docs:r,selected:t,onSelect:s}){const{topLevel:i,dirs:l}=hk(r),c=y=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===y?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function m(y,g){return p.jsxs("details",{open:!0,children:[p.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[p.jsx($w,{className:"w-3 h-3",strokeWidth:1.5}),y.label]}),p.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...y.subdirs.values()].map(f=>m(f)),y.children.map(f=>p.jsx("button",{className:c(f.path),onClick:()=>s(f.path),children:f.title},f.path))]})]},y.label)}return p.jsxs("div",{className:"space-y-0.5",children:[i.map(y=>p.jsx("button",{className:c(y.path),onClick:()=>s(y.path),children:y.title},y.path)),[...l.values()].map(y=>m(y))]})}function mk({open:r,onClose:t}){var re,K,L;const[s,i]=j.useState(!1),{data:l}=ik(),c=ok(),{data:m,isLoading:y}=ak(((re=c.current)==null?void 0:re.path)??null),g=j.useRef(null),[f,d]=j.useState(null);j.useEffect(()=>{f&&(m!=null&&m.content)&&g.current&&requestAnimationFrame(()=>{var ee;const F=(ee=g.current)==null?void 0:ee.querySelector(`#${CSS.escape(f)}`);F==null||F.scrollIntoView({behavior:"smooth",block:"start"}),d(null)})},[f,m]);const b=j.useCallback(()=>{var X;const F=ck(window.location.hash),ee=(F==null?void 0:F.path)??"README.md";((X=c.current)==null?void 0:X.path)!==ee&&c.navigate(ee,g),F!=null&&F.anchor&&d(F.anchor)},[c]),v=j.useRef(!0);j.useEffect(()=>{if(!r||!c.current)return;if(v.current){v.current=!1;return}const F=uk(c.current.path);window.location.hash!==F&&window.history.replaceState(null,"",window.location.pathname+window.location.search+F)},[r,(K=c.current)==null?void 0:K.path]),j.useEffect(()=>{if(!r)return;const F=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",F),()=>window.removeEventListener("hashchange",F)},[r,b]);const x=j.useCallback((F,ee)=>{ee&&d(ee),c.navigate(F,g)},[c]),w=j.useCallback(F=>{c.navigate(F,g)},[c]),S=j.useCallback(()=>{c.goBack(g)},[c]),M=j.useCallback(()=>{c.goForward(g)},[c]),B=j.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(j.useEffect(()=>{if(r){v.current=!0,b();const F=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(F)}},[r]),!(r||s))return null;const se=()=>{i(!1),setTimeout(()=>{t(),c.reset()},200)},fe=((L=c.current)==null?void 0:L.path)??null,C=c.backStack.length>0,U=c.forwardStack.length>0;return p.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[p.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:se}),p.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:S,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:p.jsx(pb,{className:"w-4 h-4"})}),p.jsx("button",{onClick:M,disabled:!U,className:`p-0.5 transition-colors ${U?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:p.jsx(ed,{className:"w-4 h-4"})}),p.jsx(gb,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),p.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),p.jsx("button",{onClick:se,className:"p-1 text-text-tertiary hover:text-text-primary",children:p.jsx(Ft,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:l!=null&&l.docs?p.jsx(dk,{docs:l.docs,selected:fe,onSelect:w}):p.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),p.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:fe?y?p.jsxs("div",{className:"animate-pulse space-y-2",children:[p.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):m!=null&&m.content?p.jsx(fk,{content:m.content,currentPath:fe,onNavigate:x,onAnchorClick:B}):p.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[p.jsx(ed,{className:"w-5 h-5 mb-2"}),p.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function pk(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const ab=2e3;function yk(r){const s=r.filter(l=>!l.pending).slice(-8);return s.length===0?"":`[Prior conversation]
60
+ ${s.map(l=>`${l.role==="user"?"User":"Assistant"}: ${l.content}`).join(`
61
+ `)}
62
+ [End prior conversation]
63
+
64
+ `}function gk(r){const t=r.summary,s=r.title;if(t){const i=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?t.slice(0,i).trim():t}return s||(typeof r=="string"?r:"Query completed.")}const tx=j.createContext(null);function bk({children:r}){const t=vn(),[s,i]=j.useState(!1),[l,c]=j.useState([]),[m,y]=j.useState(null),[g,f]=j.useState({}),d=j.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??pk(t.pathname)};j.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const v=j.useCallback(()=>i(B=>!B),[]),x=j.useCallback(B=>{f(B)},[]),w=j.useCallback(()=>{c([]),y(null)},[]),S=j.useCallback(async B=>{var K;const P=new Date().toISOString(),se={id:`user-${Date.now()}`,role:"user",content:B,timestamp:P},fe={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:P,pending:!0};c(L=>[...L,se,fe]);const C={...b};(K=C.entities)!=null&&K.yamlContent&&C.entities.yamlContent.length>ab&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,ab)+`
65
+ ... (truncated)`});const re=`${yk(l.concat(se))}${B}`;try{const F=(await ge("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:re,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;y(F),c(ee=>ee.map(X=>X.id===fe.id?{...X,workflowId:F}:X)),d.current&&clearInterval(d.current),d.current=setInterval(async()=>{var ee;try{const X=await ge(`/workflows/${F}/result`),he=(ee=X==null?void 0:X.result)==null?void 0:ee.data;if(he){d.current&&clearInterval(d.current),d.current=null,y(null);const ve=gk(he);let Te;try{Te=(await ge(`/workflow-states/${F}/execution`)).duration_ms}catch{}c(Y=>Y.map(ae=>ae.id===fe.id?{...ae,content:ve,timestamp:new Date().toISOString(),pending:!1,durationMs:Te}:ae))}}catch{}},3e3)}catch{c(L=>L.map(F=>F.id===fe.id?{...F,content:"Failed to submit query. Please try again.",pending:!1}:F))}},[l,b]),M=j.useCallback(async B=>{const P=l.find(C=>C.id===B);if(!(P!=null&&P.workflowId)||P.compilationStatus==="compiling"||P.compilationStatus==="done")return;const se=l.indexOf(P),fe=l.slice(0,se).reverse().find(C=>C.role==="user");if(fe){c(C=>C.map(U=>U.id===B?{...U,compilationStatus:"compiling"}:U));try{const C=await ge("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:fe.content,summary:P.content})}),U=await ge("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:P.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await ge(`/yaml-workflows/${U.id}/deploy`,{method:"POST"}),c(re=>re.map(K=>K.id===B?{...K,compilationStatus:"done"}:K))}catch(C){const U=C instanceof Error?C.message:"Compilation failed";c(re=>re.map(K=>K.id===B?{...K,compilationStatus:"error",compilationError:U}:K))}}},[l]);return p.jsx(tx.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:v,messages:l,sendMessage:S,pageContext:b,setPageContext:x,activeWorkflowId:m,clearMessages:w,compileMessage:M},children:r})}function nx(){const r=j.useContext(tx);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function vk(){const{helpOpen:r,toggleHelp:t}=nx();return p.jsx("button",{onClick:t,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?p.jsx(Ft,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):p.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Nt}/logo512.png)`}})})}function xk({ms:r,className:t=""}){const s=ZA(r),i=j.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?p.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):p.jsx(Sv,{options:i,children:p.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const _k=["sm","md","lg","full"],ob={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"},lb={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function wk({which:r}){const t="stroke-current";switch(r){case"sm":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function Sk({msg:r}){const[t,s]=j.useState(0);j.useEffect(()=>{const m=new Date(r.timestamp).getTime(),y=()=>s(Math.floor((Date.now()-m)/1e3));y();const g=setInterval(y,1e3);return()=>clearInterval(g)},[r.timestamp]);const i=Math.floor(t/60),l=t%60,c=i>0?`${i}m ${l}s`:`${l}s`;return p.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),p.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),r.workflowId&&p.jsxs(Fs,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[p.jsx(Cd,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function Ek({msg:r,compileMessage:t}){const s=r.role==="assistant";return p.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[p.jsx(Ev,{date:r.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),r.durationMs!=null&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),p.jsx(xk,{ms:r.durationMs,className:"!text-2xs text-text-muted/50"})]}),r.workflowId&&p.jsx(Fs,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:p.jsx(Cd,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&p.jsx("button",{onClick:()=>t(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:p.jsx(Hw,{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 Ok(){const{helpOpen:r,setHelpOpen:t,messages:s,sendMessage:i,pageContext:l,activeWorkflowId:c,clearMessages:m,compileMessage:y}=nx(),[g,f]=j.useState(""),[d,b]=j.useState("md"),[v,x]=j.useState(!0),w=j.useRef(null),S=j.useRef(null);if(j.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[s]),j.useEffect(()=>{r&&S.current&&S.current.focus()},[r]),j.useEffect(()=>{if(!r)return;const C=U=>{U.key==="Escape"&&(d==="full"?b("lg"):d==="lg"?b("md"):d==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,d,t]),!r)return null;const M=()=>{const C=g.trim();!C||c||(i(C),f(""),S.current&&(S.current.style.height="auto"))},B=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),M())},P=d==="full",se=l.page.replace(/-/g," "),fe=P?{}:{bottom:"108px"};return p.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${P?ob.full:`right-6 ${ob[d]}`} ${v?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:fe,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),children:[p.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),p.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:se})]}),p.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[p.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:_k.map(C=>p.jsx("button",{onClick:()=>b(C),className:`p-1 rounded transition-colors ${C===d?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===d,"aria-label":lb[C],title:lb[C],children:p.jsx(wk,{which:C})},C))}),s.length>0&&p.jsx("button",{onClick:m,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:p.jsx(Gw,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),p.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:p.jsx(Ft,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),p.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&p.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>p.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[p.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?p.jsx(Sk,{msg:C}):C.role==="assistant"?p.jsx(Su,{content:C.content}):C.content}),!C.pending&&p.jsx("div",{className:"mt-0.5",children:p.jsx(Ek,{msg:C,compileMessage:y})})]},C.id))]}),p.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsx("textarea",{ref:S,value:g,onChange:C=>{f(C.target.value);const U=C.target;U.style.height="auto",U.style.height=`${Math.min(U.scrollHeight,120)}px`},onKeyDown:B,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:!!c}),p.jsx("button",{onClick:M,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:p.jsx(Fw,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const Ak=6e3,jk="scan";function Tk(){const{lastResult:r}=Lv(),{open:t,ownerKey:s}=tm(),[i,l]=j.useState(null);if(j.useEffect(()=>{if(!r)return;const m=setTimeout(()=>l(r.at),Ak);return()=>clearTimeout(m)},[r]),!r||r.navigated||i===r.at||t&&s===jk)return null;const{response:c}=r;return p.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:p.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[p.jsx(hu,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-sm font-mono text-text-secondary truncate",children:r.code}),c?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`text-sm font-medium ${Fv[c.outcome]}`,children:Vv(c)}),c.error&&p.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c.error}),uu(c)&&p.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:p.jsx(Yv,{content:uu(c),compact:!0})})]}):p.jsx("div",{className:"text-sm text-status-error",children:r.error})]}),p.jsx("button",{type:"button",onClick:()=>l(r.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:p.jsx(Ft,{className:"w-3.5 h-3.5"})})]})})}const rx="lt-announcement-dismissed:";function kk(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Nk(r){try{return localStorage.getItem(`${rx}${r}`)==="1"}catch{return!1}}function Ck(){const{isAuthenticated:r,userRoleNames:t}=Vt(),{data:s}=yv(r),i=Ve(),[l,c]=j.useState(null),[m,y]=j.useState(0);yn(PO,()=>{i.invalidateQueries({queryKey:["announcements"]})});const g=Date.now(),f=((s==null?void 0:s.announcements)??[]).filter(b=>!Nk(b.id)&&new Date(b.expires_at).getTime()>g&&(b.roles.length===0||b.roles.some(v=>t.includes(v))));if(j.useEffect(()=>{const b=((s==null?void 0:s.announcements)??[]).map(x=>new Date(x.expires_at).getTime()-Date.now()).filter(x=>x>0);if(b.length===0)return;const v=setTimeout(()=>y(x=>x+1),Math.min(...b)+250);return()=>clearTimeout(v)},[s,m]),f.length===0)return null;const d=b=>{try{localStorage.setItem(`${rx}${b}`,"1")}catch{}y(v=>v+1)};return p.jsx("div",{"data-testid":"announcement-banner",className:"relative z-40",children:f.map(b=>{const v=l===b.id,x=b.title??b.body.split(`
66
+ `)[0];return p.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[p.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[p.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),p.jsxs("button",{type:"button",onClick:()=>c(v?null:b.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[p.jsx("span",{className:"truncate",children:x}),v?p.jsx(Sb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):p.jsx(wb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{type:"button",onClick:()=>d(b.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${x}`,children:p.jsx(Ft,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&p.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:p.jsx(Su,{content:kk(b.body)})})]},b.id)})})}function Mk(){var C;const{isBuilder:r,isOps:t,viewAs:s}=ov(),{canSeePaceBoard:i}=lv();vO();const{data:l}=nr(),c=sv(),m=c!==null?c:!!((C=l==null?void 0:l.ai)!=null&&C.enabled),{collapsed:y,toggle:g}=Wd(),[f,d]=j.useState(!1),[b,v]=j.useState(!1),[x,w]=j.useState(!1),[S,M]=j.useState(()=>window.location.hash.startsWith("#docs")),B=vn(),P=j.useRef(null),{kiosk:se,homePath:fe}=fv();return j.useEffect(()=>{const U=P.current;U&&(U.classList.remove("animate-page-in"),U.offsetWidth,U.classList.add("animate-page-in"))},[B.pathname]),j.useEffect(()=>{const U=()=>{window.location.hash.startsWith("#docs")&&M(!0)};return window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)},[]),se&&fe&&!TO(B.pathname)?p.jsx(Gn,{to:fe,replace:!0}):p.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[p.jsx(xT,{onToggleEventFeed:()=>d(U=>!U),onToggleDocs:()=>M(U=>!U),onToggleNav:se?void 0:()=>v(U=>!U)}),p.jsx(Ck,{}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!se&&p.jsxs("aside",{className:`${y?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[p.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:p.jsx(Xv,{aiEnabled:m,isBuilder:r,isOps:t,viewAs:s,canSeePaceBoard:i})}),p.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${y?"flex justify-center":"flex items-center px-7"}`,"aria-label":y?"Expand sidebar":"Collapse sidebar",children:y?p.jsx(Vw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):p.jsx(Yw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!y&&(l==null?void 0:l.environment)&&p.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${l.environment.longTailVersion} · HotMesh v${l.environment.hotmeshVersion} · Node ${l.environment.nodeVersion} · ${l.environment.nodeEnv}`,children:["long-tail v",l.environment.longTailVersion,p.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",l.environment.hotmeshVersion]})]}),p.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:p.jsx("div",{ref:P,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:p.jsx($i,{})})}),p.jsx(Rk,{})]}),!se&&p.jsx(PT,{open:b,onClose:()=>v(!1),aiEnabled:m,isBuilder:r,isOps:t,viewAs:s,canSeePaceBoard:i}),p.jsx(sk,{open:f,onToggle:()=>d(U=>!U),configOpen:x,onToggleConfig:()=>w(U=>!U)}),p.jsx(mk,{open:S,onClose:()=>{M(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),m&&p.jsx(vk,{}),m&&p.jsx(Ok,{}),p.jsx(Tk,{})]})}function Rk(){const{node:r,width:t,open:s}=tm();return p.jsx(RO,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:r})}function Dk(){const{isAuthenticated:r}=Vt(),t=vn();return r?p.jsx(NO,{children:p.jsx(MO,{children:p.jsx(bk,{children:p.jsx(hj,{children:p.jsx(Oj,{children:p.jsx(Mk,{})})})})})}):p.jsx(Gn,{to:"/login",state:{from:t.pathname},replace:!0})}function sx({provider:r,className:t="w-5 h-5"}){switch(r){case"google":return p.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),p.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),p.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),p.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return p.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return p.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),p.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),p.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),p.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return p.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return p.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("path",{d:"M12 8v4l3 3"})]})}}async function qk(){return ge("/auth/oauth/providers")}async function Lk(r,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return ge(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function tC(){return st({queryKey:["oauth-connections"],queryFn:()=>ge("/auth/oauth/connections")})}function nC(){const r=Ve();return We({mutationFn:({provider:t,label:s})=>Lk(t,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function Bk(){var re;const{login:r,isAuthenticated:t}=Vt(),s=_o(),i=vn(),l=new URLSearchParams(i.search),c=l.get("token"),m=l.get("error"),y=((re=i.state)==null?void 0:re.from)??l.get("returnTo")??"/",g=j.useRef(!1);c&&!g.current&&(g.current=!0,r(c,void 0,{displayName:l.get("displayName"),username:l.get("username")}));const[f,d]=j.useState(""),[b,v]=j.useState(""),[x,w]=j.useState(m||""),[S,M]=j.useState(!1),[B,P]=j.useState(!!c),[se,fe]=j.useState([]),C=j.useRef(!1);if(j.useEffect(()=>{c||C.current||(C.current=!0,(async()=>{var K,L,F,ee;try{const X=await fetch(`${Nt}/api/settings`);if(!X.ok)return;const he=await X.json();if(!((K=he.auth)!=null&&K.sso))return;const ve=await fetch(`${Nt}/api/auth/sso`,{method:"POST"});if(!ve.ok){w("Host authentication required — please log in to your organization first");return}const Te=await ve.json();Te.token&&((L=he.auth)!=null&&L.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",he.auth.ssoLogoutUrl),P(!0),r(Te.token,void 0,{displayName:(F=Te.user)==null?void 0:F.display_name,username:(ee=Te.user)==null?void 0:ee.external_id}))}catch{}})())},[]),j.useEffect(()=>{c||qk().then(fe).catch(()=>{})},[]),j.useEffect(()=>{if(!B)return;const K=setTimeout(()=>s(y,{replace:!0}),1500);return()=>clearTimeout(K)},[B]),t&&!B)return p.jsx(Gn,{to:y,replace:!0});const U=async K=>{var L,F;if(K.preventDefault(),w(""),!f.trim()||!b){w("Username and password are required");return}M(!0);try{const ee=await fetch(`${Nt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:f.trim(),password:b})}),X=await ee.json();if(!ee.ok){w(X.error||"Login failed");return}P(!0),r(X.token,{username:f.trim(),password:b},{displayName:(L=X.user)==null?void 0:L.display_name,username:(F=X.user)==null?void 0:F.external_id})}catch{w("Unable to connect to server")}finally{M(!1)}};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${B?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:p.jsx(ou,{size:"lg",hideLabel:B})}),p.jsxs("form",{onSubmit:U,className:`space-y-5 transition-opacity duration-300 ${B?"opacity-0":""}`,children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),p.jsx("input",{id:"username",type:"text",value:f,onChange:K=>d(K.target.value),className:"input",placeholder:"Enter your username",autoFocus:!B,autoComplete:"username"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),p.jsx("input",{id:"password",type:"password",value:b,onChange:K=>v(K.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),x&&p.jsx("p",{className:"text-sm text-status-error",children:x}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||B,children:S?"Signing in...":"Sign In"}),se.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[p.jsx("div",{className:"flex-1 h-px bg-border"}),p.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),p.jsx("div",{className:"flex-1 h-px bg-border"})]}),p.jsx("div",{className:"space-y-2",children:se.filter(K=>K.provider!=="anthropic").map(K=>p.jsxs("a",{href:`${Nt}/api/auth/oauth/${K.provider}?returnTo=${encodeURIComponent(y)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[p.jsx(sx,{provider:K.provider}),"Sign in with ",K.name]},K.provider))})]})]})]})})}function cb(){const{isAuthenticated:r}=Vt(),t=_o(),s=vn(),i=new URLSearchParams(s.search),l=i.get("state")||"";j.useEffect(()=>{r||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[c,m]=j.useState(""),[y,g]=j.useState(i.get("label")||"default"),[f,d]=j.useState(""),[b,v]=j.useState(!1),x=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=M=>{M.preventDefault();const B=c.trim();if(!B){d("A token or API key is required");return}if(!B.startsWith("sk-ant-")){d('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}v(!0),d("");const P=`${Nt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(B)}&state=${encodeURIComponent(l)}`;window.location.href=P};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:"mb-10",children:p.jsx(ou,{size:"lg"})}),p.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[p.jsx(sx,{provider:"anthropic",className:"w-6 h-6"}),p.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),p.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),p.jsxs("form",{onSubmit:S,className:"space-y-5",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),p.jsx("input",{id:"token",type:"password",value:c,onChange:M=>m(M.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),x&&p.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&p.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),p.jsx("input",{id:"label",type:"text",value:y,onChange:M=>g(M.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),p.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),f&&p.jsx("p",{className:"text-sm text-status-error",children:f}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),p.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),p.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",p.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",p.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function Hc({roleTypes:r,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:l,hasRoleType:c}=Vt();return i?p.jsx($i,{}):r&&r.some(m=>c(m))?p.jsx($i,{}):t&&t.some(m=>l(m))?p.jsx($i,{}):p.jsx(Gn,{to:s,replace:!0})}function Uk({redirectTo:r="/"}){var i;const{data:t,isLoading:s}=nr();return s||!t?null:(i=t.ai)!=null&&i.enabled?p.jsx($i,{}):p.jsx(Gn,{to:r,replace:!0})}function Pk({flag:r,redirectTo:t="/"}){var l;const{data:s,isLoading:i}=nr();return i||!s?null:((l=s.features)==null?void 0:l[r])===!1?p.jsx(Gn,{to:t,replace:!0}):p.jsx($i,{})}const zk=j.lazy(()=>Se(()=>import("./ProcessesListPage-nFdLMlfb.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),Ik=j.lazy(()=>Se(()=>import("./ProcessDetailPage-CWGby6KD.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,5,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),$k=j.lazy(()=>Se(()=>import("./McpOverview-gDegMXvF.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,5]),import.meta.url).then(r=>({default:r.McpOverview}))),Hk=j.lazy(()=>Se(()=>import("./McpRunsPage-nE0d_1Px.js"),__vite__mapDeps([28,1,24,25,4,5,29,26,7,8,9,16,13,30,14,12,11,15,31]),import.meta.url).then(r=>({default:r.McpRunsPage}))),Gk=j.lazy(()=>Se(()=>import("./McpRunDetailPage-tr-lrWVv.js"),__vite__mapDeps([32,1,24,14,13,33,34,12,35,19,5,36,15,37]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),Fk=j.lazy(()=>Se(()=>import("./McpQueryPage-CLEMtLOG.js"),__vite__mapDeps([38,1,14,13,8,9,12,11,15,7,10,30,16,31,4,5,39]),import.meta.url).then(r=>({default:r.McpQueryPage}))),Vk=j.lazy(()=>Se(()=>import("./McpQueryDetailPage-CnCffPks.js"),__vite__mapDeps([40,1,14,13,19,39,5,25,41,42,24,3,2,43,44,45,46,47,48,37,49,35,36]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),Yk=j.lazy(()=>Se(()=>import("./EscalationsOverview-BlFjoKlR.js"),__vite__mapDeps([50,1,14,13,27,5]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),Kk=j.lazy(()=>Se(()=>import("./AvailableEscalationsPage-D-W4OP55.js"),__vite__mapDeps([51,1,52,13,53,54,5,55,6,56,57,12,58,20,16,59,8,9,19,11,4,31]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),Qk=j.lazy(()=>Se(()=>import("./OperatorDashboard-DCG8BFKE.js"),__vite__mapDeps([60,1,4,5,6,7,52,8,9,11,31,56,13,57,12,58,20,16,59,19,54,15]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),Xk=j.lazy(()=>Se(()=>import("./index-CivQGQpu.js"),__vite__mapDeps([61,1,53,54,5,55,6,14,13,15,59,8,9,19,11,3,20,37,21,62]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),Jk=j.lazy(()=>Se(()=>import("./WorkflowsOverview--jC5F9lz.js"),__vite__mapDeps([63,1,3,14,13,27,5]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),Zk=j.lazy(()=>Se(()=>import("./index-ByYeo8P7.js"),__vite__mapDeps([64,1,3,14,13,12,16,65,46,47,5]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),Wk=j.lazy(()=>Se(()=>import("./index-ByYeo8P7.js"),__vite__mapDeps([64,1,3,14,13,12,16,65,46,47,5]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),eN=j.lazy(()=>Se(()=>import("./WorkflowsDashboard-B2wYT_hj.js"),__vite__mapDeps([66,1,30,3,29,26,5,4,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),tN=j.lazy(()=>Se(()=>import("./WorkflowsDashboard-B2wYT_hj.js"),__vite__mapDeps([66,1,30,3,29,26,5,4,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),nN=j.lazy(()=>Se(()=>import("./YamlWorkflowsPage-BUQQU9II.js"),__vite__mapDeps([67,1,25,4,5,14,13,12,9,48,65,19]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),rN=j.lazy(()=>Se(()=>import("./GraphInvokePage-BV60xkVy.js"),__vite__mapDeps([68,1,25,14,13,43,45,46,47,44,5,48,65]),import.meta.url).then(r=>({default:r.GraphInvokePage}))),sN=j.lazy(()=>Se(()=>import("./YamlWorkflowDetailPage-BdB5eX8s.js"),__vite__mapDeps([69,1,25,19,65,13,5]),import.meta.url).then(r=>({default:r.YamlWorkflowDetailPage}))),iN=j.lazy(()=>Se(()=>import("./TasksListPage-DxlS7PTD.js"),__vite__mapDeps([70,1,2,3,4,5,8,9,19,58,49,11,12,13,14,16]),import.meta.url).then(r=>({default:r.TasksListPage}))),aN=j.lazy(()=>Se(()=>import("./TaskDetailPage-Dfzdp97x.js"),__vite__mapDeps([71,1,2,19,58,14,13,5]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),ub=j.lazy(()=>Se(()=>import("./WorkflowExecutionPage-BAgMKnhe.js"),__vite__mapDeps([72,1,3,34,12,13,35,19,5,36,2,14,33,15,37]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),oN=j.lazy(()=>Se(()=>import("./AdminDashboard-B_AVB7tk.js"),__vite__mapDeps([73,1,2,23,18,13,5]),import.meta.url).then(r=>({default:r.AdminDashboard}))),lN=j.lazy(()=>Se(()=>import("./index-BrFGgfjR.js"),__vite__mapDeps([74,1,3,8,9,12,13,31,4,5,14,75,16]),import.meta.url).then(r=>({default:r.WorkersPage}))),cN=j.lazy(()=>Se(()=>import("./index-BTksPQZe.js"),__vite__mapDeps([76,1,3,12,13,77,54,5,20,16,14,46,47,65]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),fb=j.lazy(()=>Se(()=>import("./index-BTksPQZe.js"),__vite__mapDeps([76,1,3,12,13,77,54,5,20,16,14,46,47,65]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),uN=j.lazy(()=>Se(()=>import("./index-BWtW5puE.js"),__vite__mapDeps([78,1,23,9,77,54,5,14,13,12,11,4,79,45,46,47,48,44,31,19]),import.meta.url).then(r=>({default:r.McpServersPage}))),hb=j.lazy(()=>Se(()=>import("./index-DrlZc3C0.js"),__vite__mapDeps([80,1,23,14,13,41,5]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),fN=j.lazy(()=>Se(()=>import("./index-U7HShN30.js"),__vite__mapDeps([81,1,4,5,8,9,11,12,13,77,54,31,14,20,47,49,82,83,33]),import.meta.url).then(r=>({default:r.UsersPage}))),hN=j.lazy(()=>Se(()=>import("./RolesPage-DwprdPCA.js"),__vite__mapDeps([84,1,12,13,14,20,54,5]),import.meta.url).then(r=>({default:r.RolesPage}))),dN=j.lazy(()=>Se(()=>import("./RoleDetailPage-OmOdRm1F.js"),__vite__mapDeps([85,1,86,77,54,5,13]),import.meta.url).then(r=>({default:r.RoleDetailPage}))),mN=j.lazy(()=>Se(()=>import("./PersonasPage-B5fj2AK6.js"),__vite__mapDeps([87,1,82,12,13,14,20,54,5,6]),import.meta.url).then(r=>({default:r.PersonasPage}))),pN=j.lazy(()=>Se(()=>import("./PersonaDetailPage-BEVeJr1q.js"),__vite__mapDeps([88,1,82,20,13,83,86,77,54,5]),import.meta.url).then(r=>({default:r.PersonaDetailPage}))),yN=j.lazy(()=>Se(()=>import("./EscalationSchemaPage-BLM3dUEw.js"),__vite__mapDeps([89,1,13,5]),import.meta.url).then(r=>({default:r.EscalationSchemaPage}))),gN=j.lazy(()=>Se(()=>import("./EscalationListSchemaPage-D16uUVcG.js"),__vite__mapDeps([90,1,13,5]),import.meta.url).then(r=>({default:r.EscalationListSchemaPage}))),bN=j.lazy(()=>Se(()=>import("./ScanCodesPage-RPi4qZ_l.js"),__vite__mapDeps([91,1,14,13,5]),import.meta.url).then(r=>({default:r.ScanCodesPage}))),vN=j.lazy(()=>Se(()=>import("./ScanSchemeDetailPage-BKc4lUjc.js"),__vite__mapDeps([92,1,77,54,5,14,13]),import.meta.url).then(r=>({default:r.ScanSchemeDetailPage}))),xN=j.lazy(()=>Se(()=>import("./ScanStationPage-DUfxcntB.js"),__vite__mapDeps([93,1,13,54,5,62]),import.meta.url).then(r=>({default:r.ScanStationPage}))),_N=j.lazy(()=>Se(()=>import("./index-CwQn-nhR.js"),__vite__mapDeps([94,1,14,13,54,5,55]),import.meta.url).then(r=>({default:r.MaintenancePage}))),wN=j.lazy(()=>Se(()=>import("./OperationsPage-C8h1DN5Q.js").then(r=>r.O),__vite__mapDeps([95,1,57,13,5,14]),import.meta.url).then(r=>({default:r.OperationsPage}))),SN=j.lazy(()=>Se(()=>import("./index-D1KCPoRr.js"),__vite__mapDeps([96,1,18,13,12,4,5,29,26,54,42,75,8,9,31]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),EN=j.lazy(()=>Se(()=>import("./index-BHfISWyn.js"),__vite__mapDeps([97,1,36,13,4,5,29,26,7,8,9,11,12,14,15]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),ON=j.lazy(()=>Se(()=>import("./CredentialsPage-DrydlZ65.js"),__vite__mapDeps([98,1,14,13,49,77,54,5]),import.meta.url).then(r=>({default:r.CredentialsPage}))),AN=j.lazy(()=>Se(()=>import("./index-Bn-6MP9-.js"),__vite__mapDeps([99,1,5,14,13,12,15,7,9,100,49]),import.meta.url).then(r=>({default:r.FilesPage}))),jN=j.lazy(()=>Se(()=>import("./index-D0bjzVum.js"),__vite__mapDeps([101,1,14,13,12,15,11,9,100,49,102,41,5]),import.meta.url).then(r=>({default:r.KnowledgePage}))),TN=j.lazy(()=>Se(()=>import("./HomePage-BA0RYzFc.js"),__vite__mapDeps([103,1,3,24,26,20,13,16,15,95,57,5,14,52]),import.meta.url).then(r=>({default:r.HomePage}))),kN=j.lazy(()=>Se(()=>import("./AgentsPage-F2ixDk1Q.js"),__vite__mapDeps([104,1,105,4,5,7,8,9,11,12,13,14,15]),import.meta.url).then(r=>({default:r.AgentsPage}))),NN=j.lazy(()=>Se(()=>import("./AgentDetailPage-DfpR2Fgg.js"),__vite__mapDeps([106,1,105,107,13,16,5]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),db=j.lazy(()=>Se(()=>import("./AgentConfigPage-JoZko3JB.js"),__vite__mapDeps([108,1,105,107,13,14,102,45,46,47,3,25,109,110,16,5]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),CN=j.lazy(()=>Se(()=>import("./CapabilitiesPage-BSJ2oFj6.js"),__vite__mapDeps([111,1,109,79,23,45,46,47,13,48,5,44,14,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),MN=j.lazy(()=>Se(()=>import("./TopicsPage-hqlu32wg.js"),__vite__mapDeps([112,1,110,14,13,12,5]),import.meta.url).then(r=>({default:r.TopicsPage}))),RN=j.lazy(()=>Se(()=>import("./TopicDetailPage-D-N8Vsd4.js"),__vite__mapDeps([113,1,110,15,13,5]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function DN(){return p.jsxs("div",{className:"animate-pulse space-y-4",children:[p.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return p.jsx(j.Suspense,{fallback:p.jsx(DN,{}),children:p.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:r})})}const ix=new gw({defaultOptions:{queries:{staleTime:1e4,retry:(r,t)=>t instanceof Error&&t.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{ix.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const r=window.__LT_BASE__||"",t=`${r}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,i=r&&s.startsWith(r)?s.slice(r.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(i)}`}});const qN=xw([{path:"/login",element:p.jsx(Bk,{})},{path:"/connect/anthropic",element:p.jsx(cb,{})},{path:"/connect/:provider",element:p.jsx(cb,{})},{path:"/",element:p.jsx(Dk,{}),children:[{index:!0,element:p.jsx(xe,{children:p.jsx(TN,{})})},{path:"processes/all",element:p.jsx(xe,{children:p.jsx(zk,{})})},{path:"processes/detail/:originId",element:p.jsx(xe,{children:p.jsx(Ik,{})})},{path:"credentials",element:p.jsx(xe,{children:p.jsx(ON,{})})},{path:"connections",element:p.jsx(Gn,{to:"/credentials",replace:!0})},{path:"escalations",element:p.jsx(xe,{children:p.jsx(Yk,{})})},{path:"escalations/available",element:p.jsx(xe,{children:p.jsx(Kk,{})})},{path:"escalations/queue",element:p.jsx(xe,{children:p.jsx(Qk,{})})},{path:"escalations/detail/:id",element:p.jsx(xe,{children:p.jsx(Xk,{})})},{path:"scan/station",element:p.jsx(xe,{children:p.jsx(xN,{})})},{path:"capabilities",element:p.jsx(xe,{children:p.jsx(CN,{})})},{path:"agents",element:p.jsx(xe,{children:p.jsx(kN,{})})},{path:"agents/new",element:p.jsx(xe,{children:p.jsx(db,{})})},{path:"agents/:id",element:p.jsx(xe,{children:p.jsx(NN,{})})},{path:"agents/:id/edit",element:p.jsx(xe,{children:p.jsx(db,{})})},{path:"topics",element:p.jsx(xe,{children:p.jsx(MN,{})})},{path:"topics/:topic",element:p.jsx(xe,{children:p.jsx(RN,{})})},{element:p.jsx(Hc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:p.jsx(xe,{children:p.jsx(Jk,{})})},{path:"workflows/executions",element:p.jsx(xe,{children:p.jsx(tN,{})})},{path:"workflows/durable/executions",element:p.jsx(xe,{children:p.jsx(eN,{})})},{path:"workflows/durable/executions/:workflowId",element:p.jsx(xe,{children:p.jsx(ub,{})})},{path:"workflows/tasks",element:p.jsx(xe,{children:p.jsx(iN,{})})},{path:"workflows/tasks/detail/:id",element:p.jsx(xe,{children:p.jsx(aN,{})})},{path:"workflows/executions/:workflowId",element:p.jsx(xe,{children:p.jsx(ub,{})})},{path:"workflows/start",element:p.jsx(xe,{children:p.jsx(Zk,{})})},{path:"workflows/durable/invoke",element:p.jsx(xe,{children:p.jsx(Wk,{})})},{path:"workflows/cron",element:p.jsx(Gn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:p.jsx(xe,{children:p.jsx(lN,{})})},{path:"workflows/registry",element:p.jsx(xe,{children:p.jsx(cN,{})})},{path:"workflows/registry/new",element:p.jsx(xe,{children:p.jsx(fb,{})})},{path:"workflows/registry/:workflowType",element:p.jsx(xe,{children:p.jsx(fb,{})})}]},{element:p.jsx(Hc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:p.jsx(xe,{children:p.jsx(nN,{})})},{path:"mcp/workflows/invoke",element:p.jsx(xe,{children:p.jsx(rN,{})})},{path:"mcp/workflows/:id",element:p.jsx(xe,{children:p.jsx(sN,{})})},{path:"mcp/executions",element:p.jsx(xe,{children:p.jsx(Hk,{})})},{path:"mcp/executions/:jobId",element:p.jsx(xe,{children:p.jsx(Gk,{})})},{path:"files",element:p.jsx(xe,{children:p.jsx(AN,{})})},{path:"knowledge",element:p.jsx(xe,{children:p.jsx(jN,{})})},{element:p.jsx(Uk,{}),children:[{path:"mcp",element:p.jsx(xe,{children:p.jsx($k,{})})},{path:"mcp/queries",element:p.jsx(xe,{children:p.jsx(Fk,{})})},{path:"mcp/queries/:workflowId",element:p.jsx(xe,{children:p.jsx(Vk,{})})},{path:"mcp/tools",element:p.jsx(Gn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:p.jsx(xe,{children:p.jsx(uN,{})})},{path:"mcp/servers/new",element:p.jsx(xe,{children:p.jsx(hb,{})})},{path:"mcp/servers/:serverId",element:p.jsx(xe,{children:p.jsx(hb,{})})}]}]},{path:"operations",element:p.jsx(xe,{children:p.jsx(wN,{})})},{element:p.jsx(Hc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:p.jsx(xe,{children:p.jsx(oN,{})})},{path:"admin/users",element:p.jsx(xe,{children:p.jsx(fN,{})})},{path:"admin/escalation-chains",element:p.jsx(Gn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:p.jsx(xe,{children:p.jsx(hN,{})})},{path:"admin/roles/:role",element:p.jsx(xe,{children:p.jsx(dN,{})})},{path:"admin/roles/:role/schema",element:p.jsx(xe,{children:p.jsx(yN,{})})},{path:"admin/roles/:role/list-schema",element:p.jsx(xe,{children:p.jsx(gN,{})})},{path:"admin/scan-codes",element:p.jsx(xe,{children:p.jsx(bN,{})})},{path:"admin/scan-codes/:version",element:p.jsx(xe,{children:p.jsx(vN,{})})},{path:"admin/personas",element:p.jsx(xe,{children:p.jsx(mN,{})})},{path:"admin/personas/:key",element:p.jsx(xe,{children:p.jsx(pN,{})})}]},{element:p.jsx(Hc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:p.jsx(Gn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:p.jsx(Pk,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:p.jsx(xe,{children:p.jsx(_N,{})})}]},{path:"admin/controlplane",element:p.jsx(xe,{children:p.jsx(SN,{})})},{path:"admin/streams",element:p.jsx(xe,{children:p.jsx(EN,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function LN(){return p.jsx(bw,{client:ix,children:p.jsx(lS,{children:p.jsx(fO,{children:p.jsx(_w,{router:qN})})})})}kv(Tv());const om=document.createElement("link");om.rel="stylesheet";om.href=`${Nt}/api/settings/custom.css`;document.head.appendChild(om);Zw.createRoot(document.getElementById("root")).render(p.jsx(j.StrictMode,{children:p.jsx(LN,{})}));export{pv as $,eC as A,tm as B,am as C,xk as D,AT as E,Zv as F,jT as G,NT as H,ov as I,tk as J,fv as K,b3 as L,v3 as M,Ht as N,x3 as O,i3 as P,_3 as Q,w3 as R,HT as S,E3 as T,_O as U,Jd as V,c3 as W,Vt as X,Kv as Y,WN as Z,JN as _,N3 as a,P3 as a$,mv as a0,im as a1,p3 as a2,bT as a3,z3 as a4,s3 as a5,wj as a6,rc as a7,Su as a8,Yv as a9,U3 as aA,Nt as aB,Ob as aC,R3 as aD,$3 as aE,e3 as aF,V3 as aG,G3 as aH,K3 as aI,tj as aJ,X3 as aK,J3 as aL,Y3 as aM,Q3 as aN,Lv as aO,JA as aP,Sj as aQ,F3 as aR,ze as aS,o3 as aT,M3 as aU,tC as aV,nC as aW,sx as aX,Ks as aY,Xd as aZ,lv as a_,h3 as aa,fj as ab,Dv as ac,q3 as ad,d3 as ae,g3 as af,S3 as ag,ng as ah,HN as ai,$N as aj,Rv as ak,sm as al,Sv as am,I3 as an,j3 as ao,GN as ap,FN as aq,QN as ar,XN as as,VN as at,YN as au,KN as av,t3 as aw,r3 as ax,n3 as ay,ZN as az,nr as b,L3 as b0,H3 as c,O3 as d,Ev as e,ZA as f,RO as g,a3 as h,Wt as i,yn as j,A3 as k,ge as l,T3 as m,k3 as n,f3 as o,m3 as p,y3 as q,C3 as r,l3 as s,sv as t,B3 as u,W3 as v,D3 as w,_j as x,Z3 as y,u3 as z};
67
+ //# sourceMappingURL=index-D9rtK9QF.js.map