@hotmeshio/long-tail 0.25.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/build/services/domain/seed.d.ts +12 -10
  2. package/build/services/domain/seed.js +31 -25
  3. package/build/shared/form-validation/x-lt-roster.js +22 -3
  4. package/build/start/workers.d.ts +3 -0
  5. package/build/start/workers.js +15 -5
  6. package/build/types/startup.d.ts +8 -1
  7. package/dashboard/dist/assets/{AdminDashboard-DWVRAu63.js → AdminDashboard-C_0ShYrm.js} +2 -2
  8. package/dashboard/dist/assets/{AdminDashboard-DWVRAu63.js.map → AdminDashboard-C_0ShYrm.js.map} +1 -1
  9. package/dashboard/dist/assets/{AgentConfigPage-Exjtjbvp.js → AgentConfigPage-Cc9dI8lO.js} +2 -2
  10. package/dashboard/dist/assets/{AgentConfigPage-Exjtjbvp.js.map → AgentConfigPage-Cc9dI8lO.js.map} +1 -1
  11. package/dashboard/dist/assets/{AgentDetailPage-nDbZo6RB.js → AgentDetailPage-Sdmt5j-k.js} +3 -3
  12. package/dashboard/dist/assets/{AgentDetailPage-nDbZo6RB.js.map → AgentDetailPage-Sdmt5j-k.js.map} +1 -1
  13. package/dashboard/dist/assets/{AgentsPage-Dsk9iHps.js → AgentsPage-BuzXc1mg.js} +2 -2
  14. package/dashboard/dist/assets/{AgentsPage-Dsk9iHps.js.map → AgentsPage-BuzXc1mg.js.map} +1 -1
  15. package/dashboard/dist/assets/{AvailableEscalationsPage-D1mCqj8Z.js → AvailableEscalationsPage-DU84iaBN.js} +2 -2
  16. package/dashboard/dist/assets/{AvailableEscalationsPage-D1mCqj8Z.js.map → AvailableEscalationsPage-DU84iaBN.js.map} +1 -1
  17. package/dashboard/dist/assets/{BotPicker-u5760MWZ.js → BotPicker-Ci5PUrkl.js} +2 -2
  18. package/dashboard/dist/assets/{BotPicker-u5760MWZ.js.map → BotPicker-Ci5PUrkl.js.map} +1 -1
  19. package/dashboard/dist/assets/{BulkAssignModal-CtISXXmW.js → BulkAssignModal-PLx7SLvF.js} +2 -2
  20. package/dashboard/dist/assets/{BulkAssignModal-CtISXXmW.js.map → BulkAssignModal-PLx7SLvF.js.map} +1 -1
  21. package/dashboard/dist/assets/{CapabilitiesPage-BKIlrQfU.js → CapabilitiesPage-DuSfgr6i.js} +2 -2
  22. package/dashboard/dist/assets/{CapabilitiesPage-BKIlrQfU.js.map → CapabilitiesPage-DuSfgr6i.js.map} +1 -1
  23. package/dashboard/dist/assets/{CollapsibleSection-DlBVTFqc.js → CollapsibleSection-KOO37qs6.js} +2 -2
  24. package/dashboard/dist/assets/{CollapsibleSection-DlBVTFqc.js.map → CollapsibleSection-KOO37qs6.js.map} +1 -1
  25. package/dashboard/dist/assets/{ConfirmDeleteModal-Pabkchg_.js → ConfirmDeleteModal-CI1eE-Nr.js} +2 -2
  26. package/dashboard/dist/assets/{ConfirmDeleteModal-Pabkchg_.js.map → ConfirmDeleteModal-CI1eE-Nr.js.map} +1 -1
  27. package/dashboard/dist/assets/{ConnectedAppsPage-DG2YZGN3.js → ConnectedAppsPage-DZgbCC0G.js} +2 -2
  28. package/dashboard/dist/assets/{ConnectedAppsPage-DG2YZGN3.js.map → ConnectedAppsPage-DZgbCC0G.js.map} +1 -1
  29. package/dashboard/dist/assets/{CountdownTimer-5t8S2qMi.js → CountdownTimer-C-Ngk8oq.js} +2 -2
  30. package/dashboard/dist/assets/{CountdownTimer-5t8S2qMi.js.map → CountdownTimer-C-Ngk8oq.js.map} +1 -1
  31. package/dashboard/dist/assets/{CredentialsPage-CPVbYQow.js → CredentialsPage-BR7s6eVu.js} +2 -2
  32. package/dashboard/dist/assets/{CredentialsPage-CPVbYQow.js.map → CredentialsPage-BR7s6eVu.js.map} +1 -1
  33. package/dashboard/dist/assets/{CronLabel-C7UbTrO-.js → CronLabel-BQ7Y1Nfd.js} +2 -2
  34. package/dashboard/dist/assets/{CronLabel-C7UbTrO-.js.map → CronLabel-BQ7Y1Nfd.js.map} +1 -1
  35. package/dashboard/dist/assets/{ElapsedCell-Yz7-LbtE.js → ElapsedCell-BT49mUIc.js} +2 -2
  36. package/dashboard/dist/assets/{ElapsedCell-Yz7-LbtE.js.map → ElapsedCell-BT49mUIc.js.map} +1 -1
  37. package/dashboard/dist/assets/{EntityTimelinePanel-xgPRdKEq.js → EntityTimelinePanel-BtARWy3R.js} +2 -2
  38. package/dashboard/dist/assets/{EntityTimelinePanel-xgPRdKEq.js.map → EntityTimelinePanel-BtARWy3R.js.map} +1 -1
  39. package/dashboard/dist/assets/{EscalationListSchemaPage-CqCd-y6B.js → EscalationListSchemaPage-EEBsNpTe.js} +3 -3
  40. package/dashboard/dist/assets/{EscalationListSchemaPage-CqCd-y6B.js.map → EscalationListSchemaPage-EEBsNpTe.js.map} +1 -1
  41. package/dashboard/dist/assets/{EscalationSchemaPage-D8YVQNph.js → EscalationSchemaPage-BHSC46Ow.js} +2 -2
  42. package/dashboard/dist/assets/{EscalationSchemaPage-D8YVQNph.js.map → EscalationSchemaPage-BHSC46Ow.js.map} +1 -1
  43. package/dashboard/dist/assets/{EscalationTimeline-D6jrDcBb.js → EscalationTimeline-BWTUBxUf.js} +2 -2
  44. package/dashboard/dist/assets/{EscalationTimeline-D6jrDcBb.js.map → EscalationTimeline-BWTUBxUf.js.map} +1 -1
  45. package/dashboard/dist/assets/{EscalationTitleSelect-CGGT-QTu.js → EscalationTitleSelect-DOsfY4u8.js} +2 -2
  46. package/dashboard/dist/assets/{EscalationTitleSelect-CGGT-QTu.js.map → EscalationTitleSelect-DOsfY4u8.js.map} +1 -1
  47. package/dashboard/dist/assets/{EscalationsOverview-B7O4ttP4.js → EscalationsOverview-Bl8g53x-.js} +2 -2
  48. package/dashboard/dist/assets/{EscalationsOverview-B7O4ttP4.js.map → EscalationsOverview-Bl8g53x-.js.map} +1 -1
  49. package/dashboard/dist/assets/{EventTable-DJniXnhe.js → EventTable-Bjx17W_i.js} +2 -2
  50. package/dashboard/dist/assets/{EventTable-DJniXnhe.js.map → EventTable-Bjx17W_i.js.map} +1 -1
  51. package/dashboard/dist/assets/{FilterBar-f-LEKcHI.js → FilterBar-Dnse0soD.js} +2 -2
  52. package/dashboard/dist/assets/{FilterBar-f-LEKcHI.js.map → FilterBar-Dnse0soD.js.map} +1 -1
  53. package/dashboard/dist/assets/{FormattedValue-CUtv1g3k.js → FormattedValue-DeVrRJy4.js} +2 -2
  54. package/dashboard/dist/assets/{FormattedValue-CUtv1g3k.js.map → FormattedValue-DeVrRJy4.js.map} +1 -1
  55. package/dashboard/dist/assets/{GraphInvokePage-CR0MtYv8.js → GraphInvokePage-HQEvbHTd.js} +2 -2
  56. package/dashboard/dist/assets/{GraphInvokePage-CR0MtYv8.js.map → GraphInvokePage-HQEvbHTd.js.map} +1 -1
  57. package/dashboard/dist/assets/{HomePage-HVw7T5ER.js → HomePage-DizTklVg.js} +2 -2
  58. package/dashboard/dist/assets/{HomePage-HVw7T5ER.js.map → HomePage-DizTklVg.js.map} +1 -1
  59. package/dashboard/dist/assets/{ListToolbar-CTGK5BXW.js → ListToolbar-B0qe2QZ5.js} +2 -2
  60. package/dashboard/dist/assets/{ListToolbar-CTGK5BXW.js.map → ListToolbar-B0qe2QZ5.js.map} +1 -1
  61. package/dashboard/dist/assets/{McpOverview-B2bbKKu2.js → McpOverview-DmH-qtX9.js} +2 -2
  62. package/dashboard/dist/assets/{McpOverview-B2bbKKu2.js.map → McpOverview-DmH-qtX9.js.map} +1 -1
  63. package/dashboard/dist/assets/{McpQueryDetailPage-DgLxwwJy.js → McpQueryDetailPage-B-qtmwLd.js} +2 -2
  64. package/dashboard/dist/assets/{McpQueryDetailPage-DgLxwwJy.js.map → McpQueryDetailPage-B-qtmwLd.js.map} +1 -1
  65. package/dashboard/dist/assets/{McpQueryPage-CSkczeJP.js → McpQueryPage-DX1T-Ugq.js} +2 -2
  66. package/dashboard/dist/assets/{McpQueryPage-CSkczeJP.js.map → McpQueryPage-DX1T-Ugq.js.map} +1 -1
  67. package/dashboard/dist/assets/{McpRunDetailPage-CrUsDPRD.js → McpRunDetailPage-DNdl10nB.js} +2 -2
  68. package/dashboard/dist/assets/{McpRunDetailPage-CrUsDPRD.js.map → McpRunDetailPage-DNdl10nB.js.map} +1 -1
  69. package/dashboard/dist/assets/{McpRunsPage-twxFdTtJ.js → McpRunsPage-DVXVB4AJ.js} +2 -2
  70. package/dashboard/dist/assets/{McpRunsPage-twxFdTtJ.js.map → McpRunsPage-DVXVB4AJ.js.map} +1 -1
  71. package/dashboard/dist/assets/{OperationsPage-gOVMrL_a.js → OperationsPage-BxgWQq8v.js} +3 -3
  72. package/dashboard/dist/assets/{OperationsPage-gOVMrL_a.js.map → OperationsPage-BxgWQq8v.js.map} +1 -1
  73. package/dashboard/dist/assets/{OperatorDashboard-BoeZIyup.js → OperatorDashboard-Cw86vOPg.js} +2 -2
  74. package/dashboard/dist/assets/{OperatorDashboard-BoeZIyup.js.map → OperatorDashboard-Cw86vOPg.js.map} +1 -1
  75. package/dashboard/dist/assets/{PersonaDetailPage-CDktk1mi.js → PersonaDetailPage-BTIJ4A6p.js} +2 -2
  76. package/dashboard/dist/assets/{PersonaDetailPage-CDktk1mi.js.map → PersonaDetailPage-BTIJ4A6p.js.map} +1 -1
  77. package/dashboard/dist/assets/{PersonasPage-Bs097x07.js → PersonasPage-D11PokPb.js} +2 -2
  78. package/dashboard/dist/assets/{PersonasPage-Bs097x07.js.map → PersonasPage-D11PokPb.js.map} +1 -1
  79. package/dashboard/dist/assets/{PortalPage-DjfjerpF.js → PortalPage-1rXm0cNK.js} +2 -2
  80. package/dashboard/dist/assets/{PortalPage-DjfjerpF.js.map → PortalPage-1rXm0cNK.js.map} +1 -1
  81. package/dashboard/dist/assets/{ProcessDetailPage-B30RatjD.js → ProcessDetailPage-Cp5-969g.js} +2 -2
  82. package/dashboard/dist/assets/{ProcessDetailPage-B30RatjD.js.map → ProcessDetailPage-Cp5-969g.js.map} +1 -1
  83. package/dashboard/dist/assets/{ProcessesListPage-DrvjzgWT.js → ProcessesListPage-assXQe-x.js} +2 -2
  84. package/dashboard/dist/assets/{ProcessesListPage-DrvjzgWT.js.map → ProcessesListPage-assXQe-x.js.map} +1 -1
  85. package/dashboard/dist/assets/ResolverForm-CMzNjmGG.js +8 -0
  86. package/dashboard/dist/assets/ResolverForm-CMzNjmGG.js.map +1 -0
  87. package/dashboard/dist/assets/{RoleDetailPage-ClYgn-3d.js → RoleDetailPage-c_Qij0Tf.js} +2 -2
  88. package/dashboard/dist/assets/{RoleDetailPage-ClYgn-3d.js.map → RoleDetailPage-c_Qij0Tf.js.map} +1 -1
  89. package/dashboard/dist/assets/{RolesPage-B_3qWsvQ.js → RolesPage-D4oaYgTg.js} +2 -2
  90. package/dashboard/dist/assets/{RolesPage-B_3qWsvQ.js.map → RolesPage-D4oaYgTg.js.map} +1 -1
  91. package/dashboard/dist/assets/{RunAsSelector-CbJT50Hp.js → RunAsSelector-Fptil_sB.js} +2 -2
  92. package/dashboard/dist/assets/{RunAsSelector-CbJT50Hp.js.map → RunAsSelector-Fptil_sB.js.map} +1 -1
  93. package/dashboard/dist/assets/{ScanCodesPage-CIIDuh8w.js → ScanCodesPage-BeZA_YJW.js} +2 -2
  94. package/dashboard/dist/assets/{ScanCodesPage-CIIDuh8w.js.map → ScanCodesPage-BeZA_YJW.js.map} +1 -1
  95. package/dashboard/dist/assets/{ScanSchemeDetailPage-Bd3P3eyh.js → ScanSchemeDetailPage-Bxi15xNr.js} +2 -2
  96. package/dashboard/dist/assets/{ScanSchemeDetailPage-Bd3P3eyh.js.map → ScanSchemeDetailPage-Bxi15xNr.js.map} +1 -1
  97. package/dashboard/dist/assets/{ScanStationPage-BiO34nov.js → ScanStationPage-t5Bz957t.js} +2 -2
  98. package/dashboard/dist/assets/{ScanStationPage-BiO34nov.js.map → ScanStationPage-t5Bz957t.js.map} +1 -1
  99. package/dashboard/dist/assets/{StickyPagination-BNOuYZ1m.js → StickyPagination-C2drZk7w.js} +2 -2
  100. package/dashboard/dist/assets/{StickyPagination-BNOuYZ1m.js.map → StickyPagination-C2drZk7w.js.map} +1 -1
  101. package/dashboard/dist/assets/{StreamMessageDetail-ALVUnfF1.js → StreamMessageDetail-x-l5653y.js} +2 -2
  102. package/dashboard/dist/assets/{StreamMessageDetail-ALVUnfF1.js.map → StreamMessageDetail-x-l5653y.js.map} +1 -1
  103. package/dashboard/dist/assets/{SwimlaneTimeline-B5b8-xqI.js → SwimlaneTimeline-Ds_CqLXL.js} +2 -2
  104. package/dashboard/dist/assets/{SwimlaneTimeline-B5b8-xqI.js.map → SwimlaneTimeline-Ds_CqLXL.js.map} +1 -1
  105. package/dashboard/dist/assets/{TaskDetailPage-CoV3WcTA.js → TaskDetailPage-BJGKEnIo.js} +2 -2
  106. package/dashboard/dist/assets/{TaskDetailPage-CoV3WcTA.js.map → TaskDetailPage-BJGKEnIo.js.map} +1 -1
  107. package/dashboard/dist/assets/{TasksListPage-CkMmOYOE.js → TasksListPage-DyLaZvTT.js} +2 -2
  108. package/dashboard/dist/assets/{TasksListPage-CkMmOYOE.js.map → TasksListPage-DyLaZvTT.js.map} +1 -1
  109. package/dashboard/dist/assets/{TimeAgo-DVkFgECX.js → TimeAgo-B_Ta97uy.js} +2 -2
  110. package/dashboard/dist/assets/{TimeAgo-DVkFgECX.js.map → TimeAgo-B_Ta97uy.js.map} +1 -1
  111. package/dashboard/dist/assets/{TimestampCell-CfTc6Txy.js → TimestampCell-CiTYBQw-.js} +2 -2
  112. package/dashboard/dist/assets/{TimestampCell-CfTc6Txy.js.map → TimestampCell-CiTYBQw-.js.map} +1 -1
  113. package/dashboard/dist/assets/{ToolTestPanel-kvqZqM0A.js → ToolTestPanel-Dw8Zu6xr.js} +2 -2
  114. package/dashboard/dist/assets/{ToolTestPanel-kvqZqM0A.js.map → ToolTestPanel-Dw8Zu6xr.js.map} +1 -1
  115. package/dashboard/dist/assets/{TopicDetailPage-CjkAAyy8.js → TopicDetailPage-DPMAWKTN.js} +2 -2
  116. package/dashboard/dist/assets/{TopicDetailPage-CjkAAyy8.js.map → TopicDetailPage-DPMAWKTN.js.map} +1 -1
  117. package/dashboard/dist/assets/{TopicsPage-CJZnv50y.js → TopicsPage-0Z2lAE0d.js} +2 -2
  118. package/dashboard/dist/assets/{TopicsPage-CJZnv50y.js.map → TopicsPage-0Z2lAE0d.js.map} +1 -1
  119. package/dashboard/dist/assets/{UserName-CPJPZnN1.js → UserName-DrAbCpdY.js} +2 -2
  120. package/dashboard/dist/assets/{UserName-CPJPZnN1.js.map → UserName-DrAbCpdY.js.map} +1 -1
  121. package/dashboard/dist/assets/{WorkflowExecutionPage-46UV5pJd.js → WorkflowExecutionPage-DQITqX-6.js} +2 -2
  122. package/dashboard/dist/assets/{WorkflowExecutionPage-46UV5pJd.js.map → WorkflowExecutionPage-DQITqX-6.js.map} +1 -1
  123. package/dashboard/dist/assets/{WorkflowsDashboard-DtxYdQbQ.js → WorkflowsDashboard-CMJPiR6G.js} +2 -2
  124. package/dashboard/dist/assets/{WorkflowsDashboard-DtxYdQbQ.js.map → WorkflowsDashboard-CMJPiR6G.js.map} +1 -1
  125. package/dashboard/dist/assets/{WorkflowsOverview-Cg4LSfck.js → WorkflowsOverview-DwVMLe1y.js} +2 -2
  126. package/dashboard/dist/assets/{WorkflowsOverview-Cg4LSfck.js.map → WorkflowsOverview-DwVMLe1y.js.map} +1 -1
  127. package/dashboard/dist/assets/{YamlWorkflowDetailPage-Del-RCgi.js → YamlWorkflowDetailPage-Do6s_wmW.js} +2 -2
  128. package/dashboard/dist/assets/{YamlWorkflowDetailPage-Del-RCgi.js.map → YamlWorkflowDetailPage-Do6s_wmW.js.map} +1 -1
  129. package/dashboard/dist/assets/{YamlWorkflowsPage-BF6Jtx24.js → YamlWorkflowsPage-8Sr6rZMZ.js} +2 -2
  130. package/dashboard/dist/assets/{YamlWorkflowsPage-BF6Jtx24.js.map → YamlWorkflowsPage-8Sr6rZMZ.js.map} +1 -1
  131. package/dashboard/dist/assets/{agents-wL-3dMOX.js → agents-Maom-dbf.js} +2 -2
  132. package/dashboard/dist/assets/{agents-wL-3dMOX.js.map → agents-Maom-dbf.js.map} +1 -1
  133. package/dashboard/dist/assets/{bots-D72EsztP.js → bots-BESWftTA.js} +2 -2
  134. package/dashboard/dist/assets/{bots-D72EsztP.js.map → bots-BESWftTA.js.map} +1 -1
  135. package/dashboard/dist/assets/{capabilities-DXFo6bRb.js → capabilities-BnvJAmFQ.js} +2 -2
  136. package/dashboard/dist/assets/{capabilities-DXFo6bRb.js.map → capabilities-BnvJAmFQ.js.map} +1 -1
  137. package/dashboard/dist/assets/{controlplane-gQdOgVtH.js → controlplane-Cu7TD1RX.js} +2 -2
  138. package/dashboard/dist/assets/{controlplane-gQdOgVtH.js.map → controlplane-Cu7TD1RX.js.map} +1 -1
  139. package/dashboard/dist/assets/{escalation-columns-CSE5wfWQ.js → escalation-columns-BPSH8qMx.js} +2 -2
  140. package/dashboard/dist/assets/{escalation-columns-CSE5wfWQ.js.map → escalation-columns-BPSH8qMx.js.map} +1 -1
  141. package/dashboard/dist/assets/{escalation-items-BIgBWbaw.js → escalation-items-uDQTphVW.js} +2 -2
  142. package/dashboard/dist/assets/{escalation-items-BIgBWbaw.js.map → escalation-items-uDQTphVW.js.map} +1 -1
  143. package/dashboard/dist/assets/{index-BvH8T-jb.js → index-AJNPDsTI.js} +2 -2
  144. package/dashboard/dist/assets/{index-BvH8T-jb.js.map → index-AJNPDsTI.js.map} +1 -1
  145. package/dashboard/dist/assets/{index-Cu0xdX2t.js → index-B4SNhwgt.js} +2 -2
  146. package/dashboard/dist/assets/{index-Cu0xdX2t.js.map → index-B4SNhwgt.js.map} +1 -1
  147. package/dashboard/dist/assets/{index-ujGmmwl6.js → index-BG7OpNg7.js} +2 -2
  148. package/dashboard/dist/assets/{index-ujGmmwl6.js.map → index-BG7OpNg7.js.map} +1 -1
  149. package/dashboard/dist/assets/{index-BaCDL5fh.js → index-BLbZsMRG.js} +27 -27
  150. package/dashboard/dist/assets/index-BLbZsMRG.js.map +1 -0
  151. package/dashboard/dist/assets/{index-C1iuZ4Q5.js → index-BLlg1aVG.js} +2 -2
  152. package/dashboard/dist/assets/{index-C1iuZ4Q5.js.map → index-BLlg1aVG.js.map} +1 -1
  153. package/dashboard/dist/assets/{index-Btm8FtTQ.js → index-BkVarz6E.js} +2 -2
  154. package/dashboard/dist/assets/{index-Btm8FtTQ.js.map → index-BkVarz6E.js.map} +1 -1
  155. package/dashboard/dist/assets/{index-czgLyfSo.js → index-BpWutGxS.js} +2 -2
  156. package/dashboard/dist/assets/{index-czgLyfSo.js.map → index-BpWutGxS.js.map} +1 -1
  157. package/dashboard/dist/assets/{index-CptTEhWp.js → index-BvI2_dSt.js} +2 -2
  158. package/dashboard/dist/assets/{index-CptTEhWp.js.map → index-BvI2_dSt.js.map} +1 -1
  159. package/dashboard/dist/assets/{index-C-QQ5rKF.js → index-D5JQweUm.js} +2 -2
  160. package/dashboard/dist/assets/{index-C-QQ5rKF.js.map → index-D5JQweUm.js.map} +1 -1
  161. package/dashboard/dist/assets/{index-h1Useskt.js → index-WA8py2Yc.js} +2 -2
  162. package/dashboard/dist/assets/{index-h1Useskt.js.map → index-WA8py2Yc.js.map} +1 -1
  163. package/dashboard/dist/assets/{index-CDxOQ84B.js → index-_yHsJJTS.js} +2 -2
  164. package/dashboard/dist/assets/{index-CDxOQ84B.js.map → index-_yHsJJTS.js.map} +1 -1
  165. package/dashboard/dist/assets/index-kGSUZCOb.js +3 -0
  166. package/dashboard/dist/assets/index-kGSUZCOb.js.map +1 -0
  167. package/dashboard/dist/assets/{index-D1lfq5iZ.js → index-qY2KDGkM.js} +2 -2
  168. package/dashboard/dist/assets/{index-D1lfq5iZ.js.map → index-qY2KDGkM.js.map} +1 -1
  169. package/dashboard/dist/assets/{knowledge-150lsM68.js → knowledge-DCFRNG8R.js} +2 -2
  170. package/dashboard/dist/assets/{knowledge-150lsM68.js.map → knowledge-DCFRNG8R.js.map} +1 -1
  171. package/dashboard/dist/assets/{mcp-CRtY4v5W.js → mcp-CZhOocmN.js} +2 -2
  172. package/dashboard/dist/assets/{mcp-CRtY4v5W.js.map → mcp-CZhOocmN.js.map} +1 -1
  173. package/dashboard/dist/assets/{mcp-query-CDsSMaYq.js → mcp-query-Wt8z6yAL.js} +2 -2
  174. package/dashboard/dist/assets/{mcp-query-CDsSMaYq.js.map → mcp-query-Wt8z6yAL.js.map} +1 -1
  175. package/dashboard/dist/assets/{personas-C2Wm4ng1.js → personas-D2_foqJm.js} +2 -2
  176. package/dashboard/dist/assets/{personas-C2Wm4ng1.js.map → personas-D2_foqJm.js.map} +1 -1
  177. package/dashboard/dist/assets/{pipelines-BH0F9-jf.js → pipelines-Bb159fNz.js} +2 -2
  178. package/dashboard/dist/assets/{pipelines-BH0F9-jf.js.map → pipelines-Bb159fNz.js.map} +1 -1
  179. package/dashboard/dist/assets/{tasks-BkUVpaOa.js → tasks-xAU6C6tb.js} +2 -2
  180. package/dashboard/dist/assets/{tasks-BkUVpaOa.js.map → tasks-xAU6C6tb.js.map} +1 -1
  181. package/dashboard/dist/assets/{topics-Crl8HKHq.js → topics-DFdqb2Te.js} +2 -2
  182. package/dashboard/dist/assets/{topics-Crl8HKHq.js.map → topics-DFdqb2Te.js.map} +1 -1
  183. package/dashboard/dist/assets/{useDebouncedValue-Dk3r5xo-.js → useDebouncedValue-CbHmpS4w.js} +2 -2
  184. package/dashboard/dist/assets/{useDebouncedValue-Dk3r5xo-.js.map → useDebouncedValue-CbHmpS4w.js.map} +1 -1
  185. package/dashboard/dist/assets/{useNamespace-BXuyHKAs.js → useNamespace-B_00X1yb.js} +2 -2
  186. package/dashboard/dist/assets/{useNamespace-BXuyHKAs.js.map → useNamespace-B_00X1yb.js.map} +1 -1
  187. package/dashboard/dist/assets/{useYamlActivityEvents-DSlkjQfb.js → useYamlActivityEvents-B4F-s9g0.js} +2 -2
  188. package/dashboard/dist/assets/{useYamlActivityEvents-DSlkjQfb.js.map → useYamlActivityEvents-B4F-s9g0.js.map} +1 -1
  189. package/dashboard/dist/assets/{yaml-workflows-B230v5Za.js → yaml-workflows-DyjbPFVp.js} +2 -2
  190. package/dashboard/dist/assets/{yaml-workflows-B230v5Za.js.map → yaml-workflows-DyjbPFVp.js.map} +1 -1
  191. package/dashboard/dist/index.html +1 -1
  192. package/docs/code-owned-configuration.md +2 -2
  193. package/docs/domain-dictionary.md +19 -3
  194. package/docs/faceted-routing.md +4 -3
  195. package/docs/hitl/x-lt-display.md +1 -1
  196. package/docs/hitl/x-lt-roster.md +2 -2
  197. package/package.json +1 -1
  198. package/dashboard/dist/assets/ResolverForm-Bl8Pibyz.js +0 -8
  199. package/dashboard/dist/assets/ResolverForm-Bl8Pibyz.js.map +0 -1
  200. package/dashboard/dist/assets/index-BaCDL5fh.js.map +0 -1
  201. package/dashboard/dist/assets/index-CED9cLE2.js +0 -3
  202. package/dashboard/dist/assets/index-CED9cLE2.js.map +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-DrvjzgWT.js","./vendor-query-DvWWuNIB.js","./tasks-BkUVpaOa.js","./useFilterParams-DBRw1Hcv.js","./vendor-react-_9U4mKFr.js","./useDebouncedValue-Dk3r5xo-.js","./api-path-u2Jf9QXS.js","./DataTable-FjFhx0SE.js","./EmptyState-DgC_6njU.js","./useContainerWidth-DSLp1gEm.js","./TimestampCell-CfTc6Txy.js","./StickyPagination-BNOuYZ1m.js","./FilterBar-f-LEKcHI.js","./vendor-icons-C_DQEeBy.js","./PageHeader-C4z1ExF7.js","./ListToolbar-CTGK5BXW.js","./WorkflowPill-Cly9Ln_3.js","./ProcessDetailPage-B30RatjD.js","./PageHeaderWithStats-B_f_Sz_Q.js","./StatusBadge-DHVwxre2.js","./RolePill-Bw_n7EpR.js","./UserName-CPJPZnN1.js","./McpOverview-B2bbKKu2.js","./mcp-CRtY4v5W.js","./pipelines-BH0F9-jf.js","./yaml-workflows-B230v5Za.js","./controlplane-gQdOgVtH.js","./StatCard-nWY4sndl.js","./McpRunsPage-twxFdTtJ.js","./useNamespace-BXuyHKAs.js","./ElapsedCell-Yz7-LbtE.js","./RowActions-Bdd7z4eB.js","./McpRunDetailPage-CrUsDPRD.js","./SegmentedTabs-BpJh4Hwn.js","./EventTable-DJniXnhe.js","./SwimlaneTimeline-B5b8-xqI.js","./StreamMessageDetail-ALVUnfF1.js","./CopyableId-Bn02zYxt.js","./McpQueryPage-CSkczeJP.js","./mcp-query-CDsSMaYq.js","./McpQueryDetailPage-DgLxwwJy.js","./TagInput-B6fMAqxd.js","./CollapsibleSection-DlBVTFqc.js","./useYamlActivityEvents-DSlkjQfb.js","./helpers-DzO-OGPe.js","./RunAsSelector-CbJT50Hp.js","./BotPicker-u5760MWZ.js","./bots-D72EsztP.js","./ToolPill-BRZWo4l8.js","./TimeAgo-DVkFgECX.js","./EscalationsOverview-B7O4ttP4.js","./AvailableEscalationsPage-D1mCqj8Z.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-CtISXXmW.js","./constants-CeBBTzf5.js","./EscalationTitleSelect-CGGT-QTu.js","./EscalationTimeline-D6jrDcBb.js","./escalation-items-BIgBWbaw.js","./escalation-columns-CSE5wfWQ.js","./FormattedValue-CUtv1g3k.js","./EntityTimelinePanel-xgPRdKEq.js","./PriorityBadge-r33mpDju.js","./CountdownTimer-5t8S2qMi.js","./OperatorDashboard-BoeZIyup.js","./index-CED9cLE2.js","./ResolverForm-Bl8Pibyz.js","./metadata-display-B7X5hGxG.js","./WorkflowsOverview-Cg4LSfck.js","./index-BvH8T-jb.js","./NamespacePill-CSZT2fA4.js","./WorkflowsDashboard-DtxYdQbQ.js","./YamlWorkflowsPage-BF6Jtx24.js","./GraphInvokePage-CR0MtYv8.js","./YamlWorkflowDetailPage-Del-RCgi.js","./TasksListPage-CkMmOYOE.js","./TaskDetailPage-CoV3WcTA.js","./WorkflowExecutionPage-46UV5pJd.js","./AdminDashboard-DWVRAu63.js","./index-Cu0xdX2t.js","./TaskQueuePill-BnDp_DE6.js","./index-D1lfq5iZ.js","./ConfirmDeleteModal-Pabkchg_.js","./index-h1Useskt.js","./ToolTestPanel-kvqZqM0A.js","./index-Btm8FtTQ.js","./index-C-QQ5rKF.js","./personas-C2Wm4ng1.js","./ScopeBadge-CKgfwTy3.js","./RolesPage-B_3qWsvQ.js","./RoleDetailPage-ClYgn-3d.js","./AutoGrowTextarea-7X3T9La8.js","./PersonasPage-Bs097x07.js","./PersonaDetailPage-CDktk1mi.js","./EscalationSchemaPage-D8YVQNph.js","./PortalPage-DjfjerpF.js","./EscalationListSchemaPage-CqCd-y6B.js","./ScanCodesPage-CIIDuh8w.js","./GrantScopeField-BzWGzBfA.js","./ScanSchemeDetailPage-Bd3P3eyh.js","./ScanStationPage-BiO34nov.js","./index-czgLyfSo.js","./OperationsPage-gOVMrL_a.js","./index-ujGmmwl6.js","./index-C1iuZ4Q5.js","./CredentialsPage-CPVbYQow.js","./ConnectedAppsPage-DG2YZGN3.js","./index-CDxOQ84B.js","./DropZone-DCZpORx-.js","./index-CptTEhWp.js","./knowledge-150lsM68.js","./HomePage-HVw7T5ER.js","./AgentsPage-Dsk9iHps.js","./agents-wL-3dMOX.js","./AgentDetailPage-nDbZo6RB.js","./CronLabel-C7UbTrO-.js","./AgentConfigPage-Exjtjbvp.js","./capabilities-DXFo6bRb.js","./topics-Crl8HKHq.js","./CapabilitiesPage-BKIlrQfU.js","./TopicsPage-CJZnv50y.js","./TopicDetailPage-CjkAAyy8.js"])))=>i.map(i=>d[i]);
2
- var aS=Object.defineProperty;var oS=(n,e,s)=>e in n?aS(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s;var j=(n,e,s)=>oS(n,typeof e!="symbol"?e+"":e,s);import{r as lS,u as qe,a as E,j as h,b as Be,c as Fe,g as cS,d as uS,Q as fS,e as hS}from"./vendor-query-DvWWuNIB.js";import{r as dS,u as ni,a as en,b as sm,L as ar,N as Es,c as Sn,O as ei,d as mS,R as pS}from"./vendor-react-_9U4mKFr.js";import{X as Zt,E as yS,S as gS,M as bS,a as Mo,C as im,b as xS,B as vS,c as _S,d as lx,e as gd,I as bd,U as wS,L as xd,f as SS,G as ES,T as OS,R as cx,g as AS,Z as jS,P as Cg,h as ux,i as kS,j as Mg,k as vd,l as Rg,m as NS,W as am,n as TS,o as CS,F as MS,p as fx,q as RS,D as DS,N as LS,r as qS,s as hx,t as dx,u as mx,v as PS,w as BS,x as US,y as zS,z as IS,A as $S,H as HS,J as FS,K as GS}from"./vendor-icons-C_DQEeBy.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)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(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Jh={exports:{}},no={},Qh={exports:{}},Xh={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-assXQe-x.js","./vendor-query-DvWWuNIB.js","./tasks-xAU6C6tb.js","./useFilterParams-DBRw1Hcv.js","./vendor-react-_9U4mKFr.js","./useDebouncedValue-CbHmpS4w.js","./api-path-u2Jf9QXS.js","./DataTable-FjFhx0SE.js","./EmptyState-DgC_6njU.js","./useContainerWidth-DSLp1gEm.js","./TimestampCell-CiTYBQw-.js","./StickyPagination-C2drZk7w.js","./FilterBar-Dnse0soD.js","./vendor-icons-C_DQEeBy.js","./PageHeader-C4z1ExF7.js","./ListToolbar-B0qe2QZ5.js","./WorkflowPill-Cly9Ln_3.js","./ProcessDetailPage-Cp5-969g.js","./PageHeaderWithStats-B_f_Sz_Q.js","./StatusBadge-DHVwxre2.js","./RolePill-Bw_n7EpR.js","./UserName-DrAbCpdY.js","./McpOverview-DmH-qtX9.js","./mcp-CZhOocmN.js","./pipelines-Bb159fNz.js","./yaml-workflows-DyjbPFVp.js","./controlplane-Cu7TD1RX.js","./StatCard-nWY4sndl.js","./McpRunsPage-DVXVB4AJ.js","./useNamespace-B_00X1yb.js","./ElapsedCell-BT49mUIc.js","./RowActions-Bdd7z4eB.js","./McpRunDetailPage-DNdl10nB.js","./SegmentedTabs-BpJh4Hwn.js","./EventTable-Bjx17W_i.js","./SwimlaneTimeline-Ds_CqLXL.js","./StreamMessageDetail-x-l5653y.js","./CopyableId-Bn02zYxt.js","./McpQueryPage-DX1T-Ugq.js","./mcp-query-Wt8z6yAL.js","./McpQueryDetailPage-B-qtmwLd.js","./TagInput-B6fMAqxd.js","./CollapsibleSection-KOO37qs6.js","./useYamlActivityEvents-B4F-s9g0.js","./helpers-DzO-OGPe.js","./RunAsSelector-Fptil_sB.js","./BotPicker-Ci5PUrkl.js","./bots-BESWftTA.js","./ToolPill-BRZWo4l8.js","./TimeAgo-B_Ta97uy.js","./EscalationsOverview-Bl8g53x-.js","./AvailableEscalationsPage-DU84iaBN.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-PLx7SLvF.js","./constants-CeBBTzf5.js","./EscalationTitleSelect-DOsfY4u8.js","./EscalationTimeline-BWTUBxUf.js","./escalation-items-uDQTphVW.js","./escalation-columns-BPSH8qMx.js","./FormattedValue-DeVrRJy4.js","./EntityTimelinePanel-BtARWy3R.js","./PriorityBadge-r33mpDju.js","./CountdownTimer-C-Ngk8oq.js","./OperatorDashboard-Cw86vOPg.js","./index-kGSUZCOb.js","./ResolverForm-CMzNjmGG.js","./metadata-display-B7X5hGxG.js","./WorkflowsOverview-DwVMLe1y.js","./index-AJNPDsTI.js","./NamespacePill-CSZT2fA4.js","./WorkflowsDashboard-CMJPiR6G.js","./YamlWorkflowsPage-8Sr6rZMZ.js","./GraphInvokePage-HQEvbHTd.js","./YamlWorkflowDetailPage-Do6s_wmW.js","./TasksListPage-DyLaZvTT.js","./TaskDetailPage-BJGKEnIo.js","./WorkflowExecutionPage-DQITqX-6.js","./AdminDashboard-C_0ShYrm.js","./index-B4SNhwgt.js","./TaskQueuePill-BnDp_DE6.js","./index-qY2KDGkM.js","./ConfirmDeleteModal-CI1eE-Nr.js","./index-WA8py2Yc.js","./ToolTestPanel-Dw8Zu6xr.js","./index-BkVarz6E.js","./index-D5JQweUm.js","./personas-D2_foqJm.js","./ScopeBadge-CKgfwTy3.js","./RolesPage-D4oaYgTg.js","./RoleDetailPage-c_Qij0Tf.js","./AutoGrowTextarea-7X3T9La8.js","./PersonasPage-D11PokPb.js","./PersonaDetailPage-BTIJ4A6p.js","./EscalationSchemaPage-BHSC46Ow.js","./PortalPage-1rXm0cNK.js","./EscalationListSchemaPage-EEBsNpTe.js","./ScanCodesPage-BeZA_YJW.js","./GrantScopeField-BzWGzBfA.js","./ScanSchemeDetailPage-Bxi15xNr.js","./ScanStationPage-t5Bz957t.js","./index-BpWutGxS.js","./OperationsPage-BxgWQq8v.js","./index-BG7OpNg7.js","./index-BLlg1aVG.js","./CredentialsPage-BR7s6eVu.js","./ConnectedAppsPage-DZgbCC0G.js","./index-_yHsJJTS.js","./DropZone-DCZpORx-.js","./index-BvI2_dSt.js","./knowledge-DCFRNG8R.js","./HomePage-DizTklVg.js","./AgentsPage-BuzXc1mg.js","./agents-Maom-dbf.js","./AgentDetailPage-Sdmt5j-k.js","./CronLabel-BQ7Y1Nfd.js","./AgentConfigPage-Cc9dI8lO.js","./capabilities-BnvJAmFQ.js","./topics-DFdqb2Te.js","./CapabilitiesPage-DuSfgr6i.js","./TopicsPage-0Z2lAE0d.js","./TopicDetailPage-DPMAWKTN.js"])))=>i.map(i=>d[i]);
2
+ var oS=Object.defineProperty;var lS=(n,e,s)=>e in n?oS(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s;var j=(n,e,s)=>lS(n,typeof e!="symbol"?e+"":e,s);import{r as cS,u as qe,a as E,j as h,b as Be,c as Fe,g as uS,d as fS,Q as hS,e as dS}from"./vendor-query-DvWWuNIB.js";import{r as mS,u as ni,a as en,b as sm,L as ar,N as Es,c as Sn,O as ei,d as pS,R as yS}from"./vendor-react-_9U4mKFr.js";import{X as Zt,E as gS,S as bS,M as xS,a as Mo,C as im,b as vS,B as _S,c as wS,d as cx,e as gd,I as bd,U as SS,L as xd,f as ES,G as OS,T as AS,R as ux,g as jS,Z as kS,P as Mg,h as fx,i as NS,j as Rg,k as vd,l as Dg,m as TS,W as am,n as CS,o as MS,F as RS,p as hx,q as DS,D as LS,N as qS,r as PS,s as dx,t as mx,u as px,v as BS,w as US,x as zS,y as IS,z as $S,A as HS,H as FS,J as GS,K as VS}from"./vendor-icons-C_DQEeBy.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)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(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Jh={exports:{}},no={},Qh={exports:{}},Xh={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -7,7 +7,7 @@ var aS=Object.defineProperty;var oS=(n,e,s)=>e in n?aS(n,e,{enumerable:!0,config
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var Dg;function VS(){return Dg||(Dg=1,(function(n){function e(F,J){var le=F.length;F.push(J);e:for(;0<le;){var pe=le-1>>>1,ye=F[pe];if(0<o(ye,J))F[pe]=J,F[le]=ye,le=pe;else break e}}function s(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var J=F[0],le=F.pop();if(le!==J){F[0]=le;e:for(var pe=0,ye=F.length,Ce=ye>>>1;pe<Ce;){var Ne=2*(pe+1)-1,Me=F[Ne],We=Ne+1,pt=F[We];if(0>o(Me,le))We<ye&&0>o(pt,Me)?(F[pe]=pt,F[We]=le,pe=We):(F[pe]=Me,F[Ne]=le,pe=Ne);else if(We<ye&&0>o(pt,le))F[pe]=pt,F[We]=le,pe=We;else break e}}return J}function o(F,J){var le=F.sortIndex-J.sortIndex;return le!==0?le:F.id-J.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var m=Date,p=m.now();n.unstable_now=function(){return m.now()-p}}var g=[],u=[],d=1,b=null,x=3,v=!1,w=!1,S=!1,C=!1,P=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,re=typeof setImmediate<"u"?setImmediate:null;function se(F){for(var J=s(u);J!==null;){if(J.callback===null)i(u);else if(J.startTime<=F)i(u),J.sortIndex=J.expirationTime,e(g,J);else break;J=s(u)}}function M(F){if(S=!1,se(F),!w)if(s(g)!==null)w=!0,U||(U=!0,W());else{var J=s(u);J!==null&&Oe(M,J.startTime-F)}}var U=!1,ae=-1,z=5,I=-1;function D(){return C?!0:!(n.unstable_now()-I<z)}function X(){if(C=!1,U){var F=n.unstable_now();I=F;var J=!0;try{e:{w=!1,S&&(S=!1,q(ae),ae=-1),v=!0;var le=x;try{t:{for(se(F),b=s(g);b!==null&&!(b.expirationTime>F&&D());){var pe=b.callback;if(typeof pe=="function"){b.callback=null,x=b.priorityLevel;var ye=pe(b.expirationTime<=F);if(F=n.unstable_now(),typeof ye=="function"){b.callback=ye,se(F),J=!0;break t}b===s(g)&&i(g),se(F)}else i(g);b=s(g)}if(b!==null)J=!0;else{var Ce=s(u);Ce!==null&&Oe(M,Ce.startTime-F),J=!1}}break e}finally{b=null,x=le,v=!1}J=void 0}}finally{J?W():U=!1}}}var W;if(typeof re=="function")W=function(){re(X)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,we=he.port2;he.port1.onmessage=X,W=function(){we.postMessage(null)}}else W=function(){P(X,0)};function Oe(F,J){ae=P(function(){F(n.unstable_now())},J)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(F){F.callback=null},n.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<F?Math.floor(1e3/F):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(F){switch(x){case 1:case 2:case 3:var J=3;break;default:J=x}var le=x;x=J;try{return F()}finally{x=le}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(F,J){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var le=x;x=F;try{return J()}finally{x=le}},n.unstable_scheduleCallback=function(F,J,le){var pe=n.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?pe+le:pe):le=pe,F){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=le+ye,F={id:d++,callback:J,priorityLevel:F,startTime:le,expirationTime:ye,sortIndex:-1},le>pe?(F.sortIndex=le,e(u,F),s(g)===null&&F===s(u)&&(S?(q(ae),ae=-1):S=!0,Oe(M,le-pe))):(F.sortIndex=ye,e(g,F),w||v||(w=!0,U||(U=!0,W()))),F},n.unstable_shouldYield=D,n.unstable_wrapCallback=function(F){var J=x;return function(){var le=x;x=J;try{return F.apply(this,arguments)}finally{x=le}}}})(Xh)),Xh}var Lg;function YS(){return Lg||(Lg=1,Qh.exports=VS()),Qh.exports}/**
10
+ */var Lg;function YS(){return Lg||(Lg=1,(function(n){function e(F,J){var le=F.length;F.push(J);e:for(;0<le;){var pe=le-1>>>1,ye=F[pe];if(0<o(ye,J))F[pe]=J,F[le]=ye,le=pe;else break e}}function s(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var J=F[0],le=F.pop();if(le!==J){F[0]=le;e:for(var pe=0,ye=F.length,Ce=ye>>>1;pe<Ce;){var Ne=2*(pe+1)-1,Me=F[Ne],We=Ne+1,pt=F[We];if(0>o(Me,le))We<ye&&0>o(pt,Me)?(F[pe]=pt,F[We]=le,pe=We):(F[pe]=Me,F[Ne]=le,pe=Ne);else if(We<ye&&0>o(pt,le))F[pe]=pt,F[We]=le,pe=We;else break e}}return J}function o(F,J){var le=F.sortIndex-J.sortIndex;return le!==0?le:F.id-J.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var m=Date,p=m.now();n.unstable_now=function(){return m.now()-p}}var g=[],u=[],d=1,b=null,x=3,v=!1,_=!1,S=!1,C=!1,P=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,ne=typeof setImmediate<"u"?setImmediate:null;function te(F){for(var J=s(u);J!==null;){if(J.callback===null)i(u);else if(J.startTime<=F)i(u),J.sortIndex=J.expirationTime,e(g,J);else break;J=s(u)}}function M(F){if(S=!1,te(F),!_)if(s(g)!==null)_=!0,U||(U=!0,W());else{var J=s(u);J!==null&&Oe(M,J.startTime-F)}}var U=!1,ae=-1,z=5,I=-1;function D(){return C?!0:!(n.unstable_now()-I<z)}function X(){if(C=!1,U){var F=n.unstable_now();I=F;var J=!0;try{e:{_=!1,S&&(S=!1,q(ae),ae=-1),v=!0;var le=x;try{t:{for(te(F),b=s(g);b!==null&&!(b.expirationTime>F&&D());){var pe=b.callback;if(typeof pe=="function"){b.callback=null,x=b.priorityLevel;var ye=pe(b.expirationTime<=F);if(F=n.unstable_now(),typeof ye=="function"){b.callback=ye,te(F),J=!0;break t}b===s(g)&&i(g),te(F)}else i(g);b=s(g)}if(b!==null)J=!0;else{var Ce=s(u);Ce!==null&&Oe(M,Ce.startTime-F),J=!1}}break e}finally{b=null,x=le,v=!1}J=void 0}}finally{J?W():U=!1}}}var W;if(typeof ne=="function")W=function(){ne(X)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,we=he.port2;he.port1.onmessage=X,W=function(){we.postMessage(null)}}else W=function(){P(X,0)};function Oe(F,J){ae=P(function(){F(n.unstable_now())},J)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(F){F.callback=null},n.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<F?Math.floor(1e3/F):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(F){switch(x){case 1:case 2:case 3:var J=3;break;default:J=x}var le=x;x=J;try{return F()}finally{x=le}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(F,J){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var le=x;x=F;try{return J()}finally{x=le}},n.unstable_scheduleCallback=function(F,J,le){var pe=n.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?pe+le:pe):le=pe,F){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=le+ye,F={id:d++,callback:J,priorityLevel:F,startTime:le,expirationTime:ye,sortIndex:-1},le>pe?(F.sortIndex=le,e(u,F),s(g)===null&&F===s(u)&&(S?(q(ae),ae=-1):S=!0,Oe(M,le-pe))):(F.sortIndex=ye,e(g,F),_||v||(_=!0,U||(U=!0,W()))),F},n.unstable_shouldYield=D,n.unstable_wrapCallback=function(F){var J=x;return function(){var le=x;x=J;try{return F.apply(this,arguments)}finally{x=le}}}})(Xh)),Xh}var qg;function KS(){return qg||(qg=1,Qh.exports=YS()),Qh.exports}/**
11
11
  * @license React
12
12
  * react-dom-client.production.js
13
13
  *
@@ -15,28 +15,28 @@ var aS=Object.defineProperty;var oS=(n,e,s)=>e in n?aS(n,e,{enumerable:!0,config
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var qg;function KS(){if(qg)return no;qg=1;var n=YS(),e=lS(),s=dS();function i(t){var r="https://react.dev/errors/"+t;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var r=t,a=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,(r.flags&4098)!==0&&(a=r.return),t=r.return;while(t)}return r.tag===3?a:null}function m(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function p(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function g(t){if(c(t)!==t)throw Error(i(188))}function u(t){var r=t.alternate;if(!r){if(r=c(t),r===null)throw Error(i(188));return r!==t?null:t}for(var a=t,l=r;;){var f=a.return;if(f===null)break;var y=f.alternate;if(y===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===y.child){for(y=f.child;y;){if(y===a)return g(f),t;if(y===l)return g(f),r;y=y.sibling}throw Error(i(188))}if(a.return!==l.return)a=f,l=y;else{for(var _=!1,O=f.child;O;){if(O===a){_=!0,a=f,l=y;break}if(O===l){_=!0,l=f,a=y;break}O=O.sibling}if(!_){for(O=y.child;O;){if(O===a){_=!0,a=y,l=f;break}if(O===l){_=!0,l=y,a=f;break}O=O.sibling}if(!_)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?t:r}function d(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=d(t),r!==null)return r;t=t.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),re=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function W(t){return t===null||typeof t!="object"?null:(t=X&&t[X]||t["@@iterator"],typeof t=="function"?t:null)}var he=Symbol.for("react.client.reference");function we(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===he?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case S:return"Fragment";case P:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case U:return"SuspenseList";case I:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case re:return t.displayName||"Context";case q:return(t._context.displayName||"Context")+".Consumer";case se:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ae:return r=t.displayName||null,r!==null?r:we(t.type)||"Memo";case z:r=t._payload,t=t._init;try{return we(t(r))}catch{}}return null}var Oe=Array.isArray,F=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},pe=[],ye=-1;function Ce(t){return{current:t}}function Ne(t){0>ye||(t.current=pe[ye],pe[ye]=null,ye--)}function Me(t,r){ye++,pe[ye]=t.current,t.current=r}var We=Ce(null),pt=Ce(null),Ct=Ce(null),Se=Ce(null);function Re(t,r){switch(Me(Ct,r),Me(pt,t),Me(We,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?eg(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=eg(r),t=tg(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Ne(We),Me(We,t)}function ce(){Ne(We),Ne(pt),Ne(Ct)}function Ue(t){t.memoizedState!==null&&Me(Se,t);var r=We.current,a=tg(r,t.type);r!==a&&(Me(pt,t),Me(We,a))}function Xe(t){pt.current===t&&(Ne(We),Ne(pt)),Se.current===t&&(Ne(Se),Wa._currentValue=le)}var cn,Mt;function be(t){if(cn===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);cn=r&&r[1]||"",Mt=-1<a.stack.indexOf(`
18
+ */var Pg;function JS(){if(Pg)return no;Pg=1;var n=KS(),e=cS(),s=mS();function i(t){var r="https://react.dev/errors/"+t;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var r=t,a=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,(r.flags&4098)!==0&&(a=r.return),t=r.return;while(t)}return r.tag===3?a:null}function m(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function p(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function g(t){if(c(t)!==t)throw Error(i(188))}function u(t){var r=t.alternate;if(!r){if(r=c(t),r===null)throw Error(i(188));return r!==t?null:t}for(var a=t,l=r;;){var f=a.return;if(f===null)break;var y=f.alternate;if(y===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===y.child){for(y=f.child;y;){if(y===a)return g(f),t;if(y===l)return g(f),r;y=y.sibling}throw Error(i(188))}if(a.return!==l.return)a=f,l=y;else{for(var w=!1,O=f.child;O;){if(O===a){w=!0,a=f,l=y;break}if(O===l){w=!0,l=f,a=y;break}O=O.sibling}if(!w){for(O=y.child;O;){if(O===a){w=!0,a=y,l=f;break}if(O===l){w=!0,l=y,a=f;break}O=O.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?t:r}function d(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=d(t),r!==null)return r;t=t.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),ne=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function W(t){return t===null||typeof t!="object"?null:(t=X&&t[X]||t["@@iterator"],typeof t=="function"?t:null)}var he=Symbol.for("react.client.reference");function we(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===he?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case S:return"Fragment";case P:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case U:return"SuspenseList";case I:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case _:return"Portal";case ne:return t.displayName||"Context";case q:return(t._context.displayName||"Context")+".Consumer";case te:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ae:return r=t.displayName||null,r!==null?r:we(t.type)||"Memo";case z:r=t._payload,t=t._init;try{return we(t(r))}catch{}}return null}var Oe=Array.isArray,F=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},pe=[],ye=-1;function Ce(t){return{current:t}}function Ne(t){0>ye||(t.current=pe[ye],pe[ye]=null,ye--)}function Me(t,r){ye++,pe[ye]=t.current,t.current=r}var We=Ce(null),pt=Ce(null),Ct=Ce(null),Se=Ce(null);function Re(t,r){switch(Me(Ct,r),Me(pt,t),Me(We,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?tg(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=tg(r),t=ng(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Ne(We),Me(We,t)}function ce(){Ne(We),Ne(pt),Ne(Ct)}function Ue(t){t.memoizedState!==null&&Me(Se,t);var r=We.current,a=ng(r,t.type);r!==a&&(Me(pt,t),Me(We,a))}function Xe(t){pt.current===t&&(Ne(We),Ne(pt)),Se.current===t&&(Ne(Se),Wa._currentValue=le)}var cn,Mt;function be(t){if(cn===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);cn=r&&r[1]||"",Mt=-1<a.stack.indexOf(`
19
19
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+cn+t+Mt}var it=!1;function yt(t,r){if(!t||it)return"";it=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Q){var Y=Q}Reflect.construct(t,[],ie)}else{try{ie.call()}catch(Q){Y=Q}t.call(ie.prototype)}}else{try{throw Error()}catch(Q){Y=Q}(ie=t())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Q){if(Q&&Y&&typeof Q.stack=="string")return[Q.stack,Y.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=l.DetermineComponentFrameRoot(),_=y[0],O=y[1];if(_&&O){var R=_.split(`
20
+ `+cn+t+Mt}var it=!1;function yt(t,r){if(!t||it)return"";it=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Q){var Y=Q}Reflect.construct(t,[],ie)}else{try{ie.call()}catch(Q){Y=Q}t.call(ie.prototype)}}else{try{throw Error()}catch(Q){Y=Q}(ie=t())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Q){if(Q&&Y&&typeof Q.stack=="string")return[Q.stack,Y.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=l.DetermineComponentFrameRoot(),w=y[0],O=y[1];if(w&&O){var R=w.split(`
21
21
  `),V=O.split(`
22
22
  `);for(f=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;f<V.length&&!V[f].includes("DetermineComponentFrameRoot");)f++;if(l===R.length||f===V.length)for(l=R.length-1,f=V.length-1;1<=l&&0<=f&&R[l]!==V[f];)f--;for(;1<=l&&0<=f;l--,f--)if(R[l]!==V[f]){if(l!==1||f!==1)do if(l--,f--,0>f||R[l]!==V[f]){var Z=`
23
23
  `+R[l].replace(" at new "," at ");return t.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",t.displayName)),Z}while(1<=l&&0<=f);break}}}finally{it=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?be(a):""}function Ot(t,r){switch(t.tag){case 26:case 27:case 5:return be(t.type);case 16:return be("Lazy");case 13:return t.child!==r&&r!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return yt(t.type,!1);case 11:return yt(t.type.render,!1);case 1:return yt(t.type,!0);case 31:return be("Activity");default:return""}}function Ur(t){try{var r="",a=null;do r+=Ot(t,a),a=t,t=t.return;while(t);return r}catch(l){return`
24
24
  Error generating stack: `+l.message+`
25
- `+l.stack}}var la=Object.prototype.hasOwnProperty,ca=n.unstable_scheduleCallback,hr=n.unstable_cancelCallback,zo=n.unstable_shouldYield,si=n.unstable_requestPaint,ft=n.unstable_now,Bu=n.unstable_getCurrentPriorityLevel,Io=n.unstable_ImmediatePriority,$o=n.unstable_UserBlockingPriority,ii=n.unstable_NormalPriority,Uu=n.unstable_LowPriority,Ho=n.unstable_IdlePriority,zu=n.log,Fo=n.unstable_setDisableYieldValue,ks=null,_t=null;function un(t){if(typeof zu=="function"&&Fo(t),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(ks,t)}catch{}}var Ft=Math.clz32?Math.clz32:ai,ua=Math.log,fa=Math.LN2;function ai(t){return t>>>=0,t===0?32:31-(ua(t)/fa|0)|0}var zr=256,dr=262144,Ir=4194304;function Hn(t){var r=t&42;if(r!==0)return r;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ns(t,r,a){var l=t.pendingLanes;if(l===0)return 0;var f=0,y=t.suspendedLanes,_=t.pingedLanes;t=t.warmLanes;var O=l&134217727;return O!==0?(l=O&~y,l!==0?f=Hn(l):(_&=O,_!==0?f=Hn(_):a||(a=O&~t,a!==0&&(f=Hn(a))))):(O=l&~y,O!==0?f=Hn(O):_!==0?f=Hn(_):a||(a=l&~t,a!==0&&(f=Hn(a)))),f===0?0:r!==0&&r!==f&&(r&y)===0&&(y=f&-f,a=r&-r,y>=a||y===32&&(a&4194048)!==0)?r:f}function Ts(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function ha(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 oi(){var t=Ir;return Ir<<=1,(Ir&62914560)===0&&(Ir=4194304),t}function $r(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function Fn(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Hr(t,r,a,l,f,y){var _=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var O=t.entanglements,R=t.expirationTimes,V=t.hiddenUpdates;for(a=_&~a;0<a;){var Z=31-Ft(a),ie=1<<Z;O[Z]=0,R[Z]=-1;var Y=V[Z];if(Y!==null)for(V[Z]=null,Z=0;Z<Y.length;Z++){var Q=Y[Z];Q!==null&&(Q.lane&=-536870913)}a&=~ie}l!==0&&Fr(t,l,0),y!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=y&~(_&~r))}function Fr(t,r,a){t.pendingLanes|=r,t.suspendedLanes&=~r;var l=31-Ft(r);t.entangledLanes|=r,t.entanglements[l]=t.entanglements[l]|1073741824|a&261930}function Cs(t,r){var a=t.entangledLanes|=r;for(t=t.entanglements;a;){var l=31-Ft(a),f=1<<l;f&r|t[l]&r&&(t[l]|=r),a&=~f}}function Gr(t,r){var a=r&-r;return a=(a&42)!==0?1:mr(a),(a&(t.suspendedLanes|r))!==0?0:a}function mr(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Ms(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function da(){var t=J.p;return t!==0?t:(t=window.event,t===void 0?32:Eg(t.type))}function Go(t,r){var a=J.p;try{return J.p=t,r()}finally{J.p=a}}var tr=Math.random().toString(36).slice(2),at="__reactFiber$"+tr,gt="__reactProps$"+tr,fn="__reactContainer$"+tr,Rs="__reactEvents$"+tr,ma="__reactListeners$"+tr,Vo="__reactHandles$"+tr,Yo="__reactResources$"+tr,Rt="__reactMarker$"+tr;function li(t){delete t[at],delete t[gt],delete t[Rs],delete t[ma],delete t[Vo]}function A(t){var r=t[at];if(r)return r;for(var a=t.parentNode;a;){if(r=a[fn]||a[at]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(t=lg(t);t!==null;){if(a=t[at])return a;t=lg(t)}return r}t=a,a=t.parentNode}return null}function N(t){if(t=t[at]||t[fn]){var r=t.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return t}return null}function k(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t.stateNode;throw Error(i(33))}function T(t){var r=t[Yo];return r||(r=t[Yo]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function L(t){t[Rt]=!0}var H=new Set,ne={};function oe(t,r){K(t,r),K(t+"Capture",r)}function K(t,r){for(ne[t]=r,t=0;t<r.length;t++)H.add(r[t])}var te=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]*$"),xe={},Pe={};function lt(t){return la.call(Pe,t)?!0:la.call(xe,t)?!1:te.test(t)?Pe[t]=!0:(xe[t]=!0,!1)}function Gt(t,r,a){if(lt(r))if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){t.removeAttribute(r);return}}t.setAttribute(r,""+a)}}function Gn(t,r,a){if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttribute(r,""+a)}}function pr(t,r,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(r,a,""+l)}}function Tn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Vm(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Zv(t,r,a){var l=Object.getOwnPropertyDescriptor(t.constructor.prototype,r);if(!t.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,y=l.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,y.call(this,_)}}),Object.defineProperty(t,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function Iu(t){if(!t._valueTracker){var r=Vm(t)?"checked":"value";t._valueTracker=Zv(t,r,""+t[r])}}function Ym(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return t&&(l=Vm(t)?t.checked?"true":"false":t.value),t=l,t!==a?(r.setValue(t),!0):!1}function Ko(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var e_=/[\n"\\]/g;function Cn(t){return t.replace(e_,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function $u(t,r,a,l,f,y,_,O){t.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?t.type=_:t.removeAttribute("type"),r!=null?_==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+Tn(r)):t.value!==""+Tn(r)&&(t.value=""+Tn(r)):_!=="submit"&&_!=="reset"||t.removeAttribute("value"),r!=null?Hu(t,_,Tn(r)):a!=null?Hu(t,_,Tn(a)):l!=null&&t.removeAttribute("value"),f==null&&y!=null&&(t.defaultChecked=!!y),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.name=""+Tn(O):t.removeAttribute("name")}function Km(t,r,a,l,f,y,_,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),r!=null||a!=null){if(!(y!=="submit"&&y!=="reset"||r!=null)){Iu(t);return}a=a!=null?""+Tn(a):"",r=r!=null?""+Tn(r):a,O||r===t.value||(t.value=r),t.defaultValue=r}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,t.checked=O?t.checked:!!l,t.defaultChecked=!!l,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(t.name=_),Iu(t)}function Hu(t,r,a){r==="number"&&Ko(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function ci(t,r,a,l){if(t=t.options,r){r={};for(var f=0;f<a.length;f++)r["$"+a[f]]=!0;for(a=0;a<t.length;a++)f=r.hasOwnProperty("$"+t[a].value),t[a].selected!==f&&(t[a].selected=f),f&&l&&(t[a].defaultSelected=!0)}else{for(a=""+Tn(a),r=null,f=0;f<t.length;f++){if(t[f].value===a){t[f].selected=!0,l&&(t[f].defaultSelected=!0);return}r!==null||t[f].disabled||(r=t[f])}r!==null&&(r.selected=!0)}}function Jm(t,r,a){if(r!=null&&(r=""+Tn(r),r!==t.value&&(t.value=r),a==null)){t.defaultValue!==r&&(t.defaultValue=r);return}t.defaultValue=a!=null?""+Tn(a):""}function Qm(t,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(i(92));if(Oe(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=Tn(r),t.defaultValue=a,l=t.textContent,l===a&&l!==""&&l!==null&&(t.value=l),Iu(t)}function ui(t,r){if(r){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=r;return}}t.textContent=r}var t_=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 Xm(t,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="":l?t.setProperty(r,a):typeof a!="number"||a===0||t_.has(r)?r==="float"?t.cssFloat=a:t[r]=(""+a).trim():t[r]=a+"px"}function Wm(t,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(t=t.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="");for(var f in r)l=r[f],r.hasOwnProperty(f)&&a[f]!==l&&Xm(t,f,l)}else for(var y in r)r.hasOwnProperty(y)&&Xm(t,y,r[y])}function Fu(t){if(t.indexOf("-")===-1)return!1;switch(t){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 n_=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"]]),r_=/^[\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 Jo(t){return r_.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function yr(){}var Gu=null;function Vu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var fi=null,hi=null;function Zm(t){var r=N(t);if(r&&(t=r.stateNode)){var a=t[gt]||null;e:switch(t=r.stateNode,r.type){case"input":if($u(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Cn(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==t&&l.form===t.form){var f=l[gt]||null;if(!f)throw Error(i(90));$u(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===t.form&&Ym(l)}break e;case"textarea":Jm(t,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&ci(t,!!a.multiple,r,!1)}}}var Yu=!1;function e0(t,r,a){if(Yu)return t(r,a);Yu=!0;try{var l=t(r);return l}finally{if(Yu=!1,(fi!==null||hi!==null)&&(ql(),fi&&(r=fi,t=hi,hi=fi=null,Zm(r),t)))for(r=0;r<t.length;r++)Zm(t[r])}}function pa(t,r){var a=t.stateNode;if(a===null)return null;var l=a[gt]||null;if(l===null)return null;a=l[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(t=t.type,l=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!l;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(gr)try{var ya={};Object.defineProperty(ya,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",ya,ya),window.removeEventListener("test",ya,ya)}catch{Ku=!1}var Vr=null,Ju=null,Qo=null;function t0(){if(Qo)return Qo;var t,r=Ju,a=r.length,l,f="value"in Vr?Vr.value:Vr.textContent,y=f.length;for(t=0;t<a&&r[t]===f[t];t++);var _=a-t;for(l=1;l<=_&&r[a-l]===f[y-l];l++);return Qo=f.slice(t,1<l?1-l:void 0)}function Xo(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function Wo(){return!0}function n0(){return!1}function nn(t){function r(a,l,f,y,_){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=y,this.target=_,this.currentTarget=null;for(var O in t)t.hasOwnProperty(O)&&(a=t[O],this[O]=a?a(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Wo:n0,this.isPropagationStopped=n0,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Wo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Wo)},persist:function(){},isPersistent:Wo}),r}var Ds={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zo=nn(Ds),ga=b({},Ds,{view:0,detail:0}),s_=nn(ga),Qu,Xu,ba,el=b({},ga,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ba&&(ba&&t.type==="mousemove"?(Qu=t.screenX-ba.screenX,Xu=t.screenY-ba.screenY):Xu=Qu=0,ba=t),Qu)},movementY:function(t){return"movementY"in t?t.movementY:Xu}}),r0=nn(el),i_=b({},el,{dataTransfer:0}),a_=nn(i_),o_=b({},ga,{relatedTarget:0}),Wu=nn(o_),l_=b({},Ds,{animationName:0,elapsedTime:0,pseudoElement:0}),c_=nn(l_),u_=b({},Ds,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),f_=nn(u_),h_=b({},Ds,{data:0}),s0=nn(h_),d_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},m_={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"},p_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function y_(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=p_[t])?!!r[t]:!1}function Zu(){return y_}var g_=b({},ga,{key:function(t){if(t.key){var r=d_[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=Xo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?m_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zu,charCode:function(t){return t.type==="keypress"?Xo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Xo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),b_=nn(g_),x_=b({},el,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),i0=nn(x_),v_=b({},ga,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zu}),__=nn(v_),w_=b({},Ds,{propertyName:0,elapsedTime:0,pseudoElement:0}),S_=nn(w_),E_=b({},el,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),O_=nn(E_),A_=b({},Ds,{newState:0,oldState:0}),j_=nn(A_),k_=[9,13,27,32],ef=gr&&"CompositionEvent"in window,xa=null;gr&&"documentMode"in document&&(xa=document.documentMode);var N_=gr&&"TextEvent"in window&&!xa,a0=gr&&(!ef||xa&&8<xa&&11>=xa),o0=" ",l0=!1;function c0(t,r){switch(t){case"keyup":return k_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function u0(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var di=!1;function T_(t,r){switch(t){case"compositionend":return u0(r);case"keypress":return r.which!==32?null:(l0=!0,o0);case"textInput":return t=r.data,t===o0&&l0?null:t;default:return null}}function C_(t,r){if(di)return t==="compositionend"||!ef&&c0(t,r)?(t=t0(),Qo=Ju=Vr=null,di=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return a0&&r.locale!=="ko"?null:r.data;default:return null}}var M_={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 f0(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!M_[t.type]:r==="textarea"}function h0(t,r,a,l){fi?hi?hi.push(l):hi=[l]:fi=l,r=Hl(r,"onChange"),0<r.length&&(a=new Zo("onChange","change",null,a,l),t.push({event:a,listeners:r}))}var va=null,_a=null;function R_(t){Ky(t,0)}function tl(t){var r=k(t);if(Ym(r))return t}function d0(t,r){if(t==="change")return r}var m0=!1;if(gr){var tf;if(gr){var nf="oninput"in document;if(!nf){var p0=document.createElement("div");p0.setAttribute("oninput","return;"),nf=typeof p0.oninput=="function"}tf=nf}else tf=!1;m0=tf&&(!document.documentMode||9<document.documentMode)}function y0(){va&&(va.detachEvent("onpropertychange",g0),_a=va=null)}function g0(t){if(t.propertyName==="value"&&tl(_a)){var r=[];h0(r,_a,t,Vu(t)),e0(R_,r)}}function D_(t,r,a){t==="focusin"?(y0(),va=r,_a=a,va.attachEvent("onpropertychange",g0)):t==="focusout"&&y0()}function L_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return tl(_a)}function q_(t,r){if(t==="click")return tl(r)}function P_(t,r){if(t==="input"||t==="change")return tl(r)}function B_(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var hn=typeof Object.is=="function"?Object.is:B_;function wa(t,r){if(hn(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var a=Object.keys(t),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!la.call(r,f)||!hn(t[f],r[f]))return!1}return!0}function b0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function x0(t,r){var a=b0(t);t=0;for(var l;a;){if(a.nodeType===3){if(l=t+a.textContent.length,t<=r&&l>=r)return{node:a,offset:r-t};t=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=b0(a)}}function v0(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?v0(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function _0(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=Ko(t.document);r instanceof t.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)t=r.contentWindow;else break;r=Ko(t.document)}return r}function rf(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var U_=gr&&"documentMode"in document&&11>=document.documentMode,mi=null,sf=null,Sa=null,af=!1;function w0(t,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;af||mi==null||mi!==Ko(l)||(l=mi,"selectionStart"in l&&rf(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Sa&&wa(Sa,l)||(Sa=l,l=Hl(sf,"onSelect"),0<l.length&&(r=new Zo("onSelect","select",null,r,a),t.push({event:r,listeners:l}),r.target=mi)))}function Ls(t,r){var a={};return a[t.toLowerCase()]=r.toLowerCase(),a["Webkit"+t]="webkit"+r,a["Moz"+t]="moz"+r,a}var pi={animationend:Ls("Animation","AnimationEnd"),animationiteration:Ls("Animation","AnimationIteration"),animationstart:Ls("Animation","AnimationStart"),transitionrun:Ls("Transition","TransitionRun"),transitionstart:Ls("Transition","TransitionStart"),transitioncancel:Ls("Transition","TransitionCancel"),transitionend:Ls("Transition","TransitionEnd")},of={},S0={};gr&&(S0=document.createElement("div").style,"AnimationEvent"in window||(delete pi.animationend.animation,delete pi.animationiteration.animation,delete pi.animationstart.animation),"TransitionEvent"in window||delete pi.transitionend.transition);function qs(t){if(of[t])return of[t];if(!pi[t])return t;var r=pi[t],a;for(a in r)if(r.hasOwnProperty(a)&&a in S0)return of[t]=r[a];return t}var E0=qs("animationend"),O0=qs("animationiteration"),A0=qs("animationstart"),z_=qs("transitionrun"),I_=qs("transitionstart"),$_=qs("transitioncancel"),j0=qs("transitionend"),k0=new Map,lf="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(" ");lf.push("scrollEnd");function Vn(t,r){k0.set(t,r),oe(r,[t])}var nl=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Mn=[],yi=0,cf=0;function rl(){for(var t=yi,r=cf=yi=0;r<t;){var a=Mn[r];Mn[r++]=null;var l=Mn[r];Mn[r++]=null;var f=Mn[r];Mn[r++]=null;var y=Mn[r];if(Mn[r++]=null,l!==null&&f!==null){var _=l.pending;_===null?f.next=f:(f.next=_.next,_.next=f),l.pending=f}y!==0&&N0(a,f,y)}}function sl(t,r,a,l){Mn[yi++]=t,Mn[yi++]=r,Mn[yi++]=a,Mn[yi++]=l,cf|=l,t.lanes|=l,t=t.alternate,t!==null&&(t.lanes|=l)}function uf(t,r,a,l){return sl(t,r,a,l),il(t)}function Ps(t,r){return sl(t,null,null,r),il(t)}function N0(t,r,a){t.lanes|=a;var l=t.alternate;l!==null&&(l.lanes|=a);for(var f=!1,y=t.return;y!==null;)y.childLanes|=a,l=y.alternate,l!==null&&(l.childLanes|=a),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(f=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,f&&r!==null&&(f=31-Ft(a),t=y.hiddenUpdates,l=t[f],l===null?t[f]=[r]:l.push(r),r.lane=a|536870912),y):null}function il(t){if(50<Ga)throw Ga=0,xh=null,Error(i(185));for(var r=t.return;r!==null;)t=r,r=t.return;return t.tag===3?t.stateNode:null}var gi={};function H_(t,r,a,l){this.tag=t,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=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(t,r,a,l){return new H_(t,r,a,l)}function ff(t){return t=t.prototype,!(!t||!t.isReactComponent)}function br(t,r){var a=t.alternate;return a===null?(a=dn(t.tag,r,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=r,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,r=t.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function T0(t,r){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=r,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,r=a.dependencies,t.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),t}function al(t,r,a,l,f,y){var _=0;if(l=t,typeof t=="function")ff(t)&&(_=1);else if(typeof t=="string")_=Kw(t,a,We.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=dn(31,a,r,f),t.elementType=I,t.lanes=y,t;case S:return Bs(a.children,f,y,r);case C:_=8,f|=24;break;case P:return t=dn(12,a,r,f|2),t.elementType=P,t.lanes=y,t;case M:return t=dn(13,a,r,f),t.elementType=M,t.lanes=y,t;case U:return t=dn(19,a,r,f),t.elementType=U,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case re:_=10;break e;case q:_=9;break e;case se:_=11;break e;case ae:_=14;break e;case z:_=16,l=null;break e}_=29,a=Error(i(130,t===null?"null":typeof t,"")),l=null}return r=dn(_,a,r,f),r.elementType=t,r.type=l,r.lanes=y,r}function Bs(t,r,a,l){return t=dn(7,t,l,r),t.lanes=a,t}function hf(t,r,a){return t=dn(6,t,null,r),t.lanes=a,t}function C0(t){var r=dn(18,null,null,0);return r.stateNode=t,r}function df(t,r,a){return r=dn(4,t.children!==null?t.children:[],t.key,r),r.lanes=a,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}var M0=new WeakMap;function Rn(t,r){if(typeof t=="object"&&t!==null){var a=M0.get(t);return a!==void 0?a:(r={value:t,source:r,stack:Ur(r)},M0.set(t,r),r)}return{value:t,source:r,stack:Ur(r)}}var bi=[],xi=0,ol=null,Ea=0,Dn=[],Ln=0,Yr=null,nr=1,rr="";function xr(t,r){bi[xi++]=Ea,bi[xi++]=ol,ol=t,Ea=r}function R0(t,r,a){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,Yr=t;var l=nr;t=rr;var f=32-Ft(l)-1;l&=~(1<<f),a+=1;var y=32-Ft(r)+f;if(30<y){var _=f-f%5;y=(l&(1<<_)-1).toString(32),l>>=_,f-=_,nr=1<<32-Ft(r)+f|a<<f|l,rr=y+t}else nr=1<<y|a<<f|l,rr=t}function mf(t){t.return!==null&&(xr(t,1),R0(t,1,0))}function pf(t){for(;t===ol;)ol=bi[--xi],bi[xi]=null,Ea=bi[--xi],bi[xi]=null;for(;t===Yr;)Yr=Dn[--Ln],Dn[Ln]=null,rr=Dn[--Ln],Dn[Ln]=null,nr=Dn[--Ln],Dn[Ln]=null}function D0(t,r){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,nr=r.id,rr=r.overflow,Yr=t}var zt=null,ct=null,Ge=!1,Kr=null,qn=!1,yf=Error(i(519));function Jr(t){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Oa(Rn(r,t)),yf}function L0(t){var r=t.stateNode,a=t.type,l=t.memoizedProps;switch(r[at]=t,r[gt]=l,a){case"dialog":Ie("cancel",r),Ie("close",r);break;case"iframe":case"object":case"embed":Ie("load",r);break;case"video":case"audio":for(a=0;a<Ya.length;a++)Ie(Ya[a],r);break;case"source":Ie("error",r);break;case"img":case"image":case"link":Ie("error",r),Ie("load",r);break;case"details":Ie("toggle",r);break;case"input":Ie("invalid",r),Km(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ie("invalid",r);break;case"textarea":Ie("invalid",r),Qm(r,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||l.suppressHydrationWarning===!0||Wy(r.textContent,a)?(l.popover!=null&&(Ie("beforetoggle",r),Ie("toggle",r)),l.onScroll!=null&&Ie("scroll",r),l.onScrollEnd!=null&&Ie("scrollend",r),l.onClick!=null&&(r.onclick=yr),r=!0):r=!1,r||Jr(t,!0)}function q0(t){for(zt=t.return;zt;)switch(zt.tag){case 5:case 31:case 13:qn=!1;return;case 27:case 3:qn=!0;return;default:zt=zt.return}}function vi(t){if(t!==zt)return!1;if(!Ge)return q0(t),Ge=!0,!1;var r=t.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Dh(t.type,t.memoizedProps)),a=!a),a&&ct&&Jr(t),q0(t),r===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));ct=og(t)}else if(r===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));ct=og(t)}else r===27?(r=ct,cs(t.type)?(t=Uh,Uh=null,ct=t):ct=r):ct=zt?Bn(t.stateNode.nextSibling):null;return!0}function Us(){ct=zt=null,Ge=!1}function gf(){var t=Kr;return t!==null&&(on===null?on=t:on.push.apply(on,t),Kr=null),t}function Oa(t){Kr===null?Kr=[t]:Kr.push(t)}var bf=Ce(null),zs=null,vr=null;function Qr(t,r,a){Me(bf,r._currentValue),r._currentValue=a}function _r(t){t._currentValue=bf.current,Ne(bf)}function xf(t,r,a){for(;t!==null;){var l=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),t===a)break;t=t.return}}function vf(t,r,a,l){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var y=f.dependencies;if(y!==null){var _=f.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=f;for(var R=0;R<r.length;R++)if(O.context===r[R]){y.lanes|=a,O=y.alternate,O!==null&&(O.lanes|=a),xf(y.return,a,t),l||(_=null);break e}y=O.next}}else if(f.tag===18){if(_=f.return,_===null)throw Error(i(341));_.lanes|=a,y=_.alternate,y!==null&&(y.lanes|=a),xf(_,a,t),_=null}else _=f.child;if(_!==null)_.return=f;else for(_=f;_!==null;){if(_===t){_=null;break}if(f=_.sibling,f!==null){f.return=_.return,_=f;break}_=_.return}f=_}}function _i(t,r,a,l){t=null;for(var f=r,y=!1;f!==null;){if(!y){if((f.flags&524288)!==0)y=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var _=f.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var O=f.type;hn(f.pendingProps.value,_.value)||(t!==null?t.push(O):t=[O])}}else if(f===Se.current){if(_=f.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(Wa):t=[Wa])}f=f.return}t!==null&&vf(r,t,a,l),r.flags|=262144}function ll(t){for(t=t.firstContext;t!==null;){if(!hn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Is(t){zs=t,vr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function It(t){return P0(zs,t)}function cl(t,r){return zs===null&&Is(t),P0(t,r)}function P0(t,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},vr===null){if(t===null)throw Error(i(308));vr=r,t.dependencies={lanes:0,firstContext:r},t.flags|=524288}else vr=vr.next=r;return a}var F_=typeof AbortController<"u"?AbortController:function(){var t=[],r=this.signal={aborted:!1,addEventListener:function(a,l){t.push(l)}};this.abort=function(){r.aborted=!0,t.forEach(function(a){return a()})}},G_=n.unstable_scheduleCallback,V_=n.unstable_NormalPriority,At={$$typeof:re,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _f(){return{controller:new F_,data:new Map,refCount:0}}function Aa(t){t.refCount--,t.refCount===0&&G_(V_,function(){t.controller.abort()})}var ja=null,wf=0,wi=0,Si=null;function Y_(t,r){if(ja===null){var a=ja=[];wf=0,wi=Oh(),Si={status:"pending",value:void 0,then:function(l){a.push(l)}}}return wf++,r.then(B0,B0),r}function B0(){if(--wf===0&&ja!==null){Si!==null&&(Si.status="fulfilled");var t=ja;ja=null,wi=0,Si=null;for(var r=0;r<t.length;r++)(0,t[r])()}}function K_(t,r){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return t.then(function(){l.status="fulfilled",l.value=r;for(var f=0;f<a.length;f++)(0,a[f])(r)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var U0=F.S;F.S=function(t,r){wy=ft(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&Y_(t,r),U0!==null&&U0(t,r)};var $s=Ce(null);function Sf(){var t=$s.current;return t!==null?t:ot.pooledCache}function ul(t,r){r===null?Me($s,$s.current):Me($s,r.pool)}function z0(){var t=Sf();return t===null?null:{parent:At._currentValue,pool:t}}var Ei=Error(i(460)),Ef=Error(i(474)),fl=Error(i(542)),hl={then:function(){}};function I0(t){return t=t.status,t==="fulfilled"||t==="rejected"}function $0(t,r,a){switch(a=t[a],a===void 0?t.push(r):a!==r&&(r.then(yr,yr),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,F0(t),t;default:if(typeof r.status=="string")r.then(yr,yr);else{if(t=ot,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=r,t.status="pending",t.then(function(l){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=l}},function(l){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,F0(t),t}throw Fs=r,Ei}}function Hs(t){try{var r=t._init;return r(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Fs=a,Ei):a}}var Fs=null;function H0(){if(Fs===null)throw Error(i(459));var t=Fs;return Fs=null,t}function F0(t){if(t===Ei||t===fl)throw Error(i(483))}var Oi=null,ka=0;function dl(t){var r=ka;return ka+=1,Oi===null&&(Oi=[]),$0(Oi,t,r)}function Na(t,r){r=r.props.ref,t.ref=r!==void 0?r:null}function ml(t,r){throw r.$$typeof===x?Error(i(525)):(t=Object.prototype.toString.call(r),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t)))}function G0(t){function r($,B){if(t){var G=$.deletions;G===null?($.deletions=[B],$.flags|=16):G.push(B)}}function a($,B){if(!t)return null;for(;B!==null;)r($,B),B=B.sibling;return null}function l($){for(var B=new Map;$!==null;)$.key!==null?B.set($.key,$):B.set($.index,$),$=$.sibling;return B}function f($,B){return $=br($,B),$.index=0,$.sibling=null,$}function y($,B,G){return $.index=G,t?(G=$.alternate,G!==null?(G=G.index,G<B?($.flags|=67108866,B):G):($.flags|=67108866,B)):($.flags|=1048576,B)}function _($){return t&&$.alternate===null&&($.flags|=67108866),$}function O($,B,G,ee){return B===null||B.tag!==6?(B=hf(G,$.mode,ee),B.return=$,B):(B=f(B,G),B.return=$,B)}function R($,B,G,ee){var Ae=G.type;return Ae===S?Z($,B,G.props.children,ee,G.key):B!==null&&(B.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===z&&Hs(Ae)===B.type)?(B=f(B,G.props),Na(B,G),B.return=$,B):(B=al(G.type,G.key,G.props,null,$.mode,ee),Na(B,G),B.return=$,B)}function V($,B,G,ee){return B===null||B.tag!==4||B.stateNode.containerInfo!==G.containerInfo||B.stateNode.implementation!==G.implementation?(B=df(G,$.mode,ee),B.return=$,B):(B=f(B,G.children||[]),B.return=$,B)}function Z($,B,G,ee,Ae){return B===null||B.tag!==7?(B=Bs(G,$.mode,ee,Ae),B.return=$,B):(B=f(B,G),B.return=$,B)}function ie($,B,G){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=hf(""+B,$.mode,G),B.return=$,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case v:return G=al(B.type,B.key,B.props,null,$.mode,G),Na(G,B),G.return=$,G;case w:return B=df(B,$.mode,G),B.return=$,B;case z:return B=Hs(B),ie($,B,G)}if(Oe(B)||W(B))return B=Bs(B,$.mode,G,null),B.return=$,B;if(typeof B.then=="function")return ie($,dl(B),G);if(B.$$typeof===re)return ie($,cl($,B),G);ml($,B)}return null}function Y($,B,G,ee){var Ae=B!==null?B.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return Ae!==null?null:O($,B,""+G,ee);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case v:return G.key===Ae?R($,B,G,ee):null;case w:return G.key===Ae?V($,B,G,ee):null;case z:return G=Hs(G),Y($,B,G,ee)}if(Oe(G)||W(G))return Ae!==null?null:Z($,B,G,ee,null);if(typeof G.then=="function")return Y($,B,dl(G),ee);if(G.$$typeof===re)return Y($,B,cl($,G),ee);ml($,G)}return null}function Q($,B,G,ee,Ae){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return $=$.get(G)||null,O(B,$,""+ee,Ae);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return $=$.get(ee.key===null?G:ee.key)||null,R(B,$,ee,Ae);case w:return $=$.get(ee.key===null?G:ee.key)||null,V(B,$,ee,Ae);case z:return ee=Hs(ee),Q($,B,G,ee,Ae)}if(Oe(ee)||W(ee))return $=$.get(G)||null,Z(B,$,ee,Ae,null);if(typeof ee.then=="function")return Q($,B,G,dl(ee),Ae);if(ee.$$typeof===re)return Q($,B,G,cl(B,ee),Ae);ml(B,ee)}return null}function ve($,B,G,ee){for(var Ae=null,Ke=null,_e=B,Le=B=0,He=null;_e!==null&&Le<G.length;Le++){_e.index>Le?(He=_e,_e=null):He=_e.sibling;var Je=Y($,_e,G[Le],ee);if(Je===null){_e===null&&(_e=He);break}t&&_e&&Je.alternate===null&&r($,_e),B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je,_e=He}if(Le===G.length)return a($,_e),Ge&&xr($,Le),Ae;if(_e===null){for(;Le<G.length;Le++)_e=ie($,G[Le],ee),_e!==null&&(B=y(_e,B,Le),Ke===null?Ae=_e:Ke.sibling=_e,Ke=_e);return Ge&&xr($,Le),Ae}for(_e=l(_e);Le<G.length;Le++)He=Q(_e,$,Le,G[Le],ee),He!==null&&(t&&He.alternate!==null&&_e.delete(He.key===null?Le:He.key),B=y(He,B,Le),Ke===null?Ae=He:Ke.sibling=He,Ke=He);return t&&_e.forEach(function(ms){return r($,ms)}),Ge&&xr($,Le),Ae}function Te($,B,G,ee){if(G==null)throw Error(i(151));for(var Ae=null,Ke=null,_e=B,Le=B=0,He=null,Je=G.next();_e!==null&&!Je.done;Le++,Je=G.next()){_e.index>Le?(He=_e,_e=null):He=_e.sibling;var ms=Y($,_e,Je.value,ee);if(ms===null){_e===null&&(_e=He);break}t&&_e&&ms.alternate===null&&r($,_e),B=y(ms,B,Le),Ke===null?Ae=ms:Ke.sibling=ms,Ke=ms,_e=He}if(Je.done)return a($,_e),Ge&&xr($,Le),Ae;if(_e===null){for(;!Je.done;Le++,Je=G.next())Je=ie($,Je.value,ee),Je!==null&&(B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je);return Ge&&xr($,Le),Ae}for(_e=l(_e);!Je.done;Le++,Je=G.next())Je=Q(_e,$,Le,Je.value,ee),Je!==null&&(t&&Je.alternate!==null&&_e.delete(Je.key===null?Le:Je.key),B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je);return t&&_e.forEach(function(iS){return r($,iS)}),Ge&&xr($,Le),Ae}function st($,B,G,ee){if(typeof G=="object"&&G!==null&&G.type===S&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case v:e:{for(var Ae=G.key;B!==null;){if(B.key===Ae){if(Ae=G.type,Ae===S){if(B.tag===7){a($,B.sibling),ee=f(B,G.props.children),ee.return=$,$=ee;break e}}else if(B.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===z&&Hs(Ae)===B.type){a($,B.sibling),ee=f(B,G.props),Na(ee,G),ee.return=$,$=ee;break e}a($,B);break}else r($,B);B=B.sibling}G.type===S?(ee=Bs(G.props.children,$.mode,ee,G.key),ee.return=$,$=ee):(ee=al(G.type,G.key,G.props,null,$.mode,ee),Na(ee,G),ee.return=$,$=ee)}return _($);case w:e:{for(Ae=G.key;B!==null;){if(B.key===Ae)if(B.tag===4&&B.stateNode.containerInfo===G.containerInfo&&B.stateNode.implementation===G.implementation){a($,B.sibling),ee=f(B,G.children||[]),ee.return=$,$=ee;break e}else{a($,B);break}else r($,B);B=B.sibling}ee=df(G,$.mode,ee),ee.return=$,$=ee}return _($);case z:return G=Hs(G),st($,B,G,ee)}if(Oe(G))return ve($,B,G,ee);if(W(G)){if(Ae=W(G),typeof Ae!="function")throw Error(i(150));return G=Ae.call(G),Te($,B,G,ee)}if(typeof G.then=="function")return st($,B,dl(G),ee);if(G.$$typeof===re)return st($,B,cl($,G),ee);ml($,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,B!==null&&B.tag===6?(a($,B.sibling),ee=f(B,G),ee.return=$,$=ee):(a($,B),ee=hf(G,$.mode,ee),ee.return=$,$=ee),_($)):a($,B)}return function($,B,G,ee){try{ka=0;var Ae=st($,B,G,ee);return Oi=null,Ae}catch(_e){if(_e===Ei||_e===fl)throw _e;var Ke=dn(29,_e,null,$.mode);return Ke.lanes=ee,Ke.return=$,Ke}finally{}}}var Gs=G0(!0),V0=G0(!1),Xr=!1;function Of(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Af(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Wr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(t,r,a){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),l.pending=r,r=il(t),N0(t,null,a),r}return sl(t,l,r,a),il(t)}function Ta(t,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=t.pendingLanes,a|=l,r.lanes=a,Cs(t,a)}}function jf(t,r){var a=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,y=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};y===null?f=y=_:y=y.next=_,a=a.next}while(a!==null);y===null?f=y=r:y=y.next=r}else f=y=r;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:y,shared:l.shared,callbacks:l.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=r:t.next=r,a.lastBaseUpdate=r}var kf=!1;function Ca(){if(kf){var t=Si;if(t!==null)throw t}}function Ma(t,r,a,l){kf=!1;var f=t.updateQueue;Xr=!1;var y=f.firstBaseUpdate,_=f.lastBaseUpdate,O=f.shared.pending;if(O!==null){f.shared.pending=null;var R=O,V=R.next;R.next=null,_===null?y=V:_.next=V,_=R;var Z=t.alternate;Z!==null&&(Z=Z.updateQueue,O=Z.lastBaseUpdate,O!==_&&(O===null?Z.firstBaseUpdate=V:O.next=V,Z.lastBaseUpdate=R))}if(y!==null){var ie=f.baseState;_=0,Z=V=R=null,O=y;do{var Y=O.lane&-536870913,Q=Y!==O.lane;if(Q?($e&Y)===Y:(l&Y)===Y){Y!==0&&Y===wi&&(kf=!0),Z!==null&&(Z=Z.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var ve=t,Te=O;Y=r;var st=a;switch(Te.tag){case 1:if(ve=Te.payload,typeof ve=="function"){ie=ve.call(st,ie,Y);break e}ie=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Te.payload,Y=typeof ve=="function"?ve.call(st,ie,Y):ve,Y==null)break e;ie=b({},ie,Y);break e;case 2:Xr=!0}}Y=O.callback,Y!==null&&(t.flags|=64,Q&&(t.flags|=8192),Q=f.callbacks,Q===null?f.callbacks=[Y]:Q.push(Y))}else Q={lane:Y,tag:O.tag,payload:O.payload,callback:O.callback,next:null},Z===null?(V=Z=Q,R=ie):Z=Z.next=Q,_|=Y;if(O=O.next,O===null){if(O=f.shared.pending,O===null)break;Q=O,O=Q.next,Q.next=null,f.lastBaseUpdate=Q,f.shared.pending=null}}while(!0);Z===null&&(R=ie),f.baseState=R,f.firstBaseUpdate=V,f.lastBaseUpdate=Z,y===null&&(f.shared.lanes=0),ss|=_,t.lanes=_,t.memoizedState=ie}}function Y0(t,r){if(typeof t!="function")throw Error(i(191,t));t.call(r)}function K0(t,r){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)Y0(a[t],r)}var Ai=Ce(null),pl=Ce(0);function J0(t,r){t=Tr,Me(pl,t),Me(Ai,r),Tr=t|r.baseLanes}function Nf(){Me(pl,Tr),Me(Ai,Ai.current)}function Tf(){Tr=pl.current,Ne(Ai),Ne(pl)}var mn=Ce(null),Pn=null;function es(t){var r=t.alternate;Me(wt,wt.current&1),Me(mn,t),Pn===null&&(r===null||Ai.current!==null||r.memoizedState!==null)&&(Pn=t)}function Cf(t){Me(wt,wt.current),Me(mn,t),Pn===null&&(Pn=t)}function Q0(t){t.tag===22?(Me(wt,wt.current),Me(mn,t),Pn===null&&(Pn=t)):ts()}function ts(){Me(wt,wt.current),Me(mn,mn.current)}function pn(t){Ne(mn),Pn===t&&(Pn=null),Ne(wt)}var wt=Ce(0);function yl(t){for(var r=t;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ph(a)||Bh(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var wr=0,De=null,nt=null,jt=null,gl=!1,ji=!1,Vs=!1,bl=0,Ra=0,ki=null,J_=0;function bt(){throw Error(i(321))}function Mf(t,r){if(r===null)return!1;for(var a=0;a<r.length&&a<t.length;a++)if(!hn(t[a],r[a]))return!1;return!0}function Rf(t,r,a,l,f,y){return wr=y,De=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,F.H=t===null||t.memoizedState===null?Rp:Kf,Vs=!1,y=a(l,f),Vs=!1,ji&&(y=W0(r,a,l,f)),X0(t),y}function X0(t){F.H=qa;var r=nt!==null&&nt.next!==null;if(wr=0,jt=nt=De=null,gl=!1,Ra=0,ki=null,r)throw Error(i(300));t===null||kt||(t=t.dependencies,t!==null&&ll(t)&&(kt=!0))}function W0(t,r,a,l){De=t;var f=0;do{if(ji&&(ki=null),Ra=0,ji=!1,25<=f)throw Error(i(301));if(f+=1,jt=nt=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}F.H=Dp,y=r(a,l)}while(ji);return y}function Q_(){var t=F.H,r=t.useState()[0];return r=typeof r.then=="function"?Da(r):r,t=t.useState()[0],(nt!==null?nt.memoizedState:null)!==t&&(De.flags|=1024),r}function Df(){var t=bl!==0;return bl=0,t}function Lf(t,r,a){r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~a}function qf(t){if(gl){for(t=t.memoizedState;t!==null;){var r=t.queue;r!==null&&(r.pending=null),t=t.next}gl=!1}wr=0,jt=nt=De=null,ji=!1,Ra=bl=0,ki=null}function Yt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?De.memoizedState=jt=t:jt=jt.next=t,jt}function St(){if(nt===null){var t=De.alternate;t=t!==null?t.memoizedState:null}else t=nt.next;var r=jt===null?De.memoizedState:jt.next;if(r!==null)jt=r,nt=t;else{if(t===null)throw De.alternate===null?Error(i(467)):Error(i(310));nt=t,t={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},jt===null?De.memoizedState=jt=t:jt=jt.next=t}return jt}function xl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Da(t){var r=Ra;return Ra+=1,ki===null&&(ki=[]),t=$0(ki,t,r),r=De,(jt===null?r.memoizedState:jt.next)===null&&(r=r.alternate,F.H=r===null||r.memoizedState===null?Rp:Kf),t}function vl(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Da(t);if(t.$$typeof===re)return It(t)}throw Error(i(438,String(t)))}function Pf(t){var r=null,a=De.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=De.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=xl(),De.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(t),l=0;l<t;l++)a[l]=D;return r.index++,a}function Sr(t,r){return typeof r=="function"?r(t):r}function _l(t){var r=St();return Bf(r,nt,t)}function Bf(t,r,a){var l=t.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var f=t.baseQueue,y=l.pending;if(y!==null){if(f!==null){var _=f.next;f.next=y.next,y.next=_}r.baseQueue=f=y,l.pending=null}if(y=t.baseState,f===null)t.memoizedState=y;else{r=f.next;var O=_=null,R=null,V=r,Z=!1;do{var ie=V.lane&-536870913;if(ie!==V.lane?($e&ie)===ie:(wr&ie)===ie){var Y=V.revertLane;if(Y===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),ie===wi&&(Z=!0);else if((wr&Y)===Y){V=V.next,Y===wi&&(Z=!0);continue}else ie={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=ie,_=y):R=R.next=ie,De.lanes|=Y,ss|=Y;ie=V.action,Vs&&a(y,ie),y=V.hasEagerState?V.eagerState:a(y,ie)}else Y={lane:ie,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=Y,_=y):R=R.next=Y,De.lanes|=ie,ss|=ie;V=V.next}while(V!==null&&V!==r);if(R===null?_=y:R.next=O,!hn(y,t.memoizedState)&&(kt=!0,Z&&(a=Si,a!==null)))throw a;t.memoizedState=y,t.baseState=_,t.baseQueue=R,l.lastRenderedState=y}return f===null&&(l.lanes=0),[t.memoizedState,l.dispatch]}function Uf(t){var r=St(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var l=a.dispatch,f=a.pending,y=r.memoizedState;if(f!==null){a.pending=null;var _=f=f.next;do y=t(y,_.action),_=_.next;while(_!==f);hn(y,r.memoizedState)||(kt=!0),r.memoizedState=y,r.baseQueue===null&&(r.baseState=y),a.lastRenderedState=y}return[y,l]}function Z0(t,r,a){var l=De,f=St(),y=Ge;if(y){if(a===void 0)throw Error(i(407));a=a()}else a=r();var _=!hn((nt||f).memoizedState,a);if(_&&(f.memoizedState=a,kt=!0),f=f.queue,$f(np.bind(null,l,f,t),[t]),f.getSnapshot!==r||_||jt!==null&&jt.memoizedState.tag&1){if(l.flags|=2048,Ni(9,{destroy:void 0},tp.bind(null,l,f,a,r),null),ot===null)throw Error(i(349));y||(wr&127)!==0||ep(l,r,a)}return a}function ep(t,r,a){t.flags|=16384,t={getSnapshot:r,value:a},r=De.updateQueue,r===null?(r=xl(),De.updateQueue=r,r.stores=[t]):(a=r.stores,a===null?r.stores=[t]:a.push(t))}function tp(t,r,a,l){r.value=a,r.getSnapshot=l,rp(r)&&sp(t)}function np(t,r,a){return a(function(){rp(r)&&sp(t)})}function rp(t){var r=t.getSnapshot;t=t.value;try{var a=r();return!hn(t,a)}catch{return!0}}function sp(t){var r=Ps(t,2);r!==null&&ln(r,t,2)}function zf(t){var r=Yt();if(typeof t=="function"){var a=t;if(t=a(),Vs){un(!0);try{a()}finally{un(!1)}}}return r.memoizedState=r.baseState=t,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:t},r}function ip(t,r,a,l){return t.baseState=a,Bf(t,nt,typeof l=="function"?l:Sr)}function X_(t,r,a,l,f){if(El(t))throw Error(i(485));if(t=r.action,t!==null){var y={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){y.listeners.push(_)}};F.T!==null?a(!0):y.isTransition=!1,l(y),a=r.pending,a===null?(y.next=r.pending=y,ap(r,y)):(y.next=a.next,r.pending=a.next=y)}}function ap(t,r){var a=r.action,l=r.payload,f=t.state;if(r.isTransition){var y=F.T,_={};F.T=_;try{var O=a(f,l),R=F.S;R!==null&&R(_,O),op(t,r,O)}catch(V){If(t,r,V)}finally{y!==null&&_.types!==null&&(y.types=_.types),F.T=y}}else try{y=a(f,l),op(t,r,y)}catch(V){If(t,r,V)}}function op(t,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){lp(t,r,l)},function(l){return If(t,r,l)}):lp(t,r,a)}function lp(t,r,a){r.status="fulfilled",r.value=a,cp(r),t.state=a,r=t.pending,r!==null&&(a=r.next,a===r?t.pending=null:(a=a.next,r.next=a,ap(t,a)))}function If(t,r,a){var l=t.pending;if(t.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,cp(r),r=r.next;while(r!==l)}t.action=null}function cp(t){t=t.listeners;for(var r=0;r<t.length;r++)(0,t[r])()}function up(t,r){return r}function fp(t,r){if(Ge){var a=ot.formState;if(a!==null){e:{var l=De;if(Ge){if(ct){t:{for(var f=ct,y=qn;f.nodeType!==8;){if(!y){f=null;break t}if(f=Bn(f.nextSibling),f===null){f=null;break t}}y=f.data,f=y==="F!"||y==="F"?f:null}if(f){ct=Bn(f.nextSibling),l=f.data==="F!";break e}}Jr(l)}l=!1}l&&(r=a[0])}}return a=Yt(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:up,lastRenderedState:r},a.queue=l,a=Tp.bind(null,De,l),l.dispatch=a,l=zf(!1),y=Yf.bind(null,De,!1,l.queue),l=Yt(),f={state:r,dispatch:null,action:t,pending:null},l.queue=f,a=X_.bind(null,De,f,y,a),f.dispatch=a,l.memoizedState=t,[r,a,!1]}function hp(t){var r=St();return dp(r,nt,t)}function dp(t,r,a){if(r=Bf(t,r,up)[0],t=_l(Sr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Da(r)}catch(_){throw _===Ei?fl:_}else l=r;r=St();var f=r.queue,y=f.dispatch;return a!==r.memoizedState&&(De.flags|=2048,Ni(9,{destroy:void 0},W_.bind(null,f,a),null)),[l,y,t]}function W_(t,r){t.action=r}function mp(t){var r=St(),a=nt;if(a!==null)return dp(r,a,t);St(),r=r.memoizedState,a=St();var l=a.queue.dispatch;return a.memoizedState=t,[r,l,!1]}function Ni(t,r,a,l){return t={tag:t,create:a,deps:l,inst:r,next:null},r=De.updateQueue,r===null&&(r=xl(),De.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=t.next=t:(l=a.next,a.next=t,t.next=l,r.lastEffect=t),t}function pp(){return St().memoizedState}function wl(t,r,a,l){var f=Yt();De.flags|=t,f.memoizedState=Ni(1|r,{destroy:void 0},a,l===void 0?null:l)}function Sl(t,r,a,l){var f=St();l=l===void 0?null:l;var y=f.memoizedState.inst;nt!==null&&l!==null&&Mf(l,nt.memoizedState.deps)?f.memoizedState=Ni(r,y,a,l):(De.flags|=t,f.memoizedState=Ni(1|r,y,a,l))}function yp(t,r){wl(8390656,8,t,r)}function $f(t,r){Sl(2048,8,t,r)}function Z_(t){De.flags|=4;var r=De.updateQueue;if(r===null)r=xl(),De.updateQueue=r,r.events=[t];else{var a=r.events;a===null?r.events=[t]:a.push(t)}}function gp(t){var r=St().memoizedState;return Z_({ref:r,nextImpl:t}),function(){if((Qe&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function bp(t,r){return Sl(4,2,t,r)}function xp(t,r){return Sl(4,4,t,r)}function vp(t,r){if(typeof r=="function"){t=t();var a=r(t);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function _p(t,r,a){a=a!=null?a.concat([t]):null,Sl(4,4,vp.bind(null,r,t),a)}function Hf(){}function wp(t,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Mf(r,l[1])?l[0]:(a.memoizedState=[t,r],t)}function Sp(t,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Mf(r,l[1]))return l[0];if(l=t(),Vs){un(!0);try{t()}finally{un(!1)}}return a.memoizedState=[l,r],l}function Ff(t,r,a){return a===void 0||(wr&1073741824)!==0&&($e&261930)===0?t.memoizedState=r:(t.memoizedState=a,t=Ey(),De.lanes|=t,ss|=t,a)}function Ep(t,r,a,l){return hn(a,r)?a:Ai.current!==null?(t=Ff(t,a,l),hn(t,r)||(kt=!0),t):(wr&42)===0||(wr&1073741824)!==0&&($e&261930)===0?(kt=!0,t.memoizedState=a):(t=Ey(),De.lanes|=t,ss|=t,r)}function Op(t,r,a,l,f){var y=J.p;J.p=y!==0&&8>y?y:8;var _=F.T,O={};F.T=O,Yf(t,!1,r,a);try{var R=f(),V=F.S;if(V!==null&&V(O,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Z=K_(R,l);La(t,r,Z,bn(t))}else La(t,r,l,bn(t))}catch(ie){La(t,r,{then:function(){},status:"rejected",reason:ie},bn())}finally{J.p=y,_!==null&&O.types!==null&&(_.types=O.types),F.T=_}}function ew(){}function Gf(t,r,a,l){if(t.tag!==5)throw Error(i(476));var f=Ap(t).queue;Op(t,f,r,le,a===null?ew:function(){return jp(t),a(l)})}function Ap(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:le},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:a},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function jp(t){var r=Ap(t);r.next===null&&(r=t.alternate.memoizedState),La(t,r.next.queue,{},bn())}function Vf(){return It(Wa)}function kp(){return St().memoizedState}function Np(){return St().memoizedState}function tw(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var a=bn();t=Wr(a);var l=Zr(r,t,a);l!==null&&(ln(l,r,a),Ta(l,r,a)),r={cache:_f()},t.payload=r;return}r=r.return}}function nw(t,r,a){var l=bn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},El(t)?Cp(r,a):(a=uf(t,r,a,l),a!==null&&(ln(a,t,l),Mp(a,r,l)))}function Tp(t,r,a){var l=bn();La(t,r,a,l)}function La(t,r,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(El(t))Cp(r,f);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=r.lastRenderedReducer,y!==null))try{var _=r.lastRenderedState,O=y(_,a);if(f.hasEagerState=!0,f.eagerState=O,hn(O,_))return sl(t,r,f,0),ot===null&&rl(),!1}catch{}finally{}if(a=uf(t,r,f,l),a!==null)return ln(a,t,l),Mp(a,r,l),!0}return!1}function Yf(t,r,a,l){if(l={lane:2,revertLane:Oh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},El(t)){if(r)throw Error(i(479))}else r=uf(t,a,l,2),r!==null&&ln(r,t,2)}function El(t){var r=t.alternate;return t===De||r!==null&&r===De}function Cp(t,r){ji=gl=!0;var a=t.pending;a===null?r.next=r:(r.next=a.next,a.next=r),t.pending=r}function Mp(t,r,a){if((a&4194048)!==0){var l=r.lanes;l&=t.pendingLanes,a|=l,r.lanes=a,Cs(t,a)}}var qa={readContext:It,use:vl,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};qa.useEffectEvent=bt;var Rp={readContext:It,use:vl,useCallback:function(t,r){return Yt().memoizedState=[t,r===void 0?null:r],t},useContext:It,useEffect:yp,useImperativeHandle:function(t,r,a){a=a!=null?a.concat([t]):null,wl(4194308,4,vp.bind(null,r,t),a)},useLayoutEffect:function(t,r){return wl(4194308,4,t,r)},useInsertionEffect:function(t,r){wl(4,2,t,r)},useMemo:function(t,r){var a=Yt();r=r===void 0?null:r;var l=t();if(Vs){un(!0);try{t()}finally{un(!1)}}return a.memoizedState=[l,r],l},useReducer:function(t,r,a){var l=Yt();if(a!==void 0){var f=a(r);if(Vs){un(!0);try{a(r)}finally{un(!1)}}}else f=r;return l.memoizedState=l.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},l.queue=t,t=t.dispatch=nw.bind(null,De,t),[l.memoizedState,t]},useRef:function(t){var r=Yt();return t={current:t},r.memoizedState=t},useState:function(t){t=zf(t);var r=t.queue,a=Tp.bind(null,De,r);return r.dispatch=a,[t.memoizedState,a]},useDebugValue:Hf,useDeferredValue:function(t,r){var a=Yt();return Ff(a,t,r)},useTransition:function(){var t=zf(!1);return t=Op.bind(null,De,t.queue,!0,!1),Yt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,a){var l=De,f=Yt();if(Ge){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),ot===null)throw Error(i(349));($e&127)!==0||ep(l,r,a)}f.memoizedState=a;var y={value:a,getSnapshot:r};return f.queue=y,yp(np.bind(null,l,y,t),[t]),l.flags|=2048,Ni(9,{destroy:void 0},tp.bind(null,l,y,a,r),null),a},useId:function(){var t=Yt(),r=ot.identifierPrefix;if(Ge){var a=rr,l=nr;a=(l&~(1<<32-Ft(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=bl++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=J_++,r="_"+r+"r_"+a.toString(32)+"_";return t.memoizedState=r},useHostTransitionStatus:Vf,useFormState:fp,useActionState:fp,useOptimistic:function(t){var r=Yt();r.memoizedState=r.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Yf.bind(null,De,!0,a),a.dispatch=r,[t,r]},useMemoCache:Pf,useCacheRefresh:function(){return Yt().memoizedState=tw.bind(null,De)},useEffectEvent:function(t){var r=Yt(),a={impl:t};return r.memoizedState=a,function(){if((Qe&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Kf={readContext:It,use:vl,useCallback:wp,useContext:It,useEffect:$f,useImperativeHandle:_p,useInsertionEffect:bp,useLayoutEffect:xp,useMemo:Sp,useReducer:_l,useRef:pp,useState:function(){return _l(Sr)},useDebugValue:Hf,useDeferredValue:function(t,r){var a=St();return Ep(a,nt.memoizedState,t,r)},useTransition:function(){var t=_l(Sr)[0],r=St().memoizedState;return[typeof t=="boolean"?t:Da(t),r]},useSyncExternalStore:Z0,useId:kp,useHostTransitionStatus:Vf,useFormState:hp,useActionState:hp,useOptimistic:function(t,r){var a=St();return ip(a,nt,t,r)},useMemoCache:Pf,useCacheRefresh:Np};Kf.useEffectEvent=gp;var Dp={readContext:It,use:vl,useCallback:wp,useContext:It,useEffect:$f,useImperativeHandle:_p,useInsertionEffect:bp,useLayoutEffect:xp,useMemo:Sp,useReducer:Uf,useRef:pp,useState:function(){return Uf(Sr)},useDebugValue:Hf,useDeferredValue:function(t,r){var a=St();return nt===null?Ff(a,t,r):Ep(a,nt.memoizedState,t,r)},useTransition:function(){var t=Uf(Sr)[0],r=St().memoizedState;return[typeof t=="boolean"?t:Da(t),r]},useSyncExternalStore:Z0,useId:kp,useHostTransitionStatus:Vf,useFormState:mp,useActionState:mp,useOptimistic:function(t,r){var a=St();return nt!==null?ip(a,nt,t,r):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Pf,useCacheRefresh:Np};Dp.useEffectEvent=gp;function Jf(t,r,a,l){r=t.memoizedState,a=a(l,r),a=a==null?r:b({},r,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Qf={enqueueSetState:function(t,r,a){t=t._reactInternals;var l=bn(),f=Wr(l);f.payload=r,a!=null&&(f.callback=a),r=Zr(t,f,l),r!==null&&(ln(r,t,l),Ta(r,t,l))},enqueueReplaceState:function(t,r,a){t=t._reactInternals;var l=bn(),f=Wr(l);f.tag=1,f.payload=r,a!=null&&(f.callback=a),r=Zr(t,f,l),r!==null&&(ln(r,t,l),Ta(r,t,l))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var a=bn(),l=Wr(a);l.tag=2,r!=null&&(l.callback=r),r=Zr(t,l,a),r!==null&&(ln(r,t,a),Ta(r,t,a))}};function Lp(t,r,a,l,f,y,_){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(l,y,_):r.prototype&&r.prototype.isPureReactComponent?!wa(a,l)||!wa(f,y):!0}function qp(t,r,a,l){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==t&&Qf.enqueueReplaceState(r,r.state,null)}function Ys(t,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(t=t.defaultProps){a===r&&(a=b({},a));for(var f in t)a[f]===void 0&&(a[f]=t[f])}return a}function Pp(t){nl(t)}function Bp(t){console.error(t)}function Up(t){nl(t)}function Ol(t,r){try{var a=t.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function zp(t,r,a){try{var l=t.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Xf(t,r,a){return a=Wr(a),a.tag=3,a.payload={element:null},a.callback=function(){Ol(t,r)},a}function Ip(t){return t=Wr(t),t.tag=3,t}function $p(t,r,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var y=l.value;t.payload=function(){return f(y)},t.callback=function(){zp(r,a,l)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(t.callback=function(){zp(r,a,l),typeof f!="function"&&(is===null?is=new Set([this]):is.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})})}function rw(t,r,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&_i(r,a,f,!0),a=mn.current,a!==null){switch(a.tag){case 31:case 13:return Pn===null?Pl():a.alternate===null&&xt===0&&(xt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===hl?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),wh(t,l,f)),!1;case 22:return a.flags|=65536,l===hl?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([l]):a.add(l)),wh(t,l,f)),!1}throw Error(i(435,a.tag))}return wh(t,l,f),Pl(),!1}if(Ge)return r=mn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,l!==yf&&(t=Error(i(422),{cause:l}),Oa(Rn(t,a)))):(l!==yf&&(r=Error(i(423),{cause:l}),Oa(Rn(r,a))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,l=Rn(l,a),f=Xf(t.stateNode,l,f),jf(t,f),xt!==4&&(xt=2)),!1;var y=Error(i(520),{cause:l});if(y=Rn(y,a),Fa===null?Fa=[y]:Fa.push(y),xt!==4&&(xt=2),r===null)return!0;l=Rn(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,t=f&-f,a.lanes|=t,t=Xf(a.stateNode,l,t),jf(a,t),!1;case 1:if(r=a.type,y=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(is===null||!is.has(y))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Ip(f),$p(f,t,a,l),jf(a,f),!1}a=a.return}while(a!==null);return!1}var Wf=Error(i(461)),kt=!1;function $t(t,r,a,l){r.child=t===null?V0(r,null,a,l):Gs(r,t.child,a,l)}function Hp(t,r,a,l,f){a=a.render;var y=r.ref;if("ref"in l){var _={};for(var O in l)O!=="ref"&&(_[O]=l[O])}else _=l;return Is(r),l=Rf(t,r,a,_,y,f),O=Df(),t!==null&&!kt?(Lf(t,r,f),Er(t,r,f)):(Ge&&O&&mf(r),r.flags|=1,$t(t,r,l,f),r.child)}function Fp(t,r,a,l,f){if(t===null){var y=a.type;return typeof y=="function"&&!ff(y)&&y.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=y,Gp(t,r,y,l,f)):(t=al(a.type,null,l,r,r.mode,f),t.ref=r.ref,t.return=r,r.child=t)}if(y=t.child,!ah(t,f)){var _=y.memoizedProps;if(a=a.compare,a=a!==null?a:wa,a(_,l)&&t.ref===r.ref)return Er(t,r,f)}return r.flags|=1,t=br(y,l),t.ref=r.ref,t.return=r,r.child=t}function Gp(t,r,a,l,f){if(t!==null){var y=t.memoizedProps;if(wa(y,l)&&t.ref===r.ref)if(kt=!1,r.pendingProps=l=y,ah(t,f))(t.flags&131072)!==0&&(kt=!0);else return r.lanes=t.lanes,Er(t,r,f)}return Zf(t,r,a,l,f)}function Vp(t,r,a,l){var f=l.children,y=t!==null?t.memoizedState:null;if(t===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(y=y!==null?y.baseLanes|a:a,t!==null){for(l=r.child=t.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~y}else l=0,r.child=null;return Yp(t,r,y,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},t!==null&&ul(r,y!==null?y.cachePool:null),y!==null?J0(r,y):Nf(),Q0(r);else return l=r.lanes=536870912,Yp(t,r,y!==null?y.baseLanes|a:a,a,l)}else y!==null?(ul(r,y.cachePool),J0(r,y),ts(),r.memoizedState=null):(t!==null&&ul(r,null),Nf(),ts());return $t(t,r,f,a),r.child}function Pa(t,r){return t!==null&&t.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Yp(t,r,a,l,f){var y=Sf();return y=y===null?null:{parent:At._currentValue,pool:y},r.memoizedState={baseLanes:a,cachePool:y},t!==null&&ul(r,null),Nf(),Q0(r),t!==null&&_i(t,r,l,!0),r.childLanes=f,null}function Al(t,r){return r=kl({mode:r.mode,children:r.children},t.mode),r.ref=t.ref,t.child=r,r.return=t,r}function Kp(t,r,a){return Gs(r,t.child,null,a),t=Al(r,r.pendingProps),t.flags|=2,pn(r),r.memoizedState=null,t}function sw(t,r,a){var l=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,t===null){if(Ge){if(l.mode==="hidden")return t=Al(r,l),r.lanes=536870912,Pa(null,t);if(Cf(r),(t=ct)?(t=ag(t,qn),t=t!==null&&t.data==="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=C0(t),a.return=r,r.child=a,zt=r,ct=null)):t=null,t===null)throw Jr(r);return r.lanes=536870912,null}return Al(r,l)}var y=t.memoizedState;if(y!==null){var _=y.dehydrated;if(Cf(r),f)if(r.flags&256)r.flags&=-257,r=Kp(t,r,a);else if(r.memoizedState!==null)r.child=t.child,r.flags|=128,r=null;else throw Error(i(558));else if(kt||_i(t,r,a,!1),f=(a&t.childLanes)!==0,kt||f){if(l=ot,l!==null&&(_=Gr(l,a),_!==0&&_!==y.retryLane))throw y.retryLane=_,Ps(t,_),ln(l,t,_),Wf;Pl(),r=Kp(t,r,a)}else t=y.treeContext,ct=Bn(_.nextSibling),zt=r,Ge=!0,Kr=null,qn=!1,t!==null&&D0(r,t),r=Al(r,l),r.flags|=4096;return r}return t=br(t.child,{mode:l.mode,children:l.children}),t.ref=r.ref,r.child=t,t.return=r,t}function jl(t,r){var a=r.ref;if(a===null)t!==null&&t.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(t===null||t.ref!==a)&&(r.flags|=4194816)}}function Zf(t,r,a,l,f){return Is(r),a=Rf(t,r,a,l,void 0,f),l=Df(),t!==null&&!kt?(Lf(t,r,f),Er(t,r,f)):(Ge&&l&&mf(r),r.flags|=1,$t(t,r,a,f),r.child)}function Jp(t,r,a,l,f,y){return Is(r),r.updateQueue=null,a=W0(r,l,a,f),X0(t),l=Df(),t!==null&&!kt?(Lf(t,r,y),Er(t,r,y)):(Ge&&l&&mf(r),r.flags|=1,$t(t,r,a,y),r.child)}function Qp(t,r,a,l,f){if(Is(r),r.stateNode===null){var y=gi,_=a.contextType;typeof _=="object"&&_!==null&&(y=It(_)),y=new a(l,y),r.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Qf,r.stateNode=y,y._reactInternals=r,y=r.stateNode,y.props=l,y.state=r.memoizedState,y.refs={},Of(r),_=a.contextType,y.context=typeof _=="object"&&_!==null?It(_):gi,y.state=r.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Jf(r,a,_,l),y.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(_=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),_!==y.state&&Qf.enqueueReplaceState(y,y.state,null),Ma(r,l,y,f),Ca(),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(t===null){y=r.stateNode;var O=r.memoizedProps,R=Ys(a,O);y.props=R;var V=y.context,Z=a.contextType;_=gi,typeof Z=="object"&&Z!==null&&(_=It(Z));var ie=a.getDerivedStateFromProps;Z=typeof ie=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=r.pendingProps!==O,Z||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||V!==_)&&qp(r,y,l,_),Xr=!1;var Y=r.memoizedState;y.state=Y,Ma(r,l,y,f),Ca(),V=r.memoizedState,O||Y!==V||Xr?(typeof ie=="function"&&(Jf(r,a,ie,l),V=r.memoizedState),(R=Xr||Lp(r,a,R,l,Y,V,_))?(Z||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(r.flags|=4194308)):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=V),y.props=l,y.state=V,y.context=_,l=R):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{y=r.stateNode,Af(t,r),_=r.memoizedProps,Z=Ys(a,_),y.props=Z,ie=r.pendingProps,Y=y.context,V=a.contextType,R=gi,typeof V=="object"&&V!==null&&(R=It(V)),O=a.getDerivedStateFromProps,(V=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(_!==ie||Y!==R)&&qp(r,y,l,R),Xr=!1,Y=r.memoizedState,y.state=Y,Ma(r,l,y,f),Ca();var Q=r.memoizedState;_!==ie||Y!==Q||Xr||t!==null&&t.dependencies!==null&&ll(t.dependencies)?(typeof O=="function"&&(Jf(r,a,O,l),Q=r.memoizedState),(Z=Xr||Lp(r,a,Z,l,Y,Q,R)||t!==null&&t.dependencies!==null&&ll(t.dependencies))?(V||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(l,Q,R),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(l,Q,R)),typeof y.componentDidUpdate=="function"&&(r.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof y.componentDidUpdate!="function"||_===t.memoizedProps&&Y===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&Y===t.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=Q),y.props=l,y.state=Q,y.context=R,l=Z):(typeof y.componentDidUpdate!="function"||_===t.memoizedProps&&Y===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&Y===t.memoizedState||(r.flags|=1024),l=!1)}return y=l,jl(t,r),l=(r.flags&128)!==0,y||l?(y=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:y.render(),r.flags|=1,t!==null&&l?(r.child=Gs(r,t.child,null,f),r.child=Gs(r,null,a,f)):$t(t,r,a,f),r.memoizedState=y.state,t=r.child):t=Er(t,r,f),t}function Xp(t,r,a,l){return Us(),r.flags|=256,$t(t,r,a,l),r.child}var eh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function th(t){return{baseLanes:t,cachePool:z0()}}function nh(t,r,a){return t=t!==null?t.childLanes&~a:0,r&&(t|=gn),t}function Wp(t,r,a){var l=r.pendingProps,f=!1,y=(r.flags&128)!==0,_;if((_=y)||(_=t!==null&&t.memoizedState===null?!1:(wt.current&2)!==0),_&&(f=!0,r.flags&=-129),_=(r.flags&32)!==0,r.flags&=-33,t===null){if(Ge){if(f?es(r):ts(),(t=ct)?(t=ag(t,qn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=C0(t),a.return=r,r.child=a,zt=r,ct=null)):t=null,t===null)throw Jr(r);return Bh(t)?r.lanes=32:r.lanes=536870912,null}var O=l.children;return l=l.fallback,f?(ts(),f=r.mode,O=kl({mode:"hidden",children:O},f),l=Bs(l,f,a,null),O.return=r,l.return=r,O.sibling=l,r.child=O,l=r.child,l.memoizedState=th(a),l.childLanes=nh(t,_,a),r.memoizedState=eh,Pa(null,l)):(es(r),rh(r,O))}var R=t.memoizedState;if(R!==null&&(O=R.dehydrated,O!==null)){if(y)r.flags&256?(es(r),r.flags&=-257,r=sh(t,r,a)):r.memoizedState!==null?(ts(),r.child=t.child,r.flags|=128,r=null):(ts(),O=l.fallback,f=r.mode,l=kl({mode:"visible",children:l.children},f),O=Bs(O,f,a,null),O.flags|=2,l.return=r,O.return=r,l.sibling=O,r.child=l,Gs(r,t.child,null,a),l=r.child,l.memoizedState=th(a),l.childLanes=nh(t,_,a),r.memoizedState=eh,r=Pa(null,l));else if(es(r),Bh(O)){if(_=O.nextSibling&&O.nextSibling.dataset,_)var V=_.dgst;_=V,l=Error(i(419)),l.stack="",l.digest=_,Oa({value:l,source:null,stack:null}),r=sh(t,r,a)}else if(kt||_i(t,r,a,!1),_=(a&t.childLanes)!==0,kt||_){if(_=ot,_!==null&&(l=Gr(_,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,Ps(t,l),ln(_,t,l),Wf;Ph(O)||Pl(),r=sh(t,r,a)}else Ph(O)?(r.flags|=192,r.child=t.child,r=null):(t=R.treeContext,ct=Bn(O.nextSibling),zt=r,Ge=!0,Kr=null,qn=!1,t!==null&&D0(r,t),r=rh(r,l.children),r.flags|=4096);return r}return f?(ts(),O=l.fallback,f=r.mode,R=t.child,V=R.sibling,l=br(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,V!==null?O=br(V,O):(O=Bs(O,f,a,null),O.flags|=2),O.return=r,l.return=r,l.sibling=O,r.child=l,Pa(null,l),l=r.child,O=t.child.memoizedState,O===null?O=th(a):(f=O.cachePool,f!==null?(R=At._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=z0(),O={baseLanes:O.baseLanes|a,cachePool:f}),l.memoizedState=O,l.childLanes=nh(t,_,a),r.memoizedState=eh,Pa(t.child,l)):(es(r),a=t.child,t=a.sibling,a=br(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,t!==null&&(_=r.deletions,_===null?(r.deletions=[t],r.flags|=16):_.push(t)),r.child=a,r.memoizedState=null,a)}function rh(t,r){return r=kl({mode:"visible",children:r},t.mode),r.return=t,t.child=r}function kl(t,r){return t=dn(22,t,null,r),t.lanes=0,t}function sh(t,r,a){return Gs(r,t.child,null,a),t=rh(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function Zp(t,r,a){t.lanes|=r;var l=t.alternate;l!==null&&(l.lanes|=r),xf(t.return,r,a)}function ih(t,r,a,l,f,y){var _=t.memoizedState;_===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:y}:(_.isBackwards=r,_.rendering=null,_.renderingStartTime=0,_.last=l,_.tail=a,_.tailMode=f,_.treeForkCount=y)}function ey(t,r,a){var l=r.pendingProps,f=l.revealOrder,y=l.tail;l=l.children;var _=wt.current,O=(_&2)!==0;if(O?(_=_&1|2,r.flags|=128):_&=1,Me(wt,_),$t(t,r,l,a),l=Ge?Ea:0,!O&&t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Zp(t,a,r);else if(t.tag===19)Zp(t,a,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"forwards":for(a=r.child,f=null;a!==null;)t=a.alternate,t!==null&&yl(t)===null&&(f=a),a=a.sibling;a=f,a===null?(f=r.child,r.child=null):(f=a.sibling,a.sibling=null),ih(r,!1,f,a,y,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=r.child,r.child=null;f!==null;){if(t=f.alternate,t!==null&&yl(t)===null){r.child=f;break}t=f.sibling,f.sibling=a,a=f,f=t}ih(r,!0,a,null,y,l);break;case"together":ih(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function Er(t,r,a){if(t!==null&&(r.dependencies=t.dependencies),ss|=r.lanes,(a&r.childLanes)===0)if(t!==null){if(_i(t,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(t!==null&&r.child!==t.child)throw Error(i(153));if(r.child!==null){for(t=r.child,a=br(t,t.pendingProps),r.child=a,a.return=r;t.sibling!==null;)t=t.sibling,a=a.sibling=br(t,t.pendingProps),a.return=r;a.sibling=null}return r.child}function ah(t,r){return(t.lanes&r)!==0?!0:(t=t.dependencies,!!(t!==null&&ll(t)))}function iw(t,r,a){switch(r.tag){case 3:Re(r,r.stateNode.containerInfo),Qr(r,At,t.memoizedState.cache),Us();break;case 27:case 5:Ue(r);break;case 4:Re(r,r.stateNode.containerInfo);break;case 10:Qr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Cf(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(es(r),r.flags|=128,null):(a&r.child.childLanes)!==0?Wp(t,r,a):(es(r),t=Er(t,r,a),t!==null?t.sibling:null);es(r);break;case 19:var f=(t.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(_i(t,r,a,!1),l=(a&r.childLanes)!==0),f){if(l)return ey(t,r,a);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Me(wt,wt.current),l)break;return null;case 22:return r.lanes=0,Vp(t,r,a,r.pendingProps);case 24:Qr(r,At,t.memoizedState.cache)}return Er(t,r,a)}function ty(t,r,a){if(t!==null)if(t.memoizedProps!==r.pendingProps)kt=!0;else{if(!ah(t,a)&&(r.flags&128)===0)return kt=!1,iw(t,r,a);kt=(t.flags&131072)!==0}else kt=!1,Ge&&(r.flags&1048576)!==0&&R0(r,Ea,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(t=Hs(r.elementType),r.type=t,typeof t=="function")ff(t)?(l=Ys(t,l),r.tag=1,r=Qp(null,r,t,l,a)):(r.tag=0,r=Zf(null,r,t,l,a));else{if(t!=null){var f=t.$$typeof;if(f===se){r.tag=11,r=Hp(null,r,t,l,a);break e}else if(f===ae){r.tag=14,r=Fp(null,r,t,l,a);break e}}throw r=we(t)||t,Error(i(306,r,""))}}return r;case 0:return Zf(t,r,r.type,r.pendingProps,a);case 1:return l=r.type,f=Ys(l,r.pendingProps),Qp(t,r,l,f,a);case 3:e:{if(Re(r,r.stateNode.containerInfo),t===null)throw Error(i(387));l=r.pendingProps;var y=r.memoizedState;f=y.element,Af(t,r),Ma(r,l,null,a);var _=r.memoizedState;if(l=_.cache,Qr(r,At,l),l!==y.cache&&vf(r,[At],a,!0),Ca(),l=_.element,y.isDehydrated)if(y={element:l,isDehydrated:!1,cache:_.cache},r.updateQueue.baseState=y,r.memoizedState=y,r.flags&256){r=Xp(t,r,l,a);break e}else if(l!==f){f=Rn(Error(i(424)),r),Oa(f),r=Xp(t,r,l,a);break e}else{switch(t=r.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(ct=Bn(t.firstChild),zt=r,Ge=!0,Kr=null,qn=!0,a=V0(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Us(),l===f){r=Er(t,r,a);break e}$t(t,r,l,a)}r=r.child}return r;case 26:return jl(t,r),t===null?(a=hg(r.type,null,r.pendingProps,null))?r.memoizedState=a:Ge||(a=r.type,t=r.pendingProps,l=Fl(Ct.current).createElement(a),l[at]=r,l[gt]=t,Ht(l,a,t),L(l),r.stateNode=l):r.memoizedState=hg(r.type,t.memoizedProps,r.pendingProps,t.memoizedState),null;case 27:return Ue(r),t===null&&Ge&&(l=r.stateNode=cg(r.type,r.pendingProps,Ct.current),zt=r,qn=!0,f=ct,cs(r.type)?(Uh=f,ct=Bn(l.firstChild)):ct=f),$t(t,r,r.pendingProps.children,a),jl(t,r),t===null&&(r.flags|=4194304),r.child;case 5:return t===null&&Ge&&((f=l=ct)&&(l=Lw(l,r.type,r.pendingProps,qn),l!==null?(r.stateNode=l,zt=r,ct=Bn(l.firstChild),qn=!1,f=!0):f=!1),f||Jr(r)),Ue(r),f=r.type,y=r.pendingProps,_=t!==null?t.memoizedProps:null,l=y.children,Dh(f,y)?l=null:_!==null&&Dh(f,_)&&(r.flags|=32),r.memoizedState!==null&&(f=Rf(t,r,Q_,null,null,a),Wa._currentValue=f),jl(t,r),$t(t,r,l,a),r.child;case 6:return t===null&&Ge&&((t=a=ct)&&(a=qw(a,r.pendingProps,qn),a!==null?(r.stateNode=a,zt=r,ct=null,t=!0):t=!1),t||Jr(r)),null;case 13:return Wp(t,r,a);case 4:return Re(r,r.stateNode.containerInfo),l=r.pendingProps,t===null?r.child=Gs(r,null,l,a):$t(t,r,l,a),r.child;case 11:return Hp(t,r,r.type,r.pendingProps,a);case 7:return $t(t,r,r.pendingProps,a),r.child;case 8:return $t(t,r,r.pendingProps.children,a),r.child;case 12:return $t(t,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Qr(r,r.type,l.value),$t(t,r,l.children,a),r.child;case 9:return f=r.type._context,l=r.pendingProps.children,Is(r),f=It(f),l=l(f),r.flags|=1,$t(t,r,l,a),r.child;case 14:return Fp(t,r,r.type,r.pendingProps,a);case 15:return Gp(t,r,r.type,r.pendingProps,a);case 19:return ey(t,r,a);case 31:return sw(t,r,a);case 22:return Vp(t,r,a,r.pendingProps);case 24:return Is(r),l=It(At),t===null?(f=Sf(),f===null&&(f=ot,y=_f(),f.pooledCache=y,y.refCount++,y!==null&&(f.pooledCacheLanes|=a),f=y),r.memoizedState={parent:l,cache:f},Of(r),Qr(r,At,f)):((t.lanes&a)!==0&&(Af(t,r),Ma(r,null,null,a),Ca()),f=t.memoizedState,y=r.memoizedState,f.parent!==l?(f={parent:l,cache:l},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Qr(r,At,l)):(l=y.cache,Qr(r,At,l),l!==f.cache&&vf(r,[At],a,!0))),$t(t,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Or(t){t.flags|=4}function oh(t,r,a,l,f){if((r=(t.mode&32)!==0)&&(r=!1),r){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(ky())t.flags|=8192;else throw Fs=hl,Ef}else t.flags&=-16777217}function ny(t,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!gg(r))if(ky())t.flags|=8192;else throw Fs=hl,Ef}function Nl(t,r){r!==null&&(t.flags|=4),t.flags&16384&&(r=t.tag!==22?oi():536870912,t.lanes|=r,Ri|=r)}function Ba(t,r){if(!Ge)switch(t.tailMode){case"hidden":r=t.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||t.tail===null?t.tail=null:t.tail.sibling=null:l.sibling=null}}function ut(t){var r=t.alternate!==null&&t.alternate.child===t.child,a=0,l=0;if(r)for(var f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=l,t.childLanes=a,r}function aw(t,r,a){var l=r.pendingProps;switch(pf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ut(r),null;case 1:return ut(r),null;case 3:return a=r.stateNode,l=null,t!==null&&(l=t.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),_r(At),ce(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(vi(r)?Or(r):t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,gf())),ut(r),null;case 26:var f=r.type,y=r.memoizedState;return t===null?(Or(r),y!==null?(ut(r),ny(r,y)):(ut(r),oh(r,f,null,l,a))):y?y!==t.memoizedState?(Or(r),ut(r),ny(r,y)):(ut(r),r.flags&=-16777217):(t=t.memoizedProps,t!==l&&Or(r),ut(r),oh(r,f,t,l,a)),null;case 27:if(Xe(r),a=Ct.current,f=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ut(r),null}t=We.current,vi(r)?L0(r):(t=cg(f,l,a),r.stateNode=t,Or(r))}return ut(r),null;case 5:if(Xe(r),f=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ut(r),null}if(y=We.current,vi(r))L0(r);else{var _=Fl(Ct.current);switch(y){case 1:y=_.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:y=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":y=_.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":y=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":y=_.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof l.is=="string"?_.createElement("select",{is:l.is}):_.createElement("select"),l.multiple?y.multiple=!0:l.size&&(y.size=l.size);break;default:y=typeof l.is=="string"?_.createElement(f,{is:l.is}):_.createElement(f)}}y[at]=r,y[gt]=l;e:for(_=r.child;_!==null;){if(_.tag===5||_.tag===6)y.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===r)break e;for(;_.sibling===null;){if(_.return===null||_.return===r)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}r.stateNode=y;e:switch(Ht(y,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Or(r)}}return ut(r),oh(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,a),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(i(166));if(t=Ct.current,vi(r)){if(t=r.stateNode,a=r.memoizedProps,l=null,f=zt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}t[at]=r,t=!!(t.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Wy(t.nodeValue,a)),t||Jr(r,!0)}else t=Fl(t).createTextNode(l),t[at]=r,r.stateNode=t}return ut(r),null;case 31:if(a=r.memoizedState,t===null||t.memoizedState!==null){if(l=vi(r),a!==null){if(t===null){if(!l)throw Error(i(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[at]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ut(r),t=!1}else a=gf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return r.flags&256?(pn(r),r):(pn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return ut(r),null;case 13:if(l=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=vi(r),l!==null&&l.dehydrated!==null){if(t===null){if(!f)throw Error(i(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[at]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ut(r),f=!1}else f=gf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(pn(r),r):(pn(r),null)}return pn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,t=t!==null&&t.memoizedState!==null,a&&(l=r.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),y=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(y=l.memoizedState.cachePool.pool),y!==f&&(l.flags|=2048)),a!==t&&a&&(r.child.flags|=8192),Nl(r,r.updateQueue),ut(r),null);case 4:return ce(),t===null&&Nh(r.stateNode.containerInfo),ut(r),null;case 10:return _r(r.type),ut(r),null;case 19:if(Ne(wt),l=r.memoizedState,l===null)return ut(r),null;if(f=(r.flags&128)!==0,y=l.rendering,y===null)if(f)Ba(l,!1);else{if(xt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(y=yl(t),y!==null){for(r.flags|=128,Ba(l,!1),t=y.updateQueue,r.updateQueue=t,Nl(r,t),r.subtreeFlags=0,t=a,a=r.child;a!==null;)T0(a,t),a=a.sibling;return Me(wt,wt.current&1|2),Ge&&xr(r,l.treeForkCount),r.child}t=t.sibling}l.tail!==null&&ft()>Dl&&(r.flags|=128,f=!0,Ba(l,!1),r.lanes=4194304)}else{if(!f)if(t=yl(y),t!==null){if(r.flags|=128,f=!0,t=t.updateQueue,r.updateQueue=t,Nl(r,t),Ba(l,!0),l.tail===null&&l.tailMode==="hidden"&&!y.alternate&&!Ge)return ut(r),null}else 2*ft()-l.renderingStartTime>Dl&&a!==536870912&&(r.flags|=128,f=!0,Ba(l,!1),r.lanes=4194304);l.isBackwards?(y.sibling=r.child,r.child=y):(t=l.last,t!==null?t.sibling=y:r.child=y,l.last=y)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=ft(),t.sibling=null,a=wt.current,Me(wt,f?a&1|2:a&1),Ge&&xr(r,l.treeForkCount),t):(ut(r),null);case 22:case 23:return pn(r),Tf(),l=r.memoizedState!==null,t!==null?t.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(ut(r),r.subtreeFlags&6&&(r.flags|=8192)):ut(r),a=r.updateQueue,a!==null&&Nl(r,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),t!==null&&Ne($s),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),_r(At),ut(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function ow(t,r){switch(pf(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return _r(At),ce(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return Xe(r),null;case 31:if(r.memoizedState!==null){if(pn(r),r.alternate===null)throw Error(i(340));Us()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(pn(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Us()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return Ne(wt),null;case 4:return ce(),null;case 10:return _r(r.type),null;case 22:case 23:return pn(r),Tf(),t!==null&&Ne($s),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return _r(At),null;case 25:return null;default:return null}}function ry(t,r){switch(pf(r),r.tag){case 3:_r(At),ce();break;case 26:case 27:case 5:Xe(r);break;case 4:ce();break;case 31:r.memoizedState!==null&&pn(r);break;case 13:pn(r);break;case 19:Ne(wt);break;case 10:_r(r.type);break;case 22:case 23:pn(r),Tf(),t!==null&&Ne($s);break;case 24:_r(At)}}function Ua(t,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&t)===t){l=void 0;var y=a.create,_=a.inst;l=y(),_.destroy=l}a=a.next}while(a!==f)}}catch(O){et(r,r.return,O)}}function ns(t,r,a){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var y=f.next;l=y;do{if((l.tag&t)===t){var _=l.inst,O=_.destroy;if(O!==void 0){_.destroy=void 0,f=r;var R=a,V=O;try{V()}catch(Z){et(f,R,Z)}}}l=l.next}while(l!==y)}}catch(Z){et(r,r.return,Z)}}function sy(t){var r=t.updateQueue;if(r!==null){var a=t.stateNode;try{K0(r,a)}catch(l){et(t,t.return,l)}}}function iy(t,r,a){a.props=Ys(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(l){et(t,r,l)}}function za(t,r){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var l=t.stateNode;break;case 30:l=t.stateNode;break;default:l=t.stateNode}typeof a=="function"?t.refCleanup=a(l):a.current=l}}catch(f){et(t,r,f)}}function sr(t,r){var a=t.ref,l=t.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){et(t,r,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){et(t,r,f)}else a.current=null}function ay(t){var r=t.type,a=t.memoizedProps,l=t.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){et(t,t.return,f)}}function lh(t,r,a){try{var l=t.stateNode;Nw(l,t.type,a,r),l[gt]=r}catch(f){et(t,t.return,f)}}function oy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&cs(t.type)||t.tag===4}function ch(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||oy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&cs(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function uh(t,r,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(t),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=yr));else if(l!==4&&(l===27&&cs(t.type)&&(a=t.stateNode,r=null),t=t.child,t!==null))for(uh(t,r,a),t=t.sibling;t!==null;)uh(t,r,a),t=t.sibling}function Tl(t,r,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,r?a.insertBefore(t,r):a.appendChild(t);else if(l!==4&&(l===27&&cs(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Tl(t,r,a),t=t.sibling;t!==null;)Tl(t,r,a),t=t.sibling}function ly(t){var r=t.stateNode,a=t.memoizedProps;try{for(var l=t.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Ht(r,l,a),r[at]=t,r[gt]=a}catch(y){et(t,t.return,y)}}var Ar=!1,Nt=!1,fh=!1,cy=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function lw(t,r){if(t=t.containerInfo,Mh=Xl,t=_0(t),rf(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,y=l.focusNode;l=l.focusOffset;try{a.nodeType,y.nodeType}catch{a=null;break e}var _=0,O=-1,R=-1,V=0,Z=0,ie=t,Y=null;t:for(;;){for(var Q;ie!==a||f!==0&&ie.nodeType!==3||(O=_+f),ie!==y||l!==0&&ie.nodeType!==3||(R=_+l),ie.nodeType===3&&(_+=ie.nodeValue.length),(Q=ie.firstChild)!==null;)Y=ie,ie=Q;for(;;){if(ie===t)break t;if(Y===a&&++V===f&&(O=_),Y===y&&++Z===l&&(R=_),(Q=ie.nextSibling)!==null)break;ie=Y,Y=ie.parentNode}ie=Q}a=O===-1||R===-1?null:{start:O,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Rh={focusedElem:t,selectionRange:a},Xl=!1,Pt=r;Pt!==null;)if(r=Pt,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Pt=t;else for(;Pt!==null;){switch(r=Pt,y=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)f=t[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,a=r,f=y.memoizedProps,y=y.memoizedState,l=a.stateNode;try{var ve=Ys(a.type,f);t=l.getSnapshotBeforeUpdate(ve,y),l.__reactInternalSnapshotBeforeUpdate=t}catch(Te){et(a,a.return,Te)}}break;case 3:if((t&1024)!==0){if(t=r.stateNode.containerInfo,a=t.nodeType,a===9)qh(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":qh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=r.sibling,t!==null){t.return=r.return,Pt=t;break}Pt=r.return}}function uy(t,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:kr(t,a),l&4&&Ua(5,a);break;case 1:if(kr(t,a),l&4)if(t=a.stateNode,r===null)try{t.componentDidMount()}catch(_){et(a,a.return,_)}else{var f=Ys(a.type,r.memoizedProps);r=r.memoizedState;try{t.componentDidUpdate(f,r,t.__reactInternalSnapshotBeforeUpdate)}catch(_){et(a,a.return,_)}}l&64&&sy(a),l&512&&za(a,a.return);break;case 3:if(kr(t,a),l&64&&(t=a.updateQueue,t!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{K0(t,r)}catch(_){et(a,a.return,_)}}break;case 27:r===null&&l&4&&ly(a);case 26:case 5:kr(t,a),r===null&&l&4&&ay(a),l&512&&za(a,a.return);break;case 12:kr(t,a);break;case 31:kr(t,a),l&4&&dy(t,a);break;case 13:kr(t,a),l&4&&my(t,a),l&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=gw.bind(null,a),Pw(t,a))));break;case 22:if(l=a.memoizedState!==null||Ar,!l){r=r!==null&&r.memoizedState!==null||Nt,f=Ar;var y=Nt;Ar=l,(Nt=r)&&!y?Nr(t,a,(a.subtreeFlags&8772)!==0):kr(t,a),Ar=f,Nt=y}break;case 30:break;default:kr(t,a)}}function fy(t){var r=t.alternate;r!==null&&(t.alternate=null,fy(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&li(r)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var ht=null,rn=!1;function jr(t,r,a){for(a=a.child;a!==null;)hy(t,r,a),a=a.sibling}function hy(t,r,a){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(ks,a)}catch{}switch(a.tag){case 26:Nt||sr(a,r),jr(t,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Nt||sr(a,r);var l=ht,f=rn;cs(a.type)&&(ht=a.stateNode,rn=!1),jr(t,r,a),Ja(a.stateNode),ht=l,rn=f;break;case 5:Nt||sr(a,r);case 6:if(l=ht,f=rn,ht=null,jr(t,r,a),ht=l,rn=f,ht!==null)if(rn)try{(ht.nodeType===9?ht.body:ht.nodeName==="HTML"?ht.ownerDocument.body:ht).removeChild(a.stateNode)}catch(y){et(a,r,y)}else try{ht.removeChild(a.stateNode)}catch(y){et(a,r,y)}break;case 18:ht!==null&&(rn?(t=ht,sg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Ii(t)):sg(ht,a.stateNode));break;case 4:l=ht,f=rn,ht=a.stateNode.containerInfo,rn=!0,jr(t,r,a),ht=l,rn=f;break;case 0:case 11:case 14:case 15:ns(2,a,r),Nt||ns(4,a,r),jr(t,r,a);break;case 1:Nt||(sr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&iy(a,r,l)),jr(t,r,a);break;case 21:jr(t,r,a);break;case 22:Nt=(l=Nt)||a.memoizedState!==null,jr(t,r,a),Nt=l;break;default:jr(t,r,a)}}function dy(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ii(t)}catch(a){et(r,r.return,a)}}}function my(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ii(t)}catch(a){et(r,r.return,a)}}function cw(t){switch(t.tag){case 31:case 13:case 19:var r=t.stateNode;return r===null&&(r=t.stateNode=new cy),r;case 22:return t=t.stateNode,r=t._retryCache,r===null&&(r=t._retryCache=new cy),r;default:throw Error(i(435,t.tag))}}function Cl(t,r){var a=cw(t);r.forEach(function(l){if(!a.has(l)){a.add(l);var f=bw.bind(null,t,l);l.then(f,f)}})}function sn(t,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],y=t,_=r,O=_;e:for(;O!==null;){switch(O.tag){case 27:if(cs(O.type)){ht=O.stateNode,rn=!1;break e}break;case 5:ht=O.stateNode,rn=!1;break e;case 3:case 4:ht=O.stateNode.containerInfo,rn=!0;break e}O=O.return}if(ht===null)throw Error(i(160));hy(y,_,f),ht=null,rn=!1,y=f.alternate,y!==null&&(y.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)py(r,t),r=r.sibling}var Yn=null;function py(t,r){var a=t.alternate,l=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:sn(r,t),an(t),l&4&&(ns(3,t,t.return),Ua(3,t),ns(5,t,t.return));break;case 1:sn(r,t),an(t),l&512&&(Nt||a===null||sr(a,a.return)),l&64&&Ar&&(t=t.updateQueue,t!==null&&(l=t.callbacks,l!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Yn;if(sn(r,t),an(t),l&512&&(Nt||a===null||sr(a,a.return)),l&4){var y=a!==null?a.memoizedState:null;if(l=t.memoizedState,a===null)if(l===null)if(t.stateNode===null){e:{l=t.type,a=t.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":y=f.getElementsByTagName("title")[0],(!y||y[Rt]||y[at]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=f.createElement(l),f.head.insertBefore(y,f.querySelector("head > title"))),Ht(y,l,a),y[at]=t,L(y),l=y;break e;case"link":var _=pg("link","href",f).get(l+(a.href||""));if(_){for(var O=0;O<_.length;O++)if(y=_[O],y.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&y.getAttribute("rel")===(a.rel==null?null:a.rel)&&y.getAttribute("title")===(a.title==null?null:a.title)&&y.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(O,1);break t}}y=f.createElement(l),Ht(y,l,a),f.head.appendChild(y);break;case"meta":if(_=pg("meta","content",f).get(l+(a.content||""))){for(O=0;O<_.length;O++)if(y=_[O],y.getAttribute("content")===(a.content==null?null:""+a.content)&&y.getAttribute("name")===(a.name==null?null:a.name)&&y.getAttribute("property")===(a.property==null?null:a.property)&&y.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&y.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(O,1);break t}}y=f.createElement(l),Ht(y,l,a),f.head.appendChild(y);break;default:throw Error(i(468,l))}y[at]=t,L(y),l=y}t.stateNode=l}else yg(f,t.type,t.stateNode);else t.stateNode=mg(f,l,t.memoizedProps);else y!==l?(y===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):y.count--,l===null?yg(f,t.type,t.stateNode):mg(f,l,t.memoizedProps)):l===null&&t.stateNode!==null&&lh(t,t.memoizedProps,a.memoizedProps)}break;case 27:sn(r,t),an(t),l&512&&(Nt||a===null||sr(a,a.return)),a!==null&&l&4&&lh(t,t.memoizedProps,a.memoizedProps);break;case 5:if(sn(r,t),an(t),l&512&&(Nt||a===null||sr(a,a.return)),t.flags&32){f=t.stateNode;try{ui(f,"")}catch(ve){et(t,t.return,ve)}}l&4&&t.stateNode!=null&&(f=t.memoizedProps,lh(t,f,a!==null?a.memoizedProps:f)),l&1024&&(fh=!0);break;case 6:if(sn(r,t),an(t),l&4){if(t.stateNode===null)throw Error(i(162));l=t.memoizedProps,a=t.stateNode;try{a.nodeValue=l}catch(ve){et(t,t.return,ve)}}break;case 3:if(Yl=null,f=Yn,Yn=Gl(r.containerInfo),sn(r,t),Yn=f,an(t),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ii(r.containerInfo)}catch(ve){et(t,t.return,ve)}fh&&(fh=!1,yy(t));break;case 4:l=Yn,Yn=Gl(t.stateNode.containerInfo),sn(r,t),an(t),Yn=l;break;case 12:sn(r,t),an(t);break;case 31:sn(r,t),an(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Cl(t,l)));break;case 13:sn(r,t),an(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Rl=ft()),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Cl(t,l)));break;case 22:f=t.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,V=Ar,Z=Nt;if(Ar=V||f,Nt=Z||R,sn(r,t),Nt=Z,Ar=V,an(t),l&8192)e:for(r=t.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(a===null||R||Ar||Nt||Ks(t)),a=null,r=t;;){if(r.tag===5||r.tag===26){if(a===null){R=a=r;try{if(y=R.stateNode,f)_=y.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{O=R.stateNode;var ie=R.memoizedProps.style,Y=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;O.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(ve){et(R,R.return,ve)}}}else if(r.tag===6){if(a===null){R=r;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(ve){et(R,R.return,ve)}}}else if(r.tag===18){if(a===null){R=r;try{var Q=R.stateNode;f?ig(Q,!0):ig(R.stateNode,!1)}catch(ve){et(R,R.return,ve)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===t)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=t.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Cl(t,a))));break;case 19:sn(r,t),an(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Cl(t,l)));break;case 30:break;case 21:break;default:sn(r,t),an(t)}}function an(t){var r=t.flags;if(r&2){try{for(var a,l=t.return;l!==null;){if(oy(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var f=a.stateNode,y=ch(t);Tl(t,y,f);break;case 5:var _=a.stateNode;a.flags&32&&(ui(_,""),a.flags&=-33);var O=ch(t);Tl(t,O,_);break;case 3:case 4:var R=a.stateNode.containerInfo,V=ch(t);uh(t,V,R);break;default:throw Error(i(161))}}catch(Z){et(t,t.return,Z)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function yy(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var r=t;yy(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),t=t.sibling}}function kr(t,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)uy(t,r.alternate,r),r=r.sibling}function Ks(t){for(t=t.child;t!==null;){var r=t;switch(r.tag){case 0:case 11:case 14:case 15:ns(4,r,r.return),Ks(r);break;case 1:sr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&iy(r,r.return,a),Ks(r);break;case 27:Ja(r.stateNode);case 26:case 5:sr(r,r.return),Ks(r);break;case 22:r.memoizedState===null&&Ks(r);break;case 30:Ks(r);break;default:Ks(r)}t=t.sibling}}function Nr(t,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,f=t,y=r,_=y.flags;switch(y.tag){case 0:case 11:case 15:Nr(f,y,a),Ua(4,y);break;case 1:if(Nr(f,y,a),l=y,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(V){et(l,l.return,V)}if(l=y,f=l.updateQueue,f!==null){var O=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)Y0(R[f],O)}catch(V){et(l,l.return,V)}}a&&_&64&&sy(y),za(y,y.return);break;case 27:ly(y);case 26:case 5:Nr(f,y,a),a&&l===null&&_&4&&ay(y),za(y,y.return);break;case 12:Nr(f,y,a);break;case 31:Nr(f,y,a),a&&_&4&&dy(f,y);break;case 13:Nr(f,y,a),a&&_&4&&my(f,y);break;case 22:y.memoizedState===null&&Nr(f,y,a),za(y,y.return);break;case 30:break;default:Nr(f,y,a)}r=r.sibling}}function hh(t,r){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(t=r.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Aa(a))}function dh(t,r){t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&Aa(t))}function Kn(t,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)gy(t,r,a,l),r=r.sibling}function gy(t,r,a,l){var f=r.flags;switch(r.tag){case 0:case 11:case 15:Kn(t,r,a,l),f&2048&&Ua(9,r);break;case 1:Kn(t,r,a,l);break;case 3:Kn(t,r,a,l),f&2048&&(t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&Aa(t)));break;case 12:if(f&2048){Kn(t,r,a,l),t=r.stateNode;try{var y=r.memoizedProps,_=y.id,O=y.onPostCommit;typeof O=="function"&&O(_,r.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(R){et(r,r.return,R)}}else Kn(t,r,a,l);break;case 31:Kn(t,r,a,l);break;case 13:Kn(t,r,a,l);break;case 23:break;case 22:y=r.stateNode,_=r.alternate,r.memoizedState!==null?y._visibility&2?Kn(t,r,a,l):Ia(t,r):y._visibility&2?Kn(t,r,a,l):(y._visibility|=2,Ti(t,r,a,l,(r.subtreeFlags&10256)!==0||!1)),f&2048&&hh(_,r);break;case 24:Kn(t,r,a,l),f&2048&&dh(r.alternate,r);break;default:Kn(t,r,a,l)}}function Ti(t,r,a,l,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var y=t,_=r,O=a,R=l,V=_.flags;switch(_.tag){case 0:case 11:case 15:Ti(y,_,O,R,f),Ua(8,_);break;case 23:break;case 22:var Z=_.stateNode;_.memoizedState!==null?Z._visibility&2?Ti(y,_,O,R,f):Ia(y,_):(Z._visibility|=2,Ti(y,_,O,R,f)),f&&V&2048&&hh(_.alternate,_);break;case 24:Ti(y,_,O,R,f),f&&V&2048&&dh(_.alternate,_);break;default:Ti(y,_,O,R,f)}r=r.sibling}}function Ia(t,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=t,l=r,f=l.flags;switch(l.tag){case 22:Ia(a,l),f&2048&&hh(l.alternate,l);break;case 24:Ia(a,l),f&2048&&dh(l.alternate,l);break;default:Ia(a,l)}r=r.sibling}}var $a=8192;function Ci(t,r,a){if(t.subtreeFlags&$a)for(t=t.child;t!==null;)by(t,r,a),t=t.sibling}function by(t,r,a){switch(t.tag){case 26:Ci(t,r,a),t.flags&$a&&t.memoizedState!==null&&Jw(a,Yn,t.memoizedState,t.memoizedProps);break;case 5:Ci(t,r,a);break;case 3:case 4:var l=Yn;Yn=Gl(t.stateNode.containerInfo),Ci(t,r,a),Yn=l;break;case 22:t.memoizedState===null&&(l=t.alternate,l!==null&&l.memoizedState!==null?(l=$a,$a=16777216,Ci(t,r,a),$a=l):Ci(t,r,a));break;default:Ci(t,r,a)}}function xy(t){var r=t.alternate;if(r!==null&&(t=r.child,t!==null)){r.child=null;do r=t.sibling,t.sibling=null,t=r;while(t!==null)}}function Ha(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,_y(l,t)}xy(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vy(t),t=t.sibling}function vy(t){switch(t.tag){case 0:case 11:case 15:Ha(t),t.flags&2048&&ns(9,t,t.return);break;case 3:Ha(t);break;case 12:Ha(t);break;case 22:var r=t.stateNode;t.memoizedState!==null&&r._visibility&2&&(t.return===null||t.return.tag!==13)?(r._visibility&=-3,Ml(t)):Ha(t);break;default:Ha(t)}}function Ml(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,_y(l,t)}xy(t)}for(t=t.child;t!==null;){switch(r=t,r.tag){case 0:case 11:case 15:ns(8,r,r.return),Ml(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Ml(r));break;default:Ml(r)}t=t.sibling}}function _y(t,r){for(;Pt!==null;){var a=Pt;switch(a.tag){case 0:case 11:case 15:ns(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Aa(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Pt=l;else e:for(a=t;Pt!==null;){l=Pt;var f=l.sibling,y=l.return;if(fy(l),l===a){Pt=null;break e}if(f!==null){f.return=y,Pt=f;break e}Pt=y}}}var uw={getCacheForType:function(t){var r=It(At),a=r.data.get(t);return a===void 0&&(a=t(),r.data.set(t,a)),a},cacheSignal:function(){return It(At).controller.signal}},fw=typeof WeakMap=="function"?WeakMap:Map,Qe=0,ot=null,ze=null,$e=0,Ze=0,yn=null,rs=!1,Mi=!1,mh=!1,Tr=0,xt=0,ss=0,Js=0,ph=0,gn=0,Ri=0,Fa=null,on=null,yh=!1,Rl=0,wy=0,Dl=1/0,Ll=null,is=null,Dt=0,as=null,Di=null,Cr=0,gh=0,bh=null,Sy=null,Ga=0,xh=null;function bn(){return(Qe&2)!==0&&$e!==0?$e&-$e:F.T!==null?Oh():da()}function Ey(){if(gn===0)if(($e&536870912)===0||Ge){var t=dr;dr<<=1,(dr&3932160)===0&&(dr=262144),gn=t}else gn=536870912;return t=mn.current,t!==null&&(t.flags|=32),gn}function ln(t,r,a){(t===ot&&(Ze===2||Ze===9)||t.cancelPendingCommit!==null)&&(Li(t,0),os(t,$e,gn,!1)),Fn(t,a),((Qe&2)===0||t!==ot)&&(t===ot&&((Qe&2)===0&&(Js|=a),xt===4&&os(t,$e,gn,!1)),ir(t))}function Oy(t,r,a){if((Qe&6)!==0)throw Error(i(327));var l=!a&&(r&127)===0&&(r&t.expiredLanes)===0||Ts(t,r),f=l?mw(t,r):_h(t,r,!0),y=l;do{if(f===0){Mi&&!l&&os(t,r,0,!1);break}else{if(a=t.current.alternate,y&&!hw(a)){f=_h(t,r,!1),y=!1;continue}if(f===2){if(y=r,t.errorRecoveryDisabledLanes&y)var _=0;else _=t.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){r=_;e:{var O=t;f=Fa;var R=O.current.memoizedState.isDehydrated;if(R&&(Li(O,_).flags|=256),_=_h(O,_,!1),_!==2){if(mh&&!R){O.errorRecoveryDisabledLanes|=y,Js|=y,f=4;break e}y=on,on=f,y!==null&&(on===null?on=y:on.push.apply(on,y))}f=_}if(y=!1,f!==2)continue}}if(f===1){Li(t,0),os(t,r,0,!0);break}e:{switch(l=t,y=f,y){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:os(l,r,gn,!rs);break e;case 2:on=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(f=Rl+300-ft(),10<f)){if(os(l,r,gn,!rs),Ns(l,0,!0)!==0)break e;Cr=r,l.timeoutHandle=ng(Ay.bind(null,l,a,on,Ll,yh,r,gn,Js,Ri,rs,y,"Throttled",-0,0),f);break e}Ay(l,a,on,Ll,yh,r,gn,Js,Ri,rs,y,null,-0,0)}}break}while(!0);ir(t)}function Ay(t,r,a,l,f,y,_,O,R,V,Z,ie,Y,Q){if(t.timeoutHandle=-1,ie=r.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:yr},by(r,y,ie);var ve=(y&62914560)===y?Rl-ft():(y&4194048)===y?wy-ft():0;if(ve=Qw(ie,ve),ve!==null){Cr=y,t.cancelPendingCommit=ve(Dy.bind(null,t,r,y,a,l,f,_,O,R,Z,ie,null,Y,Q)),os(t,y,_,!V);return}}Dy(t,r,y,a,l,f,_,O,R)}function hw(t){for(var r=t;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],y=f.getSnapshot;f=f.value;try{if(!hn(y(),f))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function os(t,r,a,l){r&=~ph,r&=~Js,t.suspendedLanes|=r,t.pingedLanes&=~r,l&&(t.warmLanes|=r),l=t.expirationTimes;for(var f=r;0<f;){var y=31-Ft(f),_=1<<y;l[y]=-1,f&=~_}a!==0&&Fr(t,a,r)}function ql(){return(Qe&6)===0?(Va(0),!1):!0}function vh(){if(ze!==null){if(Ze===0)var t=ze.return;else t=ze,vr=zs=null,qf(t),Oi=null,ka=0,t=ze;for(;t!==null;)ry(t.alternate,t),t=t.return;ze=null}}function Li(t,r){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,Mw(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Cr=0,vh(),ot=t,ze=a=br(t.current,null),$e=r,Ze=0,yn=null,rs=!1,Mi=Ts(t,r),mh=!1,Ri=gn=ph=Js=ss=xt=0,on=Fa=null,yh=!1,(r&8)!==0&&(r|=r&32);var l=t.entangledLanes;if(l!==0)for(t=t.entanglements,l&=r;0<l;){var f=31-Ft(l),y=1<<f;r|=t[f],l&=~y}return Tr=r,rl(),a}function jy(t,r){De=null,F.H=qa,r===Ei||r===fl?(r=H0(),Ze=3):r===Ef?(r=H0(),Ze=4):Ze=r===Wf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,yn=r,ze===null&&(xt=1,Ol(t,Rn(r,t.current)))}function ky(){var t=mn.current;return t===null?!0:($e&4194048)===$e?Pn===null:($e&62914560)===$e||($e&536870912)!==0?t===Pn:!1}function Ny(){var t=F.H;return F.H=qa,t===null?qa:t}function Ty(){var t=F.A;return F.A=uw,t}function Pl(){xt=4,rs||($e&4194048)!==$e&&mn.current!==null||(Mi=!0),(ss&134217727)===0&&(Js&134217727)===0||ot===null||os(ot,$e,gn,!1)}function _h(t,r,a){var l=Qe;Qe|=2;var f=Ny(),y=Ty();(ot!==t||$e!==r)&&(Ll=null,Li(t,r)),r=!1;var _=xt;e:do try{if(Ze!==0&&ze!==null){var O=ze,R=yn;switch(Ze){case 8:vh(),_=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(r=!0);var V=Ze;if(Ze=0,yn=null,qi(t,O,R,V),a&&Mi){_=0;break e}break;default:V=Ze,Ze=0,yn=null,qi(t,O,R,V)}}dw(),_=xt;break}catch(Z){jy(t,Z)}while(!0);return r&&t.shellSuspendCounter++,vr=zs=null,Qe=l,F.H=f,F.A=y,ze===null&&(ot=null,$e=0,rl()),_}function dw(){for(;ze!==null;)Cy(ze)}function mw(t,r){var a=Qe;Qe|=2;var l=Ny(),f=Ty();ot!==t||$e!==r?(Ll=null,Dl=ft()+500,Li(t,r)):Mi=Ts(t,r);e:do try{if(Ze!==0&&ze!==null){r=ze;var y=yn;t:switch(Ze){case 1:Ze=0,yn=null,qi(t,r,y,1);break;case 2:case 9:if(I0(y)){Ze=0,yn=null,My(r);break}r=function(){Ze!==2&&Ze!==9||ot!==t||(Ze=7),ir(t)},y.then(r,r);break e;case 3:Ze=7;break e;case 4:Ze=5;break e;case 7:I0(y)?(Ze=0,yn=null,My(r)):(Ze=0,yn=null,qi(t,r,y,7));break;case 5:var _=null;switch(ze.tag){case 26:_=ze.memoizedState;case 5:case 27:var O=ze;if(_?gg(_):O.stateNode.complete){Ze=0,yn=null;var R=O.sibling;if(R!==null)ze=R;else{var V=O.return;V!==null?(ze=V,Bl(V)):ze=null}break t}}Ze=0,yn=null,qi(t,r,y,5);break;case 6:Ze=0,yn=null,qi(t,r,y,6);break;case 8:vh(),xt=6;break e;default:throw Error(i(462))}}pw();break}catch(Z){jy(t,Z)}while(!0);return vr=zs=null,F.H=l,F.A=f,Qe=a,ze!==null?0:(ot=null,$e=0,rl(),xt)}function pw(){for(;ze!==null&&!zo();)Cy(ze)}function Cy(t){var r=ty(t.alternate,t,Tr);t.memoizedProps=t.pendingProps,r===null?Bl(t):ze=r}function My(t){var r=t,a=r.alternate;switch(r.tag){case 15:case 0:r=Jp(a,r,r.pendingProps,r.type,void 0,$e);break;case 11:r=Jp(a,r,r.pendingProps,r.type.render,r.ref,$e);break;case 5:qf(r);default:ry(a,r),r=ze=T0(r,Tr),r=ty(a,r,Tr)}t.memoizedProps=t.pendingProps,r===null?Bl(t):ze=r}function qi(t,r,a,l){vr=zs=null,qf(r),Oi=null,ka=0;var f=r.return;try{if(rw(t,f,r,a,$e)){xt=1,Ol(t,Rn(a,t.current)),ze=null;return}}catch(y){if(f!==null)throw ze=f,y;xt=1,Ol(t,Rn(a,t.current)),ze=null;return}r.flags&32768?(Ge||l===1?t=!0:Mi||($e&536870912)!==0?t=!1:(rs=t=!0,(l===2||l===9||l===3||l===6)&&(l=mn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Ry(r,t)):Bl(r)}function Bl(t){var r=t;do{if((r.flags&32768)!==0){Ry(r,rs);return}t=r.return;var a=aw(r.alternate,r,Tr);if(a!==null){ze=a;return}if(r=r.sibling,r!==null){ze=r;return}ze=r=t}while(r!==null);xt===0&&(xt=5)}function Ry(t,r){do{var a=ow(t.alternate,t);if(a!==null){a.flags&=32767,ze=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(t=t.sibling,t!==null)){ze=t;return}ze=t=a}while(t!==null);xt=6,ze=null}function Dy(t,r,a,l,f,y,_,O,R){t.cancelPendingCommit=null;do Ul();while(Dt!==0);if((Qe&6)!==0)throw Error(i(327));if(r!==null){if(r===t.current)throw Error(i(177));if(y=r.lanes|r.childLanes,y|=cf,Hr(t,a,y,_,O,R),t===ot&&(ze=ot=null,$e=0),Di=r,as=t,Cr=a,gh=y,bh=f,Sy=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,xw(ii,function(){return Uy(),null})):(t.callbackNode=null,t.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=F.T,F.T=null,f=J.p,J.p=2,_=Qe,Qe|=4;try{lw(t,r,a)}finally{Qe=_,J.p=f,F.T=l}}Dt=1,Ly(),qy(),Py()}}function Ly(){if(Dt===1){Dt=0;var t=as,r=Di,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=F.T,F.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{py(r,t);var y=Rh,_=_0(t.containerInfo),O=y.focusedElem,R=y.selectionRange;if(_!==O&&O&&O.ownerDocument&&v0(O.ownerDocument.documentElement,O)){if(R!==null&&rf(O)){var V=R.start,Z=R.end;if(Z===void 0&&(Z=V),"selectionStart"in O)O.selectionStart=V,O.selectionEnd=Math.min(Z,O.value.length);else{var ie=O.ownerDocument||document,Y=ie&&ie.defaultView||window;if(Y.getSelection){var Q=Y.getSelection(),ve=O.textContent.length,Te=Math.min(R.start,ve),st=R.end===void 0?Te:Math.min(R.end,ve);!Q.extend&&Te>st&&(_=st,st=Te,Te=_);var $=x0(O,Te),B=x0(O,st);if($&&B&&(Q.rangeCount!==1||Q.anchorNode!==$.node||Q.anchorOffset!==$.offset||Q.focusNode!==B.node||Q.focusOffset!==B.offset)){var G=ie.createRange();G.setStart($.node,$.offset),Q.removeAllRanges(),Te>st?(Q.addRange(G),Q.extend(B.node,B.offset)):(G.setEnd(B.node,B.offset),Q.addRange(G))}}}}for(ie=[],Q=O;Q=Q.parentNode;)Q.nodeType===1&&ie.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ie.length;O++){var ee=ie[O];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Xl=!!Mh,Rh=Mh=null}finally{Qe=f,J.p=l,F.T=a}}t.current=r,Dt=2}}function qy(){if(Dt===2){Dt=0;var t=as,r=Di,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=F.T,F.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{uy(t,r.alternate,r)}finally{Qe=f,J.p=l,F.T=a}}Dt=3}}function Py(){if(Dt===4||Dt===3){Dt=0,si();var t=as,r=Di,a=Cr,l=Sy;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Dt=5:(Dt=0,Di=as=null,By(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(is=null),Ms(a),r=r.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(ks,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=F.T,f=J.p,J.p=2,F.T=null;try{for(var y=t.onRecoverableError,_=0;_<l.length;_++){var O=l[_];y(O.value,{componentStack:O.stack})}}finally{F.T=r,J.p=f}}(Cr&3)!==0&&Ul(),ir(t),f=t.pendingLanes,(a&261930)!==0&&(f&42)!==0?t===xh?Ga++:(Ga=0,xh=t):Ga=0,Va(0)}}function By(t,r){(t.pooledCacheLanes&=r)===0&&(r=t.pooledCache,r!=null&&(t.pooledCache=null,Aa(r)))}function Ul(){return Ly(),qy(),Py(),Uy()}function Uy(){if(Dt!==5)return!1;var t=as,r=gh;gh=0;var a=Ms(Cr),l=F.T,f=J.p;try{J.p=32>a?32:a,F.T=null,a=bh,bh=null;var y=as,_=Cr;if(Dt=0,Di=as=null,Cr=0,(Qe&6)!==0)throw Error(i(331));var O=Qe;if(Qe|=4,vy(y.current),gy(y,y.current,_,a),Qe=O,Va(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(ks,y)}catch{}return!0}finally{J.p=f,F.T=l,By(t,r)}}function zy(t,r,a){r=Rn(a,r),r=Xf(t.stateNode,r,2),t=Zr(t,r,2),t!==null&&(Fn(t,2),ir(t))}function et(t,r,a){if(t.tag===3)zy(t,t,a);else for(;r!==null;){if(r.tag===3){zy(r,t,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(is===null||!is.has(l))){t=Rn(a,t),a=Ip(2),l=Zr(r,a,2),l!==null&&($p(a,l,r,t),Fn(l,2),ir(l));break}}r=r.return}}function wh(t,r,a){var l=t.pingCache;if(l===null){l=t.pingCache=new fw;var f=new Set;l.set(r,f)}else f=l.get(r),f===void 0&&(f=new Set,l.set(r,f));f.has(a)||(mh=!0,f.add(a),t=yw.bind(null,t,r,a),r.then(t,t))}function yw(t,r,a){var l=t.pingCache;l!==null&&l.delete(r),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,ot===t&&($e&a)===a&&(xt===4||xt===3&&($e&62914560)===$e&&300>ft()-Rl?(Qe&2)===0&&Li(t,0):ph|=a,Ri===$e&&(Ri=0)),ir(t)}function Iy(t,r){r===0&&(r=oi()),t=Ps(t,r),t!==null&&(Fn(t,r),ir(t))}function gw(t){var r=t.memoizedState,a=0;r!==null&&(a=r.retryLane),Iy(t,a)}function bw(t,r){var a=0;switch(t.tag){case 31:case 13:var l=t.stateNode,f=t.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=t.stateNode;break;case 22:l=t.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(r),Iy(t,a)}function xw(t,r){return ca(t,r)}var zl=null,Pi=null,Sh=!1,Il=!1,Eh=!1,ls=0;function ir(t){t!==Pi&&t.next===null&&(Pi===null?zl=Pi=t:Pi=Pi.next=t),Il=!0,Sh||(Sh=!0,_w())}function Va(t,r){if(!Eh&&Il){Eh=!0;do for(var a=!1,l=zl;l!==null;){if(t!==0){var f=l.pendingLanes;if(f===0)var y=0;else{var _=l.suspendedLanes,O=l.pingedLanes;y=(1<<31-Ft(42|t)+1)-1,y&=f&~(_&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(a=!0,Gy(l,y))}else y=$e,y=Ns(l,l===ot?y:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(y&3)===0||Ts(l,y)||(a=!0,Gy(l,y));l=l.next}while(a);Eh=!1}}function vw(){$y()}function $y(){Il=Sh=!1;var t=0;ls!==0&&Cw()&&(t=ls);for(var r=ft(),a=null,l=zl;l!==null;){var f=l.next,y=Hy(l,r);y===0?(l.next=null,a===null?zl=f:a.next=f,f===null&&(Pi=a)):(a=l,(t!==0||(y&3)!==0)&&(Il=!0)),l=f}Dt!==0&&Dt!==5||Va(t),ls!==0&&(ls=0)}function Hy(t,r){for(var a=t.suspendedLanes,l=t.pingedLanes,f=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var _=31-Ft(y),O=1<<_,R=f[_];R===-1?((O&a)===0||(O&l)!==0)&&(f[_]=ha(O,r)):R<=r&&(t.expiredLanes|=O),y&=~O}if(r=ot,a=$e,a=Ns(t,t===r?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l=t.callbackNode,a===0||t===r&&(Ze===2||Ze===9)||t.cancelPendingCommit!==null)return l!==null&&l!==null&&hr(l),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Ts(t,a)){if(r=a&-a,r===t.callbackPriority)return r;switch(l!==null&&hr(l),Ms(a)){case 2:case 8:a=$o;break;case 32:a=ii;break;case 268435456:a=Ho;break;default:a=ii}return l=Fy.bind(null,t),a=ca(a,l),t.callbackPriority=r,t.callbackNode=a,r}return l!==null&&l!==null&&hr(l),t.callbackPriority=2,t.callbackNode=null,2}function Fy(t,r){if(Dt!==0&&Dt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Ul()&&t.callbackNode!==a)return null;var l=$e;return l=Ns(t,t===ot?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l===0?null:(Oy(t,l,r),Hy(t,ft()),t.callbackNode!=null&&t.callbackNode===a?Fy.bind(null,t):null)}function Gy(t,r){if(Ul())return null;Oy(t,r,!0)}function _w(){Rw(function(){(Qe&6)!==0?ca(Io,vw):$y()})}function Oh(){if(ls===0){var t=wi;t===0&&(t=zr,zr<<=1,(zr&261888)===0&&(zr=256)),ls=t}return ls}function Vy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Jo(""+t)}function Yy(t,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,t.id&&a.setAttribute("form",t.id),r.parentNode.insertBefore(a,r),t=new FormData(t),a.parentNode.removeChild(a),t}function ww(t,r,a,l,f){if(r==="submit"&&a&&a.stateNode===f){var y=Vy((f[gt]||null).action),_=l.submitter;_&&(r=(r=_[gt]||null)?Vy(r.formAction):_.getAttribute("formAction"),r!==null&&(y=r,_=null));var O=new Zo("action","action",null,l,f);t.push({event:O,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ls!==0){var R=_?Yy(f,_):new FormData(f);Gf(a,{pending:!0,data:R,method:f.method,action:y},null,R)}}else typeof y=="function"&&(O.preventDefault(),R=_?Yy(f,_):new FormData(f),Gf(a,{pending:!0,data:R,method:f.method,action:y},y,R))},currentTarget:f}]})}}for(var Ah=0;Ah<lf.length;Ah++){var jh=lf[Ah],Sw=jh.toLowerCase(),Ew=jh[0].toUpperCase()+jh.slice(1);Vn(Sw,"on"+Ew)}Vn(E0,"onAnimationEnd"),Vn(O0,"onAnimationIteration"),Vn(A0,"onAnimationStart"),Vn("dblclick","onDoubleClick"),Vn("focusin","onFocus"),Vn("focusout","onBlur"),Vn(z_,"onTransitionRun"),Vn(I_,"onTransitionStart"),Vn($_,"onTransitionCancel"),Vn(j0,"onTransitionEnd"),K("onMouseEnter",["mouseout","mouseover"]),K("onMouseLeave",["mouseout","mouseover"]),K("onPointerEnter",["pointerout","pointerover"]),K("onPointerLeave",["pointerout","pointerover"]),oe("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),oe("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),oe("onBeforeInput",["compositionend","keypress","textInput","paste"]),oe("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),oe("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),oe("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ya="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(" "),Ow=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ya));function Ky(t,r){r=(r&4)!==0;for(var a=0;a<t.length;a++){var l=t[a],f=l.event;l=l.listeners;e:{var y=void 0;if(r)for(var _=l.length-1;0<=_;_--){var O=l[_],R=O.instance,V=O.currentTarget;if(O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){nl(Z)}f.currentTarget=null,y=R}else for(_=0;_<l.length;_++){if(O=l[_],R=O.instance,V=O.currentTarget,O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){nl(Z)}f.currentTarget=null,y=R}}}}function Ie(t,r){var a=r[Rs];a===void 0&&(a=r[Rs]=new Set);var l=t+"__bubble";a.has(l)||(Jy(r,t,2,!1),a.add(l))}function kh(t,r,a){var l=0;r&&(l|=4),Jy(a,t,l,r)}var $l="_reactListening"+Math.random().toString(36).slice(2);function Nh(t){if(!t[$l]){t[$l]=!0,H.forEach(function(a){a!=="selectionchange"&&(Ow.has(a)||kh(a,!1,t),kh(a,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[$l]||(r[$l]=!0,kh("selectionchange",!1,r))}}function Jy(t,r,a,l){switch(Eg(r)){case 2:var f=Zw;break;case 8:f=eS;break;default:f=Fh}a=f.bind(null,r,a,t),f=void 0,!Ku||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),l?f!==void 0?t.addEventListener(r,a,{capture:!0,passive:f}):t.addEventListener(r,a,!0):f!==void 0?t.addEventListener(r,a,{passive:f}):t.addEventListener(r,a,!1)}function Th(t,r,a,l,f){var y=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var _=l.tag;if(_===3||_===4){var O=l.stateNode.containerInfo;if(O===f)break;if(_===4)for(_=l.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===f)return;_=_.return}for(;O!==null;){if(_=A(O),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){l=y=_;continue e}O=O.parentNode}}l=l.return}e0(function(){var V=y,Z=Vu(a),ie=[];e:{var Y=k0.get(t);if(Y!==void 0){var Q=Zo,ve=t;switch(t){case"keypress":if(Xo(a)===0)break e;case"keydown":case"keyup":Q=b_;break;case"focusin":ve="focus",Q=Wu;break;case"focusout":ve="blur",Q=Wu;break;case"beforeblur":case"afterblur":Q=Wu;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=r0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=a_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=__;break;case E0:case O0:case A0:Q=c_;break;case j0:Q=S_;break;case"scroll":case"scrollend":Q=s_;break;case"wheel":Q=O_;break;case"copy":case"cut":case"paste":Q=f_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=i0;break;case"toggle":case"beforetoggle":Q=j_}var Te=(r&4)!==0,st=!Te&&(t==="scroll"||t==="scrollend"),$=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var B=V,G;B!==null;){var ee=B;if(G=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||G===null||$===null||(ee=pa(B,$),ee!=null&&Te.push(Ka(B,ee,G))),st)break;B=B.return}0<Te.length&&(Y=new Q(Y,ve,null,a,Z),ie.push({event:Y,listeners:Te}))}}if((r&7)===0){e:{if(Y=t==="mouseover"||t==="pointerover",Q=t==="mouseout"||t==="pointerout",Y&&a!==Gu&&(ve=a.relatedTarget||a.fromElement)&&(A(ve)||ve[fn]))break e;if((Q||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,Q?(ve=a.relatedTarget||a.toElement,Q=V,ve=ve?A(ve):null,ve!==null&&(st=c(ve),Te=ve.tag,ve!==st||Te!==5&&Te!==27&&Te!==6)&&(ve=null)):(Q=null,ve=V),Q!==ve)){if(Te=r0,ee="onMouseLeave",$="onMouseEnter",B="mouse",(t==="pointerout"||t==="pointerover")&&(Te=i0,ee="onPointerLeave",$="onPointerEnter",B="pointer"),st=Q==null?Y:k(Q),G=ve==null?Y:k(ve),Y=new Te(ee,B+"leave",Q,a,Z),Y.target=st,Y.relatedTarget=G,ee=null,A(Z)===V&&(Te=new Te($,B+"enter",ve,a,Z),Te.target=G,Te.relatedTarget=st,ee=Te),st=ee,Q&&ve)t:{for(Te=Aw,$=Q,B=ve,G=0,ee=$;ee;ee=Te(ee))G++;ee=0;for(var Ae=B;Ae;Ae=Te(Ae))ee++;for(;0<G-ee;)$=Te($),G--;for(;0<ee-G;)B=Te(B),ee--;for(;G--;){if($===B||B!==null&&$===B.alternate){Te=$;break t}$=Te($),B=Te(B)}Te=null}else Te=null;Q!==null&&Qy(ie,Y,Q,Te,!1),ve!==null&&st!==null&&Qy(ie,st,ve,Te,!0)}}e:{if(Y=V?k(V):window,Q=Y.nodeName&&Y.nodeName.toLowerCase(),Q==="select"||Q==="input"&&Y.type==="file")var Ke=d0;else if(f0(Y))if(m0)Ke=P_;else{Ke=L_;var _e=D_}else Q=Y.nodeName,!Q||Q.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?V&&Fu(V.elementType)&&(Ke=d0):Ke=q_;if(Ke&&(Ke=Ke(t,V))){h0(ie,Ke,a,Z);break e}_e&&_e(t,Y,V),t==="focusout"&&V&&Y.type==="number"&&V.memoizedProps.value!=null&&Hu(Y,"number",Y.value)}switch(_e=V?k(V):window,t){case"focusin":(f0(_e)||_e.contentEditable==="true")&&(mi=_e,sf=V,Sa=null);break;case"focusout":Sa=sf=mi=null;break;case"mousedown":af=!0;break;case"contextmenu":case"mouseup":case"dragend":af=!1,w0(ie,a,Z);break;case"selectionchange":if(U_)break;case"keydown":case"keyup":w0(ie,a,Z)}var Le;if(ef)e:{switch(t){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else di?c0(t,a)&&(He="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(He="onCompositionStart");He&&(a0&&a.locale!=="ko"&&(di||He!=="onCompositionStart"?He==="onCompositionEnd"&&di&&(Le=t0()):(Vr=Z,Ju="value"in Vr?Vr.value:Vr.textContent,di=!0)),_e=Hl(V,He),0<_e.length&&(He=new s0(He,t,null,a,Z),ie.push({event:He,listeners:_e}),Le?He.data=Le:(Le=u0(a),Le!==null&&(He.data=Le)))),(Le=N_?T_(t,a):C_(t,a))&&(He=Hl(V,"onBeforeInput"),0<He.length&&(_e=new s0("onBeforeInput","beforeinput",null,a,Z),ie.push({event:_e,listeners:He}),_e.data=Le)),ww(ie,t,V,a,Z)}Ky(ie,r)})}function Ka(t,r,a){return{instance:t,listener:r,currentTarget:a}}function Hl(t,r){for(var a=r+"Capture",l=[];t!==null;){var f=t,y=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||y===null||(f=pa(t,a),f!=null&&l.unshift(Ka(t,f,y)),f=pa(t,r),f!=null&&l.push(Ka(t,f,y))),t.tag===3)return l;t=t.return}return[]}function Aw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Qy(t,r,a,l,f){for(var y=r._reactName,_=[];a!==null&&a!==l;){var O=a,R=O.alternate,V=O.stateNode;if(O=O.tag,R!==null&&R===l)break;O!==5&&O!==26&&O!==27||V===null||(R=V,f?(V=pa(a,y),V!=null&&_.unshift(Ka(a,V,R))):f||(V=pa(a,y),V!=null&&_.push(Ka(a,V,R)))),a=a.return}_.length!==0&&t.push({event:r,listeners:_})}var jw=/\r\n?/g,kw=/\u0000|\uFFFD/g;function Xy(t){return(typeof t=="string"?t:""+t).replace(jw,`
26
- `).replace(kw,"")}function Wy(t,r){return r=Xy(r),Xy(t)===r}function rt(t,r,a,l,f,y){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||ui(t,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&ui(t,""+l);break;case"className":Gn(t,"class",l);break;case"tabIndex":Gn(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Gn(t,a,l);break;case"style":Wm(t,l,y);break;case"data":if(r!=="object"){Gn(t,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){t.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Jo(""+l),t.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){t.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 y=="function"&&(a==="formAction"?(r!=="input"&&rt(t,r,"name",f.name,f,null),rt(t,r,"formEncType",f.formEncType,f,null),rt(t,r,"formMethod",f.formMethod,f,null),rt(t,r,"formTarget",f.formTarget,f,null)):(rt(t,r,"encType",f.encType,f,null),rt(t,r,"method",f.method,f,null),rt(t,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Jo(""+l),t.setAttribute(a,l);break;case"onClick":l!=null&&(t.onclick=yr);break;case"onScroll":l!=null&&Ie("scroll",t);break;case"onScrollEnd":l!=null&&Ie("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){t.removeAttribute("xlink:href");break}a=Jo(""+l),t.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":l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""+l):t.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":l&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":l===!0?t.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,l):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(a,l):t.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(a):t.setAttribute(a,l);break;case"popover":Ie("beforetoggle",t),Ie("toggle",t),Gt(t,"popover",l);break;case"xlinkActuate":pr(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":pr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":pr(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":pr(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":pr(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":pr(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":pr(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":pr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":pr(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Gt(t,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=n_.get(a)||a,Gt(t,a,l))}}function Ch(t,r,a,l,f,y){switch(a){case"style":Wm(t,l,y);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof l=="string"?ui(t,l):(typeof l=="number"||typeof l=="bigint")&&ui(t,""+l);break;case"onScroll":l!=null&&Ie("scroll",t);break;case"onScrollEnd":l!=null&&Ie("scrollend",t);break;case"onClick":l!=null&&(t.onclick=yr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ne.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),y=t[gt]||null,y=y!=null?y[a]:null,typeof y=="function"&&t.removeEventListener(r,y,f),typeof l=="function")){typeof y!="function"&&y!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(r,l,f);break e}a in t?t[a]=l:l===!0?t.setAttribute(a,""):Gt(t,a,l)}}}function Ht(t,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",t),Ie("load",t);var l=!1,f=!1,y;for(y in a)if(a.hasOwnProperty(y)){var _=a[y];if(_!=null)switch(y){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,y,_,a,null)}}f&&rt(t,r,"srcSet",a.srcSet,a,null),l&&rt(t,r,"src",a.src,a,null);return;case"input":Ie("invalid",t);var O=y=_=f=null,R=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var Z=a[l];if(Z!=null)switch(l){case"name":f=Z;break;case"type":_=Z;break;case"checked":R=Z;break;case"defaultChecked":V=Z;break;case"value":y=Z;break;case"defaultValue":O=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:rt(t,r,l,Z,a,null)}}Km(t,y,O,R,V,_,f,!1);return;case"select":Ie("invalid",t),l=_=y=null;for(f in a)if(a.hasOwnProperty(f)&&(O=a[f],O!=null))switch(f){case"value":y=O;break;case"defaultValue":_=O;break;case"multiple":l=O;default:rt(t,r,f,O,a,null)}r=y,a=_,t.multiple=!!l,r!=null?ci(t,!!l,r,!1):a!=null&&ci(t,!!l,a,!0);return;case"textarea":Ie("invalid",t),y=f=l=null;for(_ in a)if(a.hasOwnProperty(_)&&(O=a[_],O!=null))switch(_){case"value":l=O;break;case"defaultValue":f=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:rt(t,r,_,O,a,null)}Qm(t,l,f,y);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":t.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:rt(t,r,R,l,a,null)}return;case"dialog":Ie("beforetoggle",t),Ie("toggle",t),Ie("cancel",t),Ie("close",t);break;case"iframe":case"object":Ie("load",t);break;case"video":case"audio":for(l=0;l<Ya.length;l++)Ie(Ya[l],t);break;case"image":Ie("error",t),Ie("load",t);break;case"details":Ie("toggle",t);break;case"embed":case"source":case"link":Ie("error",t),Ie("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,V,l,a,null)}return;default:if(Fu(r)){for(Z in a)a.hasOwnProperty(Z)&&(l=a[Z],l!==void 0&&Ch(t,r,Z,l,a,void 0));return}}for(O in a)a.hasOwnProperty(O)&&(l=a[O],l!=null&&rt(t,r,O,l,a,null))}function Nw(t,r,a,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,y=null,_=null,O=null,R=null,V=null,Z=null;for(Q in a){var ie=a[Q];if(a.hasOwnProperty(Q)&&ie!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":R=ie;default:l.hasOwnProperty(Q)||rt(t,r,Q,null,l,ie)}}for(var Y in l){var Q=l[Y];if(ie=a[Y],l.hasOwnProperty(Y)&&(Q!=null||ie!=null))switch(Y){case"type":y=Q;break;case"name":f=Q;break;case"checked":V=Q;break;case"defaultChecked":Z=Q;break;case"value":_=Q;break;case"defaultValue":O=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,r));break;default:Q!==ie&&rt(t,r,Y,Q,l,ie)}}$u(t,_,O,R,V,Z,y,f);return;case"select":Q=_=O=Y=null;for(y in a)if(R=a[y],a.hasOwnProperty(y)&&R!=null)switch(y){case"value":break;case"multiple":Q=R;default:l.hasOwnProperty(y)||rt(t,r,y,null,l,R)}for(f in l)if(y=l[f],R=a[f],l.hasOwnProperty(f)&&(y!=null||R!=null))switch(f){case"value":Y=y;break;case"defaultValue":O=y;break;case"multiple":_=y;default:y!==R&&rt(t,r,f,y,l,R)}r=O,a=_,l=Q,Y!=null?ci(t,!!a,Y,!1):!!l!=!!a&&(r!=null?ci(t,!!a,r,!0):ci(t,!!a,a?[]:"",!1));return;case"textarea":Q=Y=null;for(O in a)if(f=a[O],a.hasOwnProperty(O)&&f!=null&&!l.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:rt(t,r,O,null,l,f)}for(_ in l)if(f=l[_],y=a[_],l.hasOwnProperty(_)&&(f!=null||y!=null))switch(_){case"value":Y=f;break;case"defaultValue":Q=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==y&&rt(t,r,_,f,l,y)}Jm(t,Y,Q);return;case"option":for(var ve in a)if(Y=a[ve],a.hasOwnProperty(ve)&&Y!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":t.selected=!1;break;default:rt(t,r,ve,null,l,Y)}for(R in l)if(Y=l[R],Q=a[R],l.hasOwnProperty(R)&&Y!==Q&&(Y!=null||Q!=null))switch(R){case"selected":t.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:rt(t,r,R,Y,l,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 Te in a)Y=a[Te],a.hasOwnProperty(Te)&&Y!=null&&!l.hasOwnProperty(Te)&&rt(t,r,Te,null,l,Y);for(V in l)if(Y=l[V],Q=a[V],l.hasOwnProperty(V)&&Y!==Q&&(Y!=null||Q!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,r));break;default:rt(t,r,V,Y,l,Q)}return;default:if(Fu(r)){for(var st in a)Y=a[st],a.hasOwnProperty(st)&&Y!==void 0&&!l.hasOwnProperty(st)&&Ch(t,r,st,void 0,l,Y);for(Z in l)Y=l[Z],Q=a[Z],!l.hasOwnProperty(Z)||Y===Q||Y===void 0&&Q===void 0||Ch(t,r,Z,Y,l,Q);return}}for(var $ in a)Y=a[$],a.hasOwnProperty($)&&Y!=null&&!l.hasOwnProperty($)&&rt(t,r,$,null,l,Y);for(ie in l)Y=l[ie],Q=a[ie],!l.hasOwnProperty(ie)||Y===Q||Y==null&&Q==null||rt(t,r,ie,Y,l,Q)}function Zy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Tw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],y=f.transferSize,_=f.initiatorType,O=f.duration;if(y&&O&&Zy(_)){for(_=0,O=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],V=R.startTime;if(V>O)break;var Z=R.transferSize,ie=R.initiatorType;Z&&Zy(ie)&&(R=R.responseEnd,_+=Z*(R<O?1:(O-V)/(R-V)))}if(--l,r+=8*(y+_)/(f.duration/1e3),t++,10<t)break}}if(0<t)return r/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Mh=null,Rh=null;function Fl(t){return t.nodeType===9?t:t.ownerDocument}function eg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function tg(t,r){if(t===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&r==="foreignObject"?0:t}function Dh(t,r){return t==="textarea"||t==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Lh=null;function Cw(){var t=window.event;return t&&t.type==="popstate"?t===Lh?!1:(Lh=t,!0):(Lh=null,!1)}var ng=typeof setTimeout=="function"?setTimeout:void 0,Mw=typeof clearTimeout=="function"?clearTimeout:void 0,rg=typeof Promise=="function"?Promise:void 0,Rw=typeof queueMicrotask=="function"?queueMicrotask:typeof rg<"u"?function(t){return rg.resolve(null).then(t).catch(Dw)}:ng;function Dw(t){setTimeout(function(){throw t})}function cs(t){return t==="head"}function sg(t,r){var a=r,l=0;do{var f=a.nextSibling;if(t.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){t.removeChild(f),Ii(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Ja(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Ja(a);for(var y=a.firstChild;y;){var _=y.nextSibling,O=y.nodeName;y[Rt]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||a.removeChild(y),y=_}}else a==="body"&&Ja(t.ownerDocument.body);a=f}while(a);Ii(r)}function ig(t,r){var a=t;t=0;do{var l=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=l}while(a)}function qh(t){var r=t.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":qh(a),li(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function Lw(t,r,a,l){for(;t.nodeType===1;){var f=a;if(t.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Rt])switch(r){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(r==="input"&&t.type==="hidden"){var y=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Bn(t.nextSibling),t===null)break}return null}function qw(t,r,a){if(r==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Bn(t.nextSibling),t===null))return null;return t}function ag(t,r){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=Bn(t.nextSibling),t===null))return null;return t}function Ph(t){return t.data==="$?"||t.data==="$~"}function Bh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Pw(t,r){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=r;else if(t.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function Bn(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return t}var Uh=null;function og(t){t=t.nextSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(r===0)return Bn(t.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}t=t.nextSibling}return null}function lg(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return t;r--}else a!=="/$"&&a!=="/&"||r++}t=t.previousSibling}return null}function cg(t,r,a){switch(r=Fl(a),t){case"html":if(t=r.documentElement,!t)throw Error(i(452));return t;case"head":if(t=r.head,!t)throw Error(i(453));return t;case"body":if(t=r.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Ja(t){for(var r=t.attributes;r.length;)t.removeAttributeNode(r[0]);li(t)}var Un=new Map,ug=new Set;function Gl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Mr=J.d;J.d={f:Bw,r:Uw,D:zw,C:Iw,L:$w,m:Hw,X:Gw,S:Fw,M:Vw};function Bw(){var t=Mr.f(),r=ql();return t||r}function Uw(t){var r=N(t);r!==null&&r.tag===5&&r.type==="form"?jp(r):Mr.r(t)}var Bi=typeof document>"u"?null:document;function fg(t,r,a){var l=Bi;if(l&&typeof r=="string"&&r){var f=Cn(r);f='link[rel="'+t+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),ug.has(f)||(ug.add(f),t={rel:t,crossOrigin:a,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),Ht(r,"link",t),L(r),l.head.appendChild(r)))}}function zw(t){Mr.D(t),fg("dns-prefetch",t,null)}function Iw(t,r){Mr.C(t,r),fg("preconnect",t,r)}function $w(t,r,a){Mr.L(t,r,a);var l=Bi;if(l&&t&&r){var f='link[rel="preload"][as="'+Cn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Cn(a.imageSizes)+'"]')):f+='[href="'+Cn(t)+'"]';var y=f;switch(r){case"style":y=Ui(t);break;case"script":y=zi(t)}Un.has(y)||(t=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:t,as:r},a),Un.set(y,t),l.querySelector(f)!==null||r==="style"&&l.querySelector(Qa(y))||r==="script"&&l.querySelector(Xa(y))||(r=l.createElement("link"),Ht(r,"link",t),L(r),l.head.appendChild(r)))}}function Hw(t,r){Mr.m(t,r);var a=Bi;if(a&&t){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+Cn(l)+'"][href="'+Cn(t)+'"]',y=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=zi(t)}if(!Un.has(y)&&(t=b({rel:"modulepreload",href:t},r),Un.set(y,t),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Xa(y)))return}l=a.createElement("link"),Ht(l,"link",t),L(l),a.head.appendChild(l)}}}function Fw(t,r,a){Mr.S(t,r,a);var l=Bi;if(l&&t){var f=T(l).hoistableStyles,y=Ui(t);r=r||"default";var _=f.get(y);if(!_){var O={loading:0,preload:null};if(_=l.querySelector(Qa(y)))O.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":r},a),(a=Un.get(y))&&zh(t,a);var R=_=l.createElement("link");L(R),Ht(R,"link",t),R._p=new Promise(function(V,Z){R.onload=V,R.onerror=Z}),R.addEventListener("load",function(){O.loading|=1}),R.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Vl(_,r,l)}_={type:"stylesheet",instance:_,count:1,state:O},f.set(y,_)}}}function Gw(t,r){Mr.X(t,r);var a=Bi;if(a&&t){var l=T(a).hoistableScripts,f=zi(t),y=l.get(f);y||(y=a.querySelector(Xa(f)),y||(t=b({src:t,async:!0},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ht(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function Vw(t,r){Mr.M(t,r);var a=Bi;if(a&&t){var l=T(a).hoistableScripts,f=zi(t),y=l.get(f);y||(y=a.querySelector(Xa(f)),y||(t=b({src:t,async:!0,type:"module"},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ht(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function hg(t,r,a,l){var f=(f=Ct.current)?Gl(f):null;if(!f)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=Ui(a.href),a=T(f).hoistableStyles,l=a.get(r),l||(l={type:"style",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=Ui(a.href);var y=T(f).hoistableStyles,_=y.get(t);if(_||(f=f.ownerDocument||f,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,_),(y=f.querySelector(Qa(t)))&&!y._p&&(_.instance=y,_.state.loading=5),Un.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Un.set(t,a),y||Yw(f,t,a,_.state))),r&&l===null)throw Error(i(528,""));return _}if(r&&l!==null)throw Error(i(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=zi(a),a=T(f).hoistableScripts,l=a.get(r),l||(l={type:"script",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function Ui(t){return'href="'+Cn(t)+'"'}function Qa(t){return'link[rel="stylesheet"]['+t+"]"}function dg(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function Yw(t,r,a,l){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=t.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),Ht(r,"link",a),L(r),t.head.appendChild(r))}function zi(t){return'[src="'+Cn(t)+'"]'}function Xa(t){return"script[async]"+t}function mg(t,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=t.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(l)return r.instance=l,L(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),L(l),Ht(l,"style",f),Vl(l,a.precedence,t),r.instance=l;case"stylesheet":f=Ui(a.href);var y=t.querySelector(Qa(f));if(y)return r.state.loading|=4,r.instance=y,L(y),y;l=dg(a),(f=Un.get(f))&&zh(l,f),y=(t.ownerDocument||t).createElement("link"),L(y);var _=y;return _._p=new Promise(function(O,R){_.onload=O,_.onerror=R}),Ht(y,"link",l),r.state.loading|=4,Vl(y,a.precedence,t),r.instance=y;case"script":return y=zi(a.src),(f=t.querySelector(Xa(y)))?(r.instance=f,L(f),f):(l=a,(f=Un.get(y))&&(l=b({},a),Ih(l,f)),t=t.ownerDocument||t,f=t.createElement("script"),L(f),Ht(f,"link",l),t.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,Vl(l,a.precedence,t));return r.instance}function Vl(t,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,y=f,_=0;_<l.length;_++){var O=l[_];if(O.dataset.precedence===r)y=O;else if(y!==f)break}y?y.parentNode.insertBefore(t,y.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(t,r.firstChild))}function zh(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.title==null&&(t.title=r.title)}function Ih(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.integrity==null&&(t.integrity=r.integrity)}var Yl=null;function pg(t,r,a){if(Yl===null){var l=new Map,f=Yl=new Map;f.set(a,l)}else f=Yl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(t))return l;for(l.set(t,null),a=a.getElementsByTagName(t),f=0;f<a.length;f++){var y=a[f];if(!(y[Rt]||y[at]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var _=y.getAttribute(r)||"";_=t+_;var O=l.get(_);O?O.push(y):l.set(_,[y])}}return l}function yg(t,r,a){t=t.ownerDocument||t,t.head.insertBefore(a,r==="title"?t.querySelector("head > title"):null)}function Kw(t,r,a){if(a===1||r.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return t=r.disabled,typeof r.precedence=="string"&&t==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function gg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Jw(t,r,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=Ui(l.href),y=r.querySelector(Qa(f));if(y){r=y._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=Kl.bind(t),r.then(t,t)),a.state.loading|=4,a.instance=y,L(y);return}y=r.ownerDocument||r,l=dg(l),(f=Un.get(f))&&zh(l,f),y=y.createElement("link"),L(y);var _=y;_._p=new Promise(function(O,R){_.onload=O,_.onerror=R}),Ht(y,"link",l),a.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Kl.bind(t),r.addEventListener("load",a),r.addEventListener("error",a))}}var $h=0;function Qw(t,r){return t.stylesheets&&t.count===0&&Ql(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var l=setTimeout(function(){if(t.stylesheets&&Ql(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+r);0<t.imgBytes&&$h===0&&($h=62500*Tw());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Ql(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>$h?50:800)+r);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Kl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ql(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Jl=null;function Ql(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Jl=new Map,r.forEach(Xw,t),Jl=null,Kl.call(t))}function Xw(t,r){if(!(r.state.loading&4)){var a=Jl.get(t);if(a)var l=a.get(null);else{a=new Map,Jl.set(t,a);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<f.length;y++){var _=f[y];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),l=_)}l&&a.set(null,l)}f=r.instance,_=f.getAttribute("data-precedence"),y=a.get(_)||l,y===l&&a.set(null,f),a.set(_,f),this.count++,l=Kl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),y?y.parentNode.insertBefore(f,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),r.state.loading|=4}}var Wa={$$typeof:re,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function Ww(t,r,a,l,f,y,_,O,R){this.tag=1,this.containerInfo=t,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=$r(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$r(0),this.hiddenUpdates=$r(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=y,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function bg(t,r,a,l,f,y,_,O,R,V,Z,ie){return t=new Ww(t,r,a,_,R,V,Z,ie,O),r=1,y===!0&&(r|=24),y=dn(3,null,null,r),t.current=y,y.stateNode=t,r=_f(),r.refCount++,t.pooledCache=r,r.refCount++,y.memoizedState={element:l,isDehydrated:a,cache:r},Of(y),t}function xg(t){return t?(t=gi,t):gi}function vg(t,r,a,l,f,y){f=xg(f),l.context===null?l.context=f:l.pendingContext=f,l=Wr(r),l.payload={element:a},y=y===void 0?null:y,y!==null&&(l.callback=y),a=Zr(t,l,r),a!==null&&(ln(a,t,r),Ta(a,t,r))}function _g(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<r?a:r}}function Hh(t,r){_g(t,r),(t=t.alternate)&&_g(t,r)}function wg(t){if(t.tag===13||t.tag===31){var r=Ps(t,67108864);r!==null&&ln(r,t,67108864),Hh(t,67108864)}}function Sg(t){if(t.tag===13||t.tag===31){var r=bn();r=mr(r);var a=Ps(t,r);a!==null&&ln(a,t,r),Hh(t,r)}}var Xl=!0;function Zw(t,r,a,l){var f=F.T;F.T=null;var y=J.p;try{J.p=2,Fh(t,r,a,l)}finally{J.p=y,F.T=f}}function eS(t,r,a,l){var f=F.T;F.T=null;var y=J.p;try{J.p=8,Fh(t,r,a,l)}finally{J.p=y,F.T=f}}function Fh(t,r,a,l){if(Xl){var f=Gh(l);if(f===null)Th(t,r,l,Wl,a),Og(t,l);else if(nS(f,t,r,a,l))l.stopPropagation();else if(Og(t,l),r&4&&-1<tS.indexOf(t)){for(;f!==null;){var y=N(f);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var _=Hn(y.pendingLanes);if(_!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;_;){var R=1<<31-Ft(_);O.entanglements[1]|=R,_&=~R}ir(y),(Qe&6)===0&&(Dl=ft()+500,Va(0))}}break;case 31:case 13:O=Ps(y,2),O!==null&&ln(O,y,2),ql(),Hh(y,2)}if(y=Gh(l),y===null&&Th(t,r,l,Wl,a),y===f)break;f=y}f!==null&&l.stopPropagation()}else Th(t,r,l,null,a)}}function Gh(t){return t=Vu(t),Vh(t)}var Wl=null;function Vh(t){if(Wl=null,t=A(t),t!==null){var r=c(t);if(r===null)t=null;else{var a=r.tag;if(a===13){if(t=m(r),t!==null)return t;t=null}else if(a===31){if(t=p(r),t!==null)return t;t=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null)}}return Wl=t,null}function Eg(t){switch(t){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(Bu()){case Io:return 2;case $o:return 8;case ii:case Uu:return 32;case Ho:return 268435456;default:return 32}default:return 32}}var Yh=!1,us=null,fs=null,hs=null,Za=new Map,eo=new Map,ds=[],tS="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 Og(t,r){switch(t){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":fs=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":Za.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":eo.delete(r.pointerId)}}function to(t,r,a,l,f,y){return t===null||t.nativeEvent!==y?(t={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:y,targetContainers:[f]},r!==null&&(r=N(r),r!==null&&wg(r)),t):(t.eventSystemFlags|=l,r=t.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),t)}function nS(t,r,a,l,f){switch(r){case"focusin":return us=to(us,t,r,a,l,f),!0;case"dragenter":return fs=to(fs,t,r,a,l,f),!0;case"mouseover":return hs=to(hs,t,r,a,l,f),!0;case"pointerover":var y=f.pointerId;return Za.set(y,to(Za.get(y)||null,t,r,a,l,f)),!0;case"gotpointercapture":return y=f.pointerId,eo.set(y,to(eo.get(y)||null,t,r,a,l,f)),!0}return!1}function Ag(t){var r=A(t.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=m(a),r!==null){t.blockedOn=r,Go(t.priority,function(){Sg(a)});return}}else if(r===31){if(r=p(a),r!==null){t.blockedOn=r,Go(t.priority,function(){Sg(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Zl(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var a=Gh(t.nativeEvent);if(a===null){a=t.nativeEvent;var l=new a.constructor(a.type,a);Gu=l,a.target.dispatchEvent(l),Gu=null}else return r=N(a),r!==null&&wg(r),t.blockedOn=a,!1;r.shift()}return!0}function jg(t,r,a){Zl(t)&&a.delete(r)}function rS(){Yh=!1,us!==null&&Zl(us)&&(us=null),fs!==null&&Zl(fs)&&(fs=null),hs!==null&&Zl(hs)&&(hs=null),Za.forEach(jg),eo.forEach(jg)}function ec(t,r){t.blockedOn===r&&(t.blockedOn=null,Yh||(Yh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,rS)))}var tc=null;function kg(t){tc!==t&&(tc=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){tc===t&&(tc=null);for(var r=0;r<t.length;r+=3){var a=t[r],l=t[r+1],f=t[r+2];if(typeof l!="function"){if(Vh(l||a)===null)continue;break}var y=N(a);y!==null&&(t.splice(r,3),r-=3,Gf(y,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ii(t){function r(R){return ec(R,t)}us!==null&&ec(us,t),fs!==null&&ec(fs,t),hs!==null&&ec(hs,t),Za.forEach(r),eo.forEach(r);for(var a=0;a<ds.length;a++){var l=ds[a];l.blockedOn===t&&(l.blockedOn=null)}for(;0<ds.length&&(a=ds[0],a.blockedOn===null);)Ag(a),a.blockedOn===null&&ds.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],y=a[l+1],_=f[gt]||null;if(typeof y=="function")_||kg(a);else if(_){var O=null;if(y&&y.hasAttribute("formAction")){if(f=y,_=y[gt]||null)O=_.formAction;else if(Vh(f)!==null)continue}else O=_.action;typeof O=="function"?a[l+1]=O:(a.splice(l,3),l-=3),kg(a)}}}function Ng(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(_){return f=_})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Kh(t){this._internalRoot=t}nc.prototype.render=Kh.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=bn();vg(a,l,t,r,null,null)},nc.prototype.unmount=Kh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;vg(t.current,2,null,t,null,null),ql(),r[fn]=null}};function nc(t){this._internalRoot=t}nc.prototype.unstable_scheduleHydration=function(t){if(t){var r=da();t={blockedOn:null,target:t,priority:r};for(var a=0;a<ds.length&&r!==0&&r<ds[a].priority;a++);ds.splice(a,0,t),a===0&&Ag(t)}};var Tg=e.version;if(Tg!=="19.2.4")throw Error(i(527,Tg,"19.2.4"));J.findDOMNode=function(t){var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=u(r),t=t!==null?d(t):null,t=t===null?null:t.stateNode,t};var sS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rc.isDisabled&&rc.supportsFiber)try{ks=rc.inject(sS),_t=rc}catch{}}return no.createRoot=function(t,r){if(!o(t))throw Error(i(299));var a=!1,l="",f=Pp,y=Bp,_=Up;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(_=r.onRecoverableError)),r=bg(t,1,!1,null,null,a,l,null,f,y,_,Ng),t[fn]=r.current,Nh(t),new Kh(r)},no.hydrateRoot=function(t,r,a){if(!o(t))throw Error(i(299));var l=!1,f="",y=Pp,_=Bp,O=Up,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),r=bg(t,1,!0,r,a??null,l,f,R,y,_,O,Ng),r.context=xg(null),a=r.current,l=bn(),l=mr(l),f=Wr(l),f.callback=null,Zr(a,f,l),a=l,r.current.lanes=a,Fn(r,a),ir(r),t[fn]=r.current,Nh(t),new nc(r)},no.version="19.2.4",no}var Pg;function JS(){if(Pg)return Jh.exports;Pg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Jh.exports=KS(),Jh.exports}var QS=JS();const XS="modulepreload",WS=function(n,e){return new URL(n,e).href},Bg={},ke=function(e,s,i){let o=Promise.resolve();if(s&&s.length>0){let m=function(d){return Promise.all(d.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),u=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=m(s.map(d=>{if(d=WS(d,i),d in Bg)return;Bg[d]=!0;const b=d.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=p.length-1;S>=0;S--){const C=p[S];if(C.href===d&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${x}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":XS,b||(w.as="script"),w.crossOrigin="",w.href=d,u&&w.setAttribute("nonce",u),document.head.appendChild(w),b)return new Promise((S,C)=>{w.addEventListener("load",S),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${d}`)))})}))}function c(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return o.then(m=>{for(const p of m||[])p.status==="rejected"&&c(p.reason);return e().catch(c)})};function Eu(n){try{const e=n.split(".");if(e.length!==3)return null;const s=atob(e[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function px(n){const e=Eu(n);return!e||typeof e.exp!="number"?null:e.exp}function om(n,e=0){const s=px(n);return s===null?!0:Date.now()/1e3>=s-e}const Vt=window.__LT_BASE__??"",_d=`${Vt}/api`;class Ug extends Error{constructor(e,s,i){super(e),this.status=s,this.body=i,this.name="ApiError"}}let bs=null;function sc(n){bs=n}function wd(){return bs}const ZS="X-LT-Acting-Token",eE="X-LT-Acting-Remaining";let eu=null,tu=null;function zg(n){eu=n}let nu=null;function Ig(n){nu=n}function $g(n){tu=n}function tE(n){const e=n==null?void 0:n.error;return typeof e=="string"&&/acting[- ]identity/i.test(e)}async function Hg(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:e,password:s}=JSON.parse(n),i=await fetch(`${_d}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:s})});if(!i.ok)return null;const o=await i.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let ps=null;async function ue(n,e={}){const s={"Content-Type":"application/json",...e.headers};if(bs){if(om(bs)){ps||(ps=Hg().finally(()=>{ps=null}));const p=await ps;if(p)bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${bs}`}const o=(e.method??"GET").toUpperCase()==="GET"?null:(eu==null?void 0:eu())??null;o&&(s[ZS]=o);let c=await fetch(`${_d}${n}`,{...e,headers:s});const m=o?c.headers.get(eE):null;if(o&&m!==null&&(nu==null||nu(o,m==="unbounded"?null:Number(m))),c.status===401&&o){const p=await c.clone().json().catch(()=>null);if(tE(p))throw tu==null||tu(),new Ug(p.error,401,p)}if(c.status===401&&bs){ps||(ps=Hg().finally(()=>{ps=null}));const p=await ps;if(p&&(bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}})),s.Authorization=`Bearer ${p}`,c=await fetch(`${_d}${n}`,{...e,headers:s})),c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!c.ok){const p=await c.json().catch(()=>({error:c.statusText}));throw new Ug(p.message||p.error||c.statusText,c.status,p)}return c.json()}const nE="lt_ai_override";let ic=null;function lm(){return ic||(ic=fetch(`${Vt}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw ic=null,n})),ic}function rE(){try{if(localStorage.getItem(nE)==="off")return!1}catch{}return null}function er(){var s;const n=qe({queryKey:["settings"],queryFn:lm,staleTime:1/0}),e=rE();return n.data&&e===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function sE(n){var u,d,b;const{data:e}=er(),s=((u=e==null?void 0:e.auth)==null?void 0:u.ssoKeepaliveSeconds)??0,i=((d=e==null?void 0:e.auth)==null?void 0:d.ssoKeepaliveIdleTimeoutSeconds)??0,o=E.useRef(Date.now()),c=E.useRef(Date.now()),m=E.useRef(!1),g=!!n&&((b=Eu(n))==null?void 0:b.sso)===!0&&s>0;E.useEffect(()=>{if(!g)return;const x=()=>{o.current=Date.now()};window.addEventListener("pointerdown",x,{passive:!0}),window.addEventListener("keydown",x,{passive:!0}),window.addEventListener("wheel",x,{passive:!0});const v=async()=>{if(!m.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-o.current>i*1e3)){m.current=!0;try{const C=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const P=await C.json().catch(()=>null);P!=null&&P.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:P.token}})))}catch{}finally{m.current=!1}}},w=setInterval(v,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&v()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),window.removeEventListener("wheel",x)}},[g,s,i])}const yx=E.createContext(null),iE=300;function Wh(n,e){if(om(n))return null;const s=Eu(n);if(!s)return null;const i=e??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):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 aE({children:n}){const[e,s]=E.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?om(b)?(sessionStorage.removeItem("lt_token"),null):(sc(b),Wh(b)):null}),i=E.useRef(void 0),o=E.useCallback(b=>{clearTimeout(i.current);const x=px(b);if(!x)return;const v=(x-iE)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const w=Eu(b);if(w!=null&&w.sso){const se=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!se.ok)return;const M=await se.json();M.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:M.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:P}=JSON.parse(S),q=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:P})});if(!q.ok)return;const re=await q.json();re.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:re.token}}))}catch{}},v))},[]),c=E.useCallback((b,x,v)=>{const w={displayName:(v==null?void 0:v.displayName)??null,username:(v==null?void 0:v.username)??(x==null?void 0:x.username)??null},S=Wh(b,w);S&&(sc(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),x&&sessionStorage.setItem("lt_credentials",JSON.stringify(x)),s(S),o(b))},[o]),m=E.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");sc(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)},[]);E.useEffect(()=>{const b=()=>m(),x=v=>{var C;const w=(C=v.detail)==null?void 0:C.token;if(!w)return;const S=Wh(w);S&&(sc(w),sessionStorage.setItem("lt_token",w),s(S),o(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",x),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",x)}},[m,o]),E.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&e&&o(b),()=>clearTimeout(i.current)},[]);const p=(e==null?void 0:e.roles.some(b=>b.type==="superadmin"))??!1,g=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.role===b))??!1,[e]),u=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.type===b))??!1,[e]),d=(e==null?void 0:e.roles.map(b=>b.role))??[];return h.jsxs(yx.Provider,{value:{user:e,isAuthenticated:!!e,isSuperAdmin:p,login:c,logout:m,hasRole:g,hasRoleType:u,userRoleNames:d},children:[h.jsx(oE,{authenticated:e!==null}),n]})}function oE({authenticated:n}){return sE(n?sessionStorage.getItem("lt_token"):null),null}function qt(){const n=E.useContext(yx);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}async function lE(n){if(!wd())return{kind:"session-ended"};try{const e=await ue("/nats-credentials"),s=e.natsWsUrl??n;return s?{kind:"ok",url:s,token:e.natsToken??null}:{kind:"unavailable"}}catch{return wd()?{kind:"unavailable"}:{kind:"session-ended"}}}const yo={initialDelayMs:1e3,maxDelayMs:6e4,noticeAfterMs:3e4,spreadMs:5e3};function cE(n,e,s=Math.random){const i=Math.min(e.maxDelayMs,e.initialDelayMs*2**Math.max(0,n));return Math.round(i/2+s()*(i/2))}function Fg(n,e=Math.random){return Math.round(e()*n.spreadMs)}function Gg(n){const e=(s,i)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:i;return{initialDelayMs:e(n==null?void 0:n.initialDelayMs,yo.initialDelayMs),maxDelayMs:e(n==null?void 0:n.maxDelayMs,yo.maxDelayMs),noticeAfterMs:e(n==null?void 0:n.noticeAfterMs,yo.noticeAfterMs),spreadMs:e(n==null?void 0:n.spreadMs,yo.spreadMs)}}const jn=new Uint8Array(0),ri=new TextEncoder,En=new TextDecoder;function uE(...n){let e=0;for(let o=0;o<n.length;o++)e+=n[o].length;const s=new Uint8Array(e);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function vo(...n){const e=[];for(let s=0;s<n.length;s++)e.push(ri.encode(n[s]));return e.length===0?jn:e.length===1?e[0]:uE(...e)}function Vg(n){return!n||n.length===0?"":En.decode(n)}const Yg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Kg=36,fE=0xcfd41b9100000,Jg=33,hE=333,Qg=22;function dE(n){for(let e=0;e<n.length;e++)n[e]=Math.floor(Math.random()*255)}function mE(n){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(n):dE(n)}class pE{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(Qg),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*fE),this.inc=Math.floor(Math.random()*(hE-Jg)+Jg)}setPre(){const e=new Uint8Array(12);mE(e);for(let s=0;s<12;s++){const i=e[s]%36;this.buf[s]=Yg.charCodeAt(i)}}fillSeq(){let e=this.seq;for(let s=Qg-1;s>=12;s--)this.buf[s]=Yg.charCodeAt(e%Kg),e=Math.floor(e/Kg)}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 Os=new pE;var Dr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Dr||(Dr={}));var Ji;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Ji||(Ji={}));var fe;(function(n){n.ApiError="BAD API",n.BadAuthentication="BAD_AUTHENTICATION",n.BadCreds="BAD_CREDS",n.BadHeader="BAD_HEADER",n.BadJson="BAD_JSON",n.BadPayload="BAD_PAYLOAD",n.BadSubject="BAD_SUBJECT",n.Cancelled="CANCELLED",n.ConnectionClosed="CONNECTION_CLOSED",n.ConnectionDraining="CONNECTION_DRAINING",n.ConnectionRefused="CONNECTION_REFUSED",n.ConnectionTimeout="CONNECTION_TIMEOUT",n.Disconnect="DISCONNECT",n.InvalidOption="INVALID_OPTION",n.InvalidPayload="INVALID_PAYLOAD",n.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",n.NoResponders="503",n.NotFunction="NOT_FUNC",n.RequestError="REQUEST_ERROR",n.ServerOptionNotAvailable="SERVER_OPT_NA",n.SubClosed="SUB_CLOSED",n.SubDraining="SUB_DRAINING",n.Timeout="TIMEOUT",n.Tls="TLS",n.Unknown="UNKNOWN_ERROR",n.WssRequired="WSS_REQUIRED",n.JetStreamInvalidAck="JESTREAM_INVALID_ACK",n.JetStream404NoMessages="404",n.JetStream408RequestTimeout="408",n.JetStream409MaxAckPendingExceeded="409",n.JetStream409="409",n.JetStreamNotEnabled="503",n.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",n.AuthorizationViolation="AUTHORIZATION_VIOLATION",n.AuthenticationExpired="AUTHENTICATION_EXPIRED",n.ProtocolError="NATS_PROTOCOL_ERR",n.PermissionsViolation="PERMISSIONS_VIOLATION",n.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",n.AccountExpired="ACCOUNT_EXPIRED"})(fe||(fe={}));function yE(n){return typeof n.code=="string"}class gx{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(fe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(fe.BadJson,"Bad JSON"),this.messages.set(fe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return gE.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const gE=new gx;class ge extends Error{constructor(s,i,o){super(s);j(this,"name");j(this,"message");j(this,"code");j(this,"permissionContext");j(this,"chainedError");j(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=o}static errorForCode(s,i){const o=gx.getMessage(s);return new ge(o,s,i)}isAuthError(){return this.code===fe.AuthenticationExpired||this.code===fe.AuthorizationViolation||this.code===fe.AccountExpired}isAuthTimeout(){return this.code===fe.AuthenticationTimeout}isPermissionError(){return this.code===fe.PermissionsViolation}isProtocolError(){return this.code===fe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var _n;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(_n||(_n={}));var Wn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Wn||(Wn={}));var _o;(function(n){n.STATS="io.nats.micro.v1.stats_response",n.INFO="io.nats.micro.v1.info_response",n.PING="io.nats.micro.v1.ping_response"})(_o||(_o={}));const uu="Nats-Service-Error",fu="Nats-Service-Error-Code";class hu extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return hu.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(fu))||"";if(i!==""){const m=parseInt(i)||400,p=((c=s==null?void 0:s.headers)==null?void 0:c.get(uu))||"";return new hu(m,p.length?p:i)}return null}}function Lr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${Os.next()}`}const Sd="127.0.0.1";var vs;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(vs||(vs={}));function Ou(n,...e){for(let s=0;s<e.length;s++){const i=e[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function ac(n){return En.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function na(n,e=!0){const s=e?ge.errorForCode(fe.Timeout):null;let i,o;const c=new Promise((m,p)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{p(s===null?ge.errorForCode(fe.Timeout):s)},n)});return Object.assign(c,i)}function ia(n=0){let e;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);e={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,e)}function mt(){let n={};const e=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(e,n)}function bx(n){for(let e=n.length-1;e>0;e--){const s=Math.floor(Math.random()*(e+1));[n[e],n[s]]=[n[s],n[e]]}return n}function bE(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function cm(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const e=n.length-1;return{backoff(s){return bE(s>e?n[e]:n[s])}}}function dt(n){return n*1e6}function um(n){return Math.floor(n/1e6)}function Xg(n){let i=!0;const o=new Array(n.length);for(let c=0;c<n.length;c++){let m=n.charCodeAt(c);if(m===58||m<33||m>126)throw new ge(`'${n[c]}' is not a valid character for a header key`,fe.BadHeader);i&&97<=m&&m<=122?m-=32:!i&&65<=m&&m<=90&&(m+=32),o[c]=m,i=m==45}return String.fromCharCode(...o)}function Pr(n=0,e=""){if(n===0&&e!==""||n>0&&e==="")throw new Error("setting status requires both code and description");return new _s(n,e)}const Zh="NATS/1.0";class _s{constructor(e=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=e,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[s,i]of this.headers){const o=e.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),m=[...o].sort();for(let p=0;p<c.length;p++)if(c[p]!==m[p])return!1}return!0}return!1}static decode(e){const s=new _s,o=En.decode(e).split(`\r
25
+ `+l.stack}}var la=Object.prototype.hasOwnProperty,ca=n.unstable_scheduleCallback,hr=n.unstable_cancelCallback,zo=n.unstable_shouldYield,si=n.unstable_requestPaint,ft=n.unstable_now,Bu=n.unstable_getCurrentPriorityLevel,Io=n.unstable_ImmediatePriority,$o=n.unstable_UserBlockingPriority,ii=n.unstable_NormalPriority,Uu=n.unstable_LowPriority,Ho=n.unstable_IdlePriority,zu=n.log,Fo=n.unstable_setDisableYieldValue,ks=null,_t=null;function un(t){if(typeof zu=="function"&&Fo(t),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(ks,t)}catch{}}var Ft=Math.clz32?Math.clz32:ai,ua=Math.log,fa=Math.LN2;function ai(t){return t>>>=0,t===0?32:31-(ua(t)/fa|0)|0}var zr=256,dr=262144,Ir=4194304;function Hn(t){var r=t&42;if(r!==0)return r;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ns(t,r,a){var l=t.pendingLanes;if(l===0)return 0;var f=0,y=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var O=l&134217727;return O!==0?(l=O&~y,l!==0?f=Hn(l):(w&=O,w!==0?f=Hn(w):a||(a=O&~t,a!==0&&(f=Hn(a))))):(O=l&~y,O!==0?f=Hn(O):w!==0?f=Hn(w):a||(a=l&~t,a!==0&&(f=Hn(a)))),f===0?0:r!==0&&r!==f&&(r&y)===0&&(y=f&-f,a=r&-r,y>=a||y===32&&(a&4194048)!==0)?r:f}function Ts(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function ha(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 oi(){var t=Ir;return Ir<<=1,(Ir&62914560)===0&&(Ir=4194304),t}function $r(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function Fn(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Hr(t,r,a,l,f,y){var w=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var O=t.entanglements,R=t.expirationTimes,V=t.hiddenUpdates;for(a=w&~a;0<a;){var Z=31-Ft(a),ie=1<<Z;O[Z]=0,R[Z]=-1;var Y=V[Z];if(Y!==null)for(V[Z]=null,Z=0;Z<Y.length;Z++){var Q=Y[Z];Q!==null&&(Q.lane&=-536870913)}a&=~ie}l!==0&&Fr(t,l,0),y!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=y&~(w&~r))}function Fr(t,r,a){t.pendingLanes|=r,t.suspendedLanes&=~r;var l=31-Ft(r);t.entangledLanes|=r,t.entanglements[l]=t.entanglements[l]|1073741824|a&261930}function Cs(t,r){var a=t.entangledLanes|=r;for(t=t.entanglements;a;){var l=31-Ft(a),f=1<<l;f&r|t[l]&r&&(t[l]|=r),a&=~f}}function Gr(t,r){var a=r&-r;return a=(a&42)!==0?1:mr(a),(a&(t.suspendedLanes|r))!==0?0:a}function mr(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Ms(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function da(){var t=J.p;return t!==0?t:(t=window.event,t===void 0?32:Og(t.type))}function Go(t,r){var a=J.p;try{return J.p=t,r()}finally{J.p=a}}var tr=Math.random().toString(36).slice(2),at="__reactFiber$"+tr,gt="__reactProps$"+tr,fn="__reactContainer$"+tr,Rs="__reactEvents$"+tr,ma="__reactListeners$"+tr,Vo="__reactHandles$"+tr,Yo="__reactResources$"+tr,Rt="__reactMarker$"+tr;function li(t){delete t[at],delete t[gt],delete t[Rs],delete t[ma],delete t[Vo]}function A(t){var r=t[at];if(r)return r;for(var a=t.parentNode;a;){if(r=a[fn]||a[at]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(t=cg(t);t!==null;){if(a=t[at])return a;t=cg(t)}return r}t=a,a=t.parentNode}return null}function N(t){if(t=t[at]||t[fn]){var r=t.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return t}return null}function k(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t.stateNode;throw Error(i(33))}function T(t){var r=t[Yo];return r||(r=t[Yo]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function L(t){t[Rt]=!0}var H=new Set,se={};function oe(t,r){K(t,r),K(t+"Capture",r)}function K(t,r){for(se[t]=r,t=0;t<r.length;t++)H.add(r[t])}var re=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]*$"),xe={},Pe={};function lt(t){return la.call(Pe,t)?!0:la.call(xe,t)?!1:re.test(t)?Pe[t]=!0:(xe[t]=!0,!1)}function Gt(t,r,a){if(lt(r))if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){t.removeAttribute(r);return}}t.setAttribute(r,""+a)}}function Gn(t,r,a){if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttribute(r,""+a)}}function pr(t,r,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(r,a,""+l)}}function Tn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ym(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function e_(t,r,a){var l=Object.getOwnPropertyDescriptor(t.constructor.prototype,r);if(!t.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,y=l.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return f.call(this)},set:function(w){a=""+w,y.call(this,w)}}),Object.defineProperty(t,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function Iu(t){if(!t._valueTracker){var r=Ym(t)?"checked":"value";t._valueTracker=e_(t,r,""+t[r])}}function Km(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return t&&(l=Ym(t)?t.checked?"true":"false":t.value),t=l,t!==a?(r.setValue(t),!0):!1}function Ko(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var t_=/[\n"\\]/g;function Cn(t){return t.replace(t_,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function $u(t,r,a,l,f,y,w,O){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),r!=null?w==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+Tn(r)):t.value!==""+Tn(r)&&(t.value=""+Tn(r)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),r!=null?Hu(t,w,Tn(r)):a!=null?Hu(t,w,Tn(a)):l!=null&&t.removeAttribute("value"),f==null&&y!=null&&(t.defaultChecked=!!y),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.name=""+Tn(O):t.removeAttribute("name")}function Jm(t,r,a,l,f,y,w,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),r!=null||a!=null){if(!(y!=="submit"&&y!=="reset"||r!=null)){Iu(t);return}a=a!=null?""+Tn(a):"",r=r!=null?""+Tn(r):a,O||r===t.value||(t.value=r),t.defaultValue=r}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,t.checked=O?t.checked:!!l,t.defaultChecked=!!l,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),Iu(t)}function Hu(t,r,a){r==="number"&&Ko(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function ci(t,r,a,l){if(t=t.options,r){r={};for(var f=0;f<a.length;f++)r["$"+a[f]]=!0;for(a=0;a<t.length;a++)f=r.hasOwnProperty("$"+t[a].value),t[a].selected!==f&&(t[a].selected=f),f&&l&&(t[a].defaultSelected=!0)}else{for(a=""+Tn(a),r=null,f=0;f<t.length;f++){if(t[f].value===a){t[f].selected=!0,l&&(t[f].defaultSelected=!0);return}r!==null||t[f].disabled||(r=t[f])}r!==null&&(r.selected=!0)}}function Qm(t,r,a){if(r!=null&&(r=""+Tn(r),r!==t.value&&(t.value=r),a==null)){t.defaultValue!==r&&(t.defaultValue=r);return}t.defaultValue=a!=null?""+Tn(a):""}function Xm(t,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(i(92));if(Oe(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=Tn(r),t.defaultValue=a,l=t.textContent,l===a&&l!==""&&l!==null&&(t.value=l),Iu(t)}function ui(t,r){if(r){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=r;return}}t.textContent=r}var n_=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 Wm(t,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="":l?t.setProperty(r,a):typeof a!="number"||a===0||n_.has(r)?r==="float"?t.cssFloat=a:t[r]=(""+a).trim():t[r]=a+"px"}function Zm(t,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(t=t.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="");for(var f in r)l=r[f],r.hasOwnProperty(f)&&a[f]!==l&&Wm(t,f,l)}else for(var y in r)r.hasOwnProperty(y)&&Wm(t,y,r[y])}function Fu(t){if(t.indexOf("-")===-1)return!1;switch(t){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 r_=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"]]),s_=/^[\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 Jo(t){return s_.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function yr(){}var Gu=null;function Vu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var fi=null,hi=null;function e0(t){var r=N(t);if(r&&(t=r.stateNode)){var a=t[gt]||null;e:switch(t=r.stateNode,r.type){case"input":if($u(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Cn(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==t&&l.form===t.form){var f=l[gt]||null;if(!f)throw Error(i(90));$u(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===t.form&&Km(l)}break e;case"textarea":Qm(t,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&ci(t,!!a.multiple,r,!1)}}}var Yu=!1;function t0(t,r,a){if(Yu)return t(r,a);Yu=!0;try{var l=t(r);return l}finally{if(Yu=!1,(fi!==null||hi!==null)&&(ql(),fi&&(r=fi,t=hi,hi=fi=null,e0(r),t)))for(r=0;r<t.length;r++)e0(t[r])}}function pa(t,r){var a=t.stateNode;if(a===null)return null;var l=a[gt]||null;if(l===null)return null;a=l[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(t=t.type,l=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!l;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(gr)try{var ya={};Object.defineProperty(ya,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",ya,ya),window.removeEventListener("test",ya,ya)}catch{Ku=!1}var Vr=null,Ju=null,Qo=null;function n0(){if(Qo)return Qo;var t,r=Ju,a=r.length,l,f="value"in Vr?Vr.value:Vr.textContent,y=f.length;for(t=0;t<a&&r[t]===f[t];t++);var w=a-t;for(l=1;l<=w&&r[a-l]===f[y-l];l++);return Qo=f.slice(t,1<l?1-l:void 0)}function Xo(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function Wo(){return!0}function r0(){return!1}function nn(t){function r(a,l,f,y,w){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=y,this.target=w,this.currentTarget=null;for(var O in t)t.hasOwnProperty(O)&&(a=t[O],this[O]=a?a(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Wo:r0,this.isPropagationStopped=r0,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Wo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Wo)},persist:function(){},isPersistent:Wo}),r}var Ds={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zo=nn(Ds),ga=b({},Ds,{view:0,detail:0}),i_=nn(ga),Qu,Xu,ba,el=b({},ga,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ba&&(ba&&t.type==="mousemove"?(Qu=t.screenX-ba.screenX,Xu=t.screenY-ba.screenY):Xu=Qu=0,ba=t),Qu)},movementY:function(t){return"movementY"in t?t.movementY:Xu}}),s0=nn(el),a_=b({},el,{dataTransfer:0}),o_=nn(a_),l_=b({},ga,{relatedTarget:0}),Wu=nn(l_),c_=b({},Ds,{animationName:0,elapsedTime:0,pseudoElement:0}),u_=nn(c_),f_=b({},Ds,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),h_=nn(f_),d_=b({},Ds,{data:0}),i0=nn(d_),m_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},p_={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"},y_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g_(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=y_[t])?!!r[t]:!1}function Zu(){return g_}var b_=b({},ga,{key:function(t){if(t.key){var r=m_[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=Xo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?p_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zu,charCode:function(t){return t.type==="keypress"?Xo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Xo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),x_=nn(b_),v_=b({},el,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),a0=nn(v_),__=b({},ga,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zu}),w_=nn(__),S_=b({},Ds,{propertyName:0,elapsedTime:0,pseudoElement:0}),E_=nn(S_),O_=b({},el,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),A_=nn(O_),j_=b({},Ds,{newState:0,oldState:0}),k_=nn(j_),N_=[9,13,27,32],ef=gr&&"CompositionEvent"in window,xa=null;gr&&"documentMode"in document&&(xa=document.documentMode);var T_=gr&&"TextEvent"in window&&!xa,o0=gr&&(!ef||xa&&8<xa&&11>=xa),l0=" ",c0=!1;function u0(t,r){switch(t){case"keyup":return N_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function f0(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var di=!1;function C_(t,r){switch(t){case"compositionend":return f0(r);case"keypress":return r.which!==32?null:(c0=!0,l0);case"textInput":return t=r.data,t===l0&&c0?null:t;default:return null}}function M_(t,r){if(di)return t==="compositionend"||!ef&&u0(t,r)?(t=n0(),Qo=Ju=Vr=null,di=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return o0&&r.locale!=="ko"?null:r.data;default:return null}}var R_={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 h0(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!R_[t.type]:r==="textarea"}function d0(t,r,a,l){fi?hi?hi.push(l):hi=[l]:fi=l,r=Hl(r,"onChange"),0<r.length&&(a=new Zo("onChange","change",null,a,l),t.push({event:a,listeners:r}))}var va=null,_a=null;function D_(t){Jy(t,0)}function tl(t){var r=k(t);if(Km(r))return t}function m0(t,r){if(t==="change")return r}var p0=!1;if(gr){var tf;if(gr){var nf="oninput"in document;if(!nf){var y0=document.createElement("div");y0.setAttribute("oninput","return;"),nf=typeof y0.oninput=="function"}tf=nf}else tf=!1;p0=tf&&(!document.documentMode||9<document.documentMode)}function g0(){va&&(va.detachEvent("onpropertychange",b0),_a=va=null)}function b0(t){if(t.propertyName==="value"&&tl(_a)){var r=[];d0(r,_a,t,Vu(t)),t0(D_,r)}}function L_(t,r,a){t==="focusin"?(g0(),va=r,_a=a,va.attachEvent("onpropertychange",b0)):t==="focusout"&&g0()}function q_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return tl(_a)}function P_(t,r){if(t==="click")return tl(r)}function B_(t,r){if(t==="input"||t==="change")return tl(r)}function U_(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var hn=typeof Object.is=="function"?Object.is:U_;function wa(t,r){if(hn(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var a=Object.keys(t),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!la.call(r,f)||!hn(t[f],r[f]))return!1}return!0}function x0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function v0(t,r){var a=x0(t);t=0;for(var l;a;){if(a.nodeType===3){if(l=t+a.textContent.length,t<=r&&l>=r)return{node:a,offset:r-t};t=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=x0(a)}}function _0(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?_0(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function w0(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=Ko(t.document);r instanceof t.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)t=r.contentWindow;else break;r=Ko(t.document)}return r}function rf(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var z_=gr&&"documentMode"in document&&11>=document.documentMode,mi=null,sf=null,Sa=null,af=!1;function S0(t,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;af||mi==null||mi!==Ko(l)||(l=mi,"selectionStart"in l&&rf(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Sa&&wa(Sa,l)||(Sa=l,l=Hl(sf,"onSelect"),0<l.length&&(r=new Zo("onSelect","select",null,r,a),t.push({event:r,listeners:l}),r.target=mi)))}function Ls(t,r){var a={};return a[t.toLowerCase()]=r.toLowerCase(),a["Webkit"+t]="webkit"+r,a["Moz"+t]="moz"+r,a}var pi={animationend:Ls("Animation","AnimationEnd"),animationiteration:Ls("Animation","AnimationIteration"),animationstart:Ls("Animation","AnimationStart"),transitionrun:Ls("Transition","TransitionRun"),transitionstart:Ls("Transition","TransitionStart"),transitioncancel:Ls("Transition","TransitionCancel"),transitionend:Ls("Transition","TransitionEnd")},of={},E0={};gr&&(E0=document.createElement("div").style,"AnimationEvent"in window||(delete pi.animationend.animation,delete pi.animationiteration.animation,delete pi.animationstart.animation),"TransitionEvent"in window||delete pi.transitionend.transition);function qs(t){if(of[t])return of[t];if(!pi[t])return t;var r=pi[t],a;for(a in r)if(r.hasOwnProperty(a)&&a in E0)return of[t]=r[a];return t}var O0=qs("animationend"),A0=qs("animationiteration"),j0=qs("animationstart"),I_=qs("transitionrun"),$_=qs("transitionstart"),H_=qs("transitioncancel"),k0=qs("transitionend"),N0=new Map,lf="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(" ");lf.push("scrollEnd");function Vn(t,r){N0.set(t,r),oe(r,[t])}var nl=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Mn=[],yi=0,cf=0;function rl(){for(var t=yi,r=cf=yi=0;r<t;){var a=Mn[r];Mn[r++]=null;var l=Mn[r];Mn[r++]=null;var f=Mn[r];Mn[r++]=null;var y=Mn[r];if(Mn[r++]=null,l!==null&&f!==null){var w=l.pending;w===null?f.next=f:(f.next=w.next,w.next=f),l.pending=f}y!==0&&T0(a,f,y)}}function sl(t,r,a,l){Mn[yi++]=t,Mn[yi++]=r,Mn[yi++]=a,Mn[yi++]=l,cf|=l,t.lanes|=l,t=t.alternate,t!==null&&(t.lanes|=l)}function uf(t,r,a,l){return sl(t,r,a,l),il(t)}function Ps(t,r){return sl(t,null,null,r),il(t)}function T0(t,r,a){t.lanes|=a;var l=t.alternate;l!==null&&(l.lanes|=a);for(var f=!1,y=t.return;y!==null;)y.childLanes|=a,l=y.alternate,l!==null&&(l.childLanes|=a),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(f=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,f&&r!==null&&(f=31-Ft(a),t=y.hiddenUpdates,l=t[f],l===null?t[f]=[r]:l.push(r),r.lane=a|536870912),y):null}function il(t){if(50<Ga)throw Ga=0,xh=null,Error(i(185));for(var r=t.return;r!==null;)t=r,r=t.return;return t.tag===3?t.stateNode:null}var gi={};function F_(t,r,a,l){this.tag=t,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=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(t,r,a,l){return new F_(t,r,a,l)}function ff(t){return t=t.prototype,!(!t||!t.isReactComponent)}function br(t,r){var a=t.alternate;return a===null?(a=dn(t.tag,r,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=r,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,r=t.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function C0(t,r){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=r,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,r=a.dependencies,t.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),t}function al(t,r,a,l,f,y){var w=0;if(l=t,typeof t=="function")ff(t)&&(w=1);else if(typeof t=="string")w=Jw(t,a,We.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=dn(31,a,r,f),t.elementType=I,t.lanes=y,t;case S:return Bs(a.children,f,y,r);case C:w=8,f|=24;break;case P:return t=dn(12,a,r,f|2),t.elementType=P,t.lanes=y,t;case M:return t=dn(13,a,r,f),t.elementType=M,t.lanes=y,t;case U:return t=dn(19,a,r,f),t.elementType=U,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ne:w=10;break e;case q:w=9;break e;case te:w=11;break e;case ae:w=14;break e;case z:w=16,l=null;break e}w=29,a=Error(i(130,t===null?"null":typeof t,"")),l=null}return r=dn(w,a,r,f),r.elementType=t,r.type=l,r.lanes=y,r}function Bs(t,r,a,l){return t=dn(7,t,l,r),t.lanes=a,t}function hf(t,r,a){return t=dn(6,t,null,r),t.lanes=a,t}function M0(t){var r=dn(18,null,null,0);return r.stateNode=t,r}function df(t,r,a){return r=dn(4,t.children!==null?t.children:[],t.key,r),r.lanes=a,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}var R0=new WeakMap;function Rn(t,r){if(typeof t=="object"&&t!==null){var a=R0.get(t);return a!==void 0?a:(r={value:t,source:r,stack:Ur(r)},R0.set(t,r),r)}return{value:t,source:r,stack:Ur(r)}}var bi=[],xi=0,ol=null,Ea=0,Dn=[],Ln=0,Yr=null,nr=1,rr="";function xr(t,r){bi[xi++]=Ea,bi[xi++]=ol,ol=t,Ea=r}function D0(t,r,a){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,Yr=t;var l=nr;t=rr;var f=32-Ft(l)-1;l&=~(1<<f),a+=1;var y=32-Ft(r)+f;if(30<y){var w=f-f%5;y=(l&(1<<w)-1).toString(32),l>>=w,f-=w,nr=1<<32-Ft(r)+f|a<<f|l,rr=y+t}else nr=1<<y|a<<f|l,rr=t}function mf(t){t.return!==null&&(xr(t,1),D0(t,1,0))}function pf(t){for(;t===ol;)ol=bi[--xi],bi[xi]=null,Ea=bi[--xi],bi[xi]=null;for(;t===Yr;)Yr=Dn[--Ln],Dn[Ln]=null,rr=Dn[--Ln],Dn[Ln]=null,nr=Dn[--Ln],Dn[Ln]=null}function L0(t,r){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,nr=r.id,rr=r.overflow,Yr=t}var zt=null,ct=null,Ge=!1,Kr=null,qn=!1,yf=Error(i(519));function Jr(t){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Oa(Rn(r,t)),yf}function q0(t){var r=t.stateNode,a=t.type,l=t.memoizedProps;switch(r[at]=t,r[gt]=l,a){case"dialog":Ie("cancel",r),Ie("close",r);break;case"iframe":case"object":case"embed":Ie("load",r);break;case"video":case"audio":for(a=0;a<Ya.length;a++)Ie(Ya[a],r);break;case"source":Ie("error",r);break;case"img":case"image":case"link":Ie("error",r),Ie("load",r);break;case"details":Ie("toggle",r);break;case"input":Ie("invalid",r),Jm(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ie("invalid",r);break;case"textarea":Ie("invalid",r),Xm(r,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||l.suppressHydrationWarning===!0||Zy(r.textContent,a)?(l.popover!=null&&(Ie("beforetoggle",r),Ie("toggle",r)),l.onScroll!=null&&Ie("scroll",r),l.onScrollEnd!=null&&Ie("scrollend",r),l.onClick!=null&&(r.onclick=yr),r=!0):r=!1,r||Jr(t,!0)}function P0(t){for(zt=t.return;zt;)switch(zt.tag){case 5:case 31:case 13:qn=!1;return;case 27:case 3:qn=!0;return;default:zt=zt.return}}function vi(t){if(t!==zt)return!1;if(!Ge)return P0(t),Ge=!0,!1;var r=t.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Dh(t.type,t.memoizedProps)),a=!a),a&&ct&&Jr(t),P0(t),r===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));ct=lg(t)}else if(r===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));ct=lg(t)}else r===27?(r=ct,cs(t.type)?(t=Uh,Uh=null,ct=t):ct=r):ct=zt?Bn(t.stateNode.nextSibling):null;return!0}function Us(){ct=zt=null,Ge=!1}function gf(){var t=Kr;return t!==null&&(on===null?on=t:on.push.apply(on,t),Kr=null),t}function Oa(t){Kr===null?Kr=[t]:Kr.push(t)}var bf=Ce(null),zs=null,vr=null;function Qr(t,r,a){Me(bf,r._currentValue),r._currentValue=a}function _r(t){t._currentValue=bf.current,Ne(bf)}function xf(t,r,a){for(;t!==null;){var l=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),t===a)break;t=t.return}}function vf(t,r,a,l){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var y=f.dependencies;if(y!==null){var w=f.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=f;for(var R=0;R<r.length;R++)if(O.context===r[R]){y.lanes|=a,O=y.alternate,O!==null&&(O.lanes|=a),xf(y.return,a,t),l||(w=null);break e}y=O.next}}else if(f.tag===18){if(w=f.return,w===null)throw Error(i(341));w.lanes|=a,y=w.alternate,y!==null&&(y.lanes|=a),xf(w,a,t),w=null}else w=f.child;if(w!==null)w.return=f;else for(w=f;w!==null;){if(w===t){w=null;break}if(f=w.sibling,f!==null){f.return=w.return,w=f;break}w=w.return}f=w}}function _i(t,r,a,l){t=null;for(var f=r,y=!1;f!==null;){if(!y){if((f.flags&524288)!==0)y=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var w=f.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var O=f.type;hn(f.pendingProps.value,w.value)||(t!==null?t.push(O):t=[O])}}else if(f===Se.current){if(w=f.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(Wa):t=[Wa])}f=f.return}t!==null&&vf(r,t,a,l),r.flags|=262144}function ll(t){for(t=t.firstContext;t!==null;){if(!hn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Is(t){zs=t,vr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function It(t){return B0(zs,t)}function cl(t,r){return zs===null&&Is(t),B0(t,r)}function B0(t,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},vr===null){if(t===null)throw Error(i(308));vr=r,t.dependencies={lanes:0,firstContext:r},t.flags|=524288}else vr=vr.next=r;return a}var G_=typeof AbortController<"u"?AbortController:function(){var t=[],r=this.signal={aborted:!1,addEventListener:function(a,l){t.push(l)}};this.abort=function(){r.aborted=!0,t.forEach(function(a){return a()})}},V_=n.unstable_scheduleCallback,Y_=n.unstable_NormalPriority,At={$$typeof:ne,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _f(){return{controller:new G_,data:new Map,refCount:0}}function Aa(t){t.refCount--,t.refCount===0&&V_(Y_,function(){t.controller.abort()})}var ja=null,wf=0,wi=0,Si=null;function K_(t,r){if(ja===null){var a=ja=[];wf=0,wi=Oh(),Si={status:"pending",value:void 0,then:function(l){a.push(l)}}}return wf++,r.then(U0,U0),r}function U0(){if(--wf===0&&ja!==null){Si!==null&&(Si.status="fulfilled");var t=ja;ja=null,wi=0,Si=null;for(var r=0;r<t.length;r++)(0,t[r])()}}function J_(t,r){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return t.then(function(){l.status="fulfilled",l.value=r;for(var f=0;f<a.length;f++)(0,a[f])(r)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var z0=F.S;F.S=function(t,r){Sy=ft(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&K_(t,r),z0!==null&&z0(t,r)};var $s=Ce(null);function Sf(){var t=$s.current;return t!==null?t:ot.pooledCache}function ul(t,r){r===null?Me($s,$s.current):Me($s,r.pool)}function I0(){var t=Sf();return t===null?null:{parent:At._currentValue,pool:t}}var Ei=Error(i(460)),Ef=Error(i(474)),fl=Error(i(542)),hl={then:function(){}};function $0(t){return t=t.status,t==="fulfilled"||t==="rejected"}function H0(t,r,a){switch(a=t[a],a===void 0?t.push(r):a!==r&&(r.then(yr,yr),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,G0(t),t;default:if(typeof r.status=="string")r.then(yr,yr);else{if(t=ot,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=r,t.status="pending",t.then(function(l){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=l}},function(l){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,G0(t),t}throw Fs=r,Ei}}function Hs(t){try{var r=t._init;return r(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Fs=a,Ei):a}}var Fs=null;function F0(){if(Fs===null)throw Error(i(459));var t=Fs;return Fs=null,t}function G0(t){if(t===Ei||t===fl)throw Error(i(483))}var Oi=null,ka=0;function dl(t){var r=ka;return ka+=1,Oi===null&&(Oi=[]),H0(Oi,t,r)}function Na(t,r){r=r.props.ref,t.ref=r!==void 0?r:null}function ml(t,r){throw r.$$typeof===x?Error(i(525)):(t=Object.prototype.toString.call(r),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t)))}function V0(t){function r($,B){if(t){var G=$.deletions;G===null?($.deletions=[B],$.flags|=16):G.push(B)}}function a($,B){if(!t)return null;for(;B!==null;)r($,B),B=B.sibling;return null}function l($){for(var B=new Map;$!==null;)$.key!==null?B.set($.key,$):B.set($.index,$),$=$.sibling;return B}function f($,B){return $=br($,B),$.index=0,$.sibling=null,$}function y($,B,G){return $.index=G,t?(G=$.alternate,G!==null?(G=G.index,G<B?($.flags|=67108866,B):G):($.flags|=67108866,B)):($.flags|=1048576,B)}function w($){return t&&$.alternate===null&&($.flags|=67108866),$}function O($,B,G,ee){return B===null||B.tag!==6?(B=hf(G,$.mode,ee),B.return=$,B):(B=f(B,G),B.return=$,B)}function R($,B,G,ee){var Ae=G.type;return Ae===S?Z($,B,G.props.children,ee,G.key):B!==null&&(B.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===z&&Hs(Ae)===B.type)?(B=f(B,G.props),Na(B,G),B.return=$,B):(B=al(G.type,G.key,G.props,null,$.mode,ee),Na(B,G),B.return=$,B)}function V($,B,G,ee){return B===null||B.tag!==4||B.stateNode.containerInfo!==G.containerInfo||B.stateNode.implementation!==G.implementation?(B=df(G,$.mode,ee),B.return=$,B):(B=f(B,G.children||[]),B.return=$,B)}function Z($,B,G,ee,Ae){return B===null||B.tag!==7?(B=Bs(G,$.mode,ee,Ae),B.return=$,B):(B=f(B,G),B.return=$,B)}function ie($,B,G){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=hf(""+B,$.mode,G),B.return=$,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case v:return G=al(B.type,B.key,B.props,null,$.mode,G),Na(G,B),G.return=$,G;case _:return B=df(B,$.mode,G),B.return=$,B;case z:return B=Hs(B),ie($,B,G)}if(Oe(B)||W(B))return B=Bs(B,$.mode,G,null),B.return=$,B;if(typeof B.then=="function")return ie($,dl(B),G);if(B.$$typeof===ne)return ie($,cl($,B),G);ml($,B)}return null}function Y($,B,G,ee){var Ae=B!==null?B.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return Ae!==null?null:O($,B,""+G,ee);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case v:return G.key===Ae?R($,B,G,ee):null;case _:return G.key===Ae?V($,B,G,ee):null;case z:return G=Hs(G),Y($,B,G,ee)}if(Oe(G)||W(G))return Ae!==null?null:Z($,B,G,ee,null);if(typeof G.then=="function")return Y($,B,dl(G),ee);if(G.$$typeof===ne)return Y($,B,cl($,G),ee);ml($,G)}return null}function Q($,B,G,ee,Ae){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return $=$.get(G)||null,O(B,$,""+ee,Ae);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return $=$.get(ee.key===null?G:ee.key)||null,R(B,$,ee,Ae);case _:return $=$.get(ee.key===null?G:ee.key)||null,V(B,$,ee,Ae);case z:return ee=Hs(ee),Q($,B,G,ee,Ae)}if(Oe(ee)||W(ee))return $=$.get(G)||null,Z(B,$,ee,Ae,null);if(typeof ee.then=="function")return Q($,B,G,dl(ee),Ae);if(ee.$$typeof===ne)return Q($,B,G,cl(B,ee),Ae);ml(B,ee)}return null}function ve($,B,G,ee){for(var Ae=null,Ke=null,_e=B,Le=B=0,He=null;_e!==null&&Le<G.length;Le++){_e.index>Le?(He=_e,_e=null):He=_e.sibling;var Je=Y($,_e,G[Le],ee);if(Je===null){_e===null&&(_e=He);break}t&&_e&&Je.alternate===null&&r($,_e),B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je,_e=He}if(Le===G.length)return a($,_e),Ge&&xr($,Le),Ae;if(_e===null){for(;Le<G.length;Le++)_e=ie($,G[Le],ee),_e!==null&&(B=y(_e,B,Le),Ke===null?Ae=_e:Ke.sibling=_e,Ke=_e);return Ge&&xr($,Le),Ae}for(_e=l(_e);Le<G.length;Le++)He=Q(_e,$,Le,G[Le],ee),He!==null&&(t&&He.alternate!==null&&_e.delete(He.key===null?Le:He.key),B=y(He,B,Le),Ke===null?Ae=He:Ke.sibling=He,Ke=He);return t&&_e.forEach(function(ms){return r($,ms)}),Ge&&xr($,Le),Ae}function Te($,B,G,ee){if(G==null)throw Error(i(151));for(var Ae=null,Ke=null,_e=B,Le=B=0,He=null,Je=G.next();_e!==null&&!Je.done;Le++,Je=G.next()){_e.index>Le?(He=_e,_e=null):He=_e.sibling;var ms=Y($,_e,Je.value,ee);if(ms===null){_e===null&&(_e=He);break}t&&_e&&ms.alternate===null&&r($,_e),B=y(ms,B,Le),Ke===null?Ae=ms:Ke.sibling=ms,Ke=ms,_e=He}if(Je.done)return a($,_e),Ge&&xr($,Le),Ae;if(_e===null){for(;!Je.done;Le++,Je=G.next())Je=ie($,Je.value,ee),Je!==null&&(B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je);return Ge&&xr($,Le),Ae}for(_e=l(_e);!Je.done;Le++,Je=G.next())Je=Q(_e,$,Le,Je.value,ee),Je!==null&&(t&&Je.alternate!==null&&_e.delete(Je.key===null?Le:Je.key),B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je);return t&&_e.forEach(function(aS){return r($,aS)}),Ge&&xr($,Le),Ae}function st($,B,G,ee){if(typeof G=="object"&&G!==null&&G.type===S&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case v:e:{for(var Ae=G.key;B!==null;){if(B.key===Ae){if(Ae=G.type,Ae===S){if(B.tag===7){a($,B.sibling),ee=f(B,G.props.children),ee.return=$,$=ee;break e}}else if(B.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===z&&Hs(Ae)===B.type){a($,B.sibling),ee=f(B,G.props),Na(ee,G),ee.return=$,$=ee;break e}a($,B);break}else r($,B);B=B.sibling}G.type===S?(ee=Bs(G.props.children,$.mode,ee,G.key),ee.return=$,$=ee):(ee=al(G.type,G.key,G.props,null,$.mode,ee),Na(ee,G),ee.return=$,$=ee)}return w($);case _:e:{for(Ae=G.key;B!==null;){if(B.key===Ae)if(B.tag===4&&B.stateNode.containerInfo===G.containerInfo&&B.stateNode.implementation===G.implementation){a($,B.sibling),ee=f(B,G.children||[]),ee.return=$,$=ee;break e}else{a($,B);break}else r($,B);B=B.sibling}ee=df(G,$.mode,ee),ee.return=$,$=ee}return w($);case z:return G=Hs(G),st($,B,G,ee)}if(Oe(G))return ve($,B,G,ee);if(W(G)){if(Ae=W(G),typeof Ae!="function")throw Error(i(150));return G=Ae.call(G),Te($,B,G,ee)}if(typeof G.then=="function")return st($,B,dl(G),ee);if(G.$$typeof===ne)return st($,B,cl($,G),ee);ml($,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,B!==null&&B.tag===6?(a($,B.sibling),ee=f(B,G),ee.return=$,$=ee):(a($,B),ee=hf(G,$.mode,ee),ee.return=$,$=ee),w($)):a($,B)}return function($,B,G,ee){try{ka=0;var Ae=st($,B,G,ee);return Oi=null,Ae}catch(_e){if(_e===Ei||_e===fl)throw _e;var Ke=dn(29,_e,null,$.mode);return Ke.lanes=ee,Ke.return=$,Ke}finally{}}}var Gs=V0(!0),Y0=V0(!1),Xr=!1;function Of(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Af(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Wr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(t,r,a){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),l.pending=r,r=il(t),T0(t,null,a),r}return sl(t,l,r,a),il(t)}function Ta(t,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=t.pendingLanes,a|=l,r.lanes=a,Cs(t,a)}}function jf(t,r){var a=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,y=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};y===null?f=y=w:y=y.next=w,a=a.next}while(a!==null);y===null?f=y=r:y=y.next=r}else f=y=r;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:y,shared:l.shared,callbacks:l.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=r:t.next=r,a.lastBaseUpdate=r}var kf=!1;function Ca(){if(kf){var t=Si;if(t!==null)throw t}}function Ma(t,r,a,l){kf=!1;var f=t.updateQueue;Xr=!1;var y=f.firstBaseUpdate,w=f.lastBaseUpdate,O=f.shared.pending;if(O!==null){f.shared.pending=null;var R=O,V=R.next;R.next=null,w===null?y=V:w.next=V,w=R;var Z=t.alternate;Z!==null&&(Z=Z.updateQueue,O=Z.lastBaseUpdate,O!==w&&(O===null?Z.firstBaseUpdate=V:O.next=V,Z.lastBaseUpdate=R))}if(y!==null){var ie=f.baseState;w=0,Z=V=R=null,O=y;do{var Y=O.lane&-536870913,Q=Y!==O.lane;if(Q?($e&Y)===Y:(l&Y)===Y){Y!==0&&Y===wi&&(kf=!0),Z!==null&&(Z=Z.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var ve=t,Te=O;Y=r;var st=a;switch(Te.tag){case 1:if(ve=Te.payload,typeof ve=="function"){ie=ve.call(st,ie,Y);break e}ie=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Te.payload,Y=typeof ve=="function"?ve.call(st,ie,Y):ve,Y==null)break e;ie=b({},ie,Y);break e;case 2:Xr=!0}}Y=O.callback,Y!==null&&(t.flags|=64,Q&&(t.flags|=8192),Q=f.callbacks,Q===null?f.callbacks=[Y]:Q.push(Y))}else Q={lane:Y,tag:O.tag,payload:O.payload,callback:O.callback,next:null},Z===null?(V=Z=Q,R=ie):Z=Z.next=Q,w|=Y;if(O=O.next,O===null){if(O=f.shared.pending,O===null)break;Q=O,O=Q.next,Q.next=null,f.lastBaseUpdate=Q,f.shared.pending=null}}while(!0);Z===null&&(R=ie),f.baseState=R,f.firstBaseUpdate=V,f.lastBaseUpdate=Z,y===null&&(f.shared.lanes=0),ss|=w,t.lanes=w,t.memoizedState=ie}}function K0(t,r){if(typeof t!="function")throw Error(i(191,t));t.call(r)}function J0(t,r){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)K0(a[t],r)}var Ai=Ce(null),pl=Ce(0);function Q0(t,r){t=Tr,Me(pl,t),Me(Ai,r),Tr=t|r.baseLanes}function Nf(){Me(pl,Tr),Me(Ai,Ai.current)}function Tf(){Tr=pl.current,Ne(Ai),Ne(pl)}var mn=Ce(null),Pn=null;function es(t){var r=t.alternate;Me(wt,wt.current&1),Me(mn,t),Pn===null&&(r===null||Ai.current!==null||r.memoizedState!==null)&&(Pn=t)}function Cf(t){Me(wt,wt.current),Me(mn,t),Pn===null&&(Pn=t)}function X0(t){t.tag===22?(Me(wt,wt.current),Me(mn,t),Pn===null&&(Pn=t)):ts()}function ts(){Me(wt,wt.current),Me(mn,mn.current)}function pn(t){Ne(mn),Pn===t&&(Pn=null),Ne(wt)}var wt=Ce(0);function yl(t){for(var r=t;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ph(a)||Bh(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var wr=0,De=null,nt=null,jt=null,gl=!1,ji=!1,Vs=!1,bl=0,Ra=0,ki=null,Q_=0;function bt(){throw Error(i(321))}function Mf(t,r){if(r===null)return!1;for(var a=0;a<r.length&&a<t.length;a++)if(!hn(t[a],r[a]))return!1;return!0}function Rf(t,r,a,l,f,y){return wr=y,De=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,F.H=t===null||t.memoizedState===null?Dp:Kf,Vs=!1,y=a(l,f),Vs=!1,ji&&(y=Z0(r,a,l,f)),W0(t),y}function W0(t){F.H=qa;var r=nt!==null&&nt.next!==null;if(wr=0,jt=nt=De=null,gl=!1,Ra=0,ki=null,r)throw Error(i(300));t===null||kt||(t=t.dependencies,t!==null&&ll(t)&&(kt=!0))}function Z0(t,r,a,l){De=t;var f=0;do{if(ji&&(ki=null),Ra=0,ji=!1,25<=f)throw Error(i(301));if(f+=1,jt=nt=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}F.H=Lp,y=r(a,l)}while(ji);return y}function X_(){var t=F.H,r=t.useState()[0];return r=typeof r.then=="function"?Da(r):r,t=t.useState()[0],(nt!==null?nt.memoizedState:null)!==t&&(De.flags|=1024),r}function Df(){var t=bl!==0;return bl=0,t}function Lf(t,r,a){r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~a}function qf(t){if(gl){for(t=t.memoizedState;t!==null;){var r=t.queue;r!==null&&(r.pending=null),t=t.next}gl=!1}wr=0,jt=nt=De=null,ji=!1,Ra=bl=0,ki=null}function Yt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?De.memoizedState=jt=t:jt=jt.next=t,jt}function St(){if(nt===null){var t=De.alternate;t=t!==null?t.memoizedState:null}else t=nt.next;var r=jt===null?De.memoizedState:jt.next;if(r!==null)jt=r,nt=t;else{if(t===null)throw De.alternate===null?Error(i(467)):Error(i(310));nt=t,t={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},jt===null?De.memoizedState=jt=t:jt=jt.next=t}return jt}function xl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Da(t){var r=Ra;return Ra+=1,ki===null&&(ki=[]),t=H0(ki,t,r),r=De,(jt===null?r.memoizedState:jt.next)===null&&(r=r.alternate,F.H=r===null||r.memoizedState===null?Dp:Kf),t}function vl(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Da(t);if(t.$$typeof===ne)return It(t)}throw Error(i(438,String(t)))}function Pf(t){var r=null,a=De.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=De.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=xl(),De.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(t),l=0;l<t;l++)a[l]=D;return r.index++,a}function Sr(t,r){return typeof r=="function"?r(t):r}function _l(t){var r=St();return Bf(r,nt,t)}function Bf(t,r,a){var l=t.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var f=t.baseQueue,y=l.pending;if(y!==null){if(f!==null){var w=f.next;f.next=y.next,y.next=w}r.baseQueue=f=y,l.pending=null}if(y=t.baseState,f===null)t.memoizedState=y;else{r=f.next;var O=w=null,R=null,V=r,Z=!1;do{var ie=V.lane&-536870913;if(ie!==V.lane?($e&ie)===ie:(wr&ie)===ie){var Y=V.revertLane;if(Y===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),ie===wi&&(Z=!0);else if((wr&Y)===Y){V=V.next,Y===wi&&(Z=!0);continue}else ie={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=ie,w=y):R=R.next=ie,De.lanes|=Y,ss|=Y;ie=V.action,Vs&&a(y,ie),y=V.hasEagerState?V.eagerState:a(y,ie)}else Y={lane:ie,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=Y,w=y):R=R.next=Y,De.lanes|=ie,ss|=ie;V=V.next}while(V!==null&&V!==r);if(R===null?w=y:R.next=O,!hn(y,t.memoizedState)&&(kt=!0,Z&&(a=Si,a!==null)))throw a;t.memoizedState=y,t.baseState=w,t.baseQueue=R,l.lastRenderedState=y}return f===null&&(l.lanes=0),[t.memoizedState,l.dispatch]}function Uf(t){var r=St(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var l=a.dispatch,f=a.pending,y=r.memoizedState;if(f!==null){a.pending=null;var w=f=f.next;do y=t(y,w.action),w=w.next;while(w!==f);hn(y,r.memoizedState)||(kt=!0),r.memoizedState=y,r.baseQueue===null&&(r.baseState=y),a.lastRenderedState=y}return[y,l]}function ep(t,r,a){var l=De,f=St(),y=Ge;if(y){if(a===void 0)throw Error(i(407));a=a()}else a=r();var w=!hn((nt||f).memoizedState,a);if(w&&(f.memoizedState=a,kt=!0),f=f.queue,$f(rp.bind(null,l,f,t),[t]),f.getSnapshot!==r||w||jt!==null&&jt.memoizedState.tag&1){if(l.flags|=2048,Ni(9,{destroy:void 0},np.bind(null,l,f,a,r),null),ot===null)throw Error(i(349));y||(wr&127)!==0||tp(l,r,a)}return a}function tp(t,r,a){t.flags|=16384,t={getSnapshot:r,value:a},r=De.updateQueue,r===null?(r=xl(),De.updateQueue=r,r.stores=[t]):(a=r.stores,a===null?r.stores=[t]:a.push(t))}function np(t,r,a,l){r.value=a,r.getSnapshot=l,sp(r)&&ip(t)}function rp(t,r,a){return a(function(){sp(r)&&ip(t)})}function sp(t){var r=t.getSnapshot;t=t.value;try{var a=r();return!hn(t,a)}catch{return!0}}function ip(t){var r=Ps(t,2);r!==null&&ln(r,t,2)}function zf(t){var r=Yt();if(typeof t=="function"){var a=t;if(t=a(),Vs){un(!0);try{a()}finally{un(!1)}}}return r.memoizedState=r.baseState=t,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:t},r}function ap(t,r,a,l){return t.baseState=a,Bf(t,nt,typeof l=="function"?l:Sr)}function W_(t,r,a,l,f){if(El(t))throw Error(i(485));if(t=r.action,t!==null){var y={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){y.listeners.push(w)}};F.T!==null?a(!0):y.isTransition=!1,l(y),a=r.pending,a===null?(y.next=r.pending=y,op(r,y)):(y.next=a.next,r.pending=a.next=y)}}function op(t,r){var a=r.action,l=r.payload,f=t.state;if(r.isTransition){var y=F.T,w={};F.T=w;try{var O=a(f,l),R=F.S;R!==null&&R(w,O),lp(t,r,O)}catch(V){If(t,r,V)}finally{y!==null&&w.types!==null&&(y.types=w.types),F.T=y}}else try{y=a(f,l),lp(t,r,y)}catch(V){If(t,r,V)}}function lp(t,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){cp(t,r,l)},function(l){return If(t,r,l)}):cp(t,r,a)}function cp(t,r,a){r.status="fulfilled",r.value=a,up(r),t.state=a,r=t.pending,r!==null&&(a=r.next,a===r?t.pending=null:(a=a.next,r.next=a,op(t,a)))}function If(t,r,a){var l=t.pending;if(t.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,up(r),r=r.next;while(r!==l)}t.action=null}function up(t){t=t.listeners;for(var r=0;r<t.length;r++)(0,t[r])()}function fp(t,r){return r}function hp(t,r){if(Ge){var a=ot.formState;if(a!==null){e:{var l=De;if(Ge){if(ct){t:{for(var f=ct,y=qn;f.nodeType!==8;){if(!y){f=null;break t}if(f=Bn(f.nextSibling),f===null){f=null;break t}}y=f.data,f=y==="F!"||y==="F"?f:null}if(f){ct=Bn(f.nextSibling),l=f.data==="F!";break e}}Jr(l)}l=!1}l&&(r=a[0])}}return a=Yt(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fp,lastRenderedState:r},a.queue=l,a=Cp.bind(null,De,l),l.dispatch=a,l=zf(!1),y=Yf.bind(null,De,!1,l.queue),l=Yt(),f={state:r,dispatch:null,action:t,pending:null},l.queue=f,a=W_.bind(null,De,f,y,a),f.dispatch=a,l.memoizedState=t,[r,a,!1]}function dp(t){var r=St();return mp(r,nt,t)}function mp(t,r,a){if(r=Bf(t,r,fp)[0],t=_l(Sr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Da(r)}catch(w){throw w===Ei?fl:w}else l=r;r=St();var f=r.queue,y=f.dispatch;return a!==r.memoizedState&&(De.flags|=2048,Ni(9,{destroy:void 0},Z_.bind(null,f,a),null)),[l,y,t]}function Z_(t,r){t.action=r}function pp(t){var r=St(),a=nt;if(a!==null)return mp(r,a,t);St(),r=r.memoizedState,a=St();var l=a.queue.dispatch;return a.memoizedState=t,[r,l,!1]}function Ni(t,r,a,l){return t={tag:t,create:a,deps:l,inst:r,next:null},r=De.updateQueue,r===null&&(r=xl(),De.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=t.next=t:(l=a.next,a.next=t,t.next=l,r.lastEffect=t),t}function yp(){return St().memoizedState}function wl(t,r,a,l){var f=Yt();De.flags|=t,f.memoizedState=Ni(1|r,{destroy:void 0},a,l===void 0?null:l)}function Sl(t,r,a,l){var f=St();l=l===void 0?null:l;var y=f.memoizedState.inst;nt!==null&&l!==null&&Mf(l,nt.memoizedState.deps)?f.memoizedState=Ni(r,y,a,l):(De.flags|=t,f.memoizedState=Ni(1|r,y,a,l))}function gp(t,r){wl(8390656,8,t,r)}function $f(t,r){Sl(2048,8,t,r)}function ew(t){De.flags|=4;var r=De.updateQueue;if(r===null)r=xl(),De.updateQueue=r,r.events=[t];else{var a=r.events;a===null?r.events=[t]:a.push(t)}}function bp(t){var r=St().memoizedState;return ew({ref:r,nextImpl:t}),function(){if((Qe&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function xp(t,r){return Sl(4,2,t,r)}function vp(t,r){return Sl(4,4,t,r)}function _p(t,r){if(typeof r=="function"){t=t();var a=r(t);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function wp(t,r,a){a=a!=null?a.concat([t]):null,Sl(4,4,_p.bind(null,r,t),a)}function Hf(){}function Sp(t,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Mf(r,l[1])?l[0]:(a.memoizedState=[t,r],t)}function Ep(t,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Mf(r,l[1]))return l[0];if(l=t(),Vs){un(!0);try{t()}finally{un(!1)}}return a.memoizedState=[l,r],l}function Ff(t,r,a){return a===void 0||(wr&1073741824)!==0&&($e&261930)===0?t.memoizedState=r:(t.memoizedState=a,t=Oy(),De.lanes|=t,ss|=t,a)}function Op(t,r,a,l){return hn(a,r)?a:Ai.current!==null?(t=Ff(t,a,l),hn(t,r)||(kt=!0),t):(wr&42)===0||(wr&1073741824)!==0&&($e&261930)===0?(kt=!0,t.memoizedState=a):(t=Oy(),De.lanes|=t,ss|=t,r)}function Ap(t,r,a,l,f){var y=J.p;J.p=y!==0&&8>y?y:8;var w=F.T,O={};F.T=O,Yf(t,!1,r,a);try{var R=f(),V=F.S;if(V!==null&&V(O,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Z=J_(R,l);La(t,r,Z,bn(t))}else La(t,r,l,bn(t))}catch(ie){La(t,r,{then:function(){},status:"rejected",reason:ie},bn())}finally{J.p=y,w!==null&&O.types!==null&&(w.types=O.types),F.T=w}}function tw(){}function Gf(t,r,a,l){if(t.tag!==5)throw Error(i(476));var f=jp(t).queue;Ap(t,f,r,le,a===null?tw:function(){return kp(t),a(l)})}function jp(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:le},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:a},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function kp(t){var r=jp(t);r.next===null&&(r=t.alternate.memoizedState),La(t,r.next.queue,{},bn())}function Vf(){return It(Wa)}function Np(){return St().memoizedState}function Tp(){return St().memoizedState}function nw(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var a=bn();t=Wr(a);var l=Zr(r,t,a);l!==null&&(ln(l,r,a),Ta(l,r,a)),r={cache:_f()},t.payload=r;return}r=r.return}}function rw(t,r,a){var l=bn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},El(t)?Mp(r,a):(a=uf(t,r,a,l),a!==null&&(ln(a,t,l),Rp(a,r,l)))}function Cp(t,r,a){var l=bn();La(t,r,a,l)}function La(t,r,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(El(t))Mp(r,f);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=r.lastRenderedReducer,y!==null))try{var w=r.lastRenderedState,O=y(w,a);if(f.hasEagerState=!0,f.eagerState=O,hn(O,w))return sl(t,r,f,0),ot===null&&rl(),!1}catch{}finally{}if(a=uf(t,r,f,l),a!==null)return ln(a,t,l),Rp(a,r,l),!0}return!1}function Yf(t,r,a,l){if(l={lane:2,revertLane:Oh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},El(t)){if(r)throw Error(i(479))}else r=uf(t,a,l,2),r!==null&&ln(r,t,2)}function El(t){var r=t.alternate;return t===De||r!==null&&r===De}function Mp(t,r){ji=gl=!0;var a=t.pending;a===null?r.next=r:(r.next=a.next,a.next=r),t.pending=r}function Rp(t,r,a){if((a&4194048)!==0){var l=r.lanes;l&=t.pendingLanes,a|=l,r.lanes=a,Cs(t,a)}}var qa={readContext:It,use:vl,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};qa.useEffectEvent=bt;var Dp={readContext:It,use:vl,useCallback:function(t,r){return Yt().memoizedState=[t,r===void 0?null:r],t},useContext:It,useEffect:gp,useImperativeHandle:function(t,r,a){a=a!=null?a.concat([t]):null,wl(4194308,4,_p.bind(null,r,t),a)},useLayoutEffect:function(t,r){return wl(4194308,4,t,r)},useInsertionEffect:function(t,r){wl(4,2,t,r)},useMemo:function(t,r){var a=Yt();r=r===void 0?null:r;var l=t();if(Vs){un(!0);try{t()}finally{un(!1)}}return a.memoizedState=[l,r],l},useReducer:function(t,r,a){var l=Yt();if(a!==void 0){var f=a(r);if(Vs){un(!0);try{a(r)}finally{un(!1)}}}else f=r;return l.memoizedState=l.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},l.queue=t,t=t.dispatch=rw.bind(null,De,t),[l.memoizedState,t]},useRef:function(t){var r=Yt();return t={current:t},r.memoizedState=t},useState:function(t){t=zf(t);var r=t.queue,a=Cp.bind(null,De,r);return r.dispatch=a,[t.memoizedState,a]},useDebugValue:Hf,useDeferredValue:function(t,r){var a=Yt();return Ff(a,t,r)},useTransition:function(){var t=zf(!1);return t=Ap.bind(null,De,t.queue,!0,!1),Yt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,a){var l=De,f=Yt();if(Ge){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),ot===null)throw Error(i(349));($e&127)!==0||tp(l,r,a)}f.memoizedState=a;var y={value:a,getSnapshot:r};return f.queue=y,gp(rp.bind(null,l,y,t),[t]),l.flags|=2048,Ni(9,{destroy:void 0},np.bind(null,l,y,a,r),null),a},useId:function(){var t=Yt(),r=ot.identifierPrefix;if(Ge){var a=rr,l=nr;a=(l&~(1<<32-Ft(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=bl++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=Q_++,r="_"+r+"r_"+a.toString(32)+"_";return t.memoizedState=r},useHostTransitionStatus:Vf,useFormState:hp,useActionState:hp,useOptimistic:function(t){var r=Yt();r.memoizedState=r.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Yf.bind(null,De,!0,a),a.dispatch=r,[t,r]},useMemoCache:Pf,useCacheRefresh:function(){return Yt().memoizedState=nw.bind(null,De)},useEffectEvent:function(t){var r=Yt(),a={impl:t};return r.memoizedState=a,function(){if((Qe&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Kf={readContext:It,use:vl,useCallback:Sp,useContext:It,useEffect:$f,useImperativeHandle:wp,useInsertionEffect:xp,useLayoutEffect:vp,useMemo:Ep,useReducer:_l,useRef:yp,useState:function(){return _l(Sr)},useDebugValue:Hf,useDeferredValue:function(t,r){var a=St();return Op(a,nt.memoizedState,t,r)},useTransition:function(){var t=_l(Sr)[0],r=St().memoizedState;return[typeof t=="boolean"?t:Da(t),r]},useSyncExternalStore:ep,useId:Np,useHostTransitionStatus:Vf,useFormState:dp,useActionState:dp,useOptimistic:function(t,r){var a=St();return ap(a,nt,t,r)},useMemoCache:Pf,useCacheRefresh:Tp};Kf.useEffectEvent=bp;var Lp={readContext:It,use:vl,useCallback:Sp,useContext:It,useEffect:$f,useImperativeHandle:wp,useInsertionEffect:xp,useLayoutEffect:vp,useMemo:Ep,useReducer:Uf,useRef:yp,useState:function(){return Uf(Sr)},useDebugValue:Hf,useDeferredValue:function(t,r){var a=St();return nt===null?Ff(a,t,r):Op(a,nt.memoizedState,t,r)},useTransition:function(){var t=Uf(Sr)[0],r=St().memoizedState;return[typeof t=="boolean"?t:Da(t),r]},useSyncExternalStore:ep,useId:Np,useHostTransitionStatus:Vf,useFormState:pp,useActionState:pp,useOptimistic:function(t,r){var a=St();return nt!==null?ap(a,nt,t,r):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Pf,useCacheRefresh:Tp};Lp.useEffectEvent=bp;function Jf(t,r,a,l){r=t.memoizedState,a=a(l,r),a=a==null?r:b({},r,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Qf={enqueueSetState:function(t,r,a){t=t._reactInternals;var l=bn(),f=Wr(l);f.payload=r,a!=null&&(f.callback=a),r=Zr(t,f,l),r!==null&&(ln(r,t,l),Ta(r,t,l))},enqueueReplaceState:function(t,r,a){t=t._reactInternals;var l=bn(),f=Wr(l);f.tag=1,f.payload=r,a!=null&&(f.callback=a),r=Zr(t,f,l),r!==null&&(ln(r,t,l),Ta(r,t,l))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var a=bn(),l=Wr(a);l.tag=2,r!=null&&(l.callback=r),r=Zr(t,l,a),r!==null&&(ln(r,t,a),Ta(r,t,a))}};function qp(t,r,a,l,f,y,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(l,y,w):r.prototype&&r.prototype.isPureReactComponent?!wa(a,l)||!wa(f,y):!0}function Pp(t,r,a,l){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==t&&Qf.enqueueReplaceState(r,r.state,null)}function Ys(t,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(t=t.defaultProps){a===r&&(a=b({},a));for(var f in t)a[f]===void 0&&(a[f]=t[f])}return a}function Bp(t){nl(t)}function Up(t){console.error(t)}function zp(t){nl(t)}function Ol(t,r){try{var a=t.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function Ip(t,r,a){try{var l=t.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Xf(t,r,a){return a=Wr(a),a.tag=3,a.payload={element:null},a.callback=function(){Ol(t,r)},a}function $p(t){return t=Wr(t),t.tag=3,t}function Hp(t,r,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var y=l.value;t.payload=function(){return f(y)},t.callback=function(){Ip(r,a,l)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){Ip(r,a,l),typeof f!="function"&&(is===null?is=new Set([this]):is.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})})}function sw(t,r,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&_i(r,a,f,!0),a=mn.current,a!==null){switch(a.tag){case 31:case 13:return Pn===null?Pl():a.alternate===null&&xt===0&&(xt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===hl?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),wh(t,l,f)),!1;case 22:return a.flags|=65536,l===hl?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([l]):a.add(l)),wh(t,l,f)),!1}throw Error(i(435,a.tag))}return wh(t,l,f),Pl(),!1}if(Ge)return r=mn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,l!==yf&&(t=Error(i(422),{cause:l}),Oa(Rn(t,a)))):(l!==yf&&(r=Error(i(423),{cause:l}),Oa(Rn(r,a))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,l=Rn(l,a),f=Xf(t.stateNode,l,f),jf(t,f),xt!==4&&(xt=2)),!1;var y=Error(i(520),{cause:l});if(y=Rn(y,a),Fa===null?Fa=[y]:Fa.push(y),xt!==4&&(xt=2),r===null)return!0;l=Rn(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,t=f&-f,a.lanes|=t,t=Xf(a.stateNode,l,t),jf(a,t),!1;case 1:if(r=a.type,y=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(is===null||!is.has(y))))return a.flags|=65536,f&=-f,a.lanes|=f,f=$p(f),Hp(f,t,a,l),jf(a,f),!1}a=a.return}while(a!==null);return!1}var Wf=Error(i(461)),kt=!1;function $t(t,r,a,l){r.child=t===null?Y0(r,null,a,l):Gs(r,t.child,a,l)}function Fp(t,r,a,l,f){a=a.render;var y=r.ref;if("ref"in l){var w={};for(var O in l)O!=="ref"&&(w[O]=l[O])}else w=l;return Is(r),l=Rf(t,r,a,w,y,f),O=Df(),t!==null&&!kt?(Lf(t,r,f),Er(t,r,f)):(Ge&&O&&mf(r),r.flags|=1,$t(t,r,l,f),r.child)}function Gp(t,r,a,l,f){if(t===null){var y=a.type;return typeof y=="function"&&!ff(y)&&y.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=y,Vp(t,r,y,l,f)):(t=al(a.type,null,l,r,r.mode,f),t.ref=r.ref,t.return=r,r.child=t)}if(y=t.child,!ah(t,f)){var w=y.memoizedProps;if(a=a.compare,a=a!==null?a:wa,a(w,l)&&t.ref===r.ref)return Er(t,r,f)}return r.flags|=1,t=br(y,l),t.ref=r.ref,t.return=r,r.child=t}function Vp(t,r,a,l,f){if(t!==null){var y=t.memoizedProps;if(wa(y,l)&&t.ref===r.ref)if(kt=!1,r.pendingProps=l=y,ah(t,f))(t.flags&131072)!==0&&(kt=!0);else return r.lanes=t.lanes,Er(t,r,f)}return Zf(t,r,a,l,f)}function Yp(t,r,a,l){var f=l.children,y=t!==null?t.memoizedState:null;if(t===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(y=y!==null?y.baseLanes|a:a,t!==null){for(l=r.child=t.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~y}else l=0,r.child=null;return Kp(t,r,y,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},t!==null&&ul(r,y!==null?y.cachePool:null),y!==null?Q0(r,y):Nf(),X0(r);else return l=r.lanes=536870912,Kp(t,r,y!==null?y.baseLanes|a:a,a,l)}else y!==null?(ul(r,y.cachePool),Q0(r,y),ts(),r.memoizedState=null):(t!==null&&ul(r,null),Nf(),ts());return $t(t,r,f,a),r.child}function Pa(t,r){return t!==null&&t.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Kp(t,r,a,l,f){var y=Sf();return y=y===null?null:{parent:At._currentValue,pool:y},r.memoizedState={baseLanes:a,cachePool:y},t!==null&&ul(r,null),Nf(),X0(r),t!==null&&_i(t,r,l,!0),r.childLanes=f,null}function Al(t,r){return r=kl({mode:r.mode,children:r.children},t.mode),r.ref=t.ref,t.child=r,r.return=t,r}function Jp(t,r,a){return Gs(r,t.child,null,a),t=Al(r,r.pendingProps),t.flags|=2,pn(r),r.memoizedState=null,t}function iw(t,r,a){var l=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,t===null){if(Ge){if(l.mode==="hidden")return t=Al(r,l),r.lanes=536870912,Pa(null,t);if(Cf(r),(t=ct)?(t=og(t,qn),t=t!==null&&t.data==="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=M0(t),a.return=r,r.child=a,zt=r,ct=null)):t=null,t===null)throw Jr(r);return r.lanes=536870912,null}return Al(r,l)}var y=t.memoizedState;if(y!==null){var w=y.dehydrated;if(Cf(r),f)if(r.flags&256)r.flags&=-257,r=Jp(t,r,a);else if(r.memoizedState!==null)r.child=t.child,r.flags|=128,r=null;else throw Error(i(558));else if(kt||_i(t,r,a,!1),f=(a&t.childLanes)!==0,kt||f){if(l=ot,l!==null&&(w=Gr(l,a),w!==0&&w!==y.retryLane))throw y.retryLane=w,Ps(t,w),ln(l,t,w),Wf;Pl(),r=Jp(t,r,a)}else t=y.treeContext,ct=Bn(w.nextSibling),zt=r,Ge=!0,Kr=null,qn=!1,t!==null&&L0(r,t),r=Al(r,l),r.flags|=4096;return r}return t=br(t.child,{mode:l.mode,children:l.children}),t.ref=r.ref,r.child=t,t.return=r,t}function jl(t,r){var a=r.ref;if(a===null)t!==null&&t.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(t===null||t.ref!==a)&&(r.flags|=4194816)}}function Zf(t,r,a,l,f){return Is(r),a=Rf(t,r,a,l,void 0,f),l=Df(),t!==null&&!kt?(Lf(t,r,f),Er(t,r,f)):(Ge&&l&&mf(r),r.flags|=1,$t(t,r,a,f),r.child)}function Qp(t,r,a,l,f,y){return Is(r),r.updateQueue=null,a=Z0(r,l,a,f),W0(t),l=Df(),t!==null&&!kt?(Lf(t,r,y),Er(t,r,y)):(Ge&&l&&mf(r),r.flags|=1,$t(t,r,a,y),r.child)}function Xp(t,r,a,l,f){if(Is(r),r.stateNode===null){var y=gi,w=a.contextType;typeof w=="object"&&w!==null&&(y=It(w)),y=new a(l,y),r.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Qf,r.stateNode=y,y._reactInternals=r,y=r.stateNode,y.props=l,y.state=r.memoizedState,y.refs={},Of(r),w=a.contextType,y.context=typeof w=="object"&&w!==null?It(w):gi,y.state=r.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Jf(r,a,w,l),y.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(w=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),w!==y.state&&Qf.enqueueReplaceState(y,y.state,null),Ma(r,l,y,f),Ca(),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(t===null){y=r.stateNode;var O=r.memoizedProps,R=Ys(a,O);y.props=R;var V=y.context,Z=a.contextType;w=gi,typeof Z=="object"&&Z!==null&&(w=It(Z));var ie=a.getDerivedStateFromProps;Z=typeof ie=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=r.pendingProps!==O,Z||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||V!==w)&&Pp(r,y,l,w),Xr=!1;var Y=r.memoizedState;y.state=Y,Ma(r,l,y,f),Ca(),V=r.memoizedState,O||Y!==V||Xr?(typeof ie=="function"&&(Jf(r,a,ie,l),V=r.memoizedState),(R=Xr||qp(r,a,R,l,Y,V,w))?(Z||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(r.flags|=4194308)):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=V),y.props=l,y.state=V,y.context=w,l=R):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{y=r.stateNode,Af(t,r),w=r.memoizedProps,Z=Ys(a,w),y.props=Z,ie=r.pendingProps,Y=y.context,V=a.contextType,R=gi,typeof V=="object"&&V!==null&&(R=It(V)),O=a.getDerivedStateFromProps,(V=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(w!==ie||Y!==R)&&Pp(r,y,l,R),Xr=!1,Y=r.memoizedState,y.state=Y,Ma(r,l,y,f),Ca();var Q=r.memoizedState;w!==ie||Y!==Q||Xr||t!==null&&t.dependencies!==null&&ll(t.dependencies)?(typeof O=="function"&&(Jf(r,a,O,l),Q=r.memoizedState),(Z=Xr||qp(r,a,Z,l,Y,Q,R)||t!==null&&t.dependencies!==null&&ll(t.dependencies))?(V||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(l,Q,R),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(l,Q,R)),typeof y.componentDidUpdate=="function"&&(r.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof y.componentDidUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=Q),y.props=l,y.state=Q,y.context=R,l=Z):(typeof y.componentDidUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=1024),l=!1)}return y=l,jl(t,r),l=(r.flags&128)!==0,y||l?(y=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:y.render(),r.flags|=1,t!==null&&l?(r.child=Gs(r,t.child,null,f),r.child=Gs(r,null,a,f)):$t(t,r,a,f),r.memoizedState=y.state,t=r.child):t=Er(t,r,f),t}function Wp(t,r,a,l){return Us(),r.flags|=256,$t(t,r,a,l),r.child}var eh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function th(t){return{baseLanes:t,cachePool:I0()}}function nh(t,r,a){return t=t!==null?t.childLanes&~a:0,r&&(t|=gn),t}function Zp(t,r,a){var l=r.pendingProps,f=!1,y=(r.flags&128)!==0,w;if((w=y)||(w=t!==null&&t.memoizedState===null?!1:(wt.current&2)!==0),w&&(f=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,t===null){if(Ge){if(f?es(r):ts(),(t=ct)?(t=og(t,qn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=M0(t),a.return=r,r.child=a,zt=r,ct=null)):t=null,t===null)throw Jr(r);return Bh(t)?r.lanes=32:r.lanes=536870912,null}var O=l.children;return l=l.fallback,f?(ts(),f=r.mode,O=kl({mode:"hidden",children:O},f),l=Bs(l,f,a,null),O.return=r,l.return=r,O.sibling=l,r.child=O,l=r.child,l.memoizedState=th(a),l.childLanes=nh(t,w,a),r.memoizedState=eh,Pa(null,l)):(es(r),rh(r,O))}var R=t.memoizedState;if(R!==null&&(O=R.dehydrated,O!==null)){if(y)r.flags&256?(es(r),r.flags&=-257,r=sh(t,r,a)):r.memoizedState!==null?(ts(),r.child=t.child,r.flags|=128,r=null):(ts(),O=l.fallback,f=r.mode,l=kl({mode:"visible",children:l.children},f),O=Bs(O,f,a,null),O.flags|=2,l.return=r,O.return=r,l.sibling=O,r.child=l,Gs(r,t.child,null,a),l=r.child,l.memoizedState=th(a),l.childLanes=nh(t,w,a),r.memoizedState=eh,r=Pa(null,l));else if(es(r),Bh(O)){if(w=O.nextSibling&&O.nextSibling.dataset,w)var V=w.dgst;w=V,l=Error(i(419)),l.stack="",l.digest=w,Oa({value:l,source:null,stack:null}),r=sh(t,r,a)}else if(kt||_i(t,r,a,!1),w=(a&t.childLanes)!==0,kt||w){if(w=ot,w!==null&&(l=Gr(w,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,Ps(t,l),ln(w,t,l),Wf;Ph(O)||Pl(),r=sh(t,r,a)}else Ph(O)?(r.flags|=192,r.child=t.child,r=null):(t=R.treeContext,ct=Bn(O.nextSibling),zt=r,Ge=!0,Kr=null,qn=!1,t!==null&&L0(r,t),r=rh(r,l.children),r.flags|=4096);return r}return f?(ts(),O=l.fallback,f=r.mode,R=t.child,V=R.sibling,l=br(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,V!==null?O=br(V,O):(O=Bs(O,f,a,null),O.flags|=2),O.return=r,l.return=r,l.sibling=O,r.child=l,Pa(null,l),l=r.child,O=t.child.memoizedState,O===null?O=th(a):(f=O.cachePool,f!==null?(R=At._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=I0(),O={baseLanes:O.baseLanes|a,cachePool:f}),l.memoizedState=O,l.childLanes=nh(t,w,a),r.memoizedState=eh,Pa(t.child,l)):(es(r),a=t.child,t=a.sibling,a=br(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,t!==null&&(w=r.deletions,w===null?(r.deletions=[t],r.flags|=16):w.push(t)),r.child=a,r.memoizedState=null,a)}function rh(t,r){return r=kl({mode:"visible",children:r},t.mode),r.return=t,t.child=r}function kl(t,r){return t=dn(22,t,null,r),t.lanes=0,t}function sh(t,r,a){return Gs(r,t.child,null,a),t=rh(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function ey(t,r,a){t.lanes|=r;var l=t.alternate;l!==null&&(l.lanes|=r),xf(t.return,r,a)}function ih(t,r,a,l,f,y){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:y}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=l,w.tail=a,w.tailMode=f,w.treeForkCount=y)}function ty(t,r,a){var l=r.pendingProps,f=l.revealOrder,y=l.tail;l=l.children;var w=wt.current,O=(w&2)!==0;if(O?(w=w&1|2,r.flags|=128):w&=1,Me(wt,w),$t(t,r,l,a),l=Ge?Ea:0,!O&&t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&ey(t,a,r);else if(t.tag===19)ey(t,a,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"forwards":for(a=r.child,f=null;a!==null;)t=a.alternate,t!==null&&yl(t)===null&&(f=a),a=a.sibling;a=f,a===null?(f=r.child,r.child=null):(f=a.sibling,a.sibling=null),ih(r,!1,f,a,y,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=r.child,r.child=null;f!==null;){if(t=f.alternate,t!==null&&yl(t)===null){r.child=f;break}t=f.sibling,f.sibling=a,a=f,f=t}ih(r,!0,a,null,y,l);break;case"together":ih(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function Er(t,r,a){if(t!==null&&(r.dependencies=t.dependencies),ss|=r.lanes,(a&r.childLanes)===0)if(t!==null){if(_i(t,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(t!==null&&r.child!==t.child)throw Error(i(153));if(r.child!==null){for(t=r.child,a=br(t,t.pendingProps),r.child=a,a.return=r;t.sibling!==null;)t=t.sibling,a=a.sibling=br(t,t.pendingProps),a.return=r;a.sibling=null}return r.child}function ah(t,r){return(t.lanes&r)!==0?!0:(t=t.dependencies,!!(t!==null&&ll(t)))}function aw(t,r,a){switch(r.tag){case 3:Re(r,r.stateNode.containerInfo),Qr(r,At,t.memoizedState.cache),Us();break;case 27:case 5:Ue(r);break;case 4:Re(r,r.stateNode.containerInfo);break;case 10:Qr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Cf(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(es(r),r.flags|=128,null):(a&r.child.childLanes)!==0?Zp(t,r,a):(es(r),t=Er(t,r,a),t!==null?t.sibling:null);es(r);break;case 19:var f=(t.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(_i(t,r,a,!1),l=(a&r.childLanes)!==0),f){if(l)return ty(t,r,a);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Me(wt,wt.current),l)break;return null;case 22:return r.lanes=0,Yp(t,r,a,r.pendingProps);case 24:Qr(r,At,t.memoizedState.cache)}return Er(t,r,a)}function ny(t,r,a){if(t!==null)if(t.memoizedProps!==r.pendingProps)kt=!0;else{if(!ah(t,a)&&(r.flags&128)===0)return kt=!1,aw(t,r,a);kt=(t.flags&131072)!==0}else kt=!1,Ge&&(r.flags&1048576)!==0&&D0(r,Ea,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(t=Hs(r.elementType),r.type=t,typeof t=="function")ff(t)?(l=Ys(t,l),r.tag=1,r=Xp(null,r,t,l,a)):(r.tag=0,r=Zf(null,r,t,l,a));else{if(t!=null){var f=t.$$typeof;if(f===te){r.tag=11,r=Fp(null,r,t,l,a);break e}else if(f===ae){r.tag=14,r=Gp(null,r,t,l,a);break e}}throw r=we(t)||t,Error(i(306,r,""))}}return r;case 0:return Zf(t,r,r.type,r.pendingProps,a);case 1:return l=r.type,f=Ys(l,r.pendingProps),Xp(t,r,l,f,a);case 3:e:{if(Re(r,r.stateNode.containerInfo),t===null)throw Error(i(387));l=r.pendingProps;var y=r.memoizedState;f=y.element,Af(t,r),Ma(r,l,null,a);var w=r.memoizedState;if(l=w.cache,Qr(r,At,l),l!==y.cache&&vf(r,[At],a,!0),Ca(),l=w.element,y.isDehydrated)if(y={element:l,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=y,r.memoizedState=y,r.flags&256){r=Wp(t,r,l,a);break e}else if(l!==f){f=Rn(Error(i(424)),r),Oa(f),r=Wp(t,r,l,a);break e}else{switch(t=r.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(ct=Bn(t.firstChild),zt=r,Ge=!0,Kr=null,qn=!0,a=Y0(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Us(),l===f){r=Er(t,r,a);break e}$t(t,r,l,a)}r=r.child}return r;case 26:return jl(t,r),t===null?(a=dg(r.type,null,r.pendingProps,null))?r.memoizedState=a:Ge||(a=r.type,t=r.pendingProps,l=Fl(Ct.current).createElement(a),l[at]=r,l[gt]=t,Ht(l,a,t),L(l),r.stateNode=l):r.memoizedState=dg(r.type,t.memoizedProps,r.pendingProps,t.memoizedState),null;case 27:return Ue(r),t===null&&Ge&&(l=r.stateNode=ug(r.type,r.pendingProps,Ct.current),zt=r,qn=!0,f=ct,cs(r.type)?(Uh=f,ct=Bn(l.firstChild)):ct=f),$t(t,r,r.pendingProps.children,a),jl(t,r),t===null&&(r.flags|=4194304),r.child;case 5:return t===null&&Ge&&((f=l=ct)&&(l=qw(l,r.type,r.pendingProps,qn),l!==null?(r.stateNode=l,zt=r,ct=Bn(l.firstChild),qn=!1,f=!0):f=!1),f||Jr(r)),Ue(r),f=r.type,y=r.pendingProps,w=t!==null?t.memoizedProps:null,l=y.children,Dh(f,y)?l=null:w!==null&&Dh(f,w)&&(r.flags|=32),r.memoizedState!==null&&(f=Rf(t,r,X_,null,null,a),Wa._currentValue=f),jl(t,r),$t(t,r,l,a),r.child;case 6:return t===null&&Ge&&((t=a=ct)&&(a=Pw(a,r.pendingProps,qn),a!==null?(r.stateNode=a,zt=r,ct=null,t=!0):t=!1),t||Jr(r)),null;case 13:return Zp(t,r,a);case 4:return Re(r,r.stateNode.containerInfo),l=r.pendingProps,t===null?r.child=Gs(r,null,l,a):$t(t,r,l,a),r.child;case 11:return Fp(t,r,r.type,r.pendingProps,a);case 7:return $t(t,r,r.pendingProps,a),r.child;case 8:return $t(t,r,r.pendingProps.children,a),r.child;case 12:return $t(t,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Qr(r,r.type,l.value),$t(t,r,l.children,a),r.child;case 9:return f=r.type._context,l=r.pendingProps.children,Is(r),f=It(f),l=l(f),r.flags|=1,$t(t,r,l,a),r.child;case 14:return Gp(t,r,r.type,r.pendingProps,a);case 15:return Vp(t,r,r.type,r.pendingProps,a);case 19:return ty(t,r,a);case 31:return iw(t,r,a);case 22:return Yp(t,r,a,r.pendingProps);case 24:return Is(r),l=It(At),t===null?(f=Sf(),f===null&&(f=ot,y=_f(),f.pooledCache=y,y.refCount++,y!==null&&(f.pooledCacheLanes|=a),f=y),r.memoizedState={parent:l,cache:f},Of(r),Qr(r,At,f)):((t.lanes&a)!==0&&(Af(t,r),Ma(r,null,null,a),Ca()),f=t.memoizedState,y=r.memoizedState,f.parent!==l?(f={parent:l,cache:l},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Qr(r,At,l)):(l=y.cache,Qr(r,At,l),l!==f.cache&&vf(r,[At],a,!0))),$t(t,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Or(t){t.flags|=4}function oh(t,r,a,l,f){if((r=(t.mode&32)!==0)&&(r=!1),r){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(Ny())t.flags|=8192;else throw Fs=hl,Ef}else t.flags&=-16777217}function ry(t,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!bg(r))if(Ny())t.flags|=8192;else throw Fs=hl,Ef}function Nl(t,r){r!==null&&(t.flags|=4),t.flags&16384&&(r=t.tag!==22?oi():536870912,t.lanes|=r,Ri|=r)}function Ba(t,r){if(!Ge)switch(t.tailMode){case"hidden":r=t.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||t.tail===null?t.tail=null:t.tail.sibling=null:l.sibling=null}}function ut(t){var r=t.alternate!==null&&t.alternate.child===t.child,a=0,l=0;if(r)for(var f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=l,t.childLanes=a,r}function ow(t,r,a){var l=r.pendingProps;switch(pf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ut(r),null;case 1:return ut(r),null;case 3:return a=r.stateNode,l=null,t!==null&&(l=t.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),_r(At),ce(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(vi(r)?Or(r):t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,gf())),ut(r),null;case 26:var f=r.type,y=r.memoizedState;return t===null?(Or(r),y!==null?(ut(r),ry(r,y)):(ut(r),oh(r,f,null,l,a))):y?y!==t.memoizedState?(Or(r),ut(r),ry(r,y)):(ut(r),r.flags&=-16777217):(t=t.memoizedProps,t!==l&&Or(r),ut(r),oh(r,f,t,l,a)),null;case 27:if(Xe(r),a=Ct.current,f=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ut(r),null}t=We.current,vi(r)?q0(r):(t=ug(f,l,a),r.stateNode=t,Or(r))}return ut(r),null;case 5:if(Xe(r),f=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ut(r),null}if(y=We.current,vi(r))q0(r);else{var w=Fl(Ct.current);switch(y){case 1:y=w.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:y=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":y=w.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":y=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":y=w.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof l.is=="string"?w.createElement("select",{is:l.is}):w.createElement("select"),l.multiple?y.multiple=!0:l.size&&(y.size=l.size);break;default:y=typeof l.is=="string"?w.createElement(f,{is:l.is}):w.createElement(f)}}y[at]=r,y[gt]=l;e:for(w=r.child;w!==null;){if(w.tag===5||w.tag===6)y.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===r)break e;for(;w.sibling===null;){if(w.return===null||w.return===r)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}r.stateNode=y;e:switch(Ht(y,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Or(r)}}return ut(r),oh(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,a),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(i(166));if(t=Ct.current,vi(r)){if(t=r.stateNode,a=r.memoizedProps,l=null,f=zt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}t[at]=r,t=!!(t.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Zy(t.nodeValue,a)),t||Jr(r,!0)}else t=Fl(t).createTextNode(l),t[at]=r,r.stateNode=t}return ut(r),null;case 31:if(a=r.memoizedState,t===null||t.memoizedState!==null){if(l=vi(r),a!==null){if(t===null){if(!l)throw Error(i(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[at]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ut(r),t=!1}else a=gf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return r.flags&256?(pn(r),r):(pn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return ut(r),null;case 13:if(l=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=vi(r),l!==null&&l.dehydrated!==null){if(t===null){if(!f)throw Error(i(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[at]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ut(r),f=!1}else f=gf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(pn(r),r):(pn(r),null)}return pn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,t=t!==null&&t.memoizedState!==null,a&&(l=r.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),y=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(y=l.memoizedState.cachePool.pool),y!==f&&(l.flags|=2048)),a!==t&&a&&(r.child.flags|=8192),Nl(r,r.updateQueue),ut(r),null);case 4:return ce(),t===null&&Nh(r.stateNode.containerInfo),ut(r),null;case 10:return _r(r.type),ut(r),null;case 19:if(Ne(wt),l=r.memoizedState,l===null)return ut(r),null;if(f=(r.flags&128)!==0,y=l.rendering,y===null)if(f)Ba(l,!1);else{if(xt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(y=yl(t),y!==null){for(r.flags|=128,Ba(l,!1),t=y.updateQueue,r.updateQueue=t,Nl(r,t),r.subtreeFlags=0,t=a,a=r.child;a!==null;)C0(a,t),a=a.sibling;return Me(wt,wt.current&1|2),Ge&&xr(r,l.treeForkCount),r.child}t=t.sibling}l.tail!==null&&ft()>Dl&&(r.flags|=128,f=!0,Ba(l,!1),r.lanes=4194304)}else{if(!f)if(t=yl(y),t!==null){if(r.flags|=128,f=!0,t=t.updateQueue,r.updateQueue=t,Nl(r,t),Ba(l,!0),l.tail===null&&l.tailMode==="hidden"&&!y.alternate&&!Ge)return ut(r),null}else 2*ft()-l.renderingStartTime>Dl&&a!==536870912&&(r.flags|=128,f=!0,Ba(l,!1),r.lanes=4194304);l.isBackwards?(y.sibling=r.child,r.child=y):(t=l.last,t!==null?t.sibling=y:r.child=y,l.last=y)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=ft(),t.sibling=null,a=wt.current,Me(wt,f?a&1|2:a&1),Ge&&xr(r,l.treeForkCount),t):(ut(r),null);case 22:case 23:return pn(r),Tf(),l=r.memoizedState!==null,t!==null?t.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(ut(r),r.subtreeFlags&6&&(r.flags|=8192)):ut(r),a=r.updateQueue,a!==null&&Nl(r,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),t!==null&&Ne($s),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),_r(At),ut(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function lw(t,r){switch(pf(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return _r(At),ce(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return Xe(r),null;case 31:if(r.memoizedState!==null){if(pn(r),r.alternate===null)throw Error(i(340));Us()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(pn(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Us()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return Ne(wt),null;case 4:return ce(),null;case 10:return _r(r.type),null;case 22:case 23:return pn(r),Tf(),t!==null&&Ne($s),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return _r(At),null;case 25:return null;default:return null}}function sy(t,r){switch(pf(r),r.tag){case 3:_r(At),ce();break;case 26:case 27:case 5:Xe(r);break;case 4:ce();break;case 31:r.memoizedState!==null&&pn(r);break;case 13:pn(r);break;case 19:Ne(wt);break;case 10:_r(r.type);break;case 22:case 23:pn(r),Tf(),t!==null&&Ne($s);break;case 24:_r(At)}}function Ua(t,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&t)===t){l=void 0;var y=a.create,w=a.inst;l=y(),w.destroy=l}a=a.next}while(a!==f)}}catch(O){et(r,r.return,O)}}function ns(t,r,a){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var y=f.next;l=y;do{if((l.tag&t)===t){var w=l.inst,O=w.destroy;if(O!==void 0){w.destroy=void 0,f=r;var R=a,V=O;try{V()}catch(Z){et(f,R,Z)}}}l=l.next}while(l!==y)}}catch(Z){et(r,r.return,Z)}}function iy(t){var r=t.updateQueue;if(r!==null){var a=t.stateNode;try{J0(r,a)}catch(l){et(t,t.return,l)}}}function ay(t,r,a){a.props=Ys(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(l){et(t,r,l)}}function za(t,r){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var l=t.stateNode;break;case 30:l=t.stateNode;break;default:l=t.stateNode}typeof a=="function"?t.refCleanup=a(l):a.current=l}}catch(f){et(t,r,f)}}function sr(t,r){var a=t.ref,l=t.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){et(t,r,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){et(t,r,f)}else a.current=null}function oy(t){var r=t.type,a=t.memoizedProps,l=t.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){et(t,t.return,f)}}function lh(t,r,a){try{var l=t.stateNode;Tw(l,t.type,a,r),l[gt]=r}catch(f){et(t,t.return,f)}}function ly(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&cs(t.type)||t.tag===4}function ch(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ly(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&cs(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function uh(t,r,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(t),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=yr));else if(l!==4&&(l===27&&cs(t.type)&&(a=t.stateNode,r=null),t=t.child,t!==null))for(uh(t,r,a),t=t.sibling;t!==null;)uh(t,r,a),t=t.sibling}function Tl(t,r,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,r?a.insertBefore(t,r):a.appendChild(t);else if(l!==4&&(l===27&&cs(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Tl(t,r,a),t=t.sibling;t!==null;)Tl(t,r,a),t=t.sibling}function cy(t){var r=t.stateNode,a=t.memoizedProps;try{for(var l=t.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Ht(r,l,a),r[at]=t,r[gt]=a}catch(y){et(t,t.return,y)}}var Ar=!1,Nt=!1,fh=!1,uy=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function cw(t,r){if(t=t.containerInfo,Mh=Xl,t=w0(t),rf(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,y=l.focusNode;l=l.focusOffset;try{a.nodeType,y.nodeType}catch{a=null;break e}var w=0,O=-1,R=-1,V=0,Z=0,ie=t,Y=null;t:for(;;){for(var Q;ie!==a||f!==0&&ie.nodeType!==3||(O=w+f),ie!==y||l!==0&&ie.nodeType!==3||(R=w+l),ie.nodeType===3&&(w+=ie.nodeValue.length),(Q=ie.firstChild)!==null;)Y=ie,ie=Q;for(;;){if(ie===t)break t;if(Y===a&&++V===f&&(O=w),Y===y&&++Z===l&&(R=w),(Q=ie.nextSibling)!==null)break;ie=Y,Y=ie.parentNode}ie=Q}a=O===-1||R===-1?null:{start:O,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Rh={focusedElem:t,selectionRange:a},Xl=!1,Pt=r;Pt!==null;)if(r=Pt,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Pt=t;else for(;Pt!==null;){switch(r=Pt,y=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)f=t[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,a=r,f=y.memoizedProps,y=y.memoizedState,l=a.stateNode;try{var ve=Ys(a.type,f);t=l.getSnapshotBeforeUpdate(ve,y),l.__reactInternalSnapshotBeforeUpdate=t}catch(Te){et(a,a.return,Te)}}break;case 3:if((t&1024)!==0){if(t=r.stateNode.containerInfo,a=t.nodeType,a===9)qh(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":qh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=r.sibling,t!==null){t.return=r.return,Pt=t;break}Pt=r.return}}function fy(t,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:kr(t,a),l&4&&Ua(5,a);break;case 1:if(kr(t,a),l&4)if(t=a.stateNode,r===null)try{t.componentDidMount()}catch(w){et(a,a.return,w)}else{var f=Ys(a.type,r.memoizedProps);r=r.memoizedState;try{t.componentDidUpdate(f,r,t.__reactInternalSnapshotBeforeUpdate)}catch(w){et(a,a.return,w)}}l&64&&iy(a),l&512&&za(a,a.return);break;case 3:if(kr(t,a),l&64&&(t=a.updateQueue,t!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{J0(t,r)}catch(w){et(a,a.return,w)}}break;case 27:r===null&&l&4&&cy(a);case 26:case 5:kr(t,a),r===null&&l&4&&oy(a),l&512&&za(a,a.return);break;case 12:kr(t,a);break;case 31:kr(t,a),l&4&&my(t,a);break;case 13:kr(t,a),l&4&&py(t,a),l&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=bw.bind(null,a),Bw(t,a))));break;case 22:if(l=a.memoizedState!==null||Ar,!l){r=r!==null&&r.memoizedState!==null||Nt,f=Ar;var y=Nt;Ar=l,(Nt=r)&&!y?Nr(t,a,(a.subtreeFlags&8772)!==0):kr(t,a),Ar=f,Nt=y}break;case 30:break;default:kr(t,a)}}function hy(t){var r=t.alternate;r!==null&&(t.alternate=null,hy(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&li(r)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var ht=null,rn=!1;function jr(t,r,a){for(a=a.child;a!==null;)dy(t,r,a),a=a.sibling}function dy(t,r,a){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(ks,a)}catch{}switch(a.tag){case 26:Nt||sr(a,r),jr(t,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Nt||sr(a,r);var l=ht,f=rn;cs(a.type)&&(ht=a.stateNode,rn=!1),jr(t,r,a),Ja(a.stateNode),ht=l,rn=f;break;case 5:Nt||sr(a,r);case 6:if(l=ht,f=rn,ht=null,jr(t,r,a),ht=l,rn=f,ht!==null)if(rn)try{(ht.nodeType===9?ht.body:ht.nodeName==="HTML"?ht.ownerDocument.body:ht).removeChild(a.stateNode)}catch(y){et(a,r,y)}else try{ht.removeChild(a.stateNode)}catch(y){et(a,r,y)}break;case 18:ht!==null&&(rn?(t=ht,ig(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Ii(t)):ig(ht,a.stateNode));break;case 4:l=ht,f=rn,ht=a.stateNode.containerInfo,rn=!0,jr(t,r,a),ht=l,rn=f;break;case 0:case 11:case 14:case 15:ns(2,a,r),Nt||ns(4,a,r),jr(t,r,a);break;case 1:Nt||(sr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&ay(a,r,l)),jr(t,r,a);break;case 21:jr(t,r,a);break;case 22:Nt=(l=Nt)||a.memoizedState!==null,jr(t,r,a),Nt=l;break;default:jr(t,r,a)}}function my(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ii(t)}catch(a){et(r,r.return,a)}}}function py(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ii(t)}catch(a){et(r,r.return,a)}}function uw(t){switch(t.tag){case 31:case 13:case 19:var r=t.stateNode;return r===null&&(r=t.stateNode=new uy),r;case 22:return t=t.stateNode,r=t._retryCache,r===null&&(r=t._retryCache=new uy),r;default:throw Error(i(435,t.tag))}}function Cl(t,r){var a=uw(t);r.forEach(function(l){if(!a.has(l)){a.add(l);var f=xw.bind(null,t,l);l.then(f,f)}})}function sn(t,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],y=t,w=r,O=w;e:for(;O!==null;){switch(O.tag){case 27:if(cs(O.type)){ht=O.stateNode,rn=!1;break e}break;case 5:ht=O.stateNode,rn=!1;break e;case 3:case 4:ht=O.stateNode.containerInfo,rn=!0;break e}O=O.return}if(ht===null)throw Error(i(160));dy(y,w,f),ht=null,rn=!1,y=f.alternate,y!==null&&(y.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)yy(r,t),r=r.sibling}var Yn=null;function yy(t,r){var a=t.alternate,l=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:sn(r,t),an(t),l&4&&(ns(3,t,t.return),Ua(3,t),ns(5,t,t.return));break;case 1:sn(r,t),an(t),l&512&&(Nt||a===null||sr(a,a.return)),l&64&&Ar&&(t=t.updateQueue,t!==null&&(l=t.callbacks,l!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Yn;if(sn(r,t),an(t),l&512&&(Nt||a===null||sr(a,a.return)),l&4){var y=a!==null?a.memoizedState:null;if(l=t.memoizedState,a===null)if(l===null)if(t.stateNode===null){e:{l=t.type,a=t.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":y=f.getElementsByTagName("title")[0],(!y||y[Rt]||y[at]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=f.createElement(l),f.head.insertBefore(y,f.querySelector("head > title"))),Ht(y,l,a),y[at]=t,L(y),l=y;break e;case"link":var w=yg("link","href",f).get(l+(a.href||""));if(w){for(var O=0;O<w.length;O++)if(y=w[O],y.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&y.getAttribute("rel")===(a.rel==null?null:a.rel)&&y.getAttribute("title")===(a.title==null?null:a.title)&&y.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(O,1);break t}}y=f.createElement(l),Ht(y,l,a),f.head.appendChild(y);break;case"meta":if(w=yg("meta","content",f).get(l+(a.content||""))){for(O=0;O<w.length;O++)if(y=w[O],y.getAttribute("content")===(a.content==null?null:""+a.content)&&y.getAttribute("name")===(a.name==null?null:a.name)&&y.getAttribute("property")===(a.property==null?null:a.property)&&y.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&y.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(O,1);break t}}y=f.createElement(l),Ht(y,l,a),f.head.appendChild(y);break;default:throw Error(i(468,l))}y[at]=t,L(y),l=y}t.stateNode=l}else gg(f,t.type,t.stateNode);else t.stateNode=pg(f,l,t.memoizedProps);else y!==l?(y===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):y.count--,l===null?gg(f,t.type,t.stateNode):pg(f,l,t.memoizedProps)):l===null&&t.stateNode!==null&&lh(t,t.memoizedProps,a.memoizedProps)}break;case 27:sn(r,t),an(t),l&512&&(Nt||a===null||sr(a,a.return)),a!==null&&l&4&&lh(t,t.memoizedProps,a.memoizedProps);break;case 5:if(sn(r,t),an(t),l&512&&(Nt||a===null||sr(a,a.return)),t.flags&32){f=t.stateNode;try{ui(f,"")}catch(ve){et(t,t.return,ve)}}l&4&&t.stateNode!=null&&(f=t.memoizedProps,lh(t,f,a!==null?a.memoizedProps:f)),l&1024&&(fh=!0);break;case 6:if(sn(r,t),an(t),l&4){if(t.stateNode===null)throw Error(i(162));l=t.memoizedProps,a=t.stateNode;try{a.nodeValue=l}catch(ve){et(t,t.return,ve)}}break;case 3:if(Yl=null,f=Yn,Yn=Gl(r.containerInfo),sn(r,t),Yn=f,an(t),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ii(r.containerInfo)}catch(ve){et(t,t.return,ve)}fh&&(fh=!1,gy(t));break;case 4:l=Yn,Yn=Gl(t.stateNode.containerInfo),sn(r,t),an(t),Yn=l;break;case 12:sn(r,t),an(t);break;case 31:sn(r,t),an(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Cl(t,l)));break;case 13:sn(r,t),an(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Rl=ft()),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Cl(t,l)));break;case 22:f=t.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,V=Ar,Z=Nt;if(Ar=V||f,Nt=Z||R,sn(r,t),Nt=Z,Ar=V,an(t),l&8192)e:for(r=t.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(a===null||R||Ar||Nt||Ks(t)),a=null,r=t;;){if(r.tag===5||r.tag===26){if(a===null){R=a=r;try{if(y=R.stateNode,f)w=y.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{O=R.stateNode;var ie=R.memoizedProps.style,Y=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;O.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(ve){et(R,R.return,ve)}}}else if(r.tag===6){if(a===null){R=r;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(ve){et(R,R.return,ve)}}}else if(r.tag===18){if(a===null){R=r;try{var Q=R.stateNode;f?ag(Q,!0):ag(R.stateNode,!1)}catch(ve){et(R,R.return,ve)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===t)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=t.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Cl(t,a))));break;case 19:sn(r,t),an(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Cl(t,l)));break;case 30:break;case 21:break;default:sn(r,t),an(t)}}function an(t){var r=t.flags;if(r&2){try{for(var a,l=t.return;l!==null;){if(ly(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var f=a.stateNode,y=ch(t);Tl(t,y,f);break;case 5:var w=a.stateNode;a.flags&32&&(ui(w,""),a.flags&=-33);var O=ch(t);Tl(t,O,w);break;case 3:case 4:var R=a.stateNode.containerInfo,V=ch(t);uh(t,V,R);break;default:throw Error(i(161))}}catch(Z){et(t,t.return,Z)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function gy(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var r=t;gy(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),t=t.sibling}}function kr(t,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)fy(t,r.alternate,r),r=r.sibling}function Ks(t){for(t=t.child;t!==null;){var r=t;switch(r.tag){case 0:case 11:case 14:case 15:ns(4,r,r.return),Ks(r);break;case 1:sr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&ay(r,r.return,a),Ks(r);break;case 27:Ja(r.stateNode);case 26:case 5:sr(r,r.return),Ks(r);break;case 22:r.memoizedState===null&&Ks(r);break;case 30:Ks(r);break;default:Ks(r)}t=t.sibling}}function Nr(t,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,f=t,y=r,w=y.flags;switch(y.tag){case 0:case 11:case 15:Nr(f,y,a),Ua(4,y);break;case 1:if(Nr(f,y,a),l=y,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(V){et(l,l.return,V)}if(l=y,f=l.updateQueue,f!==null){var O=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)K0(R[f],O)}catch(V){et(l,l.return,V)}}a&&w&64&&iy(y),za(y,y.return);break;case 27:cy(y);case 26:case 5:Nr(f,y,a),a&&l===null&&w&4&&oy(y),za(y,y.return);break;case 12:Nr(f,y,a);break;case 31:Nr(f,y,a),a&&w&4&&my(f,y);break;case 13:Nr(f,y,a),a&&w&4&&py(f,y);break;case 22:y.memoizedState===null&&Nr(f,y,a),za(y,y.return);break;case 30:break;default:Nr(f,y,a)}r=r.sibling}}function hh(t,r){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(t=r.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Aa(a))}function dh(t,r){t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&Aa(t))}function Kn(t,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)by(t,r,a,l),r=r.sibling}function by(t,r,a,l){var f=r.flags;switch(r.tag){case 0:case 11:case 15:Kn(t,r,a,l),f&2048&&Ua(9,r);break;case 1:Kn(t,r,a,l);break;case 3:Kn(t,r,a,l),f&2048&&(t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&Aa(t)));break;case 12:if(f&2048){Kn(t,r,a,l),t=r.stateNode;try{var y=r.memoizedProps,w=y.id,O=y.onPostCommit;typeof O=="function"&&O(w,r.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(R){et(r,r.return,R)}}else Kn(t,r,a,l);break;case 31:Kn(t,r,a,l);break;case 13:Kn(t,r,a,l);break;case 23:break;case 22:y=r.stateNode,w=r.alternate,r.memoizedState!==null?y._visibility&2?Kn(t,r,a,l):Ia(t,r):y._visibility&2?Kn(t,r,a,l):(y._visibility|=2,Ti(t,r,a,l,(r.subtreeFlags&10256)!==0||!1)),f&2048&&hh(w,r);break;case 24:Kn(t,r,a,l),f&2048&&dh(r.alternate,r);break;default:Kn(t,r,a,l)}}function Ti(t,r,a,l,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var y=t,w=r,O=a,R=l,V=w.flags;switch(w.tag){case 0:case 11:case 15:Ti(y,w,O,R,f),Ua(8,w);break;case 23:break;case 22:var Z=w.stateNode;w.memoizedState!==null?Z._visibility&2?Ti(y,w,O,R,f):Ia(y,w):(Z._visibility|=2,Ti(y,w,O,R,f)),f&&V&2048&&hh(w.alternate,w);break;case 24:Ti(y,w,O,R,f),f&&V&2048&&dh(w.alternate,w);break;default:Ti(y,w,O,R,f)}r=r.sibling}}function Ia(t,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=t,l=r,f=l.flags;switch(l.tag){case 22:Ia(a,l),f&2048&&hh(l.alternate,l);break;case 24:Ia(a,l),f&2048&&dh(l.alternate,l);break;default:Ia(a,l)}r=r.sibling}}var $a=8192;function Ci(t,r,a){if(t.subtreeFlags&$a)for(t=t.child;t!==null;)xy(t,r,a),t=t.sibling}function xy(t,r,a){switch(t.tag){case 26:Ci(t,r,a),t.flags&$a&&t.memoizedState!==null&&Qw(a,Yn,t.memoizedState,t.memoizedProps);break;case 5:Ci(t,r,a);break;case 3:case 4:var l=Yn;Yn=Gl(t.stateNode.containerInfo),Ci(t,r,a),Yn=l;break;case 22:t.memoizedState===null&&(l=t.alternate,l!==null&&l.memoizedState!==null?(l=$a,$a=16777216,Ci(t,r,a),$a=l):Ci(t,r,a));break;default:Ci(t,r,a)}}function vy(t){var r=t.alternate;if(r!==null&&(t=r.child,t!==null)){r.child=null;do r=t.sibling,t.sibling=null,t=r;while(t!==null)}}function Ha(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,wy(l,t)}vy(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)_y(t),t=t.sibling}function _y(t){switch(t.tag){case 0:case 11:case 15:Ha(t),t.flags&2048&&ns(9,t,t.return);break;case 3:Ha(t);break;case 12:Ha(t);break;case 22:var r=t.stateNode;t.memoizedState!==null&&r._visibility&2&&(t.return===null||t.return.tag!==13)?(r._visibility&=-3,Ml(t)):Ha(t);break;default:Ha(t)}}function Ml(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,wy(l,t)}vy(t)}for(t=t.child;t!==null;){switch(r=t,r.tag){case 0:case 11:case 15:ns(8,r,r.return),Ml(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Ml(r));break;default:Ml(r)}t=t.sibling}}function wy(t,r){for(;Pt!==null;){var a=Pt;switch(a.tag){case 0:case 11:case 15:ns(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Aa(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Pt=l;else e:for(a=t;Pt!==null;){l=Pt;var f=l.sibling,y=l.return;if(hy(l),l===a){Pt=null;break e}if(f!==null){f.return=y,Pt=f;break e}Pt=y}}}var fw={getCacheForType:function(t){var r=It(At),a=r.data.get(t);return a===void 0&&(a=t(),r.data.set(t,a)),a},cacheSignal:function(){return It(At).controller.signal}},hw=typeof WeakMap=="function"?WeakMap:Map,Qe=0,ot=null,ze=null,$e=0,Ze=0,yn=null,rs=!1,Mi=!1,mh=!1,Tr=0,xt=0,ss=0,Js=0,ph=0,gn=0,Ri=0,Fa=null,on=null,yh=!1,Rl=0,Sy=0,Dl=1/0,Ll=null,is=null,Dt=0,as=null,Di=null,Cr=0,gh=0,bh=null,Ey=null,Ga=0,xh=null;function bn(){return(Qe&2)!==0&&$e!==0?$e&-$e:F.T!==null?Oh():da()}function Oy(){if(gn===0)if(($e&536870912)===0||Ge){var t=dr;dr<<=1,(dr&3932160)===0&&(dr=262144),gn=t}else gn=536870912;return t=mn.current,t!==null&&(t.flags|=32),gn}function ln(t,r,a){(t===ot&&(Ze===2||Ze===9)||t.cancelPendingCommit!==null)&&(Li(t,0),os(t,$e,gn,!1)),Fn(t,a),((Qe&2)===0||t!==ot)&&(t===ot&&((Qe&2)===0&&(Js|=a),xt===4&&os(t,$e,gn,!1)),ir(t))}function Ay(t,r,a){if((Qe&6)!==0)throw Error(i(327));var l=!a&&(r&127)===0&&(r&t.expiredLanes)===0||Ts(t,r),f=l?pw(t,r):_h(t,r,!0),y=l;do{if(f===0){Mi&&!l&&os(t,r,0,!1);break}else{if(a=t.current.alternate,y&&!dw(a)){f=_h(t,r,!1),y=!1;continue}if(f===2){if(y=r,t.errorRecoveryDisabledLanes&y)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var O=t;f=Fa;var R=O.current.memoizedState.isDehydrated;if(R&&(Li(O,w).flags|=256),w=_h(O,w,!1),w!==2){if(mh&&!R){O.errorRecoveryDisabledLanes|=y,Js|=y,f=4;break e}y=on,on=f,y!==null&&(on===null?on=y:on.push.apply(on,y))}f=w}if(y=!1,f!==2)continue}}if(f===1){Li(t,0),os(t,r,0,!0);break}e:{switch(l=t,y=f,y){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:os(l,r,gn,!rs);break e;case 2:on=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(f=Rl+300-ft(),10<f)){if(os(l,r,gn,!rs),Ns(l,0,!0)!==0)break e;Cr=r,l.timeoutHandle=rg(jy.bind(null,l,a,on,Ll,yh,r,gn,Js,Ri,rs,y,"Throttled",-0,0),f);break e}jy(l,a,on,Ll,yh,r,gn,Js,Ri,rs,y,null,-0,0)}}break}while(!0);ir(t)}function jy(t,r,a,l,f,y,w,O,R,V,Z,ie,Y,Q){if(t.timeoutHandle=-1,ie=r.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:yr},xy(r,y,ie);var ve=(y&62914560)===y?Rl-ft():(y&4194048)===y?Sy-ft():0;if(ve=Xw(ie,ve),ve!==null){Cr=y,t.cancelPendingCommit=ve(Ly.bind(null,t,r,y,a,l,f,w,O,R,Z,ie,null,Y,Q)),os(t,y,w,!V);return}}Ly(t,r,y,a,l,f,w,O,R)}function dw(t){for(var r=t;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],y=f.getSnapshot;f=f.value;try{if(!hn(y(),f))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function os(t,r,a,l){r&=~ph,r&=~Js,t.suspendedLanes|=r,t.pingedLanes&=~r,l&&(t.warmLanes|=r),l=t.expirationTimes;for(var f=r;0<f;){var y=31-Ft(f),w=1<<y;l[y]=-1,f&=~w}a!==0&&Fr(t,a,r)}function ql(){return(Qe&6)===0?(Va(0),!1):!0}function vh(){if(ze!==null){if(Ze===0)var t=ze.return;else t=ze,vr=zs=null,qf(t),Oi=null,ka=0,t=ze;for(;t!==null;)sy(t.alternate,t),t=t.return;ze=null}}function Li(t,r){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,Rw(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Cr=0,vh(),ot=t,ze=a=br(t.current,null),$e=r,Ze=0,yn=null,rs=!1,Mi=Ts(t,r),mh=!1,Ri=gn=ph=Js=ss=xt=0,on=Fa=null,yh=!1,(r&8)!==0&&(r|=r&32);var l=t.entangledLanes;if(l!==0)for(t=t.entanglements,l&=r;0<l;){var f=31-Ft(l),y=1<<f;r|=t[f],l&=~y}return Tr=r,rl(),a}function ky(t,r){De=null,F.H=qa,r===Ei||r===fl?(r=F0(),Ze=3):r===Ef?(r=F0(),Ze=4):Ze=r===Wf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,yn=r,ze===null&&(xt=1,Ol(t,Rn(r,t.current)))}function Ny(){var t=mn.current;return t===null?!0:($e&4194048)===$e?Pn===null:($e&62914560)===$e||($e&536870912)!==0?t===Pn:!1}function Ty(){var t=F.H;return F.H=qa,t===null?qa:t}function Cy(){var t=F.A;return F.A=fw,t}function Pl(){xt=4,rs||($e&4194048)!==$e&&mn.current!==null||(Mi=!0),(ss&134217727)===0&&(Js&134217727)===0||ot===null||os(ot,$e,gn,!1)}function _h(t,r,a){var l=Qe;Qe|=2;var f=Ty(),y=Cy();(ot!==t||$e!==r)&&(Ll=null,Li(t,r)),r=!1;var w=xt;e:do try{if(Ze!==0&&ze!==null){var O=ze,R=yn;switch(Ze){case 8:vh(),w=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(r=!0);var V=Ze;if(Ze=0,yn=null,qi(t,O,R,V),a&&Mi){w=0;break e}break;default:V=Ze,Ze=0,yn=null,qi(t,O,R,V)}}mw(),w=xt;break}catch(Z){ky(t,Z)}while(!0);return r&&t.shellSuspendCounter++,vr=zs=null,Qe=l,F.H=f,F.A=y,ze===null&&(ot=null,$e=0,rl()),w}function mw(){for(;ze!==null;)My(ze)}function pw(t,r){var a=Qe;Qe|=2;var l=Ty(),f=Cy();ot!==t||$e!==r?(Ll=null,Dl=ft()+500,Li(t,r)):Mi=Ts(t,r);e:do try{if(Ze!==0&&ze!==null){r=ze;var y=yn;t:switch(Ze){case 1:Ze=0,yn=null,qi(t,r,y,1);break;case 2:case 9:if($0(y)){Ze=0,yn=null,Ry(r);break}r=function(){Ze!==2&&Ze!==9||ot!==t||(Ze=7),ir(t)},y.then(r,r);break e;case 3:Ze=7;break e;case 4:Ze=5;break e;case 7:$0(y)?(Ze=0,yn=null,Ry(r)):(Ze=0,yn=null,qi(t,r,y,7));break;case 5:var w=null;switch(ze.tag){case 26:w=ze.memoizedState;case 5:case 27:var O=ze;if(w?bg(w):O.stateNode.complete){Ze=0,yn=null;var R=O.sibling;if(R!==null)ze=R;else{var V=O.return;V!==null?(ze=V,Bl(V)):ze=null}break t}}Ze=0,yn=null,qi(t,r,y,5);break;case 6:Ze=0,yn=null,qi(t,r,y,6);break;case 8:vh(),xt=6;break e;default:throw Error(i(462))}}yw();break}catch(Z){ky(t,Z)}while(!0);return vr=zs=null,F.H=l,F.A=f,Qe=a,ze!==null?0:(ot=null,$e=0,rl(),xt)}function yw(){for(;ze!==null&&!zo();)My(ze)}function My(t){var r=ny(t.alternate,t,Tr);t.memoizedProps=t.pendingProps,r===null?Bl(t):ze=r}function Ry(t){var r=t,a=r.alternate;switch(r.tag){case 15:case 0:r=Qp(a,r,r.pendingProps,r.type,void 0,$e);break;case 11:r=Qp(a,r,r.pendingProps,r.type.render,r.ref,$e);break;case 5:qf(r);default:sy(a,r),r=ze=C0(r,Tr),r=ny(a,r,Tr)}t.memoizedProps=t.pendingProps,r===null?Bl(t):ze=r}function qi(t,r,a,l){vr=zs=null,qf(r),Oi=null,ka=0;var f=r.return;try{if(sw(t,f,r,a,$e)){xt=1,Ol(t,Rn(a,t.current)),ze=null;return}}catch(y){if(f!==null)throw ze=f,y;xt=1,Ol(t,Rn(a,t.current)),ze=null;return}r.flags&32768?(Ge||l===1?t=!0:Mi||($e&536870912)!==0?t=!1:(rs=t=!0,(l===2||l===9||l===3||l===6)&&(l=mn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Dy(r,t)):Bl(r)}function Bl(t){var r=t;do{if((r.flags&32768)!==0){Dy(r,rs);return}t=r.return;var a=ow(r.alternate,r,Tr);if(a!==null){ze=a;return}if(r=r.sibling,r!==null){ze=r;return}ze=r=t}while(r!==null);xt===0&&(xt=5)}function Dy(t,r){do{var a=lw(t.alternate,t);if(a!==null){a.flags&=32767,ze=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(t=t.sibling,t!==null)){ze=t;return}ze=t=a}while(t!==null);xt=6,ze=null}function Ly(t,r,a,l,f,y,w,O,R){t.cancelPendingCommit=null;do Ul();while(Dt!==0);if((Qe&6)!==0)throw Error(i(327));if(r!==null){if(r===t.current)throw Error(i(177));if(y=r.lanes|r.childLanes,y|=cf,Hr(t,a,y,w,O,R),t===ot&&(ze=ot=null,$e=0),Di=r,as=t,Cr=a,gh=y,bh=f,Ey=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,vw(ii,function(){return zy(),null})):(t.callbackNode=null,t.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=F.T,F.T=null,f=J.p,J.p=2,w=Qe,Qe|=4;try{cw(t,r,a)}finally{Qe=w,J.p=f,F.T=l}}Dt=1,qy(),Py(),By()}}function qy(){if(Dt===1){Dt=0;var t=as,r=Di,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=F.T,F.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{yy(r,t);var y=Rh,w=w0(t.containerInfo),O=y.focusedElem,R=y.selectionRange;if(w!==O&&O&&O.ownerDocument&&_0(O.ownerDocument.documentElement,O)){if(R!==null&&rf(O)){var V=R.start,Z=R.end;if(Z===void 0&&(Z=V),"selectionStart"in O)O.selectionStart=V,O.selectionEnd=Math.min(Z,O.value.length);else{var ie=O.ownerDocument||document,Y=ie&&ie.defaultView||window;if(Y.getSelection){var Q=Y.getSelection(),ve=O.textContent.length,Te=Math.min(R.start,ve),st=R.end===void 0?Te:Math.min(R.end,ve);!Q.extend&&Te>st&&(w=st,st=Te,Te=w);var $=v0(O,Te),B=v0(O,st);if($&&B&&(Q.rangeCount!==1||Q.anchorNode!==$.node||Q.anchorOffset!==$.offset||Q.focusNode!==B.node||Q.focusOffset!==B.offset)){var G=ie.createRange();G.setStart($.node,$.offset),Q.removeAllRanges(),Te>st?(Q.addRange(G),Q.extend(B.node,B.offset)):(G.setEnd(B.node,B.offset),Q.addRange(G))}}}}for(ie=[],Q=O;Q=Q.parentNode;)Q.nodeType===1&&ie.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ie.length;O++){var ee=ie[O];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Xl=!!Mh,Rh=Mh=null}finally{Qe=f,J.p=l,F.T=a}}t.current=r,Dt=2}}function Py(){if(Dt===2){Dt=0;var t=as,r=Di,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=F.T,F.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{fy(t,r.alternate,r)}finally{Qe=f,J.p=l,F.T=a}}Dt=3}}function By(){if(Dt===4||Dt===3){Dt=0,si();var t=as,r=Di,a=Cr,l=Ey;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Dt=5:(Dt=0,Di=as=null,Uy(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(is=null),Ms(a),r=r.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(ks,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=F.T,f=J.p,J.p=2,F.T=null;try{for(var y=t.onRecoverableError,w=0;w<l.length;w++){var O=l[w];y(O.value,{componentStack:O.stack})}}finally{F.T=r,J.p=f}}(Cr&3)!==0&&Ul(),ir(t),f=t.pendingLanes,(a&261930)!==0&&(f&42)!==0?t===xh?Ga++:(Ga=0,xh=t):Ga=0,Va(0)}}function Uy(t,r){(t.pooledCacheLanes&=r)===0&&(r=t.pooledCache,r!=null&&(t.pooledCache=null,Aa(r)))}function Ul(){return qy(),Py(),By(),zy()}function zy(){if(Dt!==5)return!1;var t=as,r=gh;gh=0;var a=Ms(Cr),l=F.T,f=J.p;try{J.p=32>a?32:a,F.T=null,a=bh,bh=null;var y=as,w=Cr;if(Dt=0,Di=as=null,Cr=0,(Qe&6)!==0)throw Error(i(331));var O=Qe;if(Qe|=4,_y(y.current),by(y,y.current,w,a),Qe=O,Va(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(ks,y)}catch{}return!0}finally{J.p=f,F.T=l,Uy(t,r)}}function Iy(t,r,a){r=Rn(a,r),r=Xf(t.stateNode,r,2),t=Zr(t,r,2),t!==null&&(Fn(t,2),ir(t))}function et(t,r,a){if(t.tag===3)Iy(t,t,a);else for(;r!==null;){if(r.tag===3){Iy(r,t,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(is===null||!is.has(l))){t=Rn(a,t),a=$p(2),l=Zr(r,a,2),l!==null&&(Hp(a,l,r,t),Fn(l,2),ir(l));break}}r=r.return}}function wh(t,r,a){var l=t.pingCache;if(l===null){l=t.pingCache=new hw;var f=new Set;l.set(r,f)}else f=l.get(r),f===void 0&&(f=new Set,l.set(r,f));f.has(a)||(mh=!0,f.add(a),t=gw.bind(null,t,r,a),r.then(t,t))}function gw(t,r,a){var l=t.pingCache;l!==null&&l.delete(r),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,ot===t&&($e&a)===a&&(xt===4||xt===3&&($e&62914560)===$e&&300>ft()-Rl?(Qe&2)===0&&Li(t,0):ph|=a,Ri===$e&&(Ri=0)),ir(t)}function $y(t,r){r===0&&(r=oi()),t=Ps(t,r),t!==null&&(Fn(t,r),ir(t))}function bw(t){var r=t.memoizedState,a=0;r!==null&&(a=r.retryLane),$y(t,a)}function xw(t,r){var a=0;switch(t.tag){case 31:case 13:var l=t.stateNode,f=t.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=t.stateNode;break;case 22:l=t.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(r),$y(t,a)}function vw(t,r){return ca(t,r)}var zl=null,Pi=null,Sh=!1,Il=!1,Eh=!1,ls=0;function ir(t){t!==Pi&&t.next===null&&(Pi===null?zl=Pi=t:Pi=Pi.next=t),Il=!0,Sh||(Sh=!0,ww())}function Va(t,r){if(!Eh&&Il){Eh=!0;do for(var a=!1,l=zl;l!==null;){if(t!==0){var f=l.pendingLanes;if(f===0)var y=0;else{var w=l.suspendedLanes,O=l.pingedLanes;y=(1<<31-Ft(42|t)+1)-1,y&=f&~(w&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(a=!0,Vy(l,y))}else y=$e,y=Ns(l,l===ot?y:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(y&3)===0||Ts(l,y)||(a=!0,Vy(l,y));l=l.next}while(a);Eh=!1}}function _w(){Hy()}function Hy(){Il=Sh=!1;var t=0;ls!==0&&Mw()&&(t=ls);for(var r=ft(),a=null,l=zl;l!==null;){var f=l.next,y=Fy(l,r);y===0?(l.next=null,a===null?zl=f:a.next=f,f===null&&(Pi=a)):(a=l,(t!==0||(y&3)!==0)&&(Il=!0)),l=f}Dt!==0&&Dt!==5||Va(t),ls!==0&&(ls=0)}function Fy(t,r){for(var a=t.suspendedLanes,l=t.pingedLanes,f=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var w=31-Ft(y),O=1<<w,R=f[w];R===-1?((O&a)===0||(O&l)!==0)&&(f[w]=ha(O,r)):R<=r&&(t.expiredLanes|=O),y&=~O}if(r=ot,a=$e,a=Ns(t,t===r?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l=t.callbackNode,a===0||t===r&&(Ze===2||Ze===9)||t.cancelPendingCommit!==null)return l!==null&&l!==null&&hr(l),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Ts(t,a)){if(r=a&-a,r===t.callbackPriority)return r;switch(l!==null&&hr(l),Ms(a)){case 2:case 8:a=$o;break;case 32:a=ii;break;case 268435456:a=Ho;break;default:a=ii}return l=Gy.bind(null,t),a=ca(a,l),t.callbackPriority=r,t.callbackNode=a,r}return l!==null&&l!==null&&hr(l),t.callbackPriority=2,t.callbackNode=null,2}function Gy(t,r){if(Dt!==0&&Dt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Ul()&&t.callbackNode!==a)return null;var l=$e;return l=Ns(t,t===ot?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l===0?null:(Ay(t,l,r),Fy(t,ft()),t.callbackNode!=null&&t.callbackNode===a?Gy.bind(null,t):null)}function Vy(t,r){if(Ul())return null;Ay(t,r,!0)}function ww(){Dw(function(){(Qe&6)!==0?ca(Io,_w):Hy()})}function Oh(){if(ls===0){var t=wi;t===0&&(t=zr,zr<<=1,(zr&261888)===0&&(zr=256)),ls=t}return ls}function Yy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Jo(""+t)}function Ky(t,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,t.id&&a.setAttribute("form",t.id),r.parentNode.insertBefore(a,r),t=new FormData(t),a.parentNode.removeChild(a),t}function Sw(t,r,a,l,f){if(r==="submit"&&a&&a.stateNode===f){var y=Yy((f[gt]||null).action),w=l.submitter;w&&(r=(r=w[gt]||null)?Yy(r.formAction):w.getAttribute("formAction"),r!==null&&(y=r,w=null));var O=new Zo("action","action",null,l,f);t.push({event:O,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ls!==0){var R=w?Ky(f,w):new FormData(f);Gf(a,{pending:!0,data:R,method:f.method,action:y},null,R)}}else typeof y=="function"&&(O.preventDefault(),R=w?Ky(f,w):new FormData(f),Gf(a,{pending:!0,data:R,method:f.method,action:y},y,R))},currentTarget:f}]})}}for(var Ah=0;Ah<lf.length;Ah++){var jh=lf[Ah],Ew=jh.toLowerCase(),Ow=jh[0].toUpperCase()+jh.slice(1);Vn(Ew,"on"+Ow)}Vn(O0,"onAnimationEnd"),Vn(A0,"onAnimationIteration"),Vn(j0,"onAnimationStart"),Vn("dblclick","onDoubleClick"),Vn("focusin","onFocus"),Vn("focusout","onBlur"),Vn(I_,"onTransitionRun"),Vn($_,"onTransitionStart"),Vn(H_,"onTransitionCancel"),Vn(k0,"onTransitionEnd"),K("onMouseEnter",["mouseout","mouseover"]),K("onMouseLeave",["mouseout","mouseover"]),K("onPointerEnter",["pointerout","pointerover"]),K("onPointerLeave",["pointerout","pointerover"]),oe("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),oe("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),oe("onBeforeInput",["compositionend","keypress","textInput","paste"]),oe("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),oe("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),oe("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ya="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(" "),Aw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ya));function Jy(t,r){r=(r&4)!==0;for(var a=0;a<t.length;a++){var l=t[a],f=l.event;l=l.listeners;e:{var y=void 0;if(r)for(var w=l.length-1;0<=w;w--){var O=l[w],R=O.instance,V=O.currentTarget;if(O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){nl(Z)}f.currentTarget=null,y=R}else for(w=0;w<l.length;w++){if(O=l[w],R=O.instance,V=O.currentTarget,O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){nl(Z)}f.currentTarget=null,y=R}}}}function Ie(t,r){var a=r[Rs];a===void 0&&(a=r[Rs]=new Set);var l=t+"__bubble";a.has(l)||(Qy(r,t,2,!1),a.add(l))}function kh(t,r,a){var l=0;r&&(l|=4),Qy(a,t,l,r)}var $l="_reactListening"+Math.random().toString(36).slice(2);function Nh(t){if(!t[$l]){t[$l]=!0,H.forEach(function(a){a!=="selectionchange"&&(Aw.has(a)||kh(a,!1,t),kh(a,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[$l]||(r[$l]=!0,kh("selectionchange",!1,r))}}function Qy(t,r,a,l){switch(Og(r)){case 2:var f=eS;break;case 8:f=tS;break;default:f=Fh}a=f.bind(null,r,a,t),f=void 0,!Ku||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),l?f!==void 0?t.addEventListener(r,a,{capture:!0,passive:f}):t.addEventListener(r,a,!0):f!==void 0?t.addEventListener(r,a,{passive:f}):t.addEventListener(r,a,!1)}function Th(t,r,a,l,f){var y=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var w=l.tag;if(w===3||w===4){var O=l.stateNode.containerInfo;if(O===f)break;if(w===4)for(w=l.return;w!==null;){var R=w.tag;if((R===3||R===4)&&w.stateNode.containerInfo===f)return;w=w.return}for(;O!==null;){if(w=A(O),w===null)return;if(R=w.tag,R===5||R===6||R===26||R===27){l=y=w;continue e}O=O.parentNode}}l=l.return}t0(function(){var V=y,Z=Vu(a),ie=[];e:{var Y=N0.get(t);if(Y!==void 0){var Q=Zo,ve=t;switch(t){case"keypress":if(Xo(a)===0)break e;case"keydown":case"keyup":Q=x_;break;case"focusin":ve="focus",Q=Wu;break;case"focusout":ve="blur",Q=Wu;break;case"beforeblur":case"afterblur":Q=Wu;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=s0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=o_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=w_;break;case O0:case A0:case j0:Q=u_;break;case k0:Q=E_;break;case"scroll":case"scrollend":Q=i_;break;case"wheel":Q=A_;break;case"copy":case"cut":case"paste":Q=h_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=a0;break;case"toggle":case"beforetoggle":Q=k_}var Te=(r&4)!==0,st=!Te&&(t==="scroll"||t==="scrollend"),$=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var B=V,G;B!==null;){var ee=B;if(G=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||G===null||$===null||(ee=pa(B,$),ee!=null&&Te.push(Ka(B,ee,G))),st)break;B=B.return}0<Te.length&&(Y=new Q(Y,ve,null,a,Z),ie.push({event:Y,listeners:Te}))}}if((r&7)===0){e:{if(Y=t==="mouseover"||t==="pointerover",Q=t==="mouseout"||t==="pointerout",Y&&a!==Gu&&(ve=a.relatedTarget||a.fromElement)&&(A(ve)||ve[fn]))break e;if((Q||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,Q?(ve=a.relatedTarget||a.toElement,Q=V,ve=ve?A(ve):null,ve!==null&&(st=c(ve),Te=ve.tag,ve!==st||Te!==5&&Te!==27&&Te!==6)&&(ve=null)):(Q=null,ve=V),Q!==ve)){if(Te=s0,ee="onMouseLeave",$="onMouseEnter",B="mouse",(t==="pointerout"||t==="pointerover")&&(Te=a0,ee="onPointerLeave",$="onPointerEnter",B="pointer"),st=Q==null?Y:k(Q),G=ve==null?Y:k(ve),Y=new Te(ee,B+"leave",Q,a,Z),Y.target=st,Y.relatedTarget=G,ee=null,A(Z)===V&&(Te=new Te($,B+"enter",ve,a,Z),Te.target=G,Te.relatedTarget=st,ee=Te),st=ee,Q&&ve)t:{for(Te=jw,$=Q,B=ve,G=0,ee=$;ee;ee=Te(ee))G++;ee=0;for(var Ae=B;Ae;Ae=Te(Ae))ee++;for(;0<G-ee;)$=Te($),G--;for(;0<ee-G;)B=Te(B),ee--;for(;G--;){if($===B||B!==null&&$===B.alternate){Te=$;break t}$=Te($),B=Te(B)}Te=null}else Te=null;Q!==null&&Xy(ie,Y,Q,Te,!1),ve!==null&&st!==null&&Xy(ie,st,ve,Te,!0)}}e:{if(Y=V?k(V):window,Q=Y.nodeName&&Y.nodeName.toLowerCase(),Q==="select"||Q==="input"&&Y.type==="file")var Ke=m0;else if(h0(Y))if(p0)Ke=B_;else{Ke=q_;var _e=L_}else Q=Y.nodeName,!Q||Q.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?V&&Fu(V.elementType)&&(Ke=m0):Ke=P_;if(Ke&&(Ke=Ke(t,V))){d0(ie,Ke,a,Z);break e}_e&&_e(t,Y,V),t==="focusout"&&V&&Y.type==="number"&&V.memoizedProps.value!=null&&Hu(Y,"number",Y.value)}switch(_e=V?k(V):window,t){case"focusin":(h0(_e)||_e.contentEditable==="true")&&(mi=_e,sf=V,Sa=null);break;case"focusout":Sa=sf=mi=null;break;case"mousedown":af=!0;break;case"contextmenu":case"mouseup":case"dragend":af=!1,S0(ie,a,Z);break;case"selectionchange":if(z_)break;case"keydown":case"keyup":S0(ie,a,Z)}var Le;if(ef)e:{switch(t){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else di?u0(t,a)&&(He="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(He="onCompositionStart");He&&(o0&&a.locale!=="ko"&&(di||He!=="onCompositionStart"?He==="onCompositionEnd"&&di&&(Le=n0()):(Vr=Z,Ju="value"in Vr?Vr.value:Vr.textContent,di=!0)),_e=Hl(V,He),0<_e.length&&(He=new i0(He,t,null,a,Z),ie.push({event:He,listeners:_e}),Le?He.data=Le:(Le=f0(a),Le!==null&&(He.data=Le)))),(Le=T_?C_(t,a):M_(t,a))&&(He=Hl(V,"onBeforeInput"),0<He.length&&(_e=new i0("onBeforeInput","beforeinput",null,a,Z),ie.push({event:_e,listeners:He}),_e.data=Le)),Sw(ie,t,V,a,Z)}Jy(ie,r)})}function Ka(t,r,a){return{instance:t,listener:r,currentTarget:a}}function Hl(t,r){for(var a=r+"Capture",l=[];t!==null;){var f=t,y=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||y===null||(f=pa(t,a),f!=null&&l.unshift(Ka(t,f,y)),f=pa(t,r),f!=null&&l.push(Ka(t,f,y))),t.tag===3)return l;t=t.return}return[]}function jw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Xy(t,r,a,l,f){for(var y=r._reactName,w=[];a!==null&&a!==l;){var O=a,R=O.alternate,V=O.stateNode;if(O=O.tag,R!==null&&R===l)break;O!==5&&O!==26&&O!==27||V===null||(R=V,f?(V=pa(a,y),V!=null&&w.unshift(Ka(a,V,R))):f||(V=pa(a,y),V!=null&&w.push(Ka(a,V,R)))),a=a.return}w.length!==0&&t.push({event:r,listeners:w})}var kw=/\r\n?/g,Nw=/\u0000|\uFFFD/g;function Wy(t){return(typeof t=="string"?t:""+t).replace(kw,`
26
+ `).replace(Nw,"")}function Zy(t,r){return r=Wy(r),Wy(t)===r}function rt(t,r,a,l,f,y){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||ui(t,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&ui(t,""+l);break;case"className":Gn(t,"class",l);break;case"tabIndex":Gn(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Gn(t,a,l);break;case"style":Zm(t,l,y);break;case"data":if(r!=="object"){Gn(t,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){t.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Jo(""+l),t.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){t.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 y=="function"&&(a==="formAction"?(r!=="input"&&rt(t,r,"name",f.name,f,null),rt(t,r,"formEncType",f.formEncType,f,null),rt(t,r,"formMethod",f.formMethod,f,null),rt(t,r,"formTarget",f.formTarget,f,null)):(rt(t,r,"encType",f.encType,f,null),rt(t,r,"method",f.method,f,null),rt(t,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Jo(""+l),t.setAttribute(a,l);break;case"onClick":l!=null&&(t.onclick=yr);break;case"onScroll":l!=null&&Ie("scroll",t);break;case"onScrollEnd":l!=null&&Ie("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){t.removeAttribute("xlink:href");break}a=Jo(""+l),t.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":l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""+l):t.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":l&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":l===!0?t.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,l):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(a,l):t.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(a):t.setAttribute(a,l);break;case"popover":Ie("beforetoggle",t),Ie("toggle",t),Gt(t,"popover",l);break;case"xlinkActuate":pr(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":pr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":pr(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":pr(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":pr(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":pr(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":pr(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":pr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":pr(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Gt(t,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=r_.get(a)||a,Gt(t,a,l))}}function Ch(t,r,a,l,f,y){switch(a){case"style":Zm(t,l,y);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof l=="string"?ui(t,l):(typeof l=="number"||typeof l=="bigint")&&ui(t,""+l);break;case"onScroll":l!=null&&Ie("scroll",t);break;case"onScrollEnd":l!=null&&Ie("scrollend",t);break;case"onClick":l!=null&&(t.onclick=yr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!se.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),y=t[gt]||null,y=y!=null?y[a]:null,typeof y=="function"&&t.removeEventListener(r,y,f),typeof l=="function")){typeof y!="function"&&y!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(r,l,f);break e}a in t?t[a]=l:l===!0?t.setAttribute(a,""):Gt(t,a,l)}}}function Ht(t,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",t),Ie("load",t);var l=!1,f=!1,y;for(y in a)if(a.hasOwnProperty(y)){var w=a[y];if(w!=null)switch(y){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,y,w,a,null)}}f&&rt(t,r,"srcSet",a.srcSet,a,null),l&&rt(t,r,"src",a.src,a,null);return;case"input":Ie("invalid",t);var O=y=w=f=null,R=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var Z=a[l];if(Z!=null)switch(l){case"name":f=Z;break;case"type":w=Z;break;case"checked":R=Z;break;case"defaultChecked":V=Z;break;case"value":y=Z;break;case"defaultValue":O=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:rt(t,r,l,Z,a,null)}}Jm(t,y,O,R,V,w,f,!1);return;case"select":Ie("invalid",t),l=w=y=null;for(f in a)if(a.hasOwnProperty(f)&&(O=a[f],O!=null))switch(f){case"value":y=O;break;case"defaultValue":w=O;break;case"multiple":l=O;default:rt(t,r,f,O,a,null)}r=y,a=w,t.multiple=!!l,r!=null?ci(t,!!l,r,!1):a!=null&&ci(t,!!l,a,!0);return;case"textarea":Ie("invalid",t),y=f=l=null;for(w in a)if(a.hasOwnProperty(w)&&(O=a[w],O!=null))switch(w){case"value":l=O;break;case"defaultValue":f=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:rt(t,r,w,O,a,null)}Xm(t,l,f,y);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":t.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:rt(t,r,R,l,a,null)}return;case"dialog":Ie("beforetoggle",t),Ie("toggle",t),Ie("cancel",t),Ie("close",t);break;case"iframe":case"object":Ie("load",t);break;case"video":case"audio":for(l=0;l<Ya.length;l++)Ie(Ya[l],t);break;case"image":Ie("error",t),Ie("load",t);break;case"details":Ie("toggle",t);break;case"embed":case"source":case"link":Ie("error",t),Ie("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,V,l,a,null)}return;default:if(Fu(r)){for(Z in a)a.hasOwnProperty(Z)&&(l=a[Z],l!==void 0&&Ch(t,r,Z,l,a,void 0));return}}for(O in a)a.hasOwnProperty(O)&&(l=a[O],l!=null&&rt(t,r,O,l,a,null))}function Tw(t,r,a,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,y=null,w=null,O=null,R=null,V=null,Z=null;for(Q in a){var ie=a[Q];if(a.hasOwnProperty(Q)&&ie!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":R=ie;default:l.hasOwnProperty(Q)||rt(t,r,Q,null,l,ie)}}for(var Y in l){var Q=l[Y];if(ie=a[Y],l.hasOwnProperty(Y)&&(Q!=null||ie!=null))switch(Y){case"type":y=Q;break;case"name":f=Q;break;case"checked":V=Q;break;case"defaultChecked":Z=Q;break;case"value":w=Q;break;case"defaultValue":O=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,r));break;default:Q!==ie&&rt(t,r,Y,Q,l,ie)}}$u(t,w,O,R,V,Z,y,f);return;case"select":Q=w=O=Y=null;for(y in a)if(R=a[y],a.hasOwnProperty(y)&&R!=null)switch(y){case"value":break;case"multiple":Q=R;default:l.hasOwnProperty(y)||rt(t,r,y,null,l,R)}for(f in l)if(y=l[f],R=a[f],l.hasOwnProperty(f)&&(y!=null||R!=null))switch(f){case"value":Y=y;break;case"defaultValue":O=y;break;case"multiple":w=y;default:y!==R&&rt(t,r,f,y,l,R)}r=O,a=w,l=Q,Y!=null?ci(t,!!a,Y,!1):!!l!=!!a&&(r!=null?ci(t,!!a,r,!0):ci(t,!!a,a?[]:"",!1));return;case"textarea":Q=Y=null;for(O in a)if(f=a[O],a.hasOwnProperty(O)&&f!=null&&!l.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:rt(t,r,O,null,l,f)}for(w in l)if(f=l[w],y=a[w],l.hasOwnProperty(w)&&(f!=null||y!=null))switch(w){case"value":Y=f;break;case"defaultValue":Q=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==y&&rt(t,r,w,f,l,y)}Qm(t,Y,Q);return;case"option":for(var ve in a)if(Y=a[ve],a.hasOwnProperty(ve)&&Y!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":t.selected=!1;break;default:rt(t,r,ve,null,l,Y)}for(R in l)if(Y=l[R],Q=a[R],l.hasOwnProperty(R)&&Y!==Q&&(Y!=null||Q!=null))switch(R){case"selected":t.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:rt(t,r,R,Y,l,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 Te in a)Y=a[Te],a.hasOwnProperty(Te)&&Y!=null&&!l.hasOwnProperty(Te)&&rt(t,r,Te,null,l,Y);for(V in l)if(Y=l[V],Q=a[V],l.hasOwnProperty(V)&&Y!==Q&&(Y!=null||Q!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,r));break;default:rt(t,r,V,Y,l,Q)}return;default:if(Fu(r)){for(var st in a)Y=a[st],a.hasOwnProperty(st)&&Y!==void 0&&!l.hasOwnProperty(st)&&Ch(t,r,st,void 0,l,Y);for(Z in l)Y=l[Z],Q=a[Z],!l.hasOwnProperty(Z)||Y===Q||Y===void 0&&Q===void 0||Ch(t,r,Z,Y,l,Q);return}}for(var $ in a)Y=a[$],a.hasOwnProperty($)&&Y!=null&&!l.hasOwnProperty($)&&rt(t,r,$,null,l,Y);for(ie in l)Y=l[ie],Q=a[ie],!l.hasOwnProperty(ie)||Y===Q||Y==null&&Q==null||rt(t,r,ie,Y,l,Q)}function eg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Cw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],y=f.transferSize,w=f.initiatorType,O=f.duration;if(y&&O&&eg(w)){for(w=0,O=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],V=R.startTime;if(V>O)break;var Z=R.transferSize,ie=R.initiatorType;Z&&eg(ie)&&(R=R.responseEnd,w+=Z*(R<O?1:(O-V)/(R-V)))}if(--l,r+=8*(y+w)/(f.duration/1e3),t++,10<t)break}}if(0<t)return r/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Mh=null,Rh=null;function Fl(t){return t.nodeType===9?t:t.ownerDocument}function tg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ng(t,r){if(t===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&r==="foreignObject"?0:t}function Dh(t,r){return t==="textarea"||t==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Lh=null;function Mw(){var t=window.event;return t&&t.type==="popstate"?t===Lh?!1:(Lh=t,!0):(Lh=null,!1)}var rg=typeof setTimeout=="function"?setTimeout:void 0,Rw=typeof clearTimeout=="function"?clearTimeout:void 0,sg=typeof Promise=="function"?Promise:void 0,Dw=typeof queueMicrotask=="function"?queueMicrotask:typeof sg<"u"?function(t){return sg.resolve(null).then(t).catch(Lw)}:rg;function Lw(t){setTimeout(function(){throw t})}function cs(t){return t==="head"}function ig(t,r){var a=r,l=0;do{var f=a.nextSibling;if(t.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){t.removeChild(f),Ii(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Ja(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Ja(a);for(var y=a.firstChild;y;){var w=y.nextSibling,O=y.nodeName;y[Rt]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||a.removeChild(y),y=w}}else a==="body"&&Ja(t.ownerDocument.body);a=f}while(a);Ii(r)}function ag(t,r){var a=t;t=0;do{var l=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=l}while(a)}function qh(t){var r=t.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":qh(a),li(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function qw(t,r,a,l){for(;t.nodeType===1;){var f=a;if(t.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Rt])switch(r){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(r==="input"&&t.type==="hidden"){var y=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Bn(t.nextSibling),t===null)break}return null}function Pw(t,r,a){if(r==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Bn(t.nextSibling),t===null))return null;return t}function og(t,r){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=Bn(t.nextSibling),t===null))return null;return t}function Ph(t){return t.data==="$?"||t.data==="$~"}function Bh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Bw(t,r){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=r;else if(t.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function Bn(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return t}var Uh=null;function lg(t){t=t.nextSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(r===0)return Bn(t.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}t=t.nextSibling}return null}function cg(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return t;r--}else a!=="/$"&&a!=="/&"||r++}t=t.previousSibling}return null}function ug(t,r,a){switch(r=Fl(a),t){case"html":if(t=r.documentElement,!t)throw Error(i(452));return t;case"head":if(t=r.head,!t)throw Error(i(453));return t;case"body":if(t=r.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Ja(t){for(var r=t.attributes;r.length;)t.removeAttributeNode(r[0]);li(t)}var Un=new Map,fg=new Set;function Gl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Mr=J.d;J.d={f:Uw,r:zw,D:Iw,C:$w,L:Hw,m:Fw,X:Vw,S:Gw,M:Yw};function Uw(){var t=Mr.f(),r=ql();return t||r}function zw(t){var r=N(t);r!==null&&r.tag===5&&r.type==="form"?kp(r):Mr.r(t)}var Bi=typeof document>"u"?null:document;function hg(t,r,a){var l=Bi;if(l&&typeof r=="string"&&r){var f=Cn(r);f='link[rel="'+t+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),fg.has(f)||(fg.add(f),t={rel:t,crossOrigin:a,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),Ht(r,"link",t),L(r),l.head.appendChild(r)))}}function Iw(t){Mr.D(t),hg("dns-prefetch",t,null)}function $w(t,r){Mr.C(t,r),hg("preconnect",t,r)}function Hw(t,r,a){Mr.L(t,r,a);var l=Bi;if(l&&t&&r){var f='link[rel="preload"][as="'+Cn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Cn(a.imageSizes)+'"]')):f+='[href="'+Cn(t)+'"]';var y=f;switch(r){case"style":y=Ui(t);break;case"script":y=zi(t)}Un.has(y)||(t=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:t,as:r},a),Un.set(y,t),l.querySelector(f)!==null||r==="style"&&l.querySelector(Qa(y))||r==="script"&&l.querySelector(Xa(y))||(r=l.createElement("link"),Ht(r,"link",t),L(r),l.head.appendChild(r)))}}function Fw(t,r){Mr.m(t,r);var a=Bi;if(a&&t){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+Cn(l)+'"][href="'+Cn(t)+'"]',y=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=zi(t)}if(!Un.has(y)&&(t=b({rel:"modulepreload",href:t},r),Un.set(y,t),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Xa(y)))return}l=a.createElement("link"),Ht(l,"link",t),L(l),a.head.appendChild(l)}}}function Gw(t,r,a){Mr.S(t,r,a);var l=Bi;if(l&&t){var f=T(l).hoistableStyles,y=Ui(t);r=r||"default";var w=f.get(y);if(!w){var O={loading:0,preload:null};if(w=l.querySelector(Qa(y)))O.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":r},a),(a=Un.get(y))&&zh(t,a);var R=w=l.createElement("link");L(R),Ht(R,"link",t),R._p=new Promise(function(V,Z){R.onload=V,R.onerror=Z}),R.addEventListener("load",function(){O.loading|=1}),R.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Vl(w,r,l)}w={type:"stylesheet",instance:w,count:1,state:O},f.set(y,w)}}}function Vw(t,r){Mr.X(t,r);var a=Bi;if(a&&t){var l=T(a).hoistableScripts,f=zi(t),y=l.get(f);y||(y=a.querySelector(Xa(f)),y||(t=b({src:t,async:!0},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ht(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function Yw(t,r){Mr.M(t,r);var a=Bi;if(a&&t){var l=T(a).hoistableScripts,f=zi(t),y=l.get(f);y||(y=a.querySelector(Xa(f)),y||(t=b({src:t,async:!0,type:"module"},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ht(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function dg(t,r,a,l){var f=(f=Ct.current)?Gl(f):null;if(!f)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=Ui(a.href),a=T(f).hoistableStyles,l=a.get(r),l||(l={type:"style",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=Ui(a.href);var y=T(f).hoistableStyles,w=y.get(t);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,w),(y=f.querySelector(Qa(t)))&&!y._p&&(w.instance=y,w.state.loading=5),Un.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Un.set(t,a),y||Kw(f,t,a,w.state))),r&&l===null)throw Error(i(528,""));return w}if(r&&l!==null)throw Error(i(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=zi(a),a=T(f).hoistableScripts,l=a.get(r),l||(l={type:"script",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function Ui(t){return'href="'+Cn(t)+'"'}function Qa(t){return'link[rel="stylesheet"]['+t+"]"}function mg(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function Kw(t,r,a,l){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=t.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),Ht(r,"link",a),L(r),t.head.appendChild(r))}function zi(t){return'[src="'+Cn(t)+'"]'}function Xa(t){return"script[async]"+t}function pg(t,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=t.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(l)return r.instance=l,L(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),L(l),Ht(l,"style",f),Vl(l,a.precedence,t),r.instance=l;case"stylesheet":f=Ui(a.href);var y=t.querySelector(Qa(f));if(y)return r.state.loading|=4,r.instance=y,L(y),y;l=mg(a),(f=Un.get(f))&&zh(l,f),y=(t.ownerDocument||t).createElement("link"),L(y);var w=y;return w._p=new Promise(function(O,R){w.onload=O,w.onerror=R}),Ht(y,"link",l),r.state.loading|=4,Vl(y,a.precedence,t),r.instance=y;case"script":return y=zi(a.src),(f=t.querySelector(Xa(y)))?(r.instance=f,L(f),f):(l=a,(f=Un.get(y))&&(l=b({},a),Ih(l,f)),t=t.ownerDocument||t,f=t.createElement("script"),L(f),Ht(f,"link",l),t.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,Vl(l,a.precedence,t));return r.instance}function Vl(t,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,y=f,w=0;w<l.length;w++){var O=l[w];if(O.dataset.precedence===r)y=O;else if(y!==f)break}y?y.parentNode.insertBefore(t,y.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(t,r.firstChild))}function zh(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.title==null&&(t.title=r.title)}function Ih(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.integrity==null&&(t.integrity=r.integrity)}var Yl=null;function yg(t,r,a){if(Yl===null){var l=new Map,f=Yl=new Map;f.set(a,l)}else f=Yl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(t))return l;for(l.set(t,null),a=a.getElementsByTagName(t),f=0;f<a.length;f++){var y=a[f];if(!(y[Rt]||y[at]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var w=y.getAttribute(r)||"";w=t+w;var O=l.get(w);O?O.push(y):l.set(w,[y])}}return l}function gg(t,r,a){t=t.ownerDocument||t,t.head.insertBefore(a,r==="title"?t.querySelector("head > title"):null)}function Jw(t,r,a){if(a===1||r.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return t=r.disabled,typeof r.precedence=="string"&&t==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function bg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Qw(t,r,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=Ui(l.href),y=r.querySelector(Qa(f));if(y){r=y._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=Kl.bind(t),r.then(t,t)),a.state.loading|=4,a.instance=y,L(y);return}y=r.ownerDocument||r,l=mg(l),(f=Un.get(f))&&zh(l,f),y=y.createElement("link"),L(y);var w=y;w._p=new Promise(function(O,R){w.onload=O,w.onerror=R}),Ht(y,"link",l),a.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Kl.bind(t),r.addEventListener("load",a),r.addEventListener("error",a))}}var $h=0;function Xw(t,r){return t.stylesheets&&t.count===0&&Ql(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var l=setTimeout(function(){if(t.stylesheets&&Ql(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+r);0<t.imgBytes&&$h===0&&($h=62500*Cw());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Ql(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>$h?50:800)+r);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Kl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ql(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Jl=null;function Ql(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Jl=new Map,r.forEach(Ww,t),Jl=null,Kl.call(t))}function Ww(t,r){if(!(r.state.loading&4)){var a=Jl.get(t);if(a)var l=a.get(null);else{a=new Map,Jl.set(t,a);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<f.length;y++){var w=f[y];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),l=w)}l&&a.set(null,l)}f=r.instance,w=f.getAttribute("data-precedence"),y=a.get(w)||l,y===l&&a.set(null,f),a.set(w,f),this.count++,l=Kl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),y?y.parentNode.insertBefore(f,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),r.state.loading|=4}}var Wa={$$typeof:ne,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function Zw(t,r,a,l,f,y,w,O,R){this.tag=1,this.containerInfo=t,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=$r(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$r(0),this.hiddenUpdates=$r(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=y,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function xg(t,r,a,l,f,y,w,O,R,V,Z,ie){return t=new Zw(t,r,a,w,R,V,Z,ie,O),r=1,y===!0&&(r|=24),y=dn(3,null,null,r),t.current=y,y.stateNode=t,r=_f(),r.refCount++,t.pooledCache=r,r.refCount++,y.memoizedState={element:l,isDehydrated:a,cache:r},Of(y),t}function vg(t){return t?(t=gi,t):gi}function _g(t,r,a,l,f,y){f=vg(f),l.context===null?l.context=f:l.pendingContext=f,l=Wr(r),l.payload={element:a},y=y===void 0?null:y,y!==null&&(l.callback=y),a=Zr(t,l,r),a!==null&&(ln(a,t,r),Ta(a,t,r))}function wg(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<r?a:r}}function Hh(t,r){wg(t,r),(t=t.alternate)&&wg(t,r)}function Sg(t){if(t.tag===13||t.tag===31){var r=Ps(t,67108864);r!==null&&ln(r,t,67108864),Hh(t,67108864)}}function Eg(t){if(t.tag===13||t.tag===31){var r=bn();r=mr(r);var a=Ps(t,r);a!==null&&ln(a,t,r),Hh(t,r)}}var Xl=!0;function eS(t,r,a,l){var f=F.T;F.T=null;var y=J.p;try{J.p=2,Fh(t,r,a,l)}finally{J.p=y,F.T=f}}function tS(t,r,a,l){var f=F.T;F.T=null;var y=J.p;try{J.p=8,Fh(t,r,a,l)}finally{J.p=y,F.T=f}}function Fh(t,r,a,l){if(Xl){var f=Gh(l);if(f===null)Th(t,r,l,Wl,a),Ag(t,l);else if(rS(f,t,r,a,l))l.stopPropagation();else if(Ag(t,l),r&4&&-1<nS.indexOf(t)){for(;f!==null;){var y=N(f);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var w=Hn(y.pendingLanes);if(w!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;w;){var R=1<<31-Ft(w);O.entanglements[1]|=R,w&=~R}ir(y),(Qe&6)===0&&(Dl=ft()+500,Va(0))}}break;case 31:case 13:O=Ps(y,2),O!==null&&ln(O,y,2),ql(),Hh(y,2)}if(y=Gh(l),y===null&&Th(t,r,l,Wl,a),y===f)break;f=y}f!==null&&l.stopPropagation()}else Th(t,r,l,null,a)}}function Gh(t){return t=Vu(t),Vh(t)}var Wl=null;function Vh(t){if(Wl=null,t=A(t),t!==null){var r=c(t);if(r===null)t=null;else{var a=r.tag;if(a===13){if(t=m(r),t!==null)return t;t=null}else if(a===31){if(t=p(r),t!==null)return t;t=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null)}}return Wl=t,null}function Og(t){switch(t){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(Bu()){case Io:return 2;case $o:return 8;case ii:case Uu:return 32;case Ho:return 268435456;default:return 32}default:return 32}}var Yh=!1,us=null,fs=null,hs=null,Za=new Map,eo=new Map,ds=[],nS="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 Ag(t,r){switch(t){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":fs=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":Za.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":eo.delete(r.pointerId)}}function to(t,r,a,l,f,y){return t===null||t.nativeEvent!==y?(t={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:y,targetContainers:[f]},r!==null&&(r=N(r),r!==null&&Sg(r)),t):(t.eventSystemFlags|=l,r=t.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),t)}function rS(t,r,a,l,f){switch(r){case"focusin":return us=to(us,t,r,a,l,f),!0;case"dragenter":return fs=to(fs,t,r,a,l,f),!0;case"mouseover":return hs=to(hs,t,r,a,l,f),!0;case"pointerover":var y=f.pointerId;return Za.set(y,to(Za.get(y)||null,t,r,a,l,f)),!0;case"gotpointercapture":return y=f.pointerId,eo.set(y,to(eo.get(y)||null,t,r,a,l,f)),!0}return!1}function jg(t){var r=A(t.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=m(a),r!==null){t.blockedOn=r,Go(t.priority,function(){Eg(a)});return}}else if(r===31){if(r=p(a),r!==null){t.blockedOn=r,Go(t.priority,function(){Eg(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Zl(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var a=Gh(t.nativeEvent);if(a===null){a=t.nativeEvent;var l=new a.constructor(a.type,a);Gu=l,a.target.dispatchEvent(l),Gu=null}else return r=N(a),r!==null&&Sg(r),t.blockedOn=a,!1;r.shift()}return!0}function kg(t,r,a){Zl(t)&&a.delete(r)}function sS(){Yh=!1,us!==null&&Zl(us)&&(us=null),fs!==null&&Zl(fs)&&(fs=null),hs!==null&&Zl(hs)&&(hs=null),Za.forEach(kg),eo.forEach(kg)}function ec(t,r){t.blockedOn===r&&(t.blockedOn=null,Yh||(Yh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,sS)))}var tc=null;function Ng(t){tc!==t&&(tc=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){tc===t&&(tc=null);for(var r=0;r<t.length;r+=3){var a=t[r],l=t[r+1],f=t[r+2];if(typeof l!="function"){if(Vh(l||a)===null)continue;break}var y=N(a);y!==null&&(t.splice(r,3),r-=3,Gf(y,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ii(t){function r(R){return ec(R,t)}us!==null&&ec(us,t),fs!==null&&ec(fs,t),hs!==null&&ec(hs,t),Za.forEach(r),eo.forEach(r);for(var a=0;a<ds.length;a++){var l=ds[a];l.blockedOn===t&&(l.blockedOn=null)}for(;0<ds.length&&(a=ds[0],a.blockedOn===null);)jg(a),a.blockedOn===null&&ds.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],y=a[l+1],w=f[gt]||null;if(typeof y=="function")w||Ng(a);else if(w){var O=null;if(y&&y.hasAttribute("formAction")){if(f=y,w=y[gt]||null)O=w.formAction;else if(Vh(f)!==null)continue}else O=w.action;typeof O=="function"?a[l+1]=O:(a.splice(l,3),l-=3),Ng(a)}}}function Tg(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(w){return f=w})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Kh(t){this._internalRoot=t}nc.prototype.render=Kh.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=bn();_g(a,l,t,r,null,null)},nc.prototype.unmount=Kh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;_g(t.current,2,null,t,null,null),ql(),r[fn]=null}};function nc(t){this._internalRoot=t}nc.prototype.unstable_scheduleHydration=function(t){if(t){var r=da();t={blockedOn:null,target:t,priority:r};for(var a=0;a<ds.length&&r!==0&&r<ds[a].priority;a++);ds.splice(a,0,t),a===0&&jg(t)}};var Cg=e.version;if(Cg!=="19.2.4")throw Error(i(527,Cg,"19.2.4"));J.findDOMNode=function(t){var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=u(r),t=t!==null?d(t):null,t=t===null?null:t.stateNode,t};var iS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rc.isDisabled&&rc.supportsFiber)try{ks=rc.inject(iS),_t=rc}catch{}}return no.createRoot=function(t,r){if(!o(t))throw Error(i(299));var a=!1,l="",f=Bp,y=Up,w=zp;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=xg(t,1,!1,null,null,a,l,null,f,y,w,Tg),t[fn]=r.current,Nh(t),new Kh(r)},no.hydrateRoot=function(t,r,a){if(!o(t))throw Error(i(299));var l=!1,f="",y=Bp,w=Up,O=zp,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),r=xg(t,1,!0,r,a??null,l,f,R,y,w,O,Tg),r.context=vg(null),a=r.current,l=bn(),l=mr(l),f=Wr(l),f.callback=null,Zr(a,f,l),a=l,r.current.lanes=a,Fn(r,a),ir(r),t[fn]=r.current,Nh(t),new nc(r)},no.version="19.2.4",no}var Bg;function QS(){if(Bg)return Jh.exports;Bg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Jh.exports=JS(),Jh.exports}var XS=QS();const WS="modulepreload",ZS=function(n,e){return new URL(n,e).href},Ug={},ke=function(e,s,i){let o=Promise.resolve();if(s&&s.length>0){let m=function(d){return Promise.all(d.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),u=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=m(s.map(d=>{if(d=ZS(d,i),d in Ug)return;Ug[d]=!0;const b=d.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=p.length-1;S>=0;S--){const C=p[S];if(C.href===d&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${x}`))return;const _=document.createElement("link");if(_.rel=b?"stylesheet":WS,b||(_.as="script"),_.crossOrigin="",_.href=d,u&&_.setAttribute("nonce",u),document.head.appendChild(_),b)return new Promise((S,C)=>{_.addEventListener("load",S),_.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${d}`)))})}))}function c(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return o.then(m=>{for(const p of m||[])p.status==="rejected"&&c(p.reason);return e().catch(c)})};function Eu(n){try{const e=n.split(".");if(e.length!==3)return null;const s=atob(e[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function yx(n){const e=Eu(n);return!e||typeof e.exp!="number"?null:e.exp}function om(n,e=0){const s=yx(n);return s===null?!0:Date.now()/1e3>=s-e}const Vt=window.__LT_BASE__??"",_d=`${Vt}/api`;class zg extends Error{constructor(e,s,i){super(e),this.status=s,this.body=i,this.name="ApiError"}}let bs=null;function sc(n){bs=n}function wd(){return bs}const eE="X-LT-Acting-Token",tE="X-LT-Acting-Remaining";let eu=null,tu=null;function Ig(n){eu=n}let nu=null;function $g(n){nu=n}function Hg(n){tu=n}function nE(n){const e=n==null?void 0:n.error;return typeof e=="string"&&/acting[- ]identity/i.test(e)}async function Fg(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:e,password:s}=JSON.parse(n),i=await fetch(`${_d}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:s})});if(!i.ok)return null;const o=await i.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let ps=null;async function ue(n,e={}){const s={"Content-Type":"application/json",...e.headers};if(bs){if(om(bs)){ps||(ps=Fg().finally(()=>{ps=null}));const p=await ps;if(p)bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${bs}`}const o=(e.method??"GET").toUpperCase()==="GET"?null:(eu==null?void 0:eu())??null;o&&(s[eE]=o);let c=await fetch(`${_d}${n}`,{...e,headers:s});const m=o?c.headers.get(tE):null;if(o&&m!==null&&(nu==null||nu(o,m==="unbounded"?null:Number(m))),c.status===401&&o){const p=await c.clone().json().catch(()=>null);if(nE(p))throw tu==null||tu(),new zg(p.error,401,p)}if(c.status===401&&bs){ps||(ps=Fg().finally(()=>{ps=null}));const p=await ps;if(p&&(bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}})),s.Authorization=`Bearer ${p}`,c=await fetch(`${_d}${n}`,{...e,headers:s})),c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!c.ok){const p=await c.json().catch(()=>({error:c.statusText}));throw new zg(p.message||p.error||c.statusText,c.status,p)}return c.json()}const rE="lt_ai_override";let ic=null;function lm(){return ic||(ic=fetch(`${Vt}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw ic=null,n})),ic}function sE(){try{if(localStorage.getItem(rE)==="off")return!1}catch{}return null}function er(){var s;const n=qe({queryKey:["settings"],queryFn:lm,staleTime:1/0}),e=sE();return n.data&&e===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function iE(n){var u,d,b;const{data:e}=er(),s=((u=e==null?void 0:e.auth)==null?void 0:u.ssoKeepaliveSeconds)??0,i=((d=e==null?void 0:e.auth)==null?void 0:d.ssoKeepaliveIdleTimeoutSeconds)??0,o=E.useRef(Date.now()),c=E.useRef(Date.now()),m=E.useRef(!1),g=!!n&&((b=Eu(n))==null?void 0:b.sso)===!0&&s>0;E.useEffect(()=>{if(!g)return;const x=()=>{o.current=Date.now()};window.addEventListener("pointerdown",x,{passive:!0}),window.addEventListener("keydown",x,{passive:!0}),window.addEventListener("wheel",x,{passive:!0});const v=async()=>{if(!m.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-o.current>i*1e3)){m.current=!0;try{const C=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const P=await C.json().catch(()=>null);P!=null&&P.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:P.token}})))}catch{}finally{m.current=!1}}},_=setInterval(v,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&v()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(_),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),window.removeEventListener("wheel",x)}},[g,s,i])}const gx=E.createContext(null),aE=300;function Wh(n,e){if(om(n))return null;const s=Eu(n);if(!s)return null;const i=e??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):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 oE({children:n}){const[e,s]=E.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?om(b)?(sessionStorage.removeItem("lt_token"),null):(sc(b),Wh(b)):null}),i=E.useRef(void 0),o=E.useCallback(b=>{clearTimeout(i.current);const x=yx(b);if(!x)return;const v=(x-aE)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const _=Eu(b);if(_!=null&&_.sso){const te=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!te.ok)return;const M=await te.json();M.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:M.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:P}=JSON.parse(S),q=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:P})});if(!q.ok)return;const ne=await q.json();ne.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ne.token}}))}catch{}},v))},[]),c=E.useCallback((b,x,v)=>{const _={displayName:(v==null?void 0:v.displayName)??null,username:(v==null?void 0:v.username)??(x==null?void 0:x.username)??null},S=Wh(b,_);S&&(sc(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(_)),x&&sessionStorage.setItem("lt_credentials",JSON.stringify(x)),s(S),o(b))},[o]),m=E.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");sc(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)},[]);E.useEffect(()=>{const b=()=>m(),x=v=>{var C;const _=(C=v.detail)==null?void 0:C.token;if(!_)return;const S=Wh(_);S&&(sc(_),sessionStorage.setItem("lt_token",_),s(S),o(_))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",x),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",x)}},[m,o]),E.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&e&&o(b),()=>clearTimeout(i.current)},[]);const p=(e==null?void 0:e.roles.some(b=>b.type==="superadmin"))??!1,g=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.role===b))??!1,[e]),u=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.type===b))??!1,[e]),d=(e==null?void 0:e.roles.map(b=>b.role))??[];return h.jsxs(gx.Provider,{value:{user:e,isAuthenticated:!!e,isSuperAdmin:p,login:c,logout:m,hasRole:g,hasRoleType:u,userRoleNames:d},children:[h.jsx(lE,{authenticated:e!==null}),n]})}function lE({authenticated:n}){return iE(n?sessionStorage.getItem("lt_token"):null),null}function qt(){const n=E.useContext(gx);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}async function cE(n){if(!wd())return{kind:"session-ended"};try{const e=await ue("/nats-credentials"),s=e.natsWsUrl??n;return s?{kind:"ok",url:s,token:e.natsToken??null}:{kind:"unavailable"}}catch{return wd()?{kind:"unavailable"}:{kind:"session-ended"}}}const yo={initialDelayMs:1e3,maxDelayMs:6e4,noticeAfterMs:3e4,spreadMs:5e3};function uE(n,e,s=Math.random){const i=Math.min(e.maxDelayMs,e.initialDelayMs*2**Math.max(0,n));return Math.round(i/2+s()*(i/2))}function Gg(n,e=Math.random){return Math.round(e()*n.spreadMs)}function Vg(n){const e=(s,i)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:i;return{initialDelayMs:e(n==null?void 0:n.initialDelayMs,yo.initialDelayMs),maxDelayMs:e(n==null?void 0:n.maxDelayMs,yo.maxDelayMs),noticeAfterMs:e(n==null?void 0:n.noticeAfterMs,yo.noticeAfterMs),spreadMs:e(n==null?void 0:n.spreadMs,yo.spreadMs)}}const jn=new Uint8Array(0),ri=new TextEncoder,En=new TextDecoder;function fE(...n){let e=0;for(let o=0;o<n.length;o++)e+=n[o].length;const s=new Uint8Array(e);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function vo(...n){const e=[];for(let s=0;s<n.length;s++)e.push(ri.encode(n[s]));return e.length===0?jn:e.length===1?e[0]:fE(...e)}function Yg(n){return!n||n.length===0?"":En.decode(n)}const Kg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Jg=36,hE=0xcfd41b9100000,Qg=33,dE=333,Xg=22;function mE(n){for(let e=0;e<n.length;e++)n[e]=Math.floor(Math.random()*255)}function pE(n){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(n):mE(n)}class yE{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(Xg),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*hE),this.inc=Math.floor(Math.random()*(dE-Qg)+Qg)}setPre(){const e=new Uint8Array(12);pE(e);for(let s=0;s<12;s++){const i=e[s]%36;this.buf[s]=Kg.charCodeAt(i)}}fillSeq(){let e=this.seq;for(let s=Xg-1;s>=12;s--)this.buf[s]=Kg.charCodeAt(e%Jg),e=Math.floor(e/Jg)}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 Os=new yE;var Dr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Dr||(Dr={}));var Ji;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Ji||(Ji={}));var fe;(function(n){n.ApiError="BAD API",n.BadAuthentication="BAD_AUTHENTICATION",n.BadCreds="BAD_CREDS",n.BadHeader="BAD_HEADER",n.BadJson="BAD_JSON",n.BadPayload="BAD_PAYLOAD",n.BadSubject="BAD_SUBJECT",n.Cancelled="CANCELLED",n.ConnectionClosed="CONNECTION_CLOSED",n.ConnectionDraining="CONNECTION_DRAINING",n.ConnectionRefused="CONNECTION_REFUSED",n.ConnectionTimeout="CONNECTION_TIMEOUT",n.Disconnect="DISCONNECT",n.InvalidOption="INVALID_OPTION",n.InvalidPayload="INVALID_PAYLOAD",n.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",n.NoResponders="503",n.NotFunction="NOT_FUNC",n.RequestError="REQUEST_ERROR",n.ServerOptionNotAvailable="SERVER_OPT_NA",n.SubClosed="SUB_CLOSED",n.SubDraining="SUB_DRAINING",n.Timeout="TIMEOUT",n.Tls="TLS",n.Unknown="UNKNOWN_ERROR",n.WssRequired="WSS_REQUIRED",n.JetStreamInvalidAck="JESTREAM_INVALID_ACK",n.JetStream404NoMessages="404",n.JetStream408RequestTimeout="408",n.JetStream409MaxAckPendingExceeded="409",n.JetStream409="409",n.JetStreamNotEnabled="503",n.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",n.AuthorizationViolation="AUTHORIZATION_VIOLATION",n.AuthenticationExpired="AUTHENTICATION_EXPIRED",n.ProtocolError="NATS_PROTOCOL_ERR",n.PermissionsViolation="PERMISSIONS_VIOLATION",n.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",n.AccountExpired="ACCOUNT_EXPIRED"})(fe||(fe={}));function gE(n){return typeof n.code=="string"}class bx{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(fe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(fe.BadJson,"Bad JSON"),this.messages.set(fe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return bE.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const bE=new bx;class ge extends Error{constructor(s,i,o){super(s);j(this,"name");j(this,"message");j(this,"code");j(this,"permissionContext");j(this,"chainedError");j(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=o}static errorForCode(s,i){const o=bx.getMessage(s);return new ge(o,s,i)}isAuthError(){return this.code===fe.AuthenticationExpired||this.code===fe.AuthorizationViolation||this.code===fe.AccountExpired}isAuthTimeout(){return this.code===fe.AuthenticationTimeout}isPermissionError(){return this.code===fe.PermissionsViolation}isProtocolError(){return this.code===fe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var _n;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(_n||(_n={}));var Wn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Wn||(Wn={}));var _o;(function(n){n.STATS="io.nats.micro.v1.stats_response",n.INFO="io.nats.micro.v1.info_response",n.PING="io.nats.micro.v1.ping_response"})(_o||(_o={}));const uu="Nats-Service-Error",fu="Nats-Service-Error-Code";class hu extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return hu.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(fu))||"";if(i!==""){const m=parseInt(i)||400,p=((c=s==null?void 0:s.headers)==null?void 0:c.get(uu))||"";return new hu(m,p.length?p:i)}return null}}function Lr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${Os.next()}`}const Sd="127.0.0.1";var vs;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(vs||(vs={}));function Ou(n,...e){for(let s=0;s<e.length;s++){const i=e[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function ac(n){return En.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function na(n,e=!0){const s=e?ge.errorForCode(fe.Timeout):null;let i,o;const c=new Promise((m,p)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{p(s===null?ge.errorForCode(fe.Timeout):s)},n)});return Object.assign(c,i)}function ia(n=0){let e;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);e={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,e)}function mt(){let n={};const e=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(e,n)}function xx(n){for(let e=n.length-1;e>0;e--){const s=Math.floor(Math.random()*(e+1));[n[e],n[s]]=[n[s],n[e]]}return n}function xE(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function cm(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const e=n.length-1;return{backoff(s){return xE(s>e?n[e]:n[s])}}}function dt(n){return n*1e6}function um(n){return Math.floor(n/1e6)}function Wg(n){let i=!0;const o=new Array(n.length);for(let c=0;c<n.length;c++){let m=n.charCodeAt(c);if(m===58||m<33||m>126)throw new ge(`'${n[c]}' is not a valid character for a header key`,fe.BadHeader);i&&97<=m&&m<=122?m-=32:!i&&65<=m&&m<=90&&(m+=32),o[c]=m,i=m==45}return String.fromCharCode(...o)}function Pr(n=0,e=""){if(n===0&&e!==""||n>0&&e==="")throw new Error("setting status requires both code and description");return new _s(n,e)}const Zh="NATS/1.0";class _s{constructor(e=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=e,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[s,i]of this.headers){const o=e.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),m=[...o].sort();for(let p=0;p<c.length;p++)if(c[p]!==m[p])return!1}return!0}return!1}static decode(e){const s=new _s,o=En.decode(e).split(`\r
27
27
  `),c=o[0];if(c!==Zh){let m=c.replace(Zh,"").trim();if(m.length>0){s._code=parseInt(m,10),isNaN(s._code)&&(s._code=0);const p=s._code.toString();m=m.replace(p,""),s._description=m.trim()}}return o.length>=1&&o.slice(1).map(m=>{if(m){const p=m.indexOf(":");if(p>-1){const g=m.slice(0,p),u=m.slice(p+1).trim();s.append(g,u)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let e=Zh;this._code>0&&this._description!==""&&(e+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let o=0;o<i.length;o++)e=`${e}\r
28
28
  ${s}: ${i[o]}`;return`${e}\r
29
29
  \r
30
- `}encode(){return ri.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new ge("invalid header value - \\r and \\n are not allowed.",fe.BadHeader);return e.trim()}keys(){const e=[];for(const s of this.headers.keys())e.push(s);return e}findKeys(e,s=_n.Exact){const i=this.keys();switch(s){case _n.Exact:return i.filter(o=>o===e);case _n.CanonicalMIME:return e=Xg(e),i.filter(o=>o===e);default:{const o=e.toLowerCase();return i.filter(c=>o===c.toLowerCase())}}}get(e,s=_n.Exact){const i=this.findKeys(e,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(e,s=_n.Exact){const i=this.findKeys(e,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(e,s=_n.Exact){return this.findKeys(e,s).length>0}set(e,s,i=_n.Exact){this.delete(e,i),this.append(e,s,i)}append(e,s,i=_n.Exact){const o=Xg(e);i===_n.CanonicalMIME&&(e=o);const c=this.findKeys(e,i);e=c.length>0?c[0]:e;const m=_s.validHeaderValue(s);let p=this.headers.get(e);p||(p=[],this.headers.set(e,p)),p.push(m)}values(e,s=_n.Exact){const i=[];return this.findKeys(e,s).forEach(c=>{const m=this.headers.get(c);m&&i.push(...m)}),i}delete(e,s=_n.Exact){this.findKeys(e,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const e={};return this.keys().forEach(s=>{e[s]=this.values(s)}),e}get code(){return this._code}get description(){return this._description}static fromRecord(e){const s=new _s;for(const i in e)s.headers.set(i,e[i]);return s}}function Ed(){return{encode(n){return ri.encode(n)},decode(n){return En.decode(n)}}}function Zn(n){return{encode(e){try{return e===void 0&&(e=null),ri.encode(JSON.stringify(e))}catch(s){throw ge.errorForCode(fe.BadJson,s)}},decode(e){try{return JSON.parse(En.decode(e),n)}catch(s){throw ge.errorForCode(fe.BadJson,s)}}}}function xx(n){var e;return n&&n.data.length===0&&((e=n.headers)==null?void 0:e.code)===503?ge.errorForCode(fe.NoResponders):null}class fm{constructor(e,s,i){j(this,"_headers");j(this,"_msg");j(this,"_rdata");j(this,"_reply");j(this,"_subject");j(this,"publisher");this._msg=e,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=En.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=En.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const e=this._rdata.subarray(0,this._msg.hdr);this._headers=_s.decode(e)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(e=jn,s){return this.reply?(this.publisher.publish(this.reply,e,s),!0):!1}size(){var o;const e=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,i=this._msg.size===-1?0:this._msg.size;return e+s+i}json(e){return Zn(e).decode(this.data)}string(){return En.decode(this.data)}requestInfo(){var s;const e=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return e?JSON.parse(e,function(i,o){return(i==="start"||i==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}j(fm,"jc");function Qi(n){return Au("durable",n)}function Jt(n){return Au("stream",n)}function Au(n,e=""){if(e==="")throw Error(`${n} name required`);return[".","*",">","/","\\"," "," ",`
30
+ `}encode(){return ri.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new ge("invalid header value - \\r and \\n are not allowed.",fe.BadHeader);return e.trim()}keys(){const e=[];for(const s of this.headers.keys())e.push(s);return e}findKeys(e,s=_n.Exact){const i=this.keys();switch(s){case _n.Exact:return i.filter(o=>o===e);case _n.CanonicalMIME:return e=Wg(e),i.filter(o=>o===e);default:{const o=e.toLowerCase();return i.filter(c=>o===c.toLowerCase())}}}get(e,s=_n.Exact){const i=this.findKeys(e,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(e,s=_n.Exact){const i=this.findKeys(e,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(e,s=_n.Exact){return this.findKeys(e,s).length>0}set(e,s,i=_n.Exact){this.delete(e,i),this.append(e,s,i)}append(e,s,i=_n.Exact){const o=Wg(e);i===_n.CanonicalMIME&&(e=o);const c=this.findKeys(e,i);e=c.length>0?c[0]:e;const m=_s.validHeaderValue(s);let p=this.headers.get(e);p||(p=[],this.headers.set(e,p)),p.push(m)}values(e,s=_n.Exact){const i=[];return this.findKeys(e,s).forEach(c=>{const m=this.headers.get(c);m&&i.push(...m)}),i}delete(e,s=_n.Exact){this.findKeys(e,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const e={};return this.keys().forEach(s=>{e[s]=this.values(s)}),e}get code(){return this._code}get description(){return this._description}static fromRecord(e){const s=new _s;for(const i in e)s.headers.set(i,e[i]);return s}}function Ed(){return{encode(n){return ri.encode(n)},decode(n){return En.decode(n)}}}function Zn(n){return{encode(e){try{return e===void 0&&(e=null),ri.encode(JSON.stringify(e))}catch(s){throw ge.errorForCode(fe.BadJson,s)}},decode(e){try{return JSON.parse(En.decode(e),n)}catch(s){throw ge.errorForCode(fe.BadJson,s)}}}}function vx(n){var e;return n&&n.data.length===0&&((e=n.headers)==null?void 0:e.code)===503?ge.errorForCode(fe.NoResponders):null}class fm{constructor(e,s,i){j(this,"_headers");j(this,"_msg");j(this,"_rdata");j(this,"_reply");j(this,"_subject");j(this,"publisher");this._msg=e,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=En.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=En.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const e=this._rdata.subarray(0,this._msg.hdr);this._headers=_s.decode(e)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(e=jn,s){return this.reply?(this.publisher.publish(this.reply,e,s),!0):!1}size(){var o;const e=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,i=this._msg.size===-1?0:this._msg.size;return e+s+i}json(e){return Zn(e).decode(this.data)}string(){return En.decode(this.data)}requestInfo(){var s;const e=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return e?JSON.parse(e,function(i,o){return(i==="start"||i==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}j(fm,"jc");function Qi(n){return Au("durable",n)}function Jt(n){return Au("stream",n)}function Au(n,e=""){if(e==="")throw Error(`${n} name required`);return[".","*",">","/","\\"," "," ",`
31
31
  `,"\r"].forEach(i=>{if(e.indexOf(i)!==-1){switch(i){case`
32
- `:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${n} name - ${n} name cannot contain '${i}'`)}}),""}function go(n,e=""){if(e==="")throw Error(`${n} name required`);const s=xE(e);if(s.length)throw new Error(`invalid ${n} name - ${n} name ${s}`)}function xE(n=""){if(n==="")throw Error("name required");const e=/^[-\w]+$/g;if(n.match(e)===null){for(const i of n.split(""))if(i.match(e)===null)return`cannot contain '${i}'`}return""}function Od(n){if(n.data.length>0)return!1;const e=n.headers;return e?e.code>=100&&e.code<200:!1}function Ad(n){var e;return Od(n)&&((e=n.headers)==null?void 0:e.description)==="Idle Heartbeat"}function vE(n,e,s){const i=Pr(n,e),o={hdr:1,sid:0,size:0},c=new fm(o,jn,{});return c._headers=i,c._subject=s,c}function Xi(n){if(n.data.length!==0)return null;const e=n.headers;return e?vx(e.code,e.description):null}var In;(function(n){n.MaxBatchExceeded="exceeded maxrequestbatch of",n.MaxExpiresExceeded="exceeded maxrequestexpires of",n.MaxBytesExceeded="exceeded maxrequestmaxbytes of",n.MaxMessageSizeExceeded="message size exceeds maxbytes",n.PushConsumer="consumer is push based",n.MaxWaitingExceeded="exceeded maxwaiting",n.IdleHeartbeatMissed="idle heartbeats missed",n.ConsumerDeleted="consumer deleted"})(In||(In={}));function _E(n){return n.code!==fe.JetStream409?!1:[In.MaxBatchExceeded,In.MaxExpiresExceeded,In.MaxBytesExceeded,In.MaxMessageSizeExceeded,In.PushConsumer,In.IdleHeartbeatMissed,In.ConsumerDeleted].find(s=>n.message.indexOf(s)!==-1)!==void 0}function vx(n,e=""){if(n<300)return null;switch(e=e.toLowerCase(),n){case 404:return new ge(e,fe.JetStream404NoMessages);case 408:return new ge(e,fe.JetStream408RequestTimeout);case 409:{const s=e.startsWith(In.IdleHeartbeatMissed)?fe.JetStreamIdleHeartBeat:fe.JetStream409;return new ge(e,s)}case 503:return ge.errorForCode(fe.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=fe.Unknown),new ge(e,`${n}`)}}class Ut{constructor(){j(this,"inflight");j(this,"processed");j(this,"received");j(this,"noIterator");j(this,"iterClosed");j(this,"done");j(this,"signal");j(this,"yields");j(this,"filtered");j(this,"pendingFiltered");j(this,"ingestionFilterFn");j(this,"protocolFilterFn");j(this,"dispatchedFn");j(this,"ctx");j(this,"_data");j(this,"err");j(this,"time");j(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=mt(),this.yields=[],this.iterClosed=mt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(this.done)return;if(typeof e=="function"){this.yields.push(e),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(e,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(e),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ge("unsupported iterator",fe.ApiError);if(this.yielding)throw new ge("already yielding",fe.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const e=this.yields;this.inflight=e.length,this.yields=[];for(let s=0;s<e.length;s++){if(typeof e[s]=="function"){const o=e[s];try{o()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(e[s]):!0){this.processed++;const o=Date.now();yield e[s],this.time=Date.now()-o,this.dispatchedFn&&e[s]&&this.dispatchedFn(e[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=mt())}}finally{this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class hm{constructor(e,s,i={maxOut:2}){j(this,"interval");j(this,"maxOut");j(this,"cancelAfter");j(this,"timer");j(this,"autoCancelTimer");j(this,"last");j(this,"missed");j(this,"count");j(this,"callback");this.interval=e,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(e,s=0,i=2){this.interval=e,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(e){console.log(e)}},this.interval)}}var jd;(function(n){n.Limits="limits",n.Interest="interest",n.Workqueue="workqueue"})(jd||(jd={}));var Oo;(function(n){n.Old="old",n.New="new"})(Oo||(Oo={}));var kd;(function(n){n.File="file",n.Memory="memory"})(kd||(kd={}));var Et;(function(n){n.All="all",n.Last="last",n.New="new",n.StartSequence="by_start_sequence",n.StartTime="by_start_time",n.LastPerSubject="last_per_subject"})(Et||(Et={}));var Bt;(function(n){n.None="none",n.All="all",n.Explicit="explicit",n.NotSet=""})(Bt||(Bt={}));var ra;(function(n){n.Instant="instant",n.Original="original"})(ra||(ra={}));var As;(function(n){n.None="none",n.S2="s2"})(As||(As={}));var du;(function(n){n.CreateOrUpdate="",n.Update="update",n.Create="create"})(du||(du={}));function wE(n,e={}){return Object.assign({name:n,deliver_policy:Et.All,ack_policy:Bt.Explicit,ack_wait:dt(30*1e3),replay_policy:ra.Instant},e)}var Wg;(function(n){n.API="api_audit",n.StreamAction="stream_action",n.ConsumerAction="consumer_action",n.SnapshotCreate="snapshot_create",n.SnapshotComplete="snapshot_complete",n.RestoreCreate="restore_create",n.RestoreComplete="restore_complete",n.MaxDeliver="max_deliver",n.Terminated="terminated",n.Ack="consumer_ack",n.StreamLeaderElected="stream_leader_elected",n.StreamQuorumLost="stream_quorum_lost",n.ConsumerLeaderElected="consumer_leader_elected",n.ConsumerQuorumLost="consumer_quorum_lost"})(Wg||(Wg={}));var Wt;(function(n){n.StreamSourceHdr="Nats-Stream-Source",n.LastConsumerSeqHdr="Nats-Last-Consumer",n.LastStreamSeqHdr="Nats-Last-Stream",n.ConsumerStalledHdr="Nats-Consumer-Stalled",n.MessageSizeHdr="Nats-Msg-Size",n.RollupHdr="Nats-Rollup",n.RollupValueSubject="sub",n.RollupValueAll="all",n.PendingMessagesHdr="Nats-Pending-Messages",n.PendingBytesHdr="Nats-Pending-Bytes"})(Wt||(Wt={}));var Qn;(function(n){n.LastValue="",n.AllHistory="history",n.UpdatesOnly="updates"})(Qn||(Qn={}));var Ki;(function(n){n.Stream="Nats-Stream",n.Sequence="Nats-Sequence",n.TimeStamp="Nats-Time-Stamp",n.Subject="Nats-Subject"})(Ki||(Ki={}));var Zg;(function(n){n.Stream="Nats-Stream",n.Subject="Nats-Subject",n.Sequence="Nats-Sequence",n.LastSequence="Nats-Last-Sequence",n.Size="Nats-Msg-Size"})(Zg||(Zg={}));const wn="KV_";class SE{constructor(e){j(this,"config");j(this,"ordered");j(this,"mack");j(this,"stream");j(this,"callbackFn");j(this,"max");j(this,"qname");j(this,"isBind");j(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=wE("",e||{})}getOpts(){var s;const e={};if(e.config=Object.assign({},this.config),e.config.filter_subject&&(this.filterSubject(e.config.filter_subject),e.config.filter_subject=void 0),e.config.filter_subjects&&((s=e.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),e.config.filter_subjects=void 0),e.mack=this.mack,e.stream=this.stream,e.callbackFn=this.callbackFn,e.max=this.max,e.queue=this.qname,e.ordered=this.ordered,e.config.ack_policy=e.ordered?Bt.None:e.config.ack_policy,e.isBind=e.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:e.config.filter_subject=this.filters[0];break;default:e.config.filter_subjects=this.filters}return e}description(e){return this.config.description=e,this}deliverTo(e){return this.config.deliver_subject=e,this}durable(e){return Qi(e),this.config.durable_name=e,this}startSequence(e){if(e<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=Et.StartSequence,this.config.opt_start_seq=e,this}startTime(e){return this.config.deliver_policy=Et.StartTime,this.config.opt_start_time=e.toISOString(),this}deliverAll(){return this.config.deliver_policy=Et.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Et.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Et.Last,this}deliverNew(){return this.config.deliver_policy=Et.New,this}startAtTimeDelta(e){return this.startTime(new Date(Date.now()-e)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Bt.None,this}ackAll(){return this.config.ack_policy=Bt.All,this}ackExplicit(){return this.config.ack_policy=Bt.Explicit,this}ackWait(e){return this.config.ack_wait=dt(e),this}maxDeliver(e){return this.config.max_deliver=e,this}filterSubject(e){return this.filters=this.filters||[],this.filters.push(e),this}replayInstantly(){return this.config.replay_policy=ra.Instant,this}replayOriginal(){return this.config.replay_policy=ra.Original,this}sample(e){if(e=Math.trunc(e),e<0||e>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${e}%`,this}limit(e){return this.config.rate_limit_bps=e,this}maxWaiting(e){return this.config.max_waiting=e,this}maxAckPending(e){return this.config.max_ack_pending=e,this}idleHeartbeat(e){return this.config.idle_heartbeat=dt(e),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(e){return this.queue(e),this}manualAck(){return this.mack=!0,this}maxMessages(e){return this.max=e,this}callback(e){return this.callbackFn=e,this}queue(e){return this.qname=e,this.config.deliver_group=e,this}orderedConsumer(){return this.ordered=!0,this}bind(e,s){return this.stream=e,this.config.durable_name=s,this.isBind=!0,this}bindStream(e){return this.stream=e,this}inactiveEphemeralThreshold(e){return this.config.inactive_threshold=dt(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=dt(e),this}memory(){return this.config.mem_storage=!0,this}numReplicas(e){return this.config.num_replicas=e,this}consumerName(e){return this.config.name=e,this}}function ws(n){return new SE(n)}function eb(n){return typeof n.getOpts=="function"}class EE{static encode(e){if(typeof e=="string")return btoa(e);const s=Array.from(e);return btoa(String.fromCharCode(...s))}static decode(e,s=!1){const i=atob(e);return s?Uint8Array.from(i,o=>o.charCodeAt(0)):i}}class Wi{static encode(e){return Wi.toB64URLEncoding(EE.encode(e))}static decode(e,s=!1){return Wi.decode(Wi.fromB64URLEncoding(e),s)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class sa{constructor(){j(this,"buffers");j(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...e){let s=0;for(let c=0;c<e.length;c++)s+=e[c].length;const i=new Uint8Array(s);let o=0;for(let c=0;c<e.length;c++)i.set(e[c],o),o+=e[c].length;return i}static fromAscii(e){return e||(e=""),ri.encode(e)}static toAscii(e){return En.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const e=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)e.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){const e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array(0)}drain(e){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(e===void 0||e>i)&&(e=i);const o=s.subarray(0,e);return i>e&&this.buffers.push(s.subarray(e)),this.byteLength=i-e,o}}return new Uint8Array(0)}fill(e,...s){e&&(this.buffers.push(e),this.byteLength+=e.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 OE(n,e){return e.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in n)){var o=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(n)}var AE=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},ro=AE.performance||{};ro.now||ro.mozNow||ro.msNow||ro.oNow||ro.webkitNow;var tb={versions:{}},jE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kE(n){if(n.__esModule)return n;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),e}var ed,ju={exports:{}},nb={},rb=kE(OE({__proto__:null,default:nb},[nb]));ed=ju,(function(){var n="input is invalid type",e=typeof window=="object",s=e?window:{};s.JS_SHA256_NO_WINDOW&&(e=!1);var i=!e&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&tb.versions&&tb.versions.node;o?s=jE:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&ed.exports,m=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],u=[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"],x=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(M){return Object.prototype.toString.call(M)==="[object Array]"}),!m||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(M){return typeof M=="object"&&M.buffer&&M.buffer.constructor===ArrayBuffer});var v=function(M,U){return function(ae){return new q(U,!0).update(ae)[M]()}},w=function(M){var U=v("hex",M);o&&(U=S(U,M)),U.create=function(){return new q(M)},U.update=function(I){return U.create().update(I)};for(var ae=0;ae<b.length;++ae){var z=b[ae];U[z]=v(z,M)}return U},S=function(M,U){var ae,z=rb,I=rb.Buffer,D=U?"sha224":"sha256";return ae=I.from&&!s.JS_SHA256_NO_BUFFER_FROM?I.from:function(X){return new I(X)},function(X){if(typeof X=="string")return z.createHash(D).update(X,"utf8").digest("hex");if(X==null)throw new Error(n);return X.constructor===ArrayBuffer&&(X=new Uint8Array(X)),Array.isArray(X)||ArrayBuffer.isView(X)||X.constructor===I?z.createHash(D).update(ae(X)).digest("hex"):M(X)}},C=function(M,U){return function(ae,z){return new re(ae,U,!0).update(z)[M]()}},P=function(M){var U=C("hex",M);U.create=function(I){return new re(I,M)},U.update=function(I,D){return U.create(I).update(D)};for(var ae=0;ae<b.length;++ae){var z=b[ae];U[z]=C(z,M)}return U};function q(M,U){U?(x[0]=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,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=M}function re(M,U,ae){var z,I=typeof M;if(I==="string"){var D,X=[],W=M.length,he=0;for(z=0;z<W;++z)(D=M.charCodeAt(z))<128?X[he++]=D:D<2048?(X[he++]=192|D>>>6,X[he++]=128|63&D):D<55296||D>=57344?(X[he++]=224|D>>>12,X[he++]=128|D>>>6&63,X[he++]=128|63&D):(D=65536+((1023&D)<<10|1023&M.charCodeAt(++z)),X[he++]=240|D>>>18,X[he++]=128|D>>>12&63,X[he++]=128|D>>>6&63,X[he++]=128|63&D);M=X}else{if(I!=="object")throw new Error(n);if(M===null)throw new Error(n);if(m&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||m&&ArrayBuffer.isView(M)))throw new Error(n)}M.length>64&&(M=new q(U,!0).update(M).array());var we=[],Oe=[];for(z=0;z<64;++z){var F=M[z]||0;we[z]=92^F,Oe[z]=54^F}q.call(this,U,ae),this.update(Oe),this.oKeyPad=we,this.inner=!0,this.sharedMemory=ae}q.prototype.update=function(M){if(!this.finalized){var U,ae=typeof M;if(ae!=="string"){if(ae!=="object")throw new Error(n);if(M===null)throw new Error(n);if(m&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||m&&ArrayBuffer.isView(M)))throw new Error(n);U=!0}for(var z,I,D=0,X=M.length,W=this.blocks;D<X;){if(this.hashed&&(this.hashed=!1,W[0]=this.block,this.block=W[16]=W[1]=W[2]=W[3]=W[4]=W[5]=W[6]=W[7]=W[8]=W[9]=W[10]=W[11]=W[12]=W[13]=W[14]=W[15]=0),U)for(I=this.start;D<X&&I<64;++D)W[I>>>2]|=M[D]<<u[3&I++];else for(I=this.start;D<X&&I<64;++D)(z=M.charCodeAt(D))<128?W[I>>>2]|=z<<u[3&I++]:z<2048?(W[I>>>2]|=(192|z>>>6)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]):z<55296||z>=57344?(W[I>>>2]|=(224|z>>>12)<<u[3&I++],W[I>>>2]|=(128|z>>>6&63)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]):(z=65536+((1023&z)<<10|1023&M.charCodeAt(++D)),W[I>>>2]|=(240|z>>>18)<<u[3&I++],W[I>>>2]|=(128|z>>>12&63)<<u[3&I++],W[I>>>2]|=(128|z>>>6&63)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]);this.lastByteIndex=I,this.bytes+=I-this.start,I>=64?(this.block=W[16],this.start=I-64,this.hash(),this.hashed=!0):this.start=I}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},q.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var M=this.blocks,U=this.lastByteIndex;M[16]=this.block,M[U>>>2]|=g[3&U],this.block=M[16],U>=56&&(this.hashed||this.hash(),M[0]=this.block,M[16]=M[1]=M[2]=M[3]=M[4]=M[5]=M[6]=M[7]=M[8]=M[9]=M[10]=M[11]=M[12]=M[13]=M[14]=M[15]=0),M[14]=this.hBytes<<3|this.bytes>>>29,M[15]=this.bytes<<3,this.hash()}},q.prototype.hash=function(){var M,U,ae,z,I,D,X,W,he,we=this.h0,Oe=this.h1,F=this.h2,J=this.h3,le=this.h4,pe=this.h5,ye=this.h6,Ce=this.h7,Ne=this.blocks;for(M=16;M<64;++M)U=((I=Ne[M-15])>>>7|I<<25)^(I>>>18|I<<14)^I>>>3,ae=((I=Ne[M-2])>>>17|I<<15)^(I>>>19|I<<13)^I>>>10,Ne[M]=Ne[M-16]+U+Ne[M-7]+ae|0;for(he=Oe&F,M=0;M<64;M+=4)this.first?(this.is224?(D=300032,Ce=(I=Ne[0]-1413257819)-150054599|0,J=I+24177077|0):(D=704751109,Ce=(I=Ne[0]-210244248)-1521486534|0,J=I+143694565|0),this.first=!1):(U=(we>>>2|we<<30)^(we>>>13|we<<19)^(we>>>22|we<<10),z=(D=we&Oe)^we&F^he,Ce=J+(I=Ce+(ae=(le>>>6|le<<26)^(le>>>11|le<<21)^(le>>>25|le<<7))+(le&pe^~le&ye)+d[M]+Ne[M])|0,J=I+(U+z)|0),U=(J>>>2|J<<30)^(J>>>13|J<<19)^(J>>>22|J<<10),z=(X=J&we)^J&Oe^D,ye=F+(I=ye+(ae=(Ce>>>6|Ce<<26)^(Ce>>>11|Ce<<21)^(Ce>>>25|Ce<<7))+(Ce&le^~Ce&pe)+d[M+1]+Ne[M+1])|0,U=((F=I+(U+z)|0)>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),z=(W=F&J)^F&we^X,pe=Oe+(I=pe+(ae=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&Ce^~ye&le)+d[M+2]+Ne[M+2])|0,U=((Oe=I+(U+z)|0)>>>2|Oe<<30)^(Oe>>>13|Oe<<19)^(Oe>>>22|Oe<<10),z=(he=Oe&F)^Oe&J^W,le=we+(I=le+(ae=(pe>>>6|pe<<26)^(pe>>>11|pe<<21)^(pe>>>25|pe<<7))+(pe&ye^~pe&Ce)+d[M+3]+Ne[M+3])|0,we=I+(U+z)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+we|0,this.h1=this.h1+Oe|0,this.h2=this.h2+F|0,this.h3=this.h3+J|0,this.h4=this.h4+le|0,this.h5=this.h5+pe|0,this.h6=this.h6+ye|0,this.h7=this.h7+Ce|0},q.prototype.hex=function(){this.finalize();var M=this.h0,U=this.h1,ae=this.h2,z=this.h3,I=this.h4,D=this.h5,X=this.h6,W=this.h7,he=p[M>>>28&15]+p[M>>>24&15]+p[M>>>20&15]+p[M>>>16&15]+p[M>>>12&15]+p[M>>>8&15]+p[M>>>4&15]+p[15&M]+p[U>>>28&15]+p[U>>>24&15]+p[U>>>20&15]+p[U>>>16&15]+p[U>>>12&15]+p[U>>>8&15]+p[U>>>4&15]+p[15&U]+p[ae>>>28&15]+p[ae>>>24&15]+p[ae>>>20&15]+p[ae>>>16&15]+p[ae>>>12&15]+p[ae>>>8&15]+p[ae>>>4&15]+p[15&ae]+p[z>>>28&15]+p[z>>>24&15]+p[z>>>20&15]+p[z>>>16&15]+p[z>>>12&15]+p[z>>>8&15]+p[z>>>4&15]+p[15&z]+p[I>>>28&15]+p[I>>>24&15]+p[I>>>20&15]+p[I>>>16&15]+p[I>>>12&15]+p[I>>>8&15]+p[I>>>4&15]+p[15&I]+p[D>>>28&15]+p[D>>>24&15]+p[D>>>20&15]+p[D>>>16&15]+p[D>>>12&15]+p[D>>>8&15]+p[D>>>4&15]+p[15&D]+p[X>>>28&15]+p[X>>>24&15]+p[X>>>20&15]+p[X>>>16&15]+p[X>>>12&15]+p[X>>>8&15]+p[X>>>4&15]+p[15&X];return this.is224||(he+=p[W>>>28&15]+p[W>>>24&15]+p[W>>>20&15]+p[W>>>16&15]+p[W>>>12&15]+p[W>>>8&15]+p[W>>>4&15]+p[15&W]),he},q.prototype.toString=q.prototype.hex,q.prototype.digest=function(){this.finalize();var M=this.h0,U=this.h1,ae=this.h2,z=this.h3,I=this.h4,D=this.h5,X=this.h6,W=this.h7,he=[M>>>24&255,M>>>16&255,M>>>8&255,255&M,U>>>24&255,U>>>16&255,U>>>8&255,255&U,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,z>>>24&255,z>>>16&255,z>>>8&255,255&z,I>>>24&255,I>>>16&255,I>>>8&255,255&I,D>>>24&255,D>>>16&255,D>>>8&255,255&D,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||he.push(W>>>24&255,W>>>16&255,W>>>8&255,255&W),he},q.prototype.array=q.prototype.digest,q.prototype.arrayBuffer=function(){this.finalize();var M=new ArrayBuffer(this.is224?28:32),U=new DataView(M);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),M},re.prototype=new q,re.prototype.finalize=function(){if(q.prototype.finalize.call(this),this.inner){this.inner=!1;var M=this.array();q.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(M),q.prototype.finalize.call(this)}};var se=w();se.sha256=se,se.sha224=w(!0),se.sha256.hmac=P(),se.sha224.hmac=P(!0),c?ed.exports=se:(s.sha256=se.sha256,s.sha224=se.sha224)})();ju.exports;ju.exports.sha224;var sb=ju.exports.sha256;function Nd(n){return DE(n)}function NE(n){if(!/^[0-9A-Fa-f]+$/.test(n))return!1;const s=/^[0-9A-F]+$/.test(n),i=/^[0-9a-f]+$/.test(n);return s||i?n.length%2===0:!1}function TE(n){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(n)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(n)}function CE(n){return NE(n)?"hex":TE(n)?"b64":""}function ME(n){if(n.length%2!==0)throw new Error("hex string must have an even length");const e=new Uint8Array(n.length/2);for(let s=0;s<n.length;s+=2)e[s/2]=parseInt(n.substring(s,s+2),16);return e}function RE(n){n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/");const e=atob(n);return Uint8Array.from(e,s=>s.charCodeAt(0))}function DE(n){switch(CE(n)){case"hex":return ME(n);case"b64":return RE(n)}return null}function LE(n,e){const s=typeof n=="string"?Nd(n):n,i=typeof e=="string"?Nd(e):e;if(s===null||i===null||s.length!==i.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==i[o])return!1;return!0}class _x{constructor(e,s,i=!0){j(this,"token");j(this,"received");j(this,"ctx");j(this,"requestSubject");j(this,"mux");this.mux=e,this.requestSubject=s,this.received=0,this.token=Os.next(),i&&(this.ctx=new Error)}}class qE extends _x{constructor(s,i,o={maxWait:1e3}){super(s,i);j(this,"callback");j(this,"done");j(this,"timer");j(this,"max");j(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=mt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,i){s?(this.ctx&&(s.stack+=`
32
+ `:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${n} name - ${n} name cannot contain '${i}'`)}}),""}function go(n,e=""){if(e==="")throw Error(`${n} name required`);const s=vE(e);if(s.length)throw new Error(`invalid ${n} name - ${n} name ${s}`)}function vE(n=""){if(n==="")throw Error("name required");const e=/^[-\w]+$/g;if(n.match(e)===null){for(const i of n.split(""))if(i.match(e)===null)return`cannot contain '${i}'`}return""}function Od(n){if(n.data.length>0)return!1;const e=n.headers;return e?e.code>=100&&e.code<200:!1}function Ad(n){var e;return Od(n)&&((e=n.headers)==null?void 0:e.description)==="Idle Heartbeat"}function _E(n,e,s){const i=Pr(n,e),o={hdr:1,sid:0,size:0},c=new fm(o,jn,{});return c._headers=i,c._subject=s,c}function Xi(n){if(n.data.length!==0)return null;const e=n.headers;return e?_x(e.code,e.description):null}var In;(function(n){n.MaxBatchExceeded="exceeded maxrequestbatch of",n.MaxExpiresExceeded="exceeded maxrequestexpires of",n.MaxBytesExceeded="exceeded maxrequestmaxbytes of",n.MaxMessageSizeExceeded="message size exceeds maxbytes",n.PushConsumer="consumer is push based",n.MaxWaitingExceeded="exceeded maxwaiting",n.IdleHeartbeatMissed="idle heartbeats missed",n.ConsumerDeleted="consumer deleted"})(In||(In={}));function wE(n){return n.code!==fe.JetStream409?!1:[In.MaxBatchExceeded,In.MaxExpiresExceeded,In.MaxBytesExceeded,In.MaxMessageSizeExceeded,In.PushConsumer,In.IdleHeartbeatMissed,In.ConsumerDeleted].find(s=>n.message.indexOf(s)!==-1)!==void 0}function _x(n,e=""){if(n<300)return null;switch(e=e.toLowerCase(),n){case 404:return new ge(e,fe.JetStream404NoMessages);case 408:return new ge(e,fe.JetStream408RequestTimeout);case 409:{const s=e.startsWith(In.IdleHeartbeatMissed)?fe.JetStreamIdleHeartBeat:fe.JetStream409;return new ge(e,s)}case 503:return ge.errorForCode(fe.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=fe.Unknown),new ge(e,`${n}`)}}class Ut{constructor(){j(this,"inflight");j(this,"processed");j(this,"received");j(this,"noIterator");j(this,"iterClosed");j(this,"done");j(this,"signal");j(this,"yields");j(this,"filtered");j(this,"pendingFiltered");j(this,"ingestionFilterFn");j(this,"protocolFilterFn");j(this,"dispatchedFn");j(this,"ctx");j(this,"_data");j(this,"err");j(this,"time");j(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=mt(),this.yields=[],this.iterClosed=mt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(this.done)return;if(typeof e=="function"){this.yields.push(e),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(e,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(e),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ge("unsupported iterator",fe.ApiError);if(this.yielding)throw new ge("already yielding",fe.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const e=this.yields;this.inflight=e.length,this.yields=[];for(let s=0;s<e.length;s++){if(typeof e[s]=="function"){const o=e[s];try{o()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(e[s]):!0){this.processed++;const o=Date.now();yield e[s],this.time=Date.now()-o,this.dispatchedFn&&e[s]&&this.dispatchedFn(e[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=mt())}}finally{this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class hm{constructor(e,s,i={maxOut:2}){j(this,"interval");j(this,"maxOut");j(this,"cancelAfter");j(this,"timer");j(this,"autoCancelTimer");j(this,"last");j(this,"missed");j(this,"count");j(this,"callback");this.interval=e,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(e,s=0,i=2){this.interval=e,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(e){console.log(e)}},this.interval)}}var jd;(function(n){n.Limits="limits",n.Interest="interest",n.Workqueue="workqueue"})(jd||(jd={}));var Oo;(function(n){n.Old="old",n.New="new"})(Oo||(Oo={}));var kd;(function(n){n.File="file",n.Memory="memory"})(kd||(kd={}));var Et;(function(n){n.All="all",n.Last="last",n.New="new",n.StartSequence="by_start_sequence",n.StartTime="by_start_time",n.LastPerSubject="last_per_subject"})(Et||(Et={}));var Bt;(function(n){n.None="none",n.All="all",n.Explicit="explicit",n.NotSet=""})(Bt||(Bt={}));var ra;(function(n){n.Instant="instant",n.Original="original"})(ra||(ra={}));var As;(function(n){n.None="none",n.S2="s2"})(As||(As={}));var du;(function(n){n.CreateOrUpdate="",n.Update="update",n.Create="create"})(du||(du={}));function SE(n,e={}){return Object.assign({name:n,deliver_policy:Et.All,ack_policy:Bt.Explicit,ack_wait:dt(30*1e3),replay_policy:ra.Instant},e)}var Zg;(function(n){n.API="api_audit",n.StreamAction="stream_action",n.ConsumerAction="consumer_action",n.SnapshotCreate="snapshot_create",n.SnapshotComplete="snapshot_complete",n.RestoreCreate="restore_create",n.RestoreComplete="restore_complete",n.MaxDeliver="max_deliver",n.Terminated="terminated",n.Ack="consumer_ack",n.StreamLeaderElected="stream_leader_elected",n.StreamQuorumLost="stream_quorum_lost",n.ConsumerLeaderElected="consumer_leader_elected",n.ConsumerQuorumLost="consumer_quorum_lost"})(Zg||(Zg={}));var Wt;(function(n){n.StreamSourceHdr="Nats-Stream-Source",n.LastConsumerSeqHdr="Nats-Last-Consumer",n.LastStreamSeqHdr="Nats-Last-Stream",n.ConsumerStalledHdr="Nats-Consumer-Stalled",n.MessageSizeHdr="Nats-Msg-Size",n.RollupHdr="Nats-Rollup",n.RollupValueSubject="sub",n.RollupValueAll="all",n.PendingMessagesHdr="Nats-Pending-Messages",n.PendingBytesHdr="Nats-Pending-Bytes"})(Wt||(Wt={}));var Qn;(function(n){n.LastValue="",n.AllHistory="history",n.UpdatesOnly="updates"})(Qn||(Qn={}));var Ki;(function(n){n.Stream="Nats-Stream",n.Sequence="Nats-Sequence",n.TimeStamp="Nats-Time-Stamp",n.Subject="Nats-Subject"})(Ki||(Ki={}));var eb;(function(n){n.Stream="Nats-Stream",n.Subject="Nats-Subject",n.Sequence="Nats-Sequence",n.LastSequence="Nats-Last-Sequence",n.Size="Nats-Msg-Size"})(eb||(eb={}));const wn="KV_";class EE{constructor(e){j(this,"config");j(this,"ordered");j(this,"mack");j(this,"stream");j(this,"callbackFn");j(this,"max");j(this,"qname");j(this,"isBind");j(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=SE("",e||{})}getOpts(){var s;const e={};if(e.config=Object.assign({},this.config),e.config.filter_subject&&(this.filterSubject(e.config.filter_subject),e.config.filter_subject=void 0),e.config.filter_subjects&&((s=e.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),e.config.filter_subjects=void 0),e.mack=this.mack,e.stream=this.stream,e.callbackFn=this.callbackFn,e.max=this.max,e.queue=this.qname,e.ordered=this.ordered,e.config.ack_policy=e.ordered?Bt.None:e.config.ack_policy,e.isBind=e.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:e.config.filter_subject=this.filters[0];break;default:e.config.filter_subjects=this.filters}return e}description(e){return this.config.description=e,this}deliverTo(e){return this.config.deliver_subject=e,this}durable(e){return Qi(e),this.config.durable_name=e,this}startSequence(e){if(e<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=Et.StartSequence,this.config.opt_start_seq=e,this}startTime(e){return this.config.deliver_policy=Et.StartTime,this.config.opt_start_time=e.toISOString(),this}deliverAll(){return this.config.deliver_policy=Et.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Et.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Et.Last,this}deliverNew(){return this.config.deliver_policy=Et.New,this}startAtTimeDelta(e){return this.startTime(new Date(Date.now()-e)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Bt.None,this}ackAll(){return this.config.ack_policy=Bt.All,this}ackExplicit(){return this.config.ack_policy=Bt.Explicit,this}ackWait(e){return this.config.ack_wait=dt(e),this}maxDeliver(e){return this.config.max_deliver=e,this}filterSubject(e){return this.filters=this.filters||[],this.filters.push(e),this}replayInstantly(){return this.config.replay_policy=ra.Instant,this}replayOriginal(){return this.config.replay_policy=ra.Original,this}sample(e){if(e=Math.trunc(e),e<0||e>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${e}%`,this}limit(e){return this.config.rate_limit_bps=e,this}maxWaiting(e){return this.config.max_waiting=e,this}maxAckPending(e){return this.config.max_ack_pending=e,this}idleHeartbeat(e){return this.config.idle_heartbeat=dt(e),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(e){return this.queue(e),this}manualAck(){return this.mack=!0,this}maxMessages(e){return this.max=e,this}callback(e){return this.callbackFn=e,this}queue(e){return this.qname=e,this.config.deliver_group=e,this}orderedConsumer(){return this.ordered=!0,this}bind(e,s){return this.stream=e,this.config.durable_name=s,this.isBind=!0,this}bindStream(e){return this.stream=e,this}inactiveEphemeralThreshold(e){return this.config.inactive_threshold=dt(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=dt(e),this}memory(){return this.config.mem_storage=!0,this}numReplicas(e){return this.config.num_replicas=e,this}consumerName(e){return this.config.name=e,this}}function ws(n){return new EE(n)}function tb(n){return typeof n.getOpts=="function"}class OE{static encode(e){if(typeof e=="string")return btoa(e);const s=Array.from(e);return btoa(String.fromCharCode(...s))}static decode(e,s=!1){const i=atob(e);return s?Uint8Array.from(i,o=>o.charCodeAt(0)):i}}class Wi{static encode(e){return Wi.toB64URLEncoding(OE.encode(e))}static decode(e,s=!1){return Wi.decode(Wi.fromB64URLEncoding(e),s)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class sa{constructor(){j(this,"buffers");j(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...e){let s=0;for(let c=0;c<e.length;c++)s+=e[c].length;const i=new Uint8Array(s);let o=0;for(let c=0;c<e.length;c++)i.set(e[c],o),o+=e[c].length;return i}static fromAscii(e){return e||(e=""),ri.encode(e)}static toAscii(e){return En.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const e=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)e.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){const e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array(0)}drain(e){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(e===void 0||e>i)&&(e=i);const o=s.subarray(0,e);return i>e&&this.buffers.push(s.subarray(e)),this.byteLength=i-e,o}}return new Uint8Array(0)}fill(e,...s){e&&(this.buffers.push(e),this.byteLength+=e.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 AE(n,e){return e.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in n)){var o=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(n)}var jE=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},ro=jE.performance||{};ro.now||ro.mozNow||ro.msNow||ro.oNow||ro.webkitNow;var nb={versions:{}},kE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function NE(n){if(n.__esModule)return n;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),e}var ed,ju={exports:{}},rb={},sb=NE(AE({__proto__:null,default:rb},[rb]));ed=ju,(function(){var n="input is invalid type",e=typeof window=="object",s=e?window:{};s.JS_SHA256_NO_WINDOW&&(e=!1);var i=!e&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&nb.versions&&nb.versions.node;o?s=kE:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&ed.exports,m=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],u=[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"],x=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(M){return Object.prototype.toString.call(M)==="[object Array]"}),!m||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(M){return typeof M=="object"&&M.buffer&&M.buffer.constructor===ArrayBuffer});var v=function(M,U){return function(ae){return new q(U,!0).update(ae)[M]()}},_=function(M){var U=v("hex",M);o&&(U=S(U,M)),U.create=function(){return new q(M)},U.update=function(I){return U.create().update(I)};for(var ae=0;ae<b.length;++ae){var z=b[ae];U[z]=v(z,M)}return U},S=function(M,U){var ae,z=sb,I=sb.Buffer,D=U?"sha224":"sha256";return ae=I.from&&!s.JS_SHA256_NO_BUFFER_FROM?I.from:function(X){return new I(X)},function(X){if(typeof X=="string")return z.createHash(D).update(X,"utf8").digest("hex");if(X==null)throw new Error(n);return X.constructor===ArrayBuffer&&(X=new Uint8Array(X)),Array.isArray(X)||ArrayBuffer.isView(X)||X.constructor===I?z.createHash(D).update(ae(X)).digest("hex"):M(X)}},C=function(M,U){return function(ae,z){return new ne(ae,U,!0).update(z)[M]()}},P=function(M){var U=C("hex",M);U.create=function(I){return new ne(I,M)},U.update=function(I,D){return U.create(I).update(D)};for(var ae=0;ae<b.length;++ae){var z=b[ae];U[z]=C(z,M)}return U};function q(M,U){U?(x[0]=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,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=M}function ne(M,U,ae){var z,I=typeof M;if(I==="string"){var D,X=[],W=M.length,he=0;for(z=0;z<W;++z)(D=M.charCodeAt(z))<128?X[he++]=D:D<2048?(X[he++]=192|D>>>6,X[he++]=128|63&D):D<55296||D>=57344?(X[he++]=224|D>>>12,X[he++]=128|D>>>6&63,X[he++]=128|63&D):(D=65536+((1023&D)<<10|1023&M.charCodeAt(++z)),X[he++]=240|D>>>18,X[he++]=128|D>>>12&63,X[he++]=128|D>>>6&63,X[he++]=128|63&D);M=X}else{if(I!=="object")throw new Error(n);if(M===null)throw new Error(n);if(m&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||m&&ArrayBuffer.isView(M)))throw new Error(n)}M.length>64&&(M=new q(U,!0).update(M).array());var we=[],Oe=[];for(z=0;z<64;++z){var F=M[z]||0;we[z]=92^F,Oe[z]=54^F}q.call(this,U,ae),this.update(Oe),this.oKeyPad=we,this.inner=!0,this.sharedMemory=ae}q.prototype.update=function(M){if(!this.finalized){var U,ae=typeof M;if(ae!=="string"){if(ae!=="object")throw new Error(n);if(M===null)throw new Error(n);if(m&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||m&&ArrayBuffer.isView(M)))throw new Error(n);U=!0}for(var z,I,D=0,X=M.length,W=this.blocks;D<X;){if(this.hashed&&(this.hashed=!1,W[0]=this.block,this.block=W[16]=W[1]=W[2]=W[3]=W[4]=W[5]=W[6]=W[7]=W[8]=W[9]=W[10]=W[11]=W[12]=W[13]=W[14]=W[15]=0),U)for(I=this.start;D<X&&I<64;++D)W[I>>>2]|=M[D]<<u[3&I++];else for(I=this.start;D<X&&I<64;++D)(z=M.charCodeAt(D))<128?W[I>>>2]|=z<<u[3&I++]:z<2048?(W[I>>>2]|=(192|z>>>6)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]):z<55296||z>=57344?(W[I>>>2]|=(224|z>>>12)<<u[3&I++],W[I>>>2]|=(128|z>>>6&63)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]):(z=65536+((1023&z)<<10|1023&M.charCodeAt(++D)),W[I>>>2]|=(240|z>>>18)<<u[3&I++],W[I>>>2]|=(128|z>>>12&63)<<u[3&I++],W[I>>>2]|=(128|z>>>6&63)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]);this.lastByteIndex=I,this.bytes+=I-this.start,I>=64?(this.block=W[16],this.start=I-64,this.hash(),this.hashed=!0):this.start=I}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},q.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var M=this.blocks,U=this.lastByteIndex;M[16]=this.block,M[U>>>2]|=g[3&U],this.block=M[16],U>=56&&(this.hashed||this.hash(),M[0]=this.block,M[16]=M[1]=M[2]=M[3]=M[4]=M[5]=M[6]=M[7]=M[8]=M[9]=M[10]=M[11]=M[12]=M[13]=M[14]=M[15]=0),M[14]=this.hBytes<<3|this.bytes>>>29,M[15]=this.bytes<<3,this.hash()}},q.prototype.hash=function(){var M,U,ae,z,I,D,X,W,he,we=this.h0,Oe=this.h1,F=this.h2,J=this.h3,le=this.h4,pe=this.h5,ye=this.h6,Ce=this.h7,Ne=this.blocks;for(M=16;M<64;++M)U=((I=Ne[M-15])>>>7|I<<25)^(I>>>18|I<<14)^I>>>3,ae=((I=Ne[M-2])>>>17|I<<15)^(I>>>19|I<<13)^I>>>10,Ne[M]=Ne[M-16]+U+Ne[M-7]+ae|0;for(he=Oe&F,M=0;M<64;M+=4)this.first?(this.is224?(D=300032,Ce=(I=Ne[0]-1413257819)-150054599|0,J=I+24177077|0):(D=704751109,Ce=(I=Ne[0]-210244248)-1521486534|0,J=I+143694565|0),this.first=!1):(U=(we>>>2|we<<30)^(we>>>13|we<<19)^(we>>>22|we<<10),z=(D=we&Oe)^we&F^he,Ce=J+(I=Ce+(ae=(le>>>6|le<<26)^(le>>>11|le<<21)^(le>>>25|le<<7))+(le&pe^~le&ye)+d[M]+Ne[M])|0,J=I+(U+z)|0),U=(J>>>2|J<<30)^(J>>>13|J<<19)^(J>>>22|J<<10),z=(X=J&we)^J&Oe^D,ye=F+(I=ye+(ae=(Ce>>>6|Ce<<26)^(Ce>>>11|Ce<<21)^(Ce>>>25|Ce<<7))+(Ce&le^~Ce&pe)+d[M+1]+Ne[M+1])|0,U=((F=I+(U+z)|0)>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),z=(W=F&J)^F&we^X,pe=Oe+(I=pe+(ae=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&Ce^~ye&le)+d[M+2]+Ne[M+2])|0,U=((Oe=I+(U+z)|0)>>>2|Oe<<30)^(Oe>>>13|Oe<<19)^(Oe>>>22|Oe<<10),z=(he=Oe&F)^Oe&J^W,le=we+(I=le+(ae=(pe>>>6|pe<<26)^(pe>>>11|pe<<21)^(pe>>>25|pe<<7))+(pe&ye^~pe&Ce)+d[M+3]+Ne[M+3])|0,we=I+(U+z)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+we|0,this.h1=this.h1+Oe|0,this.h2=this.h2+F|0,this.h3=this.h3+J|0,this.h4=this.h4+le|0,this.h5=this.h5+pe|0,this.h6=this.h6+ye|0,this.h7=this.h7+Ce|0},q.prototype.hex=function(){this.finalize();var M=this.h0,U=this.h1,ae=this.h2,z=this.h3,I=this.h4,D=this.h5,X=this.h6,W=this.h7,he=p[M>>>28&15]+p[M>>>24&15]+p[M>>>20&15]+p[M>>>16&15]+p[M>>>12&15]+p[M>>>8&15]+p[M>>>4&15]+p[15&M]+p[U>>>28&15]+p[U>>>24&15]+p[U>>>20&15]+p[U>>>16&15]+p[U>>>12&15]+p[U>>>8&15]+p[U>>>4&15]+p[15&U]+p[ae>>>28&15]+p[ae>>>24&15]+p[ae>>>20&15]+p[ae>>>16&15]+p[ae>>>12&15]+p[ae>>>8&15]+p[ae>>>4&15]+p[15&ae]+p[z>>>28&15]+p[z>>>24&15]+p[z>>>20&15]+p[z>>>16&15]+p[z>>>12&15]+p[z>>>8&15]+p[z>>>4&15]+p[15&z]+p[I>>>28&15]+p[I>>>24&15]+p[I>>>20&15]+p[I>>>16&15]+p[I>>>12&15]+p[I>>>8&15]+p[I>>>4&15]+p[15&I]+p[D>>>28&15]+p[D>>>24&15]+p[D>>>20&15]+p[D>>>16&15]+p[D>>>12&15]+p[D>>>8&15]+p[D>>>4&15]+p[15&D]+p[X>>>28&15]+p[X>>>24&15]+p[X>>>20&15]+p[X>>>16&15]+p[X>>>12&15]+p[X>>>8&15]+p[X>>>4&15]+p[15&X];return this.is224||(he+=p[W>>>28&15]+p[W>>>24&15]+p[W>>>20&15]+p[W>>>16&15]+p[W>>>12&15]+p[W>>>8&15]+p[W>>>4&15]+p[15&W]),he},q.prototype.toString=q.prototype.hex,q.prototype.digest=function(){this.finalize();var M=this.h0,U=this.h1,ae=this.h2,z=this.h3,I=this.h4,D=this.h5,X=this.h6,W=this.h7,he=[M>>>24&255,M>>>16&255,M>>>8&255,255&M,U>>>24&255,U>>>16&255,U>>>8&255,255&U,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,z>>>24&255,z>>>16&255,z>>>8&255,255&z,I>>>24&255,I>>>16&255,I>>>8&255,255&I,D>>>24&255,D>>>16&255,D>>>8&255,255&D,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||he.push(W>>>24&255,W>>>16&255,W>>>8&255,255&W),he},q.prototype.array=q.prototype.digest,q.prototype.arrayBuffer=function(){this.finalize();var M=new ArrayBuffer(this.is224?28:32),U=new DataView(M);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),M},ne.prototype=new q,ne.prototype.finalize=function(){if(q.prototype.finalize.call(this),this.inner){this.inner=!1;var M=this.array();q.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(M),q.prototype.finalize.call(this)}};var te=_();te.sha256=te,te.sha224=_(!0),te.sha256.hmac=P(),te.sha224.hmac=P(!0),c?ed.exports=te:(s.sha256=te.sha256,s.sha224=te.sha224)})();ju.exports;ju.exports.sha224;var ib=ju.exports.sha256;function Nd(n){return LE(n)}function TE(n){if(!/^[0-9A-Fa-f]+$/.test(n))return!1;const s=/^[0-9A-F]+$/.test(n),i=/^[0-9a-f]+$/.test(n);return s||i?n.length%2===0:!1}function CE(n){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(n)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(n)}function ME(n){return TE(n)?"hex":CE(n)?"b64":""}function RE(n){if(n.length%2!==0)throw new Error("hex string must have an even length");const e=new Uint8Array(n.length/2);for(let s=0;s<n.length;s+=2)e[s/2]=parseInt(n.substring(s,s+2),16);return e}function DE(n){n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/");const e=atob(n);return Uint8Array.from(e,s=>s.charCodeAt(0))}function LE(n){switch(ME(n)){case"hex":return RE(n);case"b64":return DE(n)}return null}function qE(n,e){const s=typeof n=="string"?Nd(n):n,i=typeof e=="string"?Nd(e):e;if(s===null||i===null||s.length!==i.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==i[o])return!1;return!0}class wx{constructor(e,s,i=!0){j(this,"token");j(this,"received");j(this,"ctx");j(this,"requestSubject");j(this,"mux");this.mux=e,this.requestSubject=s,this.received=0,this.token=Os.next(),i&&(this.ctx=new Error)}}class PE extends wx{constructor(s,i,o={maxWait:1e3}){super(s,i);j(this,"callback");j(this,"done");j(this,"timer");j(this,"max");j(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=mt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,i){s?(this.ctx&&(s.stack+=`
33
33
 
34
- ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Wn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Wn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Wn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class wx extends _x{constructor(s,i,o={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=mt(),this.timer=na(o.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
34
+ ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Wn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Wn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Wn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class Sx extends wx{constructor(s,i,o={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=mt(),this.timer=na(o.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
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||ge.errorForCode(fe.Cancelled))}}const PE="$JS.API";function BE(n){return n=n||{},n.domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),Ou({apiPrefix:PE,timeout:5e3},n)}class Ro{constructor(e,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=e,this.opts=BE(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Zn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let e=this.opts.apiPrefix;if(!e||e.length===0)throw new Error("invalid empty prefix");e[e.length-1]==="."&&(e=e.substr(0,e.length-1)),this.opts.apiPrefix=e}async _request(e,s=null,i){i=i||{},i.timeout=this.timeout;let o=jn;s&&(o=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const m=cm();for(let p=0;p<c;p++)try{const g=await this.nc.request(e,o,i);return this.parseJsResponse(g)}catch(g){const u=g;if((u.code==="503"||u.code===fe.Timeout)&&p+1<c)await ia(m.backoff(p));else throw g}}async findStream(e){const s={subject:e},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(e){const s=this.jc.decode(e.data),i=s;if(i.error){const o=vx(i.error.code,i.error.description);if(o!==null)throw o.api_error=i.error,o}return s}}class bo{constructor(e,s,i,o){j(this,"err");j(this,"offset");j(this,"pageInfo");j(this,"subject");j(this,"jsm");j(this,"filter");j(this,"payload");if(!e)throw new Error("subject is required");this.subject=e,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const e={offset:this.offset};this.payload&&Object.assign(e,this.payload);try{const s=await this.jsm._request(this.subject,e,{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(e){var s,i,o;switch(e==null?void 0:e.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=e.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=e.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e==null?void 0:e.type}`),((o=e.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let e=await this.next();for(;e.length>0;){for(const s of e)yield s;e=await this.next()}}}function ti(n=""){const e=n.match(/(\d+).(\d+).(\d+)/);if(e)return{major:parseInt(e[1]),minor:parseInt(e[2]),micro:parseInt(e[3])};throw new Error(`'${n}' is not a semver value`)}function Td(n,e){return n.major<e.major?-1:n.major>e.major?1:n.minor<e.minor?-1:n.minor>e.minor?1:n.micro<e.micro?-1:n.micro>e.micro?1:0}var Ye;(function(n){n.JS_KV="js_kv",n.JS_OBJECTSTORE="js_objectstore",n.JS_PULL_MAX_BYTES="js_pull_max_bytes",n.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",n.JS_ALLOW_DIRECT="js_allow_direct",n.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",n.JS_SIMPLIFICATION="js_simplification",n.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",n.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",n.JS_STREAM_FIRST_SEQ="js_stream_first_seq",n.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",n.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",n.JS_STREAM_COMPRESSION="js_stream_compression",n.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",n.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ye||(Ye={}));class UE{constructor(e){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e=="string"&&(e=ti(e)),this.server=e,this.set(Ye.JS_KV,"2.6.2"),this.set(Ye.JS_OBJECTSTORE,"2.6.3"),this.set(Ye.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ye.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ye.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ye.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ye.JS_SIMPLIFICATION,"2.9.4"),this.set(Ye.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ye.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ye.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ye.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ye.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ye.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(e,s){this.features.set(e,{min:s,ok:Td(this.server,ti(s))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){var s;return((s=this.get(e))==null?void 0:s.ok)||!1}require(e){return typeof e=="string"&&(e=ti(e)),Td(this.server,e)>=0}}class mu extends Ro{constructor(e,s){super(e,s)}async add(e,s,i=du.Create){if(Jt(e),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=e,o.action=i,o.config.durable_name&&Qi(o.config.durable_name);const c=this.nc;let{min:m,ok:p}=c.features.get(Ye.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!p)throw new Error(`consumer 'name' requires server ${m}`);if(g)try{Au("name",g)}catch(x){const v=x.message,w=v.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${v.substring(w)}`):x}let u,d="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get(Ye.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);p=!1}if(s.metadata){const{min:x,ok:v}=c.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(p&&(d=s.name??s.durable_name??""),d!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),u=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${d}.${x}`:`${this.prefix}.CONSUMER.CREATE.${e}.${d}`}else u=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${e}`;return await this._request(u,o)}async update(e,s,i){const o=await this.info(e,s),c=i;return this.add(e,Object.assign(o.config,c),du.Update)}async info(e,s){return Jt(e),Qi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${s}`)}async delete(e,s){return Jt(e),Qi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${s}`)).success}list(e){Jt(e);const s=o=>o.consumers,i=`${this.prefix}.CONSUMER.LIST.${e}`;return new bo(i,s,this)}pause(e,s,i){const o=`${this.prefix}.CONSUMER.PAUSE.${e}.${s}`,c={pause_until:i.toISOString()};return this._request(o,c)}resume(e,s){return this.pause(e,s,new Date(0))}}function $i(n,e,s=!1){if(s===!0&&!n)throw ge.errorForCode(fe.ApiError,new Error(`${e} is not a function`));if(n&&typeof n!="function")throw ge.errorForCode(fe.ApiError,new Error(`${e} is not a function`))}class zE extends Ut{constructor(s,i,o){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");$i(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&$i(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&($i(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&($i(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&($i(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&$i(o.cleanupFn,"cleanupFn");let c=(d,b)=>{this.callback(d,b)};if(o.callback){const d=o.callback;c=(b,x)=>{const[v,w]=this.adapter(b,x);if(v){d(v,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(d(v,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:m,queue:p,timeout:g}=o,u={queue:p,timeout:g,callback:c};m&&m>0&&(u.max=m),this.sub=s.subscribe(i,u),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=mt(),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[o,c]=this.adapter(s,i);o&&this.stop(o),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 On;function IE(n){On=n}function Sx(){return On!==void 0&&On.defaultPort!==void 0?On.defaultPort:4222}function td(){return On!==void 0&&On.urlParseFn?On.urlParseFn:void 0}function $E(){if(!On||typeof On.factory!="function")throw new Error("transport fn is not set");return On.factory()}function Cd(){return On!==void 0&&On.dnsResolveFn?On.dnsResolveFn:void 0}const ru=`\r
37
- `,pu=sa.fromAscii(ru),HE=new Uint8Array(pu)[0],FE=new Uint8Array(pu)[1];function GE(n){for(let e=0;e<n.length;e++){const s=e+1;if(n.byteLength>s&&n[e]===HE&&n[s]===FE)return s+1}return 0}function VE(n){const e=GE(n);if(e>0){const i=new Uint8Array(n).slice(0,e);return En.decode(i)}return""}const YE=4,Ex=48,KE=65,JE=97;function QE(n,e,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((m,p)=>{o[p]=m}),o[12]=n,o[13]=e,o[14]=s,o[15]=i,o}function Md(n){return XE(n)!==void 0}function XE(n){for(let e=0;e<n.length;e++)switch(n[e]){case".":return Ox(n);case":":return WE(n)}}function Ox(n){const e=new Uint8Array(4);for(let s=0;s<4;s++){if(n.length===0)return;if(s>0){if(n[0]!==".")return;n=n.substring(1)}const{n:i,c:o,ok:c}=ZE(n);if(!c||i>255)return;n=n.substring(o),e[s]=i}return QE(e[0],e[1],e[2],e[3])}function WE(n){const e=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return e;let i=0;for(;i<16;){const{n:o,c,ok:m}=e2(n);if(!m||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const p=Ox(n);if(p===void 0)return;e[i]=p[12],e[i+1]=p[13],e[i+2]=p[14],e[i+3]=p[15],n="",i+=YE;break}if(e[i]=o>>8,e[i+1]=o,i+=2,n=n.substring(c),n.length===0)break;if(n[0]!==":"||n.length==1)return;if(n=n.substring(1),n[0]===":"){if(s>=0)return;if(s=i,n=n.substring(1),n.length===0)break}}if(n.length===0){if(i<16){if(s<0)return;const o=16-i;for(let c=i-1;c>=s;c--)e[c+o]=e[c];for(let c=s+o-1;c>=s;c--)e[c]=0}else if(s>=0)return;return e}}function ZE(n){let e=0,s=0;for(e=0;e<n.length&&48<=n.charCodeAt(e)&&n.charCodeAt(e)<=57;e++)if(s=s*10+(n.charCodeAt(e)-Ex),s>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:s,c:e,ok:!0}}function e2(n){let e=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)e*=16,e+=n.charCodeAt(s)-Ex;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)e*=16,e+=n.charCodeAt(s)-JE+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)e*=16,e+=n.charCodeAt(s)-KE+10;else break;if(e>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:e,c:s,ok:!0}}function t2(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function Rd(n){return!t2(n)}function n2(n){const e="::FFFF:",s=n.toUpperCase().indexOf(e);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+e.length);return i=i.replace("[",""),i.replace("]","")}return n}function r2(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=n2(n),Rd(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const e=Rd(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=e&&e.length===3&&e[1]&&e[2]?parseInt(e[2]):4222,i=s===80?"https":"http",o=new URL(`${i}://${n}`);o.port=`${s}`;let c=o.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:o.host,hostname:c,port:s}}class wo{constructor(e,s=!1){j(this,"src");j(this,"listen");j(this,"hostname");j(this,"port");j(this,"didConnect");j(this,"reconnects");j(this,"lastConnect");j(this,"gossiped");j(this,"tlsName");j(this,"resolves");this.src=e,this.tlsName="";const i=r2(e);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(e){if(!e.fn||e.resolve===!1)return[this];const s=[];if(Md(this.hostname))return[this];{const i=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",m=new URL(`${c}://${Rd(o)?"["+o+"]":o}`);m.port=`${this.port}`;const p=new wo(m.host,!1);p.tlsName=this.hostname,s.push(p)}}return e.randomize&&bx(s),this.resolves=s,s}}class s2{constructor(e=[],s={}){j(this,"firstSelect");j(this,"servers");j(this,"currentServer");j(this,"tlsName");j(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=td();e&&(e.forEach(o=>{o=i?i(o):o,this.servers.push(new wo(o))}),this.randomize&&(this.servers=bx(this.servers))),this.servers.length===0&&this.addServer(`${Sd}:${Sx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Md(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,s=!1){const i=td();e=i?i(e):e;const o=new wo(e,s);Md(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const s=this.servers.indexOf(e);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(e,s){const i=[];let o=[];const c=td(),m=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(g=>{g=c?c(g,s):g;const u=new wo(g,!0);m.set(g,u)});const p=[];return this.servers.forEach((g,u)=>{const d=g.listen;g.gossiped&&this.currentServer.listen!==d&&m.get(d)===void 0&&p.push(u),m.delete(d)}),p.reverse(),p.forEach(g=>{const u=this.servers.splice(g,1);o=o.concat(u[0].listen)}),m.forEach((g,u)=>{this.servers.push(g),i.push(u)}),{added:i,deleted:o}}}class i2{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Lr(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const s=e.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,s){if(s&&s.permissionContext){if(e)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const o=this.all().find(c=>c.requestSubject===i.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(e,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(e===null&&s.headers&&(e=xx(s)),o.resolver(e,s))}}}close(){const e=ge.errorForCode(fe.Timeout);this.reqs.forEach(s=>{s.resolver(e,{})})}}class a2{constructor(e,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=e,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Ji.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=mt();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class o2 extends Error{constructor(e){super(e),this.name="AssertionError"}}function l2(n,e="Assertion failed."){if(!n)throw new o2(e)}const ib=32*1024,nd=2**32-2;function oc(n,e,s=0){const i=e.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),e.set(n,s),n.byteLength}class rd{constructor(e){j(this,"_buf");j(this,"_off");if(this._off=0,e==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.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(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const s=this._buf.byteLength;return e<=this.capacity-s?(this._reslice(s+e),s):-1}_reslice(e){l2(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const s=oc(this._buf.subarray(this._off),e);return this._off+=s,s}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(ri.encode(e))}write(e){const s=this._grow(e.byteLength);return oc(e,this._buf,s)}_grow(e){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(e);if(i>=0)return i;const o=this.capacity;if(e<=Math.floor(o/2)-s)oc(this._buf.subarray(this._off),this._buf);else{if(o+e>nd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+e,nd));oc(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+e,nd)),s}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const s=this._grow(e);this._reslice(s)}readFrom(e){let s=0;const i=new Uint8Array(ib);for(;;){const o=this.capacity-this.length<ib,c=o?i:new Uint8Array(this._buf.buffer,this.length),m=e.read(c);if(m===null)return s;o?this.write(c.subarray(0,m)):this._reslice(this.length+m),s+=m}}}var Qt;(function(n){n[n.OK=0]="OK",n[n.ERR=1]="ERR",n[n.MSG=2]="MSG",n[n.INFO=3]="INFO",n[n.PING=4]="PING",n[n.PONG=5]="PONG"})(Qt||(Qt={}));function ab(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const c2=48;class ob{constructor(e){j(this,"dispatcher");j(this,"state");j(this,"as");j(this,"drop");j(this,"hdr");j(this,"ma");j(this,"argBuf");j(this,"msgBuf");this.dispatcher=e,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let s;for(s=0;s<e.length;s++){const i=e[s];switch(this.state){case de.OP_START:switch(i){case me.M:case me.m:this.state=de.OP_M,this.hdr=-1,this.ma=ab();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=ab();break;case me.P:case me.p:this.state=de.OP_P;break;case me.PLUS:this.state=de.OP_PLUS;break;case me.MINUS:this.state=de.OP_MINUS;break;case me.I:case me.i:this.state=de.OP_I;break;default:throw this.fail(e.subarray(s))}break;case de.OP_H:switch(i){case me.M:case me.m:this.state=de.OP_M;break;default:throw this.fail(e.subarray(s))}break;case de.OP_M:switch(i){case me.S:case me.s:this.state=de.OP_MS;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MS:switch(i){case me.G:case me.g:this.state=de.OP_MSG;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MSG:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MSG_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MSG_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MSG_ARG,this.as=s}break;case de.MSG_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{const o=this.argBuf?this.argBuf.bytes():e.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=de.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case de.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Qt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const c=e.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(e.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Qt.MSG,msg:this.ma,data:e.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END);break;case de.MSG_END:switch(i){case me.NL:this.drop=0,this.as=s+1,this.state=de.OP_START;break;default:continue}break;case de.OP_PLUS:switch(i){case me.O:case me.o:this.state=de.OP_PLUS_O;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PLUS_O:switch(i){case me.K:case me.k:this.state=de.OP_PLUS_OK;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Qt.OK}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_MINUS:switch(i){case me.E:case me.e:this.state=de.OP_MINUS_E;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_E:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ER;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ER:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ERR:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ERR_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MINUS_ERR_ARG,this.as=s}break;case de.MINUS_ERR_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Qt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case de.OP_P:switch(i){case me.I:case me.i:this.state=de.OP_PI;break;case me.O:case me.o:this.state=de.OP_PO;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PO:switch(i){case me.N:case me.n:this.state=de.OP_PON;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PON:switch(i){case me.G:case me.g:this.state=de.OP_PONG;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Qt.PONG}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_PI:switch(i){case me.N:case me.n:this.state=de.OP_PIN;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PIN:switch(i){case me.G:case me.g:this.state=de.OP_PING;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Qt.PING}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_I:switch(i){case me.N:case me.n:this.state=de.OP_IN;break;default:throw this.fail(e.subarray(s))}break;case de.OP_IN:switch(i){case me.F:case me.f:this.state=de.OP_INF;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INF:switch(i){case me.O:case me.o:this.state=de.OP_INFO;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INFO:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_INFO_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INFO_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.INFO_ARG,this.as=s}break;case de.INFO_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Qt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(e.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new rd(e.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new rd(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(e+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,e),this.argBuf=new rd(i),this.ma.subject=i.subarray(0,e),this.ma.reply&&(this.ma.reply=i.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.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(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${En.decode(e)}`)}processHeaderMsgArgs(e){const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.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(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let s=0;for(let i=0;i<e.length;i++){if(e[i]<48||e[i]>57)return-1;s=s*10+(e[i]-c2)}return s}}var de;(function(n){n[n.OP_START=0]="OP_START",n[n.OP_PLUS=1]="OP_PLUS",n[n.OP_PLUS_O=2]="OP_PLUS_O",n[n.OP_PLUS_OK=3]="OP_PLUS_OK",n[n.OP_MINUS=4]="OP_MINUS",n[n.OP_MINUS_E=5]="OP_MINUS_E",n[n.OP_MINUS_ER=6]="OP_MINUS_ER",n[n.OP_MINUS_ERR=7]="OP_MINUS_ERR",n[n.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",n[n.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",n[n.OP_M=10]="OP_M",n[n.OP_MS=11]="OP_MS",n[n.OP_MSG=12]="OP_MSG",n[n.OP_MSG_SPC=13]="OP_MSG_SPC",n[n.MSG_ARG=14]="MSG_ARG",n[n.MSG_PAYLOAD=15]="MSG_PAYLOAD",n[n.MSG_END=16]="MSG_END",n[n.OP_H=17]="OP_H",n[n.OP_P=18]="OP_P",n[n.OP_PI=19]="OP_PI",n[n.OP_PIN=20]="OP_PIN",n[n.OP_PING=21]="OP_PING",n[n.OP_PO=22]="OP_PO",n[n.OP_PON=23]="OP_PON",n[n.OP_PONG=24]="OP_PONG",n[n.OP_I=25]="OP_I",n[n.OP_IN=26]="OP_IN",n[n.OP_INF=27]="OP_INF",n[n.OP_INFO=28]="OP_INFO",n[n.OP_INFO_SPC=29]="OP_INFO_SPC",n[n.INFO_ARG=30]="INFO_ARG"})(de||(de={}));var me;(function(n){n[n.CR=13]="CR",n[n.E=69]="E",n[n.e=101]="e",n[n.F=70]="F",n[n.f=102]="f",n[n.G=71]="G",n[n.g=103]="g",n[n.H=72]="H",n[n.h=104]="h",n[n.I=73]="I",n[n.i=105]="i",n[n.K=75]="K",n[n.k=107]="k",n[n.M=77]="M",n[n.m=109]="m",n[n.MINUS=45]="MINUS",n[n.N=78]="N",n[n.n=110]="n",n[n.NL=10]="NL",n[n.O=79]="O",n[n.o=111]="o",n[n.P=80]="P",n[n.p=112]="p",n[n.PLUS=43]="PLUS",n[n.R=82]="R",n[n.r=114]="r",n[n.S=83]="S",n[n.s=115]="s",n[n.SPACE=32]="SPACE",n[n.TAB=9]="TAB"})(me||(me={}));(function(n){var e=function(A,N){this.hi=A|0,this.lo=N|0},s=function(A){var N,k=new Float64Array(16);if(A)for(N=0;N<A.length;N++)k[N]=A[N];return k},i=function(){throw new Error("no PRNG")},o=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var m=s(),p=s([1]),g=s([56129,1]),u=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]),x=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(A,N){return A<<N|A>>>32-N}function S(A,N){var k=A[N+3]&255;return k=k<<8|A[N+2]&255,k=k<<8|A[N+1]&255,k<<8|A[N+0]&255}function C(A,N){var k=A[N]<<24|A[N+1]<<16|A[N+2]<<8|A[N+3],T=A[N+4]<<24|A[N+5]<<16|A[N+6]<<8|A[N+7];return new e(k,T)}function P(A,N,k){var T;for(T=0;T<4;T++)A[N+T]=k&255,k>>>=8}function q(A,N,k){A[N]=k.hi>>24&255,A[N+1]=k.hi>>16&255,A[N+2]=k.hi>>8&255,A[N+3]=k.hi&255,A[N+4]=k.lo>>24&255,A[N+5]=k.lo>>16&255,A[N+6]=k.lo>>8&255,A[N+7]=k.lo&255}function re(A,N,k,T,L){var H,ne=0;for(H=0;H<L;H++)ne|=A[N+H]^k[T+H];return(1&ne-1>>>8)-1}function se(A,N,k,T){return re(A,N,k,T,16)}function M(A,N,k,T){return re(A,N,k,T,32)}function U(A,N,k,T,L){var H=new Uint32Array(16),ne=new Uint32Array(16),oe=new Uint32Array(16),K=new Uint32Array(4),te,xe,Pe;for(te=0;te<4;te++)ne[5*te]=S(T,4*te),ne[1+te]=S(k,4*te),ne[6+te]=S(N,4*te),ne[11+te]=S(k,16+4*te);for(te=0;te<16;te++)oe[te]=ne[te];for(te=0;te<20;te++){for(xe=0;xe<4;xe++){for(Pe=0;Pe<4;Pe++)K[Pe]=ne[(5*xe+4*Pe)%16];for(K[1]^=w(K[0]+K[3]|0,7),K[2]^=w(K[1]+K[0]|0,9),K[3]^=w(K[2]+K[1]|0,13),K[0]^=w(K[3]+K[2]|0,18),Pe=0;Pe<4;Pe++)H[4*xe+(xe+Pe)%4]=K[Pe]}for(Pe=0;Pe<16;Pe++)ne[Pe]=H[Pe]}if(L){for(te=0;te<16;te++)ne[te]=ne[te]+oe[te]|0;for(te=0;te<4;te++)ne[5*te]=ne[5*te]-S(T,4*te)|0,ne[6+te]=ne[6+te]-S(N,4*te)|0;for(te=0;te<4;te++)P(A,4*te,ne[5*te]),P(A,16+4*te,ne[6+te])}else for(te=0;te<16;te++)P(A,4*te,ne[te]+oe[te]|0)}function ae(A,N,k,T){return U(A,N,k,T,!1),0}function z(A,N,k,T){return U(A,N,k,T,!0),0}var I=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(A,N,k,T,L,H,ne){var oe=new Uint8Array(16),K=new Uint8Array(64),te,xe;if(!L)return 0;for(xe=0;xe<16;xe++)oe[xe]=0;for(xe=0;xe<8;xe++)oe[xe]=H[xe];for(;L>=64;){for(ae(K,oe,ne,I),xe=0;xe<64;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];for(te=1,xe=8;xe<16;xe++)te=te+(oe[xe]&255)|0,oe[xe]=te&255,te>>>=8;L-=64,N+=64,k&&(T+=64)}if(L>0)for(ae(K,oe,ne,I),xe=0;xe<L;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];return 0}function X(A,N,k,T,L){return D(A,N,null,0,k,T,L)}function W(A,N,k,T,L){var H=new Uint8Array(32);return z(H,T,L,I),X(A,N,k,T.subarray(16),H)}function he(A,N,k,T,L,H,ne){var oe=new Uint8Array(32);return z(oe,H,ne,I),D(A,N,k,T,L,H.subarray(16),oe)}function we(A,N){var k,T=0;for(k=0;k<17;k++)T=T+(A[k]+N[k]|0)|0,A[k]=T&255,T>>>=8}var Oe=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function F(A,N,k,T,L,H){var ne,oe,K,te,xe=new Uint32Array(17),Pe=new Uint32Array(17),lt=new Uint32Array(17),Gt=new Uint32Array(17),Gn=new Uint32Array(17);for(K=0;K<17;K++)Pe[K]=lt[K]=0;for(K=0;K<16;K++)Pe[K]=H[K];for(Pe[3]&=15,Pe[4]&=252,Pe[7]&=15,Pe[8]&=252,Pe[11]&=15,Pe[12]&=252,Pe[15]&=15;L>0;){for(K=0;K<17;K++)Gt[K]=0;for(K=0;K<16&&K<L;++K)Gt[K]=k[T+K];for(Gt[K]=1,T+=K,L-=K,we(lt,Gt),oe=0;oe<17;oe++)for(xe[oe]=0,K=0;K<17;K++)xe[oe]=xe[oe]+lt[K]*(K<=oe?Pe[oe-K]:320*Pe[oe+17-K]|0)|0|0;for(oe=0;oe<17;oe++)lt[oe]=xe[oe];for(te=0,K=0;K<16;K++)te=te+lt[K]|0,lt[K]=te&255,te>>>=8;for(te=te+lt[16]|0,lt[16]=te&3,te=5*(te>>>2)|0,K=0;K<16;K++)te=te+lt[K]|0,lt[K]=te&255,te>>>=8;te=te+lt[16]|0,lt[16]=te}for(K=0;K<17;K++)Gn[K]=lt[K];for(we(lt,Oe),ne=-(lt[16]>>>7)|0,K=0;K<17;K++)lt[K]^=ne&(Gn[K]^lt[K]);for(K=0;K<16;K++)Gt[K]=H[K+16];for(Gt[16]=0,we(lt,Gt),K=0;K<16;K++)A[N+K]=lt[K];return 0}function J(A,N,k,T,L,H){var ne=new Uint8Array(16);return F(ne,0,k,T,L,H),se(A,N,ne,0)}function le(A,N,k,T,L){var H;if(k<32)return-1;for(he(A,0,N,0,k,T,L),F(A,16,A,32,k-32,A),H=0;H<16;H++)A[H]=0;return 0}function pe(A,N,k,T,L){var H,ne=new Uint8Array(32);if(k<32||(W(ne,0,32,T,L),J(N,16,N,32,k-32,ne)!==0))return-1;for(he(A,0,N,0,k,T,L),H=0;H<32;H++)A[H]=0;return 0}function ye(A,N){var k;for(k=0;k<16;k++)A[k]=N[k]|0}function Ce(A){var N,k;for(k=0;k<16;k++)A[k]+=65536,N=Math.floor(A[k]/65536),A[(k+1)*(k<15?1:0)]+=N-1+37*(N-1)*(k===15?1:0),A[k]-=N*65536}function Ne(A,N,k){for(var T,L=~(k-1),H=0;H<16;H++)T=L&(A[H]^N[H]),A[H]^=T,N[H]^=T}function Me(A,N){var k,T,L,H=s(),ne=s();for(k=0;k<16;k++)ne[k]=N[k];for(Ce(ne),Ce(ne),Ce(ne),T=0;T<2;T++){for(H[0]=ne[0]-65517,k=1;k<15;k++)H[k]=ne[k]-65535-(H[k-1]>>16&1),H[k-1]&=65535;H[15]=ne[15]-32767-(H[14]>>16&1),L=H[15]>>16&1,H[14]&=65535,Ne(ne,H,1-L)}for(k=0;k<16;k++)A[2*k]=ne[k]&255,A[2*k+1]=ne[k]>>8}function We(A,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Me(k,A),Me(T,N),M(k,0,T,0)}function pt(A){var N=new Uint8Array(32);return Me(N,A),N[0]&1}function Ct(A,N){var k;for(k=0;k<16;k++)A[k]=N[2*k]+(N[2*k+1]<<8);A[15]&=32767}function Se(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]+k[T]|0}function Re(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]-k[T]|0}function ce(A,N,k){var T,L,H=new Float64Array(31);for(T=0;T<31;T++)H[T]=0;for(T=0;T<16;T++)for(L=0;L<16;L++)H[T+L]+=N[T]*k[L];for(T=0;T<15;T++)H[T]+=38*H[T+16];for(T=0;T<16;T++)A[T]=H[T];Ce(A),Ce(A)}function Ue(A,N){ce(A,N,N)}function Xe(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)Ue(k,k),T!==2&&T!==4&&ce(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function cn(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)Ue(k,k),T!==1&&ce(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function Mt(A,N,k){var T=new Uint8Array(32),L=new Float64Array(80),H,ne,oe=s(),K=s(),te=s(),xe=s(),Pe=s(),lt=s();for(ne=0;ne<31;ne++)T[ne]=N[ne];for(T[31]=N[31]&127|64,T[0]&=248,Ct(L,k),ne=0;ne<16;ne++)K[ne]=L[ne],xe[ne]=oe[ne]=te[ne]=0;for(oe[0]=xe[0]=1,ne=254;ne>=0;--ne)H=T[ne>>>3]>>>(ne&7)&1,Ne(oe,K,H),Ne(te,xe,H),Se(Pe,oe,te),Re(oe,oe,te),Se(te,K,xe),Re(K,K,xe),Ue(xe,Pe),Ue(lt,oe),ce(oe,te,oe),ce(te,K,Pe),Se(Pe,oe,te),Re(oe,oe,te),Ue(K,oe),Re(te,xe,lt),ce(oe,te,g),Se(oe,oe,xe),ce(te,te,oe),ce(oe,xe,lt),ce(xe,K,L),Ue(K,Pe),Ne(oe,K,H),Ne(te,xe,H);for(ne=0;ne<16;ne++)L[ne+16]=oe[ne],L[ne+32]=te[ne],L[ne+48]=K[ne],L[ne+64]=xe[ne];var Gt=L.subarray(32),Gn=L.subarray(16);return Xe(Gt,Gt),ce(Gn,Gn,Gt),Me(A,Gn),0}function be(A,N){return Mt(A,N,c)}function it(A,N){return i(N,32),be(A,N)}function yt(A,N,k){var T=new Uint8Array(32);return Mt(T,k,N),z(A,o,T,I)}var Ot=le,Ur=pe;function la(A,N,k,T,L,H){var ne=new Uint8Array(32);return yt(ne,L,H),Ot(A,N,k,T,ne)}function ca(A,N,k,T,L,H){var ne=new Uint8Array(32);return yt(ne,L,H),Ur(A,N,k,T,ne)}function hr(){var A=0,N=0,k=0,T=0,L=65535,H,ne,oe;for(oe=0;oe<arguments.length;oe++)H=arguments[oe].lo,ne=arguments[oe].hi,A+=H&L,N+=H>>>16,k+=ne&L,T+=ne>>>16;return N+=A>>>16,k+=N>>>16,T+=k>>>16,new e(k&L|T<<16,A&L|N<<16)}function zo(A,N){return new e(A.hi>>>N,A.lo>>>N|A.hi<<32-N)}function si(){var A=0,N=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,N^=arguments[k].hi;return new e(N,A)}function ft(A,N){var k,T,L=32-N;return N<32?(k=A.hi>>>N|A.lo<<L,T=A.lo>>>N|A.hi<<L):N<64&&(k=A.lo>>>N|A.hi<<L,T=A.hi>>>N|A.lo<<L),new e(k,T)}function Bu(A,N,k){var T=A.hi&N.hi^~A.hi&k.hi,L=A.lo&N.lo^~A.lo&k.lo;return new e(T,L)}function Io(A,N,k){var T=A.hi&N.hi^A.hi&k.hi^N.hi&k.hi,L=A.lo&N.lo^A.lo&k.lo^N.lo&k.lo;return new e(T,L)}function $o(A){return si(ft(A,28),ft(A,34),ft(A,39))}function ii(A){return si(ft(A,14),ft(A,18),ft(A,41))}function Uu(A){return si(ft(A,1),ft(A,8),zo(A,7))}function Ho(A){return si(ft(A,19),ft(A,61),zo(A,6))}var zu=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function Fo(A,N,k){var T=[],L=[],H=[],ne=[],oe,K,te;for(K=0;K<8;K++)T[K]=H[K]=C(A,8*K);for(var xe=0;k>=128;){for(K=0;K<16;K++)ne[K]=C(N,8*K+xe);for(K=0;K<80;K++){for(te=0;te<8;te++)L[te]=H[te];for(oe=hr(H[7],ii(H[4]),Bu(H[4],H[5],H[6]),zu[K],ne[K%16]),L[7]=hr(oe,$o(H[0]),Io(H[0],H[1],H[2])),L[3]=hr(L[3],oe),te=0;te<8;te++)H[(te+1)%8]=L[te];if(K%16===15)for(te=0;te<16;te++)ne[te]=hr(ne[te],ne[(te+9)%16],Uu(ne[(te+1)%16]),Ho(ne[(te+14)%16]))}for(K=0;K<8;K++)H[K]=hr(H[K],T[K]),T[K]=H[K];xe+=128,k-=128}for(K=0;K<8;K++)q(A,8*K,T[K]);return k}var ks=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 _t(A,N,k){var T=new Uint8Array(64),L=new Uint8Array(256),H,ne=k;for(H=0;H<64;H++)T[H]=ks[H];for(Fo(T,N,k),k%=128,H=0;H<256;H++)L[H]=0;for(H=0;H<k;H++)L[H]=N[ne-k+H];for(L[k]=128,k=256-128*(k<112?1:0),L[k-9]=0,q(L,k-8,new e(ne/536870912|0,ne<<3)),Fo(T,L,k),H=0;H<64;H++)A[H]=T[H];return 0}function un(A,N){var k=s(),T=s(),L=s(),H=s(),ne=s(),oe=s(),K=s(),te=s(),xe=s();Re(k,A[1],A[0]),Re(xe,N[1],N[0]),ce(k,k,xe),Se(T,A[0],A[1]),Se(xe,N[0],N[1]),ce(T,T,xe),ce(L,A[3],N[3]),ce(L,L,d),ce(H,A[2],N[2]),Se(H,H,H),Re(ne,T,k),Re(oe,H,L),Se(K,H,L),Se(te,T,k),ce(A[0],ne,oe),ce(A[1],te,K),ce(A[2],K,oe),ce(A[3],ne,te)}function Ft(A,N,k){var T;for(T=0;T<4;T++)Ne(A[T],N[T],k)}function ua(A,N){var k=s(),T=s(),L=s();Xe(L,N[2]),ce(k,N[0],L),ce(T,N[1],L),Me(A,T),A[31]^=pt(k)<<7}function fa(A,N,k){var T,L;for(ye(A[0],m),ye(A[1],p),ye(A[2],p),ye(A[3],m),L=255;L>=0;--L)T=k[L/8|0]>>(L&7)&1,Ft(A,N,T),un(N,A),un(A,A),Ft(A,N,T)}function ai(A,N){var k=[s(),s(),s(),s()];ye(k[0],b),ye(k[1],x),ye(k[2],p),ce(k[3],b,x),fa(A,k,N)}function zr(A,N,k){var T=new Uint8Array(64),L=[s(),s(),s(),s()],H;for(k||i(N,32),_t(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,ai(L,T),ua(A,L),H=0;H<32;H++)N[H+32]=A[H];return 0}var dr=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 Ir(A,N){var k,T,L,H;for(T=63;T>=32;--T){for(k=0,L=T-32,H=T-12;L<H;++L)N[L]+=k-16*N[T]*dr[L-(T-32)],k=Math.floor((N[L]+128)/256),N[L]-=k*256;N[L]+=k,N[T]=0}for(k=0,L=0;L<32;L++)N[L]+=k-(N[31]>>4)*dr[L],k=N[L]>>8,N[L]&=255;for(L=0;L<32;L++)N[L]-=k*dr[L];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,A[T]=N[T]&255}function Hn(A){var N=new Float64Array(64),k;for(k=0;k<64;k++)N[k]=A[k];for(k=0;k<64;k++)A[k]=0;Ir(A,N)}function Ns(A,N,k,T){var L=new Uint8Array(64),H=new Uint8Array(64),ne=new Uint8Array(64),oe,K,te=new Float64Array(64),xe=[s(),s(),s(),s()];_t(L,T,32),L[0]&=248,L[31]&=127,L[31]|=64;var Pe=k+64;for(oe=0;oe<k;oe++)A[64+oe]=N[oe];for(oe=0;oe<32;oe++)A[32+oe]=L[32+oe];for(_t(ne,A.subarray(32),k+32),Hn(ne),ai(xe,ne),ua(A,xe),oe=32;oe<64;oe++)A[oe]=T[oe];for(_t(H,A,k+64),Hn(H),oe=0;oe<64;oe++)te[oe]=0;for(oe=0;oe<32;oe++)te[oe]=ne[oe];for(oe=0;oe<32;oe++)for(K=0;K<32;K++)te[oe+K]+=H[oe]*L[K];return Ir(A.subarray(32),te),Pe}function Ts(A,N){var k=s(),T=s(),L=s(),H=s(),ne=s(),oe=s(),K=s();return ye(A[2],p),Ct(A[1],N),Ue(L,A[1]),ce(H,L,u),Re(L,L,A[2]),Se(H,A[2],H),Ue(ne,H),Ue(oe,ne),ce(K,oe,ne),ce(k,K,L),ce(k,k,H),cn(k,k),ce(k,k,L),ce(k,k,H),ce(k,k,H),ce(A[0],k,H),Ue(T,A[0]),ce(T,T,H),We(T,L)&&ce(A[0],A[0],v),Ue(T,A[0]),ce(T,T,H),We(T,L)?-1:(pt(A[0])===N[31]>>7&&Re(A[0],m,A[0]),ce(A[3],A[0],A[1]),0)}function ha(A,N,k,T){var L,H=new Uint8Array(32),ne=new Uint8Array(64),oe=[s(),s(),s(),s()],K=[s(),s(),s(),s()];if(k<64||Ts(K,T))return-1;for(L=0;L<k;L++)A[L]=N[L];for(L=0;L<32;L++)A[L+32]=T[L];if(_t(ne,A,k),Hn(ne),fa(oe,K,ne),ai(K,N.subarray(32)),un(oe,K),ua(H,oe),k-=64,M(N,0,H,0)){for(L=0;L<k;L++)A[L]=0;return-1}for(L=0;L<k;L++)A[L]=N[L+64];return k}var oi=32,$r=24,Fn=32,Hr=16,Fr=32,Cs=32,Gr=32,mr=32,Ms=32,da=$r,Go=Fn,tr=Hr,at=64,gt=32,fn=64,Rs=32,ma=64;n.lowlevel={crypto_core_hsalsa20:z,crypto_stream_xor:he,crypto_stream:W,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:X,crypto_onetimeauth:F,crypto_onetimeauth_verify:J,crypto_verify_16:se,crypto_verify_32:M,crypto_secretbox:le,crypto_secretbox_open:pe,crypto_scalarmult:Mt,crypto_scalarmult_base:be,crypto_box_beforenm:yt,crypto_box_afternm:Ot,crypto_box:la,crypto_box_open:ca,crypto_box_keypair:it,crypto_hash:_t,crypto_sign:Ns,crypto_sign_keypair:zr,crypto_sign_open:ha,crypto_secretbox_KEYBYTES:oi,crypto_secretbox_NONCEBYTES:$r,crypto_secretbox_ZEROBYTES:Fn,crypto_secretbox_BOXZEROBYTES:Hr,crypto_scalarmult_BYTES:Fr,crypto_scalarmult_SCALARBYTES:Cs,crypto_box_PUBLICKEYBYTES:Gr,crypto_box_SECRETKEYBYTES:mr,crypto_box_BEFORENMBYTES:Ms,crypto_box_NONCEBYTES:da,crypto_box_ZEROBYTES:Go,crypto_box_BOXZEROBYTES:tr,crypto_sign_BYTES:at,crypto_sign_PUBLICKEYBYTES:gt,crypto_sign_SECRETKEYBYTES:fn,crypto_sign_SEEDBYTES:Rs,crypto_hash_BYTES:ma,gf:s,D:u,L:dr,pack25519:Me,unpack25519:Ct,M:ce,A:Se,S:Ue,Z:Re,pow2523:cn,add:un,set25519:ye,modL:Ir,scalarmult:fa,scalarbase:ai};function Vo(A,N){if(A.length!==oi)throw new Error("bad key size");if(N.length!==$r)throw new Error("bad nonce size")}function Yo(A,N){if(A.length!==Gr)throw new Error("bad public key size");if(N.length!==mr)throw new Error("bad secret key size")}function Rt(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function li(A){for(var N=0;N<A.length;N++)A[N]=0}n.randomBytes=function(A){var N=new Uint8Array(A);return i(N,A),N},n.secretbox=function(A,N,k){Rt(A,N,k),Vo(k,N);for(var T=new Uint8Array(Fn+A.length),L=new Uint8Array(T.length),H=0;H<A.length;H++)T[H+Fn]=A[H];return le(L,T,T.length,N,k),L.subarray(Hr)},n.secretbox.open=function(A,N,k){Rt(A,N,k),Vo(k,N);for(var T=new Uint8Array(Hr+A.length),L=new Uint8Array(T.length),H=0;H<A.length;H++)T[H+Hr]=A[H];return T.length<32||pe(L,T,T.length,N,k)!==0?null:L.subarray(Fn)},n.secretbox.keyLength=oi,n.secretbox.nonceLength=$r,n.secretbox.overheadLength=Hr,n.scalarMult=function(A,N){if(Rt(A,N),A.length!==Cs)throw new Error("bad n size");if(N.length!==Fr)throw new Error("bad p size");var k=new Uint8Array(Fr);return Mt(k,A,N),k},n.scalarMult.base=function(A){if(Rt(A),A.length!==Cs)throw new Error("bad n size");var N=new Uint8Array(Fr);return be(N,A),N},n.scalarMult.scalarLength=Cs,n.scalarMult.groupElementLength=Fr,n.box=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox(A,N,L)},n.box.before=function(A,N){Rt(A,N),Yo(A,N);var k=new Uint8Array(Ms);return yt(k,A,N),k},n.box.after=n.secretbox,n.box.open=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox.open(A,N,L)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Gr),N=new Uint8Array(mr);return it(A,N),{publicKey:A,secretKey:N}},n.box.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==mr)throw new Error("bad secret key size");var N=new Uint8Array(Gr);return be(N,A),{publicKey:N,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Gr,n.box.secretKeyLength=mr,n.box.sharedKeyLength=Ms,n.box.nonceLength=da,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,N){if(Rt(A,N),N.length!==fn)throw new Error("bad secret key size");var k=new Uint8Array(at+A.length);return Ns(k,A,A.length,N),k},n.sign.open=function(A,N){if(Rt(A,N),N.length!==gt)throw new Error("bad public key size");var k=new Uint8Array(A.length),T=ha(k,A,A.length,N);if(T<0)return null;for(var L=new Uint8Array(T),H=0;H<L.length;H++)L[H]=k[H];return L},n.sign.detached=function(A,N){for(var k=n.sign(A,N),T=new Uint8Array(at),L=0;L<T.length;L++)T[L]=k[L];return T},n.sign.detached.verify=function(A,N,k){if(Rt(A,N,k),N.length!==at)throw new Error("bad signature size");if(k.length!==gt)throw new Error("bad public key size");var T=new Uint8Array(at+A.length),L=new Uint8Array(at+A.length),H;for(H=0;H<at;H++)T[H]=N[H];for(H=0;H<A.length;H++)T[H+at]=A[H];return ha(L,T,T.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(gt),N=new Uint8Array(fn);return zr(A,N),{publicKey:A,secretKey:N}},n.sign.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==fn)throw new Error("bad secret key size");for(var N=new Uint8Array(gt),k=0;k<N.length;k++)N[k]=A[32+k];return{publicKey:N,secretKey:new Uint8Array(A)}},n.sign.keyPair.fromSeed=function(A){if(Rt(A),A.length!==Rs)throw new Error("bad seed size");for(var N=new Uint8Array(gt),k=new Uint8Array(fn),T=0;T<32;T++)k[T]=A[T];return zr(N,k,!0),{publicKey:N,secretKey:k}},n.sign.publicKeyLength=gt,n.sign.secretKeyLength=fn,n.sign.seedLength=Rs,n.sign.signatureLength=at,n.hash=function(A){Rt(A);var N=new Uint8Array(ma);return _t(N,A,A.length),N},n.hash.hashLength=ma,n.verify=function(A,N){return Rt(A,N),A.length===0||N.length===0||A.length!==N.length?!1:re(A,0,N,0,A.length)===0},n.setPRNG=function(A){i=A},(function(){var A=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(A&&A.getRandomValues){var N=65536;n.setPRNG(function(k,T){var L,H=new Uint8Array(T);for(L=0;L<T;L+=N)A.getRandomValues(H.subarray(L,L+Math.min(T-L,N)));for(L=0;L<T;L++)k[L]=H[L];li(H)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,T){var L,H=A.randomBytes(T);for(L=0;L<T;L++)k[L]=H[L];li(H)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const lc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;lc.sign.keyPair.fromSeed,lc.sign.detached,lc.sign.detached.verify,lc.randomBytes;var lb;(function(n){n.InvalidPrefixByte="nkeys: invalid prefix byte",n.InvalidKey="nkeys: invalid key",n.InvalidPublicKey="nkeys: invalid public key",n.InvalidSeedLen="nkeys: invalid seed length",n.InvalidSeed="nkeys: invalid seed",n.InvalidEncoding="nkeys: invalid encoded key",n.InvalidSignature="nkeys: signature verification failed",n.CannotSign="nkeys: cannot sign, no private key available",n.PublicKeyOnly="nkeys: no seed or private key available",n.InvalidChecksum="nkeys: invalid checksum",n.SerializationError="nkeys: serialization error",n.ApiError="nkeys: api error",n.ClearedPair="nkeys: pair is cleared"})(lb||(lb={}));var cb;(function(n){n[n.Seed=144]="Seed",n[n.Private=120]="Private",n[n.Operator=112]="Operator",n[n.Server=104]="Server",n[n.Cluster=16]="Cluster",n[n.Account=0]="Account",n[n.User=160]="User"})(cb||(cb={}));function u2(n){return e=>{let s={};return n.forEach(i=>{const o=i(e)||{};s=Object.assign(s,o)}),s}}function f2(){return()=>{}}function h2(n,e){return()=>{const s=typeof n=="function"?n():n,i=typeof e=="function"?e():e;return{user:s,pass:i}}}function d2(n){return()=>({auth_token:typeof n=="function"?n():n})}const Ax=120*1e3,m2=2,jx=2*1e3;function p2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Ax,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:jx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function y2(n){const e=[];return typeof n.authenticator=="function"&&e.push(n.authenticator),Array.isArray(n.authenticator)&&e.push(...n.authenticator),n.token&&e.push(d2(n.token)),n.user&&e.push(h2(n.user,n.pass)),e.length===0?f2():u2(e)}function g2(n){const e=`${Sd}:${Sx()}`;if(n=n||{servers:[e]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new ge("port and servers options are mutually exclusive",fe.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${Sd}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[e]);const s=Ou(p2(),n);if(s.authenticator=y2(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new ge(`${i} option should be a function`,fe.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{Lr(s.inboxPrefix)}catch(i){throw new ge(i.message,fe.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Cd()=="function"),s.resolve&&typeof Cd()!="function")throw new ge("'resolve' is not supported on this client",fe.InvalidOption);return s}function b2(n,e){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&e.noEcho)throw new ge("noEcho",fe.ServerOptionNotAvailable);const c=i||o||!1;if(e.tls&&!c)throw new ge("tls",fe.ServerOptionNotAvailable)}const x2=1024*32,v2=/^INFO\s+([^\r\n]+)\r\n/i,_2=vo(`PONG\r
38
- `),ub=vo(`PING\r
39
- `);class w2{constructor(e,s,i){j(this,"echo");j(this,"no_responders");j(this,"protocol");j(this,"verbose");j(this,"pedantic");j(this,"jwt");j(this,"nkey");j(this,"sig");j(this,"user");j(this,"pass");j(this,"auth_token");j(this,"tls_required");j(this,"name");j(this,"lang");j(this,"version");j(this,"headers");this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};Ou(this,o)}}class kx extends Ut{constructor(s,i,o={}){var m;super();j(this,"sid");j(this,"queue");j(this,"draining");j(this,"max");j(this,"subject");j(this,"drained");j(this,"protocol");j(this,"timer");j(this,"info");j(this,"cleanupFn");j(this,"closed");j(this,"requestSubject");Ou(this,o),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=mt();const c=!((m=s.options)!=null&&m.noAsyncTraces);o.timeout&&(this.timer=na(o.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(p=>{this.stop(p),this.noIterator&&this.callback(p,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,m=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(p,g)=>{const{ingest:u}=o(g);u&&c(g)&&(i(p,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(ge.errorForCode(fe.ConnectionClosed)):this.isClosed()?Promise.reject(ge.errorForCode(fe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(mt()).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 S2{constructor(){j(this,"mux");j(this,"subs");j(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){if(e&&e.permissionContext){const s=e.permissionContext,i=this.all();let o;if(s.operation==="subscription"&&(o=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(o=i.find(c=>c.requestSubject===s.subject)),o)return o.callback(e,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(e=>{e.close()})}}class yu{constructor(e,s){j(this,"connected");j(this,"connectedOnce");j(this,"infoReceived");j(this,"info");j(this,"muxSubscriptions");j(this,"options");j(this,"outbound");j(this,"pongs");j(this,"subscriptions");j(this,"transport");j(this,"noMorePublishing");j(this,"connectError");j(this,"publisher");j(this,"_closed");j(this,"closed");j(this,"listeners");j(this,"heartbeats");j(this,"parser");j(this,"outMsgs");j(this,"inMsgs");j(this,"outBytes");j(this,"inBytes");j(this,"pendingLimit");j(this,"lastError");j(this,"abortReconnect");j(this,"whyClosed");j(this,"servers");j(this,"server");j(this,"features");j(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=x2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=s,this.subscriptions=new S2,this.muxSubscriptions=new i2,this.outbound=new sa,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new UE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new s2(i,{randomize:!e.noRandomize}),this.closed=mt(),this.parser=new ob(this),this.heartbeats=new a2(this,this.options.pingInterval||Ax,this.options.maxPingOut||m2)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const s=ge.errorForCode(fe.Disconnect);s.stack="",e.forEach(i=>{i.reject(s)}),this.parser=new ob(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(s=>{s.push(e)})}status(){const e=new Ut;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=mt();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=s=>{e.reject(s)},this.transport=$E(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:Ji.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Ji.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Dr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Dr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===fe.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(e)}async dial(e){const s=this.prepare();let i;try{i=na(this.options.timeout||2e4);const o=this.transport.connect(e,this.options);await Promise.race([o,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(o){s.reject(o)}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(o){throw i&&i.cancel(),await this.transport.close(o),o}}async _doDial(e){const{resolve:s}=this.options,i=await e.resolve({fn:Cd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const c of i)try{o=null,this.dispatchStatus({type:Ji.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(m){o=m}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():jx;let i=s;const o=this.selectServer();if(!o||this.abortReconnect)throw e||(this.lastError?this.lastError:ge.errorForCode(fe.ConnectionRefused));const c=Date.now();if(o.lastConnect===0||o.lastConnect+s<=c){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(m){if(e=m,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&o.reconnects>=p&&this.servers.removeCurrentServer()}}else i=Math.min(i,o.lastConnect+s-c),await ia(i)}}static async connect(e,s){const i=new yu(e,s);return await i.dialLoop(),i}static toError(e){const s=e?e.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new ge(e,fe.PermissionsViolation),o=e.match(/(Publish|Subscription) to "(\S+)"/);if(o){i.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const c=e.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new ge(e,fe.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ge(e,fe.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ge(e,fe.AccountExpired):s.indexOf("authentication timeout")!==-1?new ge(e,fe.AuthenticationTimeout):new ge(e,fe.ProtocolError)}processMsg(e,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(e.sid);i&&(i.received+=1,i.callback&&i.callback(null,new fm(e,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(e){const s=Vg(e),i=yu.toError(s),o={type:Dr.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){o.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(o),this.handleError(i)}handleError(e){e.isAuthError()?this.handleAuthError(e):e.isProtocolError()?this.lastError=e:e.isAuthTimeout()&&(this.lastError=e),e.isPermissionError()||(this.lastError=e)}handleAuthError(e){this.lastError&&e.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(_2)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const s=JSON.parse(Vg(e));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(ti(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:m}=this.transport;try{const p=new w2({version:c,lang:m},this.options,s.nonce);s.headers&&(p.headers=!0,p.no_responders=!0);const g=JSON.stringify(p);this.transport.send(vo(`CONNECT ${g}${ru}`)),this.transport.send(ub)}catch(p){this._close(p)}}i&&this.dispatchStatus({type:Dr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Dr.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case Qt.MSG:{const{msg:s,data:i}=e;this.processMsg(s,i);break}case Qt.OK:break;case Qt.ERR:this.processError(e.data);break;case Qt.PING:this.processPing();break;case Qt.PONG:this.processPong();break;case Qt.INFO:this.processInfo(e.data);break}}sendCommand(e,...s){const i=this.outbound.length();let o;typeof e=="string"?o=vo(e):o=e,this.outbound.fill(o,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,s=jn,i){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ri.encode(s);else throw ge.errorForCode(fe.BadPayload);let c=o.length;i=i||{},i.reply=i.reply||"";let m=jn,p=0;if(i.headers){if(this.info&&!this.info.headers)throw new ge("headers",fe.ServerOptionNotAvailable);m=i.headers.encode(),p=m.length,c=o.length+p}if(this.info&&c>this.info.max_payload)throw ge.errorForCode(fe.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${e} ${i.reply} ${p} ${c}\r
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||ge.errorForCode(fe.Cancelled))}}const BE="$JS.API";function UE(n){return n=n||{},n.domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),Ou({apiPrefix:BE,timeout:5e3},n)}class Ro{constructor(e,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=e,this.opts=UE(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Zn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let e=this.opts.apiPrefix;if(!e||e.length===0)throw new Error("invalid empty prefix");e[e.length-1]==="."&&(e=e.substr(0,e.length-1)),this.opts.apiPrefix=e}async _request(e,s=null,i){i=i||{},i.timeout=this.timeout;let o=jn;s&&(o=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const m=cm();for(let p=0;p<c;p++)try{const g=await this.nc.request(e,o,i);return this.parseJsResponse(g)}catch(g){const u=g;if((u.code==="503"||u.code===fe.Timeout)&&p+1<c)await ia(m.backoff(p));else throw g}}async findStream(e){const s={subject:e},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(e){const s=this.jc.decode(e.data),i=s;if(i.error){const o=_x(i.error.code,i.error.description);if(o!==null)throw o.api_error=i.error,o}return s}}class bo{constructor(e,s,i,o){j(this,"err");j(this,"offset");j(this,"pageInfo");j(this,"subject");j(this,"jsm");j(this,"filter");j(this,"payload");if(!e)throw new Error("subject is required");this.subject=e,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const e={offset:this.offset};this.payload&&Object.assign(e,this.payload);try{const s=await this.jsm._request(this.subject,e,{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(e){var s,i,o;switch(e==null?void 0:e.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=e.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=e.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e==null?void 0:e.type}`),((o=e.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let e=await this.next();for(;e.length>0;){for(const s of e)yield s;e=await this.next()}}}function ti(n=""){const e=n.match(/(\d+).(\d+).(\d+)/);if(e)return{major:parseInt(e[1]),minor:parseInt(e[2]),micro:parseInt(e[3])};throw new Error(`'${n}' is not a semver value`)}function Td(n,e){return n.major<e.major?-1:n.major>e.major?1:n.minor<e.minor?-1:n.minor>e.minor?1:n.micro<e.micro?-1:n.micro>e.micro?1:0}var Ye;(function(n){n.JS_KV="js_kv",n.JS_OBJECTSTORE="js_objectstore",n.JS_PULL_MAX_BYTES="js_pull_max_bytes",n.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",n.JS_ALLOW_DIRECT="js_allow_direct",n.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",n.JS_SIMPLIFICATION="js_simplification",n.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",n.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",n.JS_STREAM_FIRST_SEQ="js_stream_first_seq",n.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",n.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",n.JS_STREAM_COMPRESSION="js_stream_compression",n.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",n.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ye||(Ye={}));class zE{constructor(e){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e=="string"&&(e=ti(e)),this.server=e,this.set(Ye.JS_KV,"2.6.2"),this.set(Ye.JS_OBJECTSTORE,"2.6.3"),this.set(Ye.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ye.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ye.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ye.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ye.JS_SIMPLIFICATION,"2.9.4"),this.set(Ye.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ye.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ye.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ye.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ye.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ye.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(e,s){this.features.set(e,{min:s,ok:Td(this.server,ti(s))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){var s;return((s=this.get(e))==null?void 0:s.ok)||!1}require(e){return typeof e=="string"&&(e=ti(e)),Td(this.server,e)>=0}}class mu extends Ro{constructor(e,s){super(e,s)}async add(e,s,i=du.Create){if(Jt(e),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=e,o.action=i,o.config.durable_name&&Qi(o.config.durable_name);const c=this.nc;let{min:m,ok:p}=c.features.get(Ye.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!p)throw new Error(`consumer 'name' requires server ${m}`);if(g)try{Au("name",g)}catch(x){const v=x.message,_=v.indexOf("cannot contain");throw _!==-1?new Error(`consumer 'name' ${v.substring(_)}`):x}let u,d="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get(Ye.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);p=!1}if(s.metadata){const{min:x,ok:v}=c.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(p&&(d=s.name??s.durable_name??""),d!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),u=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${d}.${x}`:`${this.prefix}.CONSUMER.CREATE.${e}.${d}`}else u=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${e}`;return await this._request(u,o)}async update(e,s,i){const o=await this.info(e,s),c=i;return this.add(e,Object.assign(o.config,c),du.Update)}async info(e,s){return Jt(e),Qi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${s}`)}async delete(e,s){return Jt(e),Qi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${s}`)).success}list(e){Jt(e);const s=o=>o.consumers,i=`${this.prefix}.CONSUMER.LIST.${e}`;return new bo(i,s,this)}pause(e,s,i){const o=`${this.prefix}.CONSUMER.PAUSE.${e}.${s}`,c={pause_until:i.toISOString()};return this._request(o,c)}resume(e,s){return this.pause(e,s,new Date(0))}}function $i(n,e,s=!1){if(s===!0&&!n)throw ge.errorForCode(fe.ApiError,new Error(`${e} is not a function`));if(n&&typeof n!="function")throw ge.errorForCode(fe.ApiError,new Error(`${e} is not a function`))}class IE extends Ut{constructor(s,i,o){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");$i(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&$i(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&($i(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&($i(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&($i(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&$i(o.cleanupFn,"cleanupFn");let c=(d,b)=>{this.callback(d,b)};if(o.callback){const d=o.callback;c=(b,x)=>{const[v,_]=this.adapter(b,x);if(v){d(v,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(_,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(_))&&(d(v,_),this.dispatchedFn&&_&&this.dispatchedFn(_))}}const{max:m,queue:p,timeout:g}=o,u={queue:p,timeout:g,callback:c};m&&m>0&&(u.max=m),this.sub=s.subscribe(i,u),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=mt(),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[o,c]=this.adapter(s,i);o&&this.stop(o),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 On;function $E(n){On=n}function Ex(){return On!==void 0&&On.defaultPort!==void 0?On.defaultPort:4222}function td(){return On!==void 0&&On.urlParseFn?On.urlParseFn:void 0}function HE(){if(!On||typeof On.factory!="function")throw new Error("transport fn is not set");return On.factory()}function Cd(){return On!==void 0&&On.dnsResolveFn?On.dnsResolveFn:void 0}const ru=`\r
37
+ `,pu=sa.fromAscii(ru),FE=new Uint8Array(pu)[0],GE=new Uint8Array(pu)[1];function VE(n){for(let e=0;e<n.length;e++){const s=e+1;if(n.byteLength>s&&n[e]===FE&&n[s]===GE)return s+1}return 0}function YE(n){const e=VE(n);if(e>0){const i=new Uint8Array(n).slice(0,e);return En.decode(i)}return""}const KE=4,Ox=48,JE=65,QE=97;function XE(n,e,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((m,p)=>{o[p]=m}),o[12]=n,o[13]=e,o[14]=s,o[15]=i,o}function Md(n){return WE(n)!==void 0}function WE(n){for(let e=0;e<n.length;e++)switch(n[e]){case".":return Ax(n);case":":return ZE(n)}}function Ax(n){const e=new Uint8Array(4);for(let s=0;s<4;s++){if(n.length===0)return;if(s>0){if(n[0]!==".")return;n=n.substring(1)}const{n:i,c:o,ok:c}=e2(n);if(!c||i>255)return;n=n.substring(o),e[s]=i}return XE(e[0],e[1],e[2],e[3])}function ZE(n){const e=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return e;let i=0;for(;i<16;){const{n:o,c,ok:m}=t2(n);if(!m||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const p=Ax(n);if(p===void 0)return;e[i]=p[12],e[i+1]=p[13],e[i+2]=p[14],e[i+3]=p[15],n="",i+=KE;break}if(e[i]=o>>8,e[i+1]=o,i+=2,n=n.substring(c),n.length===0)break;if(n[0]!==":"||n.length==1)return;if(n=n.substring(1),n[0]===":"){if(s>=0)return;if(s=i,n=n.substring(1),n.length===0)break}}if(n.length===0){if(i<16){if(s<0)return;const o=16-i;for(let c=i-1;c>=s;c--)e[c+o]=e[c];for(let c=s+o-1;c>=s;c--)e[c]=0}else if(s>=0)return;return e}}function e2(n){let e=0,s=0;for(e=0;e<n.length&&48<=n.charCodeAt(e)&&n.charCodeAt(e)<=57;e++)if(s=s*10+(n.charCodeAt(e)-Ox),s>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:s,c:e,ok:!0}}function t2(n){let e=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)e*=16,e+=n.charCodeAt(s)-Ox;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)e*=16,e+=n.charCodeAt(s)-QE+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)e*=16,e+=n.charCodeAt(s)-JE+10;else break;if(e>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:e,c:s,ok:!0}}function n2(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function Rd(n){return!n2(n)}function r2(n){const e="::FFFF:",s=n.toUpperCase().indexOf(e);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+e.length);return i=i.replace("[",""),i.replace("]","")}return n}function s2(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=r2(n),Rd(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const e=Rd(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=e&&e.length===3&&e[1]&&e[2]?parseInt(e[2]):4222,i=s===80?"https":"http",o=new URL(`${i}://${n}`);o.port=`${s}`;let c=o.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:o.host,hostname:c,port:s}}class wo{constructor(e,s=!1){j(this,"src");j(this,"listen");j(this,"hostname");j(this,"port");j(this,"didConnect");j(this,"reconnects");j(this,"lastConnect");j(this,"gossiped");j(this,"tlsName");j(this,"resolves");this.src=e,this.tlsName="";const i=s2(e);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(e){if(!e.fn||e.resolve===!1)return[this];const s=[];if(Md(this.hostname))return[this];{const i=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",m=new URL(`${c}://${Rd(o)?"["+o+"]":o}`);m.port=`${this.port}`;const p=new wo(m.host,!1);p.tlsName=this.hostname,s.push(p)}}return e.randomize&&xx(s),this.resolves=s,s}}class i2{constructor(e=[],s={}){j(this,"firstSelect");j(this,"servers");j(this,"currentServer");j(this,"tlsName");j(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=td();e&&(e.forEach(o=>{o=i?i(o):o,this.servers.push(new wo(o))}),this.randomize&&(this.servers=xx(this.servers))),this.servers.length===0&&this.addServer(`${Sd}:${Ex()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Md(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,s=!1){const i=td();e=i?i(e):e;const o=new wo(e,s);Md(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const s=this.servers.indexOf(e);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(e,s){const i=[];let o=[];const c=td(),m=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(g=>{g=c?c(g,s):g;const u=new wo(g,!0);m.set(g,u)});const p=[];return this.servers.forEach((g,u)=>{const d=g.listen;g.gossiped&&this.currentServer.listen!==d&&m.get(d)===void 0&&p.push(u),m.delete(d)}),p.reverse(),p.forEach(g=>{const u=this.servers.splice(g,1);o=o.concat(u[0].listen)}),m.forEach((g,u)=>{this.servers.push(g),i.push(u)}),{added:i,deleted:o}}}class a2{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Lr(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const s=e.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,s){if(s&&s.permissionContext){if(e)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const o=this.all().find(c=>c.requestSubject===i.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(e,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(e===null&&s.headers&&(e=vx(s)),o.resolver(e,s))}}}close(){const e=ge.errorForCode(fe.Timeout);this.reqs.forEach(s=>{s.resolver(e,{})})}}class o2{constructor(e,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=e,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Ji.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=mt();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class l2 extends Error{constructor(e){super(e),this.name="AssertionError"}}function c2(n,e="Assertion failed."){if(!n)throw new l2(e)}const ab=32*1024,nd=2**32-2;function oc(n,e,s=0){const i=e.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),e.set(n,s),n.byteLength}class rd{constructor(e){j(this,"_buf");j(this,"_off");if(this._off=0,e==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.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(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const s=this._buf.byteLength;return e<=this.capacity-s?(this._reslice(s+e),s):-1}_reslice(e){c2(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const s=oc(this._buf.subarray(this._off),e);return this._off+=s,s}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(ri.encode(e))}write(e){const s=this._grow(e.byteLength);return oc(e,this._buf,s)}_grow(e){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(e);if(i>=0)return i;const o=this.capacity;if(e<=Math.floor(o/2)-s)oc(this._buf.subarray(this._off),this._buf);else{if(o+e>nd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+e,nd));oc(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+e,nd)),s}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const s=this._grow(e);this._reslice(s)}readFrom(e){let s=0;const i=new Uint8Array(ab);for(;;){const o=this.capacity-this.length<ab,c=o?i:new Uint8Array(this._buf.buffer,this.length),m=e.read(c);if(m===null)return s;o?this.write(c.subarray(0,m)):this._reslice(this.length+m),s+=m}}}var Qt;(function(n){n[n.OK=0]="OK",n[n.ERR=1]="ERR",n[n.MSG=2]="MSG",n[n.INFO=3]="INFO",n[n.PING=4]="PING",n[n.PONG=5]="PONG"})(Qt||(Qt={}));function ob(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const u2=48;class lb{constructor(e){j(this,"dispatcher");j(this,"state");j(this,"as");j(this,"drop");j(this,"hdr");j(this,"ma");j(this,"argBuf");j(this,"msgBuf");this.dispatcher=e,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let s;for(s=0;s<e.length;s++){const i=e[s];switch(this.state){case de.OP_START:switch(i){case me.M:case me.m:this.state=de.OP_M,this.hdr=-1,this.ma=ob();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=ob();break;case me.P:case me.p:this.state=de.OP_P;break;case me.PLUS:this.state=de.OP_PLUS;break;case me.MINUS:this.state=de.OP_MINUS;break;case me.I:case me.i:this.state=de.OP_I;break;default:throw this.fail(e.subarray(s))}break;case de.OP_H:switch(i){case me.M:case me.m:this.state=de.OP_M;break;default:throw this.fail(e.subarray(s))}break;case de.OP_M:switch(i){case me.S:case me.s:this.state=de.OP_MS;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MS:switch(i){case me.G:case me.g:this.state=de.OP_MSG;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MSG:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MSG_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MSG_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MSG_ARG,this.as=s}break;case de.MSG_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{const o=this.argBuf?this.argBuf.bytes():e.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=de.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case de.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Qt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const c=e.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(e.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Qt.MSG,msg:this.ma,data:e.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END);break;case de.MSG_END:switch(i){case me.NL:this.drop=0,this.as=s+1,this.state=de.OP_START;break;default:continue}break;case de.OP_PLUS:switch(i){case me.O:case me.o:this.state=de.OP_PLUS_O;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PLUS_O:switch(i){case me.K:case me.k:this.state=de.OP_PLUS_OK;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Qt.OK}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_MINUS:switch(i){case me.E:case me.e:this.state=de.OP_MINUS_E;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_E:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ER;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ER:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ERR:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ERR_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MINUS_ERR_ARG,this.as=s}break;case de.MINUS_ERR_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Qt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case de.OP_P:switch(i){case me.I:case me.i:this.state=de.OP_PI;break;case me.O:case me.o:this.state=de.OP_PO;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PO:switch(i){case me.N:case me.n:this.state=de.OP_PON;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PON:switch(i){case me.G:case me.g:this.state=de.OP_PONG;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Qt.PONG}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_PI:switch(i){case me.N:case me.n:this.state=de.OP_PIN;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PIN:switch(i){case me.G:case me.g:this.state=de.OP_PING;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Qt.PING}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_I:switch(i){case me.N:case me.n:this.state=de.OP_IN;break;default:throw this.fail(e.subarray(s))}break;case de.OP_IN:switch(i){case me.F:case me.f:this.state=de.OP_INF;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INF:switch(i){case me.O:case me.o:this.state=de.OP_INFO;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INFO:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_INFO_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INFO_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.INFO_ARG,this.as=s}break;case de.INFO_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Qt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(e.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new rd(e.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new rd(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(e+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,e),this.argBuf=new rd(i),this.ma.subject=i.subarray(0,e),this.ma.reply&&(this.ma.reply=i.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.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(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${En.decode(e)}`)}processHeaderMsgArgs(e){const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.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(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let s=0;for(let i=0;i<e.length;i++){if(e[i]<48||e[i]>57)return-1;s=s*10+(e[i]-u2)}return s}}var de;(function(n){n[n.OP_START=0]="OP_START",n[n.OP_PLUS=1]="OP_PLUS",n[n.OP_PLUS_O=2]="OP_PLUS_O",n[n.OP_PLUS_OK=3]="OP_PLUS_OK",n[n.OP_MINUS=4]="OP_MINUS",n[n.OP_MINUS_E=5]="OP_MINUS_E",n[n.OP_MINUS_ER=6]="OP_MINUS_ER",n[n.OP_MINUS_ERR=7]="OP_MINUS_ERR",n[n.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",n[n.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",n[n.OP_M=10]="OP_M",n[n.OP_MS=11]="OP_MS",n[n.OP_MSG=12]="OP_MSG",n[n.OP_MSG_SPC=13]="OP_MSG_SPC",n[n.MSG_ARG=14]="MSG_ARG",n[n.MSG_PAYLOAD=15]="MSG_PAYLOAD",n[n.MSG_END=16]="MSG_END",n[n.OP_H=17]="OP_H",n[n.OP_P=18]="OP_P",n[n.OP_PI=19]="OP_PI",n[n.OP_PIN=20]="OP_PIN",n[n.OP_PING=21]="OP_PING",n[n.OP_PO=22]="OP_PO",n[n.OP_PON=23]="OP_PON",n[n.OP_PONG=24]="OP_PONG",n[n.OP_I=25]="OP_I",n[n.OP_IN=26]="OP_IN",n[n.OP_INF=27]="OP_INF",n[n.OP_INFO=28]="OP_INFO",n[n.OP_INFO_SPC=29]="OP_INFO_SPC",n[n.INFO_ARG=30]="INFO_ARG"})(de||(de={}));var me;(function(n){n[n.CR=13]="CR",n[n.E=69]="E",n[n.e=101]="e",n[n.F=70]="F",n[n.f=102]="f",n[n.G=71]="G",n[n.g=103]="g",n[n.H=72]="H",n[n.h=104]="h",n[n.I=73]="I",n[n.i=105]="i",n[n.K=75]="K",n[n.k=107]="k",n[n.M=77]="M",n[n.m=109]="m",n[n.MINUS=45]="MINUS",n[n.N=78]="N",n[n.n=110]="n",n[n.NL=10]="NL",n[n.O=79]="O",n[n.o=111]="o",n[n.P=80]="P",n[n.p=112]="p",n[n.PLUS=43]="PLUS",n[n.R=82]="R",n[n.r=114]="r",n[n.S=83]="S",n[n.s=115]="s",n[n.SPACE=32]="SPACE",n[n.TAB=9]="TAB"})(me||(me={}));(function(n){var e=function(A,N){this.hi=A|0,this.lo=N|0},s=function(A){var N,k=new Float64Array(16);if(A)for(N=0;N<A.length;N++)k[N]=A[N];return k},i=function(){throw new Error("no PRNG")},o=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var m=s(),p=s([1]),g=s([56129,1]),u=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]),x=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(A,N){return A<<N|A>>>32-N}function S(A,N){var k=A[N+3]&255;return k=k<<8|A[N+2]&255,k=k<<8|A[N+1]&255,k<<8|A[N+0]&255}function C(A,N){var k=A[N]<<24|A[N+1]<<16|A[N+2]<<8|A[N+3],T=A[N+4]<<24|A[N+5]<<16|A[N+6]<<8|A[N+7];return new e(k,T)}function P(A,N,k){var T;for(T=0;T<4;T++)A[N+T]=k&255,k>>>=8}function q(A,N,k){A[N]=k.hi>>24&255,A[N+1]=k.hi>>16&255,A[N+2]=k.hi>>8&255,A[N+3]=k.hi&255,A[N+4]=k.lo>>24&255,A[N+5]=k.lo>>16&255,A[N+6]=k.lo>>8&255,A[N+7]=k.lo&255}function ne(A,N,k,T,L){var H,se=0;for(H=0;H<L;H++)se|=A[N+H]^k[T+H];return(1&se-1>>>8)-1}function te(A,N,k,T){return ne(A,N,k,T,16)}function M(A,N,k,T){return ne(A,N,k,T,32)}function U(A,N,k,T,L){var H=new Uint32Array(16),se=new Uint32Array(16),oe=new Uint32Array(16),K=new Uint32Array(4),re,xe,Pe;for(re=0;re<4;re++)se[5*re]=S(T,4*re),se[1+re]=S(k,4*re),se[6+re]=S(N,4*re),se[11+re]=S(k,16+4*re);for(re=0;re<16;re++)oe[re]=se[re];for(re=0;re<20;re++){for(xe=0;xe<4;xe++){for(Pe=0;Pe<4;Pe++)K[Pe]=se[(5*xe+4*Pe)%16];for(K[1]^=_(K[0]+K[3]|0,7),K[2]^=_(K[1]+K[0]|0,9),K[3]^=_(K[2]+K[1]|0,13),K[0]^=_(K[3]+K[2]|0,18),Pe=0;Pe<4;Pe++)H[4*xe+(xe+Pe)%4]=K[Pe]}for(Pe=0;Pe<16;Pe++)se[Pe]=H[Pe]}if(L){for(re=0;re<16;re++)se[re]=se[re]+oe[re]|0;for(re=0;re<4;re++)se[5*re]=se[5*re]-S(T,4*re)|0,se[6+re]=se[6+re]-S(N,4*re)|0;for(re=0;re<4;re++)P(A,4*re,se[5*re]),P(A,16+4*re,se[6+re])}else for(re=0;re<16;re++)P(A,4*re,se[re]+oe[re]|0)}function ae(A,N,k,T){return U(A,N,k,T,!1),0}function z(A,N,k,T){return U(A,N,k,T,!0),0}var I=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(A,N,k,T,L,H,se){var oe=new Uint8Array(16),K=new Uint8Array(64),re,xe;if(!L)return 0;for(xe=0;xe<16;xe++)oe[xe]=0;for(xe=0;xe<8;xe++)oe[xe]=H[xe];for(;L>=64;){for(ae(K,oe,se,I),xe=0;xe<64;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];for(re=1,xe=8;xe<16;xe++)re=re+(oe[xe]&255)|0,oe[xe]=re&255,re>>>=8;L-=64,N+=64,k&&(T+=64)}if(L>0)for(ae(K,oe,se,I),xe=0;xe<L;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];return 0}function X(A,N,k,T,L){return D(A,N,null,0,k,T,L)}function W(A,N,k,T,L){var H=new Uint8Array(32);return z(H,T,L,I),X(A,N,k,T.subarray(16),H)}function he(A,N,k,T,L,H,se){var oe=new Uint8Array(32);return z(oe,H,se,I),D(A,N,k,T,L,H.subarray(16),oe)}function we(A,N){var k,T=0;for(k=0;k<17;k++)T=T+(A[k]+N[k]|0)|0,A[k]=T&255,T>>>=8}var Oe=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function F(A,N,k,T,L,H){var se,oe,K,re,xe=new Uint32Array(17),Pe=new Uint32Array(17),lt=new Uint32Array(17),Gt=new Uint32Array(17),Gn=new Uint32Array(17);for(K=0;K<17;K++)Pe[K]=lt[K]=0;for(K=0;K<16;K++)Pe[K]=H[K];for(Pe[3]&=15,Pe[4]&=252,Pe[7]&=15,Pe[8]&=252,Pe[11]&=15,Pe[12]&=252,Pe[15]&=15;L>0;){for(K=0;K<17;K++)Gt[K]=0;for(K=0;K<16&&K<L;++K)Gt[K]=k[T+K];for(Gt[K]=1,T+=K,L-=K,we(lt,Gt),oe=0;oe<17;oe++)for(xe[oe]=0,K=0;K<17;K++)xe[oe]=xe[oe]+lt[K]*(K<=oe?Pe[oe-K]:320*Pe[oe+17-K]|0)|0|0;for(oe=0;oe<17;oe++)lt[oe]=xe[oe];for(re=0,K=0;K<16;K++)re=re+lt[K]|0,lt[K]=re&255,re>>>=8;for(re=re+lt[16]|0,lt[16]=re&3,re=5*(re>>>2)|0,K=0;K<16;K++)re=re+lt[K]|0,lt[K]=re&255,re>>>=8;re=re+lt[16]|0,lt[16]=re}for(K=0;K<17;K++)Gn[K]=lt[K];for(we(lt,Oe),se=-(lt[16]>>>7)|0,K=0;K<17;K++)lt[K]^=se&(Gn[K]^lt[K]);for(K=0;K<16;K++)Gt[K]=H[K+16];for(Gt[16]=0,we(lt,Gt),K=0;K<16;K++)A[N+K]=lt[K];return 0}function J(A,N,k,T,L,H){var se=new Uint8Array(16);return F(se,0,k,T,L,H),te(A,N,se,0)}function le(A,N,k,T,L){var H;if(k<32)return-1;for(he(A,0,N,0,k,T,L),F(A,16,A,32,k-32,A),H=0;H<16;H++)A[H]=0;return 0}function pe(A,N,k,T,L){var H,se=new Uint8Array(32);if(k<32||(W(se,0,32,T,L),J(N,16,N,32,k-32,se)!==0))return-1;for(he(A,0,N,0,k,T,L),H=0;H<32;H++)A[H]=0;return 0}function ye(A,N){var k;for(k=0;k<16;k++)A[k]=N[k]|0}function Ce(A){var N,k;for(k=0;k<16;k++)A[k]+=65536,N=Math.floor(A[k]/65536),A[(k+1)*(k<15?1:0)]+=N-1+37*(N-1)*(k===15?1:0),A[k]-=N*65536}function Ne(A,N,k){for(var T,L=~(k-1),H=0;H<16;H++)T=L&(A[H]^N[H]),A[H]^=T,N[H]^=T}function Me(A,N){var k,T,L,H=s(),se=s();for(k=0;k<16;k++)se[k]=N[k];for(Ce(se),Ce(se),Ce(se),T=0;T<2;T++){for(H[0]=se[0]-65517,k=1;k<15;k++)H[k]=se[k]-65535-(H[k-1]>>16&1),H[k-1]&=65535;H[15]=se[15]-32767-(H[14]>>16&1),L=H[15]>>16&1,H[14]&=65535,Ne(se,H,1-L)}for(k=0;k<16;k++)A[2*k]=se[k]&255,A[2*k+1]=se[k]>>8}function We(A,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Me(k,A),Me(T,N),M(k,0,T,0)}function pt(A){var N=new Uint8Array(32);return Me(N,A),N[0]&1}function Ct(A,N){var k;for(k=0;k<16;k++)A[k]=N[2*k]+(N[2*k+1]<<8);A[15]&=32767}function Se(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]+k[T]|0}function Re(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]-k[T]|0}function ce(A,N,k){var T,L,H=new Float64Array(31);for(T=0;T<31;T++)H[T]=0;for(T=0;T<16;T++)for(L=0;L<16;L++)H[T+L]+=N[T]*k[L];for(T=0;T<15;T++)H[T]+=38*H[T+16];for(T=0;T<16;T++)A[T]=H[T];Ce(A),Ce(A)}function Ue(A,N){ce(A,N,N)}function Xe(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)Ue(k,k),T!==2&&T!==4&&ce(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function cn(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)Ue(k,k),T!==1&&ce(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function Mt(A,N,k){var T=new Uint8Array(32),L=new Float64Array(80),H,se,oe=s(),K=s(),re=s(),xe=s(),Pe=s(),lt=s();for(se=0;se<31;se++)T[se]=N[se];for(T[31]=N[31]&127|64,T[0]&=248,Ct(L,k),se=0;se<16;se++)K[se]=L[se],xe[se]=oe[se]=re[se]=0;for(oe[0]=xe[0]=1,se=254;se>=0;--se)H=T[se>>>3]>>>(se&7)&1,Ne(oe,K,H),Ne(re,xe,H),Se(Pe,oe,re),Re(oe,oe,re),Se(re,K,xe),Re(K,K,xe),Ue(xe,Pe),Ue(lt,oe),ce(oe,re,oe),ce(re,K,Pe),Se(Pe,oe,re),Re(oe,oe,re),Ue(K,oe),Re(re,xe,lt),ce(oe,re,g),Se(oe,oe,xe),ce(re,re,oe),ce(oe,xe,lt),ce(xe,K,L),Ue(K,Pe),Ne(oe,K,H),Ne(re,xe,H);for(se=0;se<16;se++)L[se+16]=oe[se],L[se+32]=re[se],L[se+48]=K[se],L[se+64]=xe[se];var Gt=L.subarray(32),Gn=L.subarray(16);return Xe(Gt,Gt),ce(Gn,Gn,Gt),Me(A,Gn),0}function be(A,N){return Mt(A,N,c)}function it(A,N){return i(N,32),be(A,N)}function yt(A,N,k){var T=new Uint8Array(32);return Mt(T,k,N),z(A,o,T,I)}var Ot=le,Ur=pe;function la(A,N,k,T,L,H){var se=new Uint8Array(32);return yt(se,L,H),Ot(A,N,k,T,se)}function ca(A,N,k,T,L,H){var se=new Uint8Array(32);return yt(se,L,H),Ur(A,N,k,T,se)}function hr(){var A=0,N=0,k=0,T=0,L=65535,H,se,oe;for(oe=0;oe<arguments.length;oe++)H=arguments[oe].lo,se=arguments[oe].hi,A+=H&L,N+=H>>>16,k+=se&L,T+=se>>>16;return N+=A>>>16,k+=N>>>16,T+=k>>>16,new e(k&L|T<<16,A&L|N<<16)}function zo(A,N){return new e(A.hi>>>N,A.lo>>>N|A.hi<<32-N)}function si(){var A=0,N=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,N^=arguments[k].hi;return new e(N,A)}function ft(A,N){var k,T,L=32-N;return N<32?(k=A.hi>>>N|A.lo<<L,T=A.lo>>>N|A.hi<<L):N<64&&(k=A.lo>>>N|A.hi<<L,T=A.hi>>>N|A.lo<<L),new e(k,T)}function Bu(A,N,k){var T=A.hi&N.hi^~A.hi&k.hi,L=A.lo&N.lo^~A.lo&k.lo;return new e(T,L)}function Io(A,N,k){var T=A.hi&N.hi^A.hi&k.hi^N.hi&k.hi,L=A.lo&N.lo^A.lo&k.lo^N.lo&k.lo;return new e(T,L)}function $o(A){return si(ft(A,28),ft(A,34),ft(A,39))}function ii(A){return si(ft(A,14),ft(A,18),ft(A,41))}function Uu(A){return si(ft(A,1),ft(A,8),zo(A,7))}function Ho(A){return si(ft(A,19),ft(A,61),zo(A,6))}var zu=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function Fo(A,N,k){var T=[],L=[],H=[],se=[],oe,K,re;for(K=0;K<8;K++)T[K]=H[K]=C(A,8*K);for(var xe=0;k>=128;){for(K=0;K<16;K++)se[K]=C(N,8*K+xe);for(K=0;K<80;K++){for(re=0;re<8;re++)L[re]=H[re];for(oe=hr(H[7],ii(H[4]),Bu(H[4],H[5],H[6]),zu[K],se[K%16]),L[7]=hr(oe,$o(H[0]),Io(H[0],H[1],H[2])),L[3]=hr(L[3],oe),re=0;re<8;re++)H[(re+1)%8]=L[re];if(K%16===15)for(re=0;re<16;re++)se[re]=hr(se[re],se[(re+9)%16],Uu(se[(re+1)%16]),Ho(se[(re+14)%16]))}for(K=0;K<8;K++)H[K]=hr(H[K],T[K]),T[K]=H[K];xe+=128,k-=128}for(K=0;K<8;K++)q(A,8*K,T[K]);return k}var ks=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 _t(A,N,k){var T=new Uint8Array(64),L=new Uint8Array(256),H,se=k;for(H=0;H<64;H++)T[H]=ks[H];for(Fo(T,N,k),k%=128,H=0;H<256;H++)L[H]=0;for(H=0;H<k;H++)L[H]=N[se-k+H];for(L[k]=128,k=256-128*(k<112?1:0),L[k-9]=0,q(L,k-8,new e(se/536870912|0,se<<3)),Fo(T,L,k),H=0;H<64;H++)A[H]=T[H];return 0}function un(A,N){var k=s(),T=s(),L=s(),H=s(),se=s(),oe=s(),K=s(),re=s(),xe=s();Re(k,A[1],A[0]),Re(xe,N[1],N[0]),ce(k,k,xe),Se(T,A[0],A[1]),Se(xe,N[0],N[1]),ce(T,T,xe),ce(L,A[3],N[3]),ce(L,L,d),ce(H,A[2],N[2]),Se(H,H,H),Re(se,T,k),Re(oe,H,L),Se(K,H,L),Se(re,T,k),ce(A[0],se,oe),ce(A[1],re,K),ce(A[2],K,oe),ce(A[3],se,re)}function Ft(A,N,k){var T;for(T=0;T<4;T++)Ne(A[T],N[T],k)}function ua(A,N){var k=s(),T=s(),L=s();Xe(L,N[2]),ce(k,N[0],L),ce(T,N[1],L),Me(A,T),A[31]^=pt(k)<<7}function fa(A,N,k){var T,L;for(ye(A[0],m),ye(A[1],p),ye(A[2],p),ye(A[3],m),L=255;L>=0;--L)T=k[L/8|0]>>(L&7)&1,Ft(A,N,T),un(N,A),un(A,A),Ft(A,N,T)}function ai(A,N){var k=[s(),s(),s(),s()];ye(k[0],b),ye(k[1],x),ye(k[2],p),ce(k[3],b,x),fa(A,k,N)}function zr(A,N,k){var T=new Uint8Array(64),L=[s(),s(),s(),s()],H;for(k||i(N,32),_t(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,ai(L,T),ua(A,L),H=0;H<32;H++)N[H+32]=A[H];return 0}var dr=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 Ir(A,N){var k,T,L,H;for(T=63;T>=32;--T){for(k=0,L=T-32,H=T-12;L<H;++L)N[L]+=k-16*N[T]*dr[L-(T-32)],k=Math.floor((N[L]+128)/256),N[L]-=k*256;N[L]+=k,N[T]=0}for(k=0,L=0;L<32;L++)N[L]+=k-(N[31]>>4)*dr[L],k=N[L]>>8,N[L]&=255;for(L=0;L<32;L++)N[L]-=k*dr[L];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,A[T]=N[T]&255}function Hn(A){var N=new Float64Array(64),k;for(k=0;k<64;k++)N[k]=A[k];for(k=0;k<64;k++)A[k]=0;Ir(A,N)}function Ns(A,N,k,T){var L=new Uint8Array(64),H=new Uint8Array(64),se=new Uint8Array(64),oe,K,re=new Float64Array(64),xe=[s(),s(),s(),s()];_t(L,T,32),L[0]&=248,L[31]&=127,L[31]|=64;var Pe=k+64;for(oe=0;oe<k;oe++)A[64+oe]=N[oe];for(oe=0;oe<32;oe++)A[32+oe]=L[32+oe];for(_t(se,A.subarray(32),k+32),Hn(se),ai(xe,se),ua(A,xe),oe=32;oe<64;oe++)A[oe]=T[oe];for(_t(H,A,k+64),Hn(H),oe=0;oe<64;oe++)re[oe]=0;for(oe=0;oe<32;oe++)re[oe]=se[oe];for(oe=0;oe<32;oe++)for(K=0;K<32;K++)re[oe+K]+=H[oe]*L[K];return Ir(A.subarray(32),re),Pe}function Ts(A,N){var k=s(),T=s(),L=s(),H=s(),se=s(),oe=s(),K=s();return ye(A[2],p),Ct(A[1],N),Ue(L,A[1]),ce(H,L,u),Re(L,L,A[2]),Se(H,A[2],H),Ue(se,H),Ue(oe,se),ce(K,oe,se),ce(k,K,L),ce(k,k,H),cn(k,k),ce(k,k,L),ce(k,k,H),ce(k,k,H),ce(A[0],k,H),Ue(T,A[0]),ce(T,T,H),We(T,L)&&ce(A[0],A[0],v),Ue(T,A[0]),ce(T,T,H),We(T,L)?-1:(pt(A[0])===N[31]>>7&&Re(A[0],m,A[0]),ce(A[3],A[0],A[1]),0)}function ha(A,N,k,T){var L,H=new Uint8Array(32),se=new Uint8Array(64),oe=[s(),s(),s(),s()],K=[s(),s(),s(),s()];if(k<64||Ts(K,T))return-1;for(L=0;L<k;L++)A[L]=N[L];for(L=0;L<32;L++)A[L+32]=T[L];if(_t(se,A,k),Hn(se),fa(oe,K,se),ai(K,N.subarray(32)),un(oe,K),ua(H,oe),k-=64,M(N,0,H,0)){for(L=0;L<k;L++)A[L]=0;return-1}for(L=0;L<k;L++)A[L]=N[L+64];return k}var oi=32,$r=24,Fn=32,Hr=16,Fr=32,Cs=32,Gr=32,mr=32,Ms=32,da=$r,Go=Fn,tr=Hr,at=64,gt=32,fn=64,Rs=32,ma=64;n.lowlevel={crypto_core_hsalsa20:z,crypto_stream_xor:he,crypto_stream:W,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:X,crypto_onetimeauth:F,crypto_onetimeauth_verify:J,crypto_verify_16:te,crypto_verify_32:M,crypto_secretbox:le,crypto_secretbox_open:pe,crypto_scalarmult:Mt,crypto_scalarmult_base:be,crypto_box_beforenm:yt,crypto_box_afternm:Ot,crypto_box:la,crypto_box_open:ca,crypto_box_keypair:it,crypto_hash:_t,crypto_sign:Ns,crypto_sign_keypair:zr,crypto_sign_open:ha,crypto_secretbox_KEYBYTES:oi,crypto_secretbox_NONCEBYTES:$r,crypto_secretbox_ZEROBYTES:Fn,crypto_secretbox_BOXZEROBYTES:Hr,crypto_scalarmult_BYTES:Fr,crypto_scalarmult_SCALARBYTES:Cs,crypto_box_PUBLICKEYBYTES:Gr,crypto_box_SECRETKEYBYTES:mr,crypto_box_BEFORENMBYTES:Ms,crypto_box_NONCEBYTES:da,crypto_box_ZEROBYTES:Go,crypto_box_BOXZEROBYTES:tr,crypto_sign_BYTES:at,crypto_sign_PUBLICKEYBYTES:gt,crypto_sign_SECRETKEYBYTES:fn,crypto_sign_SEEDBYTES:Rs,crypto_hash_BYTES:ma,gf:s,D:u,L:dr,pack25519:Me,unpack25519:Ct,M:ce,A:Se,S:Ue,Z:Re,pow2523:cn,add:un,set25519:ye,modL:Ir,scalarmult:fa,scalarbase:ai};function Vo(A,N){if(A.length!==oi)throw new Error("bad key size");if(N.length!==$r)throw new Error("bad nonce size")}function Yo(A,N){if(A.length!==Gr)throw new Error("bad public key size");if(N.length!==mr)throw new Error("bad secret key size")}function Rt(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function li(A){for(var N=0;N<A.length;N++)A[N]=0}n.randomBytes=function(A){var N=new Uint8Array(A);return i(N,A),N},n.secretbox=function(A,N,k){Rt(A,N,k),Vo(k,N);for(var T=new Uint8Array(Fn+A.length),L=new Uint8Array(T.length),H=0;H<A.length;H++)T[H+Fn]=A[H];return le(L,T,T.length,N,k),L.subarray(Hr)},n.secretbox.open=function(A,N,k){Rt(A,N,k),Vo(k,N);for(var T=new Uint8Array(Hr+A.length),L=new Uint8Array(T.length),H=0;H<A.length;H++)T[H+Hr]=A[H];return T.length<32||pe(L,T,T.length,N,k)!==0?null:L.subarray(Fn)},n.secretbox.keyLength=oi,n.secretbox.nonceLength=$r,n.secretbox.overheadLength=Hr,n.scalarMult=function(A,N){if(Rt(A,N),A.length!==Cs)throw new Error("bad n size");if(N.length!==Fr)throw new Error("bad p size");var k=new Uint8Array(Fr);return Mt(k,A,N),k},n.scalarMult.base=function(A){if(Rt(A),A.length!==Cs)throw new Error("bad n size");var N=new Uint8Array(Fr);return be(N,A),N},n.scalarMult.scalarLength=Cs,n.scalarMult.groupElementLength=Fr,n.box=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox(A,N,L)},n.box.before=function(A,N){Rt(A,N),Yo(A,N);var k=new Uint8Array(Ms);return yt(k,A,N),k},n.box.after=n.secretbox,n.box.open=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox.open(A,N,L)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Gr),N=new Uint8Array(mr);return it(A,N),{publicKey:A,secretKey:N}},n.box.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==mr)throw new Error("bad secret key size");var N=new Uint8Array(Gr);return be(N,A),{publicKey:N,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Gr,n.box.secretKeyLength=mr,n.box.sharedKeyLength=Ms,n.box.nonceLength=da,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,N){if(Rt(A,N),N.length!==fn)throw new Error("bad secret key size");var k=new Uint8Array(at+A.length);return Ns(k,A,A.length,N),k},n.sign.open=function(A,N){if(Rt(A,N),N.length!==gt)throw new Error("bad public key size");var k=new Uint8Array(A.length),T=ha(k,A,A.length,N);if(T<0)return null;for(var L=new Uint8Array(T),H=0;H<L.length;H++)L[H]=k[H];return L},n.sign.detached=function(A,N){for(var k=n.sign(A,N),T=new Uint8Array(at),L=0;L<T.length;L++)T[L]=k[L];return T},n.sign.detached.verify=function(A,N,k){if(Rt(A,N,k),N.length!==at)throw new Error("bad signature size");if(k.length!==gt)throw new Error("bad public key size");var T=new Uint8Array(at+A.length),L=new Uint8Array(at+A.length),H;for(H=0;H<at;H++)T[H]=N[H];for(H=0;H<A.length;H++)T[H+at]=A[H];return ha(L,T,T.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(gt),N=new Uint8Array(fn);return zr(A,N),{publicKey:A,secretKey:N}},n.sign.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==fn)throw new Error("bad secret key size");for(var N=new Uint8Array(gt),k=0;k<N.length;k++)N[k]=A[32+k];return{publicKey:N,secretKey:new Uint8Array(A)}},n.sign.keyPair.fromSeed=function(A){if(Rt(A),A.length!==Rs)throw new Error("bad seed size");for(var N=new Uint8Array(gt),k=new Uint8Array(fn),T=0;T<32;T++)k[T]=A[T];return zr(N,k,!0),{publicKey:N,secretKey:k}},n.sign.publicKeyLength=gt,n.sign.secretKeyLength=fn,n.sign.seedLength=Rs,n.sign.signatureLength=at,n.hash=function(A){Rt(A);var N=new Uint8Array(ma);return _t(N,A,A.length),N},n.hash.hashLength=ma,n.verify=function(A,N){return Rt(A,N),A.length===0||N.length===0||A.length!==N.length?!1:ne(A,0,N,0,A.length)===0},n.setPRNG=function(A){i=A},(function(){var A=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(A&&A.getRandomValues){var N=65536;n.setPRNG(function(k,T){var L,H=new Uint8Array(T);for(L=0;L<T;L+=N)A.getRandomValues(H.subarray(L,L+Math.min(T-L,N)));for(L=0;L<T;L++)k[L]=H[L];li(H)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,T){var L,H=A.randomBytes(T);for(L=0;L<T;L++)k[L]=H[L];li(H)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const lc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;lc.sign.keyPair.fromSeed,lc.sign.detached,lc.sign.detached.verify,lc.randomBytes;var cb;(function(n){n.InvalidPrefixByte="nkeys: invalid prefix byte",n.InvalidKey="nkeys: invalid key",n.InvalidPublicKey="nkeys: invalid public key",n.InvalidSeedLen="nkeys: invalid seed length",n.InvalidSeed="nkeys: invalid seed",n.InvalidEncoding="nkeys: invalid encoded key",n.InvalidSignature="nkeys: signature verification failed",n.CannotSign="nkeys: cannot sign, no private key available",n.PublicKeyOnly="nkeys: no seed or private key available",n.InvalidChecksum="nkeys: invalid checksum",n.SerializationError="nkeys: serialization error",n.ApiError="nkeys: api error",n.ClearedPair="nkeys: pair is cleared"})(cb||(cb={}));var ub;(function(n){n[n.Seed=144]="Seed",n[n.Private=120]="Private",n[n.Operator=112]="Operator",n[n.Server=104]="Server",n[n.Cluster=16]="Cluster",n[n.Account=0]="Account",n[n.User=160]="User"})(ub||(ub={}));function f2(n){return e=>{let s={};return n.forEach(i=>{const o=i(e)||{};s=Object.assign(s,o)}),s}}function h2(){return()=>{}}function d2(n,e){return()=>{const s=typeof n=="function"?n():n,i=typeof e=="function"?e():e;return{user:s,pass:i}}}function m2(n){return()=>({auth_token:typeof n=="function"?n():n})}const jx=120*1e3,p2=2,kx=2*1e3;function y2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:jx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:kx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function g2(n){const e=[];return typeof n.authenticator=="function"&&e.push(n.authenticator),Array.isArray(n.authenticator)&&e.push(...n.authenticator),n.token&&e.push(m2(n.token)),n.user&&e.push(d2(n.user,n.pass)),e.length===0?h2():f2(e)}function b2(n){const e=`${Sd}:${Ex()}`;if(n=n||{servers:[e]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new ge("port and servers options are mutually exclusive",fe.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${Sd}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[e]);const s=Ou(y2(),n);if(s.authenticator=g2(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new ge(`${i} option should be a function`,fe.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{Lr(s.inboxPrefix)}catch(i){throw new ge(i.message,fe.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Cd()=="function"),s.resolve&&typeof Cd()!="function")throw new ge("'resolve' is not supported on this client",fe.InvalidOption);return s}function x2(n,e){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&e.noEcho)throw new ge("noEcho",fe.ServerOptionNotAvailable);const c=i||o||!1;if(e.tls&&!c)throw new ge("tls",fe.ServerOptionNotAvailable)}const v2=1024*32,_2=/^INFO\s+([^\r\n]+)\r\n/i,w2=vo(`PONG\r
38
+ `),fb=vo(`PING\r
39
+ `);class S2{constructor(e,s,i){j(this,"echo");j(this,"no_responders");j(this,"protocol");j(this,"verbose");j(this,"pedantic");j(this,"jwt");j(this,"nkey");j(this,"sig");j(this,"user");j(this,"pass");j(this,"auth_token");j(this,"tls_required");j(this,"name");j(this,"lang");j(this,"version");j(this,"headers");this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};Ou(this,o)}}class Nx extends Ut{constructor(s,i,o={}){var m;super();j(this,"sid");j(this,"queue");j(this,"draining");j(this,"max");j(this,"subject");j(this,"drained");j(this,"protocol");j(this,"timer");j(this,"info");j(this,"cleanupFn");j(this,"closed");j(this,"requestSubject");Ou(this,o),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=mt();const c=!((m=s.options)!=null&&m.noAsyncTraces);o.timeout&&(this.timer=na(o.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(p=>{this.stop(p),this.noIterator&&this.callback(p,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,m=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(p,g)=>{const{ingest:u}=o(g);u&&c(g)&&(i(p,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(ge.errorForCode(fe.ConnectionClosed)):this.isClosed()?Promise.reject(ge.errorForCode(fe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(mt()).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 E2{constructor(){j(this,"mux");j(this,"subs");j(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){if(e&&e.permissionContext){const s=e.permissionContext,i=this.all();let o;if(s.operation==="subscription"&&(o=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(o=i.find(c=>c.requestSubject===s.subject)),o)return o.callback(e,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(e=>{e.close()})}}class yu{constructor(e,s){j(this,"connected");j(this,"connectedOnce");j(this,"infoReceived");j(this,"info");j(this,"muxSubscriptions");j(this,"options");j(this,"outbound");j(this,"pongs");j(this,"subscriptions");j(this,"transport");j(this,"noMorePublishing");j(this,"connectError");j(this,"publisher");j(this,"_closed");j(this,"closed");j(this,"listeners");j(this,"heartbeats");j(this,"parser");j(this,"outMsgs");j(this,"inMsgs");j(this,"outBytes");j(this,"inBytes");j(this,"pendingLimit");j(this,"lastError");j(this,"abortReconnect");j(this,"whyClosed");j(this,"servers");j(this,"server");j(this,"features");j(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=v2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=s,this.subscriptions=new E2,this.muxSubscriptions=new a2,this.outbound=new sa,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new zE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new i2(i,{randomize:!e.noRandomize}),this.closed=mt(),this.parser=new lb(this),this.heartbeats=new o2(this,this.options.pingInterval||jx,this.options.maxPingOut||p2)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const s=ge.errorForCode(fe.Disconnect);s.stack="",e.forEach(i=>{i.reject(s)}),this.parser=new lb(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(s=>{s.push(e)})}status(){const e=new Ut;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=mt();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=s=>{e.reject(s)},this.transport=HE(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:Ji.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Ji.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Dr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Dr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===fe.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(e)}async dial(e){const s=this.prepare();let i;try{i=na(this.options.timeout||2e4);const o=this.transport.connect(e,this.options);await Promise.race([o,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(o){s.reject(o)}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(o){throw i&&i.cancel(),await this.transport.close(o),o}}async _doDial(e){const{resolve:s}=this.options,i=await e.resolve({fn:Cd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const c of i)try{o=null,this.dispatchStatus({type:Ji.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(m){o=m}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():kx;let i=s;const o=this.selectServer();if(!o||this.abortReconnect)throw e||(this.lastError?this.lastError:ge.errorForCode(fe.ConnectionRefused));const c=Date.now();if(o.lastConnect===0||o.lastConnect+s<=c){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(m){if(e=m,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&o.reconnects>=p&&this.servers.removeCurrentServer()}}else i=Math.min(i,o.lastConnect+s-c),await ia(i)}}static async connect(e,s){const i=new yu(e,s);return await i.dialLoop(),i}static toError(e){const s=e?e.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new ge(e,fe.PermissionsViolation),o=e.match(/(Publish|Subscription) to "(\S+)"/);if(o){i.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const c=e.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new ge(e,fe.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ge(e,fe.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ge(e,fe.AccountExpired):s.indexOf("authentication timeout")!==-1?new ge(e,fe.AuthenticationTimeout):new ge(e,fe.ProtocolError)}processMsg(e,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(e.sid);i&&(i.received+=1,i.callback&&i.callback(null,new fm(e,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(e){const s=Yg(e),i=yu.toError(s),o={type:Dr.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){o.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(o),this.handleError(i)}handleError(e){e.isAuthError()?this.handleAuthError(e):e.isProtocolError()?this.lastError=e:e.isAuthTimeout()&&(this.lastError=e),e.isPermissionError()||(this.lastError=e)}handleAuthError(e){this.lastError&&e.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(w2)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const s=JSON.parse(Yg(e));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(ti(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:m}=this.transport;try{const p=new S2({version:c,lang:m},this.options,s.nonce);s.headers&&(p.headers=!0,p.no_responders=!0);const g=JSON.stringify(p);this.transport.send(vo(`CONNECT ${g}${ru}`)),this.transport.send(fb)}catch(p){this._close(p)}}i&&this.dispatchStatus({type:Dr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Dr.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case Qt.MSG:{const{msg:s,data:i}=e;this.processMsg(s,i);break}case Qt.OK:break;case Qt.ERR:this.processError(e.data);break;case Qt.PING:this.processPing();break;case Qt.PONG:this.processPong();break;case Qt.INFO:this.processInfo(e.data);break}}sendCommand(e,...s){const i=this.outbound.length();let o;typeof e=="string"?o=vo(e):o=e,this.outbound.fill(o,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,s=jn,i){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ri.encode(s);else throw ge.errorForCode(fe.BadPayload);let c=o.length;i=i||{},i.reply=i.reply||"";let m=jn,p=0;if(i.headers){if(this.info&&!this.info.headers)throw new ge("headers",fe.ServerOptionNotAvailable);m=i.headers.encode(),p=m.length,c=o.length+p}if(this.info&&c>this.info.max_payload)throw ge.errorForCode(fe.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${e} ${i.reply} ${p} ${c}\r
40
40
  `:g=`HPUB ${e} ${p} ${c}\r
41
41
  `,this.sendCommand(g,m,o,pu)):(i.reply?g=`PUB ${e} ${i.reply} ${c}\r
42
42
  `:g=`PUB ${e} ${c}\r
@@ -44,24 +44,24 @@ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cance
44
44
  `):this.sendCommand(`SUB ${e.subject} ${e.sid}\r
45
45
  `)}_subunsub(e){return this._sub(e),e.max&&this.unsubscribe(e,e.max),e}unsubscribe(e,s){this.unsub(e,s),(e.max===void 0||e.received>=e.max)&&this.subscriptions.cancel(e)}unsub(e,s){!e||this.isClosed()||(s?this.sendCommand(`UNSUB ${e.sid} ${s}\r
46
46
  `):this.sendCommand(`UNSUB ${e.sid}\r
47
- `),e.max=s)}resub(e,s){!e||this.isClosed()||(this.unsub(e),e.subject=s,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||(e=mt()),this.pongs.push(e),this.outbound.fill(ub),this.flushPending(),e}sendSubscriptions(){const e=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?e.push(`SUB ${i.subject} ${i.queue} ${i.sid}${ru}`):e.push(`SUB ${i.subject} ${i.sid}${ru}`)}),e.length&&this.transport.send(vo(e.join("")))}async _close(e){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(e),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(e),await this.closed.resolve(e))}close(){return this._close()}isClosed(){return this._closed}drain(){const e=this.subscriptions.all(),s=[];return e.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 e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new kx(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}const E2="$SRV";class fb{constructor(e){j(this,"msg");this.msg=e}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(e,s){return this.msg.respond(e,s)}respondError(e,s,i,o){var c,m;return o=o||{},o.headers=o.headers||Pr(),(c=o.headers)==null||c.set(fu,`${e}`),(m=o.headers)==null||m.set(uu,s),this.msg.respond(i,o)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class Ao{constructor(e,s="",i=""){j(this,"subject");j(this,"queue");j(this,"srv");s!==""&&A2("service group",s);let o="";if(e instanceof Do)this.srv=e,o="";else if(e instanceof Ao){const c=e;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),o=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=i}calcSubject(e,s=""){return s===""?e:e!==""?`${e}.${s}`:s}addEndpoint(e="",s){s=s||{subject:e};const i=typeof s=="function"?{handler:s,subject:e}:s;go("endpoint",e);let{subject:o,handler:c,metadata:m,queue:p}=i;o=o||e,p=p||this.queue,O2("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:e,subject:o,queue:p,handler:c,metadata:m};return this.srv._addEndpoint(g)}addGroup(e="",s=""){return new Ao(this,e,s)}}function O2(n,e){if(e==="")throw new Error(`${n} cannot be empty`);if(e.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${e}'`);const s=e.split(".");s.forEach((i,o)=>{if(i===">"&&o!==s.length-1)throw new Error(`${n} cannot have internal '>': '${e}'`)})}function A2(n,e){if(e.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${e}'`);e.split(".").forEach(i=>{if(i===">")throw new Error(`${n} name cannot contain internal '>': '${e}'`)})}class Do{constructor(e,s={name:"",version:""}){j(this,"nc");j(this,"_id");j(this,"config");j(this,"handlers");j(this,"internal");j(this,"_stopped");j(this,"_done");j(this,"started");this.nc=e,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),go("name",this.config.name),go("queue",this.config.queue),ti(this.config.version),this._id=Os.next(),this.internal=[],this._done=mt(),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(e,s="",i="",o){const c=o??E2;return s===""&&i===""?`${c}.${e}`:(go("control subject name",s),i!==""?(go("control subject id",i),`${c}.${e}.${s}.${i}`):`${c}.${e}.${s}`)}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.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(e){const s=Pr();if(e instanceof hu){const i=e;s.set(uu,i.message),s.set(fu,`${i.code}`)}else s.set(uu,e.message),s.set(fu,"500");return s}setupHandler(e,s=!1){const i=s?"":e.queue?e.queue:this.config.queue,{name:o,subject:c,handler:m}=e,p=e;p.internal=s,s&&this.internal.push(p),p.stats=new j2(o,c,i),p.queue=i;const g=m?(u,d)=>{if(u){this.close(u);return}const b=Date.now();try{m(u,new fb(d))}catch(x){p.stats.countError(x),d==null||d.respond(jn,{headers:this.errorToHeader(x)})}finally{p.stats.countLatency(b)}}:void 0;return p.sub=this.nc.subscribe(c,{callback:g,queue:i}),p.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${e.subject} stopped`)).catch()}).catch(u=>{if(!this._stopped){const d=new Error(`required subscription ${e.subject} errored: ${u.message}`);d.stack=u.stack,this.close(d).catch()}}),p}info(){return{type:_o.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{const{subject:s,metadata:i,name:o,queue:c}=e;return{subject:s,metadata:i,name:o,queue_group:c}})}async stats(){const e=[];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)}e.push(s.stats.stats(s.qi))}return{type:_o.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,s){const i=`${e}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,e,s),this._doAddInternalHandler(`${i}-kind`,e,s,this.name),this._doAddInternalHandler(`${i}`,e,s,this.name,this.id)}_doAddInternalHandler(e,s,i,o="",c=""){const m={};m.name=e,m.subject=Do.controlSubject(s,o,c),m.handler=i,this.setupHandler(m,!0)}start(){const e=Zn(),s=(m,p)=>m?(this.close(m),Promise.reject(m)):this.stats().then(g=>(p==null||p.respond(e.encode(g)),Promise.resolve())),i=(m,p)=>m?(this.close(m),Promise.reject(m)):(p==null||p.respond(e.encode(this.info())),Promise.resolve()),o=e.encode(this.ping()),c=(m,p)=>m?(this.close(m).then().catch(),Promise.reject(m)):(p.respond(o),Promise.resolve());return this.addInternalHandler(vs.PING,c),this.addInternalHandler(vs.STATS,s),this.addInternalHandler(vs.INFO,i),this.handlers.forEach(m=>{const{subject:p}=m;typeof p=="string"&&m.handler!==null&&this.setupHandler(m)}),Promise.resolve(this)}close(e){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(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:_o.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const e of this.handlers)e.stats.reset(e.qi)}addGroup(e,s){return new Ao(this,e,s)}addEndpoint(e,s){return new Ao(this).addEndpoint(e,s)}_addEndpoint(e){const s=new Ut;s.noIterator=typeof e.handler=="function",s.noIterator||(e.handler=(o,c)=>{o?this.stop(o).catch():s.push(new fb(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(e,!1);return i.qi=s,this.handlers.push(i),s}}class j2{constructor(e,s,i=""){j(this,"name");j(this,"subject");j(this,"average_processing_time");j(this,"num_requests");j(this,"processing_time");j(this,"num_errors");j(this,"last_error");j(this,"data");j(this,"metadata");j(this,"queue");this.name=e,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(e){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=e;s&&(s.time=0,s.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=dt(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){const{name:e,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:m,last_error:p,data:g,queue:u}=this;return{name:e,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:m,last_error:p,data:g,queue_group:u}}stats(e){const s=e;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=dt(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 k2{constructor(e,s={strategy:Wn.JitterTimer,maxWait:2e3},i){j(this,"nc");j(this,"prefix");j(this,"opts");this.nc=e,this.prefix=i,this.opts=s}ping(e="",s=""){return this.q(vs.PING,e,s)}stats(e="",s=""){return this.q(vs.STATS,e,s)}info(e="",s=""){return this.q(vs.INFO,e,s)}async q(e,s="",i=""){const o=new Ut,c=Zn(),m=Do.controlSubject(e,s,i,this.prefix),p=await this.nc.requestMany(m,jn,this.opts);return(async()=>{for await(const g of p)try{const u=c.decode(g.data);o.push(u)}catch(u){o.push(()=>{o.stop(u)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Nx(){return{key:{encode(n){return n},decode(n){return n}},value:{encode(n){return n},decode(n){return n}}}}function N2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Nx(),storage:kd.File}}const gu="KV-Operation",hb="$KV",T2=/^[-/=.\w]+$/,C2=/^[-/=.>*\w]+$/,M2=/^[-\w]+$/;function R2(n){if(n.startsWith(".")||n.endsWith(".")||!T2.test(n))throw new Error(`invalid key: ${n}`)}function D2(n){if(n.startsWith(".")||n.endsWith(".")||!C2.test(n))throw new Error(`invalid key: ${n}`)}function L2(n){if(n.startsWith(".")||n.endsWith("."))throw new Error(`invalid key: ${n}`);const e=n.split(".");let s=!1;for(let i=0;i<e.length;i++)switch(e[i]){case"*":s=!0;break;case">":if(i!==e.length-1)throw new Error(`invalid key: ${n}`);s=!0;break}return s}function su(n){if(!M2.test(n))throw new Error(`invalid bucket name: ${n}`)}var or;(function(n){n.MsgIdHdr="Nats-Msg-Id",n.ExpectedStreamHdr="Nats-Expected-Stream",n.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",n.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",n.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(or||(or={}));class jo{constructor(e,s,i){j(this,"js");j(this,"jsm");j(this,"stream");j(this,"bucket");j(this,"direct");j(this,"codec");j(this,"prefix");j(this,"editPrefix");j(this,"useJsPrefix");j(this,"_prefixLen");j(this,"validateKey",R2);j(this,"validateSearchKey",D2);j(this,"hasWildcards",L2);su(e),this.js=s,this.jsm=i,this.bucket=e,this.prefix=hb,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,s,i={}){su(s);const o=await e.jetstreamManager(),c=new jo(s,e,o);return await c.init(i),c}static async bind(e,s,i={}){const o=await e.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};su(s);const m=new jo(s,e,o);return c.config.name=i.streamName??m.bucketName(),Object.assign(m,c),m.stream=c.config.name,m.codec=i.codec||Nx(),m.direct=c.config.allow_direct??!1,m.initializePrefixes(c),m}async init(e={}){const s=Object.assign(N2(),e);this.codec=s.codec;const i={};this.stream=i.name=e.streamName??this.bucketName(),i.retention=jd.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 o=e.placementCluster??"";if(o&&(e.placement={},e.placement.cluster=o,e.placement.tags=[]),e.placement&&(i.placement=e.placement),e.republish&&(i.republish=e.republish),e.description&&(i.description=e.description),e.mirror){const b=Object.assign({},e.mirror);b.name.startsWith(wn)||(b.name=`${wn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(e.sources){const b=e.sources.map(x=>{const v=Object.assign({},x),w=v.name.startsWith(wn)?v.name.substring(wn.length):v.name;return v.name.startsWith(wn)||(v.name=`${wn}${v.name}`),!x.external&&w!==this.bucket&&(v.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),v});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];e.metadata&&(i.metadata=e.metadata),typeof e.compression=="boolean"&&(i.compression=e.compression?As.S2:As.None);const c=this.js.nc,m=c.getServerVersion(),p=m?Td(m,ti("2.7.2"))>=0:!1;i.discard=p?Oo.New:Oo.Old;const{ok:g,min:u}=c.features.get(Ye.JS_ALLOW_DIRECT);if(!g&&e.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 ${u}`))}e.allow_direct=typeof e.allow_direct=="boolean"?e.allow_direct:g,i.allow_direct=e.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=dt(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(e){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=e.config;if(s){let i=s.name;if(i.startsWith(wn)&&(i=i.substring(wn.length)),s.external&&s.external.api!==""){const o=s.name.substring(wn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${wn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(e,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(e),i.join(".")}fullKeyName(e){return this.prefix!==""?`${this.prefix}.${e}`:`${hb}.${this.bucket}.${e}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(e){const s=[];for(const i of e.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(e){const s=[];for(const i of e.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(e,s){const i=s&&s.get(Wt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):e.length}smToEntry(e){return new Q2(this.bucket,this.prefixLen,e)}jmToEntry(e){const s=this.decodeKey(e.subject.substring(this.prefixLen));return new X2(this.bucket,s,e)}async create(e,s){var c;let i;try{const m=await this.put(e,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 o=0;try{const m=await this.get(e);return(m==null?void 0:m.operation)==="DEL"||(m==null?void 0:m.operation)==="PURGE"?(o=m!==null?m.revision:0,this.update(e,s,o)):Promise.reject(i)}catch(m){return Promise.reject(m)}}update(e,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(e,s,{previousSeq:i})}async put(e,s,i={}){var m,p;const o=this.encodeKey(e);this.validateKey(o);const c={};if(i.previousSeq!==void 0){const g=Pr();c.headers=g,g.set(or.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,c)).seq}catch(g){const u=g;return u.isJetStreamError()?(u.message=(m=u.api_error)==null?void 0:m.description,u.code=`${(p=u.api_error)==null?void 0:p.code}`,Promise.reject(u)):Promise.reject(g)}}async get(e,s){const i=this.encodeKey(e);this.validateKey(i);let o={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(o={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),o):c=await this.jsm.streams.getMessage(this.bucketName(),o);const m=this.smToEntry(c);return m.key!==i?null:m}catch(m){if(m.code===fe.JetStream404NoMessages)return null;throw m}}purge(e,s){return this._deleteOrPurge(e,"PURGE",s)}delete(e,s){return this._deleteOrPurge(e,"DEL",s)}async purgeDeletes(e=1800*1e3){const s=mt(),i=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,o.stop();const c=Date.now()-e,m=i.map(g=>{const u=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:u,keep:1}):this.jsm.streams.purge(this.stream,{filter:u,keep:0})}),p=await Promise.all(m);return p.unshift({success:!0,purged:0}),p.reduce((g,u)=>(g.purged+=u.purged,g))}async _deleteOrPurge(e,s,i){if(!this.hasWildcards(e))return this._doDeleteOrPurge(e,s,i);const o=await this.keys(e),c=[];for await(const m of o)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(e,s,i){const o=this.encodeKey(e);this.validateKey(o);const c=Pr();c.set(gu,s),s==="PURGE"&&c.set(Wt.RollupHdr,Wt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(or.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),jn,{headers:c})}_buildCC(e,s,i={}){let c=(Array.isArray(e)?e:[e]).map(g=>{const u=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(u)}),m=Et.LastPerSubject;s===Qn.AllHistory&&(m=Et.All),s===Qn.UpdatesOnly&&(m=Et.New);let p;return c.length===1&&(p=c[0],c=void 0),Object.assign({deliver_policy:m,ack_policy:Bt.None,filter_subjects:c,filter_subject:p,flow_control:!0,idle_heartbeat:dt(5*1e3)},i)}remove(e){return this.purge(e)}async history(e={}){const s=e.key??">",i=new Ut,o={};o.headers_only=e.headers_only||!1;let c;c=()=>{i.stop()};let m=0;const p=this._buildCC(s,Qn.AllHistory,o),g=p.filter_subject,u=ws(p);u.bindStream(this.stream),u.orderedConsumer(),u.callback((b,x)=>{if(b){i.stop(b);return}if(x){const v=this.jmToEntry(x);i.push(v),i.received++,(c&&m>0&&i.received>=m||x.info.pending===0)&&(i.push(c),c=void 0)}});const d=await this.js.subscribe(g,u);if(c){const{info:{last:b}}=d,x=b.num_pending+b.delivered.consumer_seq;if(x===0||i.received>=x)try{c()}catch(v){i.stop(v)}finally{c=void 0}else m=x}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(Ye.JS_NEW_CONSUMER_CREATE_API);return i}async watch(e={}){const s=e.key??">",i=new Ut,o={};o.headers_only=e.headers_only||!1;let c=Qn.LastValue;e.include===Qn.AllHistory?c=Qn.AllHistory:e.include===Qn.UpdatesOnly&&(c=Qn.UpdatesOnly);const m=e.ignoreDeletes===!0;let p=e.initializedFn,g=0;const u=this._buildCC(s,c,o),d=u.filter_subject,b=ws(u);this.canSetWatcherName()&&b.consumerName(Os.next()),b.bindStream(this.stream),e.resumeFromRevision&&e.resumeFromRevision>0&&b.startSequence(e.resumeFromRevision),b.orderedConsumer(),b.callback((v,w)=>{if(v){i.stop(v);return}if(w){const S=this.jmToEntry(w);if(m&&S.operation==="DEL")return;i.push(S),i.received++,p&&(g>0&&i.received>=g||w.info.pending===0)&&(i.push(p),p=void 0)}});const x=await this.js.subscribe(d,b);if(p){const{info:{last:v}}=x,w=v.num_pending+v.delivered.consumer_seq;if(w===0||i.received>=w)try{p()}catch(S){i.stop(S)}finally{p=void 0}else g=w}return i._data=x,i.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{i.stop()}).catch(v=>{i.stop(v)}),i}async keys(e=">"){const s=new Ut,i=this._buildCC(e,Qn.LastValue,{headers_only:!0}),o=Array.isArray(e)?">":i.filter_subject,c=ws(i);c.bindStream(this.stream),c.orderedConsumer();const m=await this.js.subscribe(o,c);return(async()=>{var g;for await(const u of m){const d=(g=u.headers)==null?void 0:g.get(gu);if(d!=="DEL"&&d!=="PURGE"){const b=this.decodeKey(u.subject.substring(this.prefixLen));s.push(b)}u.info.pending===0&&m.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),m.info.last.num_pending===0&&m.unsubscribe(),s}purgeBucket(e){return this.jsm.streams.purge(this.bucketName(),e)}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(),o=await this.jsm.streams.info(i);return new Tx(o,s)}}class Tx{constructor(e,s=""){j(this,"si");j(this,"cluster");this.si=e,this.cluster=s}get bucket(){return this.si.config.name.startsWith(wn)?this.si.config.name.substring(wn.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 um(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 e;return((e=this.si.config.placement)==null?void 0:e.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!==As.None:!1}}const dm="OBJ_",db="SHA-256=";function q2(n){return su(n),`${dm}${n}`}function P2(n){return n.startsWith(dm)?n.substring(4):n}class Dd{constructor(e){j(this,"si");j(this,"backingStore");this.si=e,this.backingStore="JetStream"}get bucket(){return P2(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!==As.None:!1}}function cc(n){if(n===void 0)return;const{domain:e}=n;if(e===void 0)return n;const s=Object.assign({},n);if(delete s.domain,e==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${e}.API`},s}var zn;(function(n){n[n.Unset=-1]="Unset",n[n.Consume=0]="Consume",n[n.Fetch=1]="Fetch"})(zn||(zn={}));var lr;(function(n){n.HeartbeatsMissed="heartbeats_missed",n.ConsumerNotFound="consumer_not_found",n.StreamNotFound="stream_not_found",n.ConsumerDeleted="consumer_deleted",n.OrderedConsumerRecreated="ordered_consumer_recreated",n.NoResponders="no_responders"})(lr||(lr={}));var Zi;(function(n){n.DebugEvent="debug",n.Discard="discard",n.Reset="reset",n.Next="next"})(Zi||(Zi={}));const mb=Uint8Array.of(43,65,67,75),B2=Uint8Array.of(45,78,65,75),so=Uint8Array.of(43,87,80,73),U2=Uint8Array.of(43,78,88,84),z2=Uint8Array.of(43,84,69,82,77),I2=Uint8Array.of(32);function ko(n,e=5e3){return new sO(n,e)}class sd extends Ut{constructor(s,i,o=!1){super();j(this,"consumer");j(this,"opts");j(this,"sub");j(this,"monitor");j(this,"pending");j(this,"inbox");j(this,"refilling");j(this,"pong");j(this,"callback");j(this,"timeout");j(this,"cleanupHandler");j(this,"listeners");j(this,"statusIterator");j(this,"forOrderedConsumer");j(this,"resetHandler");j(this,"abortOnMissingResource");j(this,"bind");j(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,o),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=o,this.timeout=null,this.inbox=Lr(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:o,threshold_bytes:c,threshold_messages:m}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:p}=this;p&&p.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,u)=>{var b,x,v,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),u.subject===this.inbox){if(Ad(u))return;const S=(x=u.headers)==null?void 0:x.code,C=((w=(v=u.headers)==null?void 0:v.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:P,bytesLeft:q}=this.parseDiscard(u.headers);if(P>0||q>0)this.pending.msgs-=P,this.pending.bytes-=q,this.pending.requests--,this.notify(Zi.Discard,{msgsLeft:P,bytesLeft:q});else if(S===400){this.stop(new ge(C,`${S}`));return}else if(S===409&&C==="consumer deleted"){if(this.notify(lr.ConsumerDeleted,`${S} ${C}`),!this.refilling||this.abortOnMissingResource){const re=new ge(C,`${S}`);this.stop(re);return}}else if(S===503){if(this.notify(lr.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const re=new ge("no responders",`${S}`);this.stop(re);return}}else this.notify(Zi.DebugEvent,`${S} ${C}`)}else this._push(ko(u,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=u.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()})}),o&&(this.monitor=new hm(o,g=>(this.notify(lr.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var u;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const d of g)switch(d.type){case Dr.Disconnect:(u=this.monitor)==null||u.cancel();break;case Dr.Reconnect:this.resetPending().then(b=>{var x;b&&((x=this.monitor)==null||x.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(o){this.stop(o)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.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 o=cm([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(lr.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(m),!1}else if(m.message==="consumer not found"){if(s++,this.notify(lr.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 p=o.backoff(c),g=ia(p);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(Zi.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,o=dt(this.opts.idle_heartbeat),c=dt(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:o,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Wt.PendingMessagesHdr);o&&(i.msgsLeft=parseInt(o));const c=s==null?void 0:s.get(Wt.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,o;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,i){const c=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||c;const m=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||m}return o}status(){const s=new Ut;return this.listeners.push(s),Promise.resolve(s)}}class $2 extends Ut{constructor(){super();j(this,"src");j(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 o of i)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new Ut;return this.listeners.push(s),Promise.resolve(s)}}class Ld{constructor(e,s){j(this,"api");j(this,"_info");j(this,"stream");j(this,"name");this.api=e,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(e={max_messages:100,expires:3e4}){return Promise.resolve(new sd(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const s=new sd(this,e,!1),i=Math.round(s.opts.expires*1.05),o=na(i);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(e={expires:3e4}){const s=mt(),i=e;i.max_messages=1;const o=new sd(this,i,!1),c=Math.round(o.opts.expires*1.05);c>=6e4&&(async()=>{for await(const p of await o.status())if(p.type===lr.HeartbeatsMissed&&p.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const p of o){s.resolve(p);break}})().catch(()=>{});const m=na(c);return o.closed().then(p=>{p?s.reject(p):s.resolve(null)}).catch(p=>{s.reject(p)}).finally(()=>{m.cancel()}),m.catch(p=>{s.resolve(null),o.close().catch()}),o.trackTimeout(m),s}delete(){const{stream_name:e,name:s}=this._info;return this.api.delete(e,s)}info(e=!1){if(e)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(o=>(this._info=o,this._info))}}class H2{constructor(e,s,i={}){j(this,"api");j(this,"consumerOpts");j(this,"consumer");j(this,"opts");j(this,"cursor");j(this,"stream");j(this,"namePrefix");j(this,"serial");j(this,"currentConsumer");j(this,"userCallback");j(this,"iter");j(this,"type");j(this,"startSeq");j(this,"maxInitialReset");this.api=e,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Os.next(),typeof i.name_prefix=="string"&&(Au("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=zn.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(e){this.serial++;const s=`${this.namePrefix}_${this.serial}`;e=e===0?1:e;const i={name:s,deliver_policy:Et.StartSequence,opt_start_seq:e,ack_policy:Bt.None,inactive_threshold:dt(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),e===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||Et.StartSequence,(this.consumerOpts.deliver_policy===Et.LastPerSubject||this.consumerOpts.deliver_policy===Et.New||this.consumerOpts.deliver_policy===Et.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===Et.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=Et.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=dt(this.consumerOpts.inactive_threshold))),i}async resetConsumer(e=0){var m,p,g,u,d;Os.next();const s=this.serial===0;(m=this.consumer)==null||m.delete().catch(()=>{}),e=e===0?1:e,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(e);i.max_deliver=1,i.mem_storage=!0;const o=cm([((p=this.opts)==null?void 0:p.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(lr.OrderedConsumerRecreated,c.name);break}catch(x){if(x.message==="stream not found"&&((u=this.iter)==null||u.notify(lr.StreamNotFound,b),this.type===zn.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(x),Promise.reject(x);if(s&&b>=this.maxInitialReset)throw x;await ia(o.backoff(b+1))}return c}internalHandler(e){return s=>{var o;if(this.serial!==e)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):(o=this.iter)==null||o.push(s)}}async reset(e={max_messages:100,expires:3e4},s){var g,u;s=s||{};const i=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===zn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((u=this.iter)==null?void 0:u.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new $2),this.consumer=new Ld(this.api,this.currentConsumer);const c=e;c.callback=this.internalHandler(this.serial);let m=null;this.type===zn.Fetch&&i?m=await this.consumer.fetch(e):this.type===zn.Consume&&(m=await this.consumer.consume(e));const p=m;p.forOrderedConsumer=!0,p.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(p)}notifyOrderedResetAndReset(){var e;(e=this.iter)==null||e.notify(Zi.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===zn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===zn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=e;return i&&(this.userCallback=i),this.type=zn.Consume,this.opts=e,await this.reset(e),this.iter}async fetch(e={max_messages:100,expires:3e4}){var o;if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===zn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:i}=e;return i&&(this.userCallback=i),this.type=zn.Fetch,this.opts=e,await this.reset(e,{fromFetch:!0}),this.iter}async next(e={expires:3e4}){const s=e;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=mt();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(e=>Promise.resolve(e)).catch(e=>Promise.reject(e)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(e){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):e&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class qd{constructor(e){j(this,"api");j(this,"notified");this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(Ye.JS_SIMPLIFICATION);return e.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`))}getPullConsumerFor(e){if(e.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Ld(this.api,e)}async get(e,s={}){return typeof s=="object"?this.ordered(e,s):(await this.checkVersion(),this.api.info(e,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Ld(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(e,s){await this.checkVersion();const i=this.api;return new mm(i.nc,i.opts).info(e).then(c=>Promise.resolve(new H2(this.api,e,s))).catch(c=>Promise.reject(c))}}class ku{constructor(e,s){j(this,"api");j(this,"_info");this.api=e,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(e=>e.alternates?e.alternates:[])}async best(){if(await this.info(),this._info.alternates){const e=await this.api.info(this._info.alternates[0].name);return new ku(this.api,e)}else return this}info(e=!1,s){return e?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(e){return new qd(new mu(this.api.nc,this.api.opts)).getPullConsumerFor(e)}getConsumer(e){return new qd(new mu(this.api.nc,this.api.opts)).get(this.name,e)}getMessage(e){return this.api.getMessage(this.name,e)}deleteMessage(e,s){return this.api.deleteMessage(this.name,e,s)}}class mm extends Ro{constructor(e,s){super(e,s)}checkStreamConfigVersions(e){const s=this.nc;if(e.metadata){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${o}`)}if(e.first_seq){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${o}`)}if(e.subject_transform){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(e.compression){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${o}`)}if(e.consumer_limits){const{min:o,ok:c}=s.features.get(Ye.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function i(o,c){var p;if((((p=c==null?void 0:c.subject_transforms)==null?void 0:p.length)||0)>0){const{min:g,ok:u}=s.features.get(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!u)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}e.sources&&e.sources.forEach(o=>{i("stream sources",o)}),e.mirror&&i("stream mirror",e.mirror)}async add(e={}){var o;this.checkStreamConfigVersions(e),Jt(e.name),e.mirror=cc(e.mirror),e.sources=(o=e.sources)==null?void 0:o.map(cc);const i=await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`,e);return this._fixInfo(i),i}async delete(e){return Jt(e),(await this._request(`${this.prefix}.STREAM.DELETE.${e}`)).success}async update(e,s={}){var p;if(typeof e=="object"){const g=e;e=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),Jt(e);const i=await this.info(e),o=Object.assign(i.config,s);o.mirror=cc(o.mirror),o.sources=(p=o.sources)==null?void 0:p.map(cc);const m=await this._request(`${this.prefix}.STREAM.UPDATE.${e}`,o);return this._fixInfo(m),m}async info(e,s){Jt(e);const i=`${this.prefix}.STREAM.INFO.${e}`;let c=await this._request(i,s),{total:m,limit:p}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(m&&m>g){const u=[c],d=s||{};let b=0;for(;m>g;){b++,d.offset=p*b;const v=await this._request(i,d);m=v.total,u.push(v);const w=Object.getOwnPropertyNames(v.state.subjects).length;if(g+=w,w<p)break}let x={};for(let v=0;v<u.length;v++)c=u[v],c.state.subjects&&(x=Object.assign(x,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=x}return this._fixInfo(c),c}list(e=""){const s=e!=null&&e.length?{subject:e}:{},i=c=>{const m=c;return m.streams.forEach(p=>{this._fixInfo(p)}),m.streams},o=`${this.prefix}.STREAM.LIST`;return new bo(o,i,this,s)}_fixInfo(e){e.config.sealed=e.config.sealed||!1,e.config.deny_delete=e.config.deny_delete||!1,e.config.deny_purge=e.config.deny_purge||!1,e.config.allow_rollup_hdrs=e.config.allow_rollup_hdrs||!1}async purge(e,s){if(s){const{keep:o,seq:c}=s;if(typeof o=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Jt(e),await this._request(`${this.prefix}.STREAM.PURGE.${e}`,s)}async deleteMessage(e,s,i=!0){Jt(e);const o={seq:s};return i||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${e}`,o)).success}async getMessage(e,s){Jt(e);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${e}`,s);return new Cx(o)}find(e){return this.findStream(e)}listKvs(){const e=i=>{var g;const c=i.streams.filter(u=>u.config.name.startsWith(wn));c.forEach(u=>{this._fixInfo(u)});let m="";return c.length&&(m=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(u=>new Tx(u,m))},s=`${this.prefix}.STREAM.LIST`;return new bo(s,e,this)}listObjectStores(){const e=i=>{const c=i.streams.filter(p=>p.config.name.startsWith(dm));return c.forEach(p=>{this._fixInfo(p)}),c.map(p=>new Dd(p))},s=`${this.prefix}.STREAM.LIST`;return new bo(s,e,this)}names(e=""){const s=e!=null&&e.length?{subject:e}:{},i=c=>c.streams,o=`${this.prefix}.STREAM.NAMES`;return new bo(o,i,this,s)}async get(e){const s=await this.info(e);return Promise.resolve(new ku(this,s))}}class F2 extends Ro{constructor(e,s){super(e,s)}async getMessage(e,s){Jt(e);let i=s;const{last_by_subj:o}=i;o&&(i=null);const c=i?this.jc.encode(i):jn,m=this.opts.apiPrefix||"$JS.API",p=o?`${m}.DIRECT.GET.${e}.${o}`:`${m}.DIRECT.GET.${e}`,g=await this.nc.request(p,c,{timeout:this.timeout}),u=Xi(g);if(u)return Promise.reject(u);const d=new Pd(g);return Promise.resolve(d)}async getBatch(e,s){Jt(e);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${e}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,u)=>g==="up_to_time"&&u instanceof Date?u.toISOString():u),m=new Ut,p=await this.nc.requestMany(o,c,{strategy:Wn.SentinelMsg});return(async()=>{var b,x,v;let g=!1,u=!1,d;for await(const w of p){if(!g){g=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){d=(x=w.headers)==null?void 0:x.description.toLowerCase();break}if(((v=w.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){u=!0;break}}if(w.data.length===0)break;m.push(new Pd(w))}m.push(()=>{if(u)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 Pd{constructor(e){j(this,"data");j(this,"header");if(!e.headers)throw new Error("headers expected");this.data=e.data,this.header=e.headers}get subject(){return this.header.last(Ki.Subject)}get seq(){const e=this.header.last(Ki.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ki.TimeStamp)}get stream(){return this.header.last(Ki.Stream)}json(e){return Zn(e).decode(this.data)}string(){return En.decode(this.data)}}j(Pd,"jc");class G2 extends Ro{constructor(s,i){super(s,i);j(this,"streams");j(this,"consumers");j(this,"direct");this.streams=new mm(s,i),this.consumers=new mu(s,i),this.direct=new F2(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Ut;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,o)=>{if(i)throw i;try{const c=this.parseJsResponse(o),m=c.type.split("."),p=m[m.length-1];s.push({kind:p,data:c})}catch(c){s.stop(c)}}}),s}}class Cx{constructor(e){j(this,"_header");j(this,"smr");this.smr=e}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):jn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=_s.decode(e)}else this._header=Pr();return this._header}_parse(e){const s=atob(e),i=s.length,o=new Uint8Array(i);for(let c=0;c<i;c++)o[c]=s.charCodeAt(c);return o}json(e){return Zn(e).decode(this.data)}string(){return En.decode(this.data)}}j(Cx,"jc");class V2{constructor(e){j(this,"api");this.api=e}get(e){return this.api.info(e).then(s=>new ku(this.api,s))}}class id{constructor(e){j(this,"info");j(this,"hdrs");this.info=e}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=_s.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 e,s;return((e=this.info.options)==null?void 0:e.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function pb(n){const e={name:n.name,description:n.description??"",options:n.options,metadata:n.metadata};if(n.headers){const s=n.headers;e.headers=s.toRecord()}return e}function Y2(){return new ReadableStream({pull(n){n.enqueue(new Uint8Array(0)),n.close()}})}class So{constructor(e,s,i){j(this,"jsm");j(this,"js");j(this,"stream");j(this,"name");this.name=e,this.jsm=s,this.js=i}_checkNotEmpty(e){return!e||e.length===0?{name:e,error:new Error("name cannot be empty")}:{name:e}}async info(e){const s=await this.rawInfo(e);return s?new id(s):null}async list(){const e=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;e.push(i)}return Promise.resolve(e)}async rawInfo(e){const{name:s,error:i}=this._checkNotEmpty(e);if(i)return Promise.reject(i);const o=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),p=Zn().decode(c.data);return p.revision=c.seq,p}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(e){try{return await this.jsm.streams.info(this.stream,e)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let e=await this._si();return e===null?Promise.reject(new Error("object store not found")):(e.config.sealed=!0,e=await this.jsm.streams.update(this.stream,e.config),Promise.resolve(new Dd(e)))}async status(e){const s=await this._si(e);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Dd(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,s,i){var se;const o=this.js.getOptions();i=i||{timeout:o.timeout},i.timeout=i.timeout||o.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:m}=i,p=this.js.nc.info,g=(p==null?void 0:p.max_payload)||1024;e=e||{},e.options=e.options||{};let u=((se=e.options)==null?void 0:se.max_chunk_size)||128*1024;u=u>g?g:u,e.options.max_chunk_size=u;const d=await this.info(e.name),{name:b,error:x}=this._checkNotEmpty(e.name);if(x)return Promise.reject(x);const v=Os.next(),w=this._chunkSubject(v),S=this._metaSubject(b),C=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},pb(e)),P=mt(),q=[],re=new sa;try{const M=s?s.getReader():null,U=sb.create();for(;;){const{done:ae,value:z}=M?await M.read():{done:!0,value:void 0};if(ae){if(re.size()>0){const W=re.drain();U.update(W),C.chunks++,C.size+=W.length,q.push(this.js.publish(w,W,{timeout:c}))}await Promise.all(q),q.length=0,C.mtime=new Date().toISOString();const I=Wi.encode(U.digest());C.digest=`${db}${I}`,C.deleted=!1;const D=Pr();typeof m=="number"&&D.set(or.ExpectedLastSubjectSequenceHdr,`${m}`),D.set(Wt.RollupHdr,Wt.RollupValueSubject);const X=await this.js.publish(S,Zn().encode(C),{headers:D,timeout:c});if(C.revision=X.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}P.resolve(new id(C));break}if(z)for(re.fill(z);re.size()>u;){C.chunks++,C.size+=u;const I=re.drain(e.options.max_chunk_size);U.update(I),q.push(this.js.publish(w,I,{timeout:c}))}}}catch(M){await this.jsm.streams.purge(this.stream,{filter:w}),P.reject(M)}return P}putBlob(e,s,i){function o(c){return new ReadableStream({pull(m){m.enqueue(c),m.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(e,o(s),i)}put(e,s,i){var o;return(o=e==null?void 0:e.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(e,s,i)}async getBlob(e){async function s(c){const m=new sa,p=c.getReader();for(;;){const{done:g,value:u}=await p.read();if(g)return m.drain();u&&u.length&&m.fill(u)}}const i=await this.get(e);if(i===null)return Promise.resolve(null);const o=await Promise.all([i.error,s(i.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(e){const s=await this.rawInfo(e);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 So.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(db))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=Nd(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=mt(),c={info:new id(s),error:o};if(s.size===0)return c.data=Y2(),o.resolve(null),Promise.resolve(c);let m;const p=ws();p.orderedConsumer();const g=sb.create(),u=`$O.${this.name}.C.${s.nuid}`,d=await this.js.subscribe(u,p);return(async()=>{for await(const b of d)b.data.length>0&&(g.update(b.data),m.enqueue(b.data)),b.info.pending===0&&(LE(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(()=>{o.resolve()}).catch(b=>{m.error(b),o.reject(b)}),c.data=new ReadableStream({start(b){m=b},cancel(){d.unsubscribe()}}),c}linkStore(e,s){if(!(s instanceof So))return Promise.reject("bucket required");const i=s,{name:o,error:c}=this._checkNotEmpty(e);if(c)return Promise.reject(c);const m={name:o,options:{link:{bucket:i.name}}};return this._put(m,null)}async link(e,s){const{name:i,error:o}=this._checkNotEmpty(e);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(e);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},p={name:i,bucket:s.bucket,options:{link:m}};await this.js.publish(this._metaSubject(e),JSON.stringify(p));const g=await this.info(e);return Promise.resolve(g)}async delete(e){const s=await this.rawInfo(e);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Zn(),o=Pr();return o.set(Wt.RollupHdr,Wt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(e,s={}){const i=await this.rawInfo(e);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:o,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(e!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const m=Object.assign({},i,pb(s)),p=await this.js.publish(this._metaSubject(m.name),JSON.stringify(m));return e!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(e)}),Promise.resolve(p)}async watch(e={}){e.includeHistory=e.includeHistory??!1,e.ignoreDeletes=e.ignoreDeletes??!1;let s=!1;const i=new Ut,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Zn(),m=ws();m.orderedConsumer(),e.includeHistory?m.deliverLastPerSubject():(s=!0,m.deliverNew()),m.callback((g,u)=>{var d;if(g){i.stop(g);return}if(u!==null){const b=c.decode(u.data);b.deleted&&e.ignoreDeletes===!0||i.push(b),((d=u.info)==null?void 0:d.pending)===0&&!s&&(s=!0,i.push(null))}});const p=await this.js.subscribe(o,m);return i._data=p,i.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(e){return`$O.${this.name}.C.${e}`}_metaSubject(e){return`$O.${this.name}.M.${Wi.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=q2(this.name)}catch(o){return Promise.reject(o)}const s=(e==null?void 0:e.ttl)||0;delete e.ttl;const i=Object.assign({max_age:s},e);i.name=this.stream,i.num_replicas=e.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=Oo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],e.placement&&(i.placement=e.placement),e.metadata&&(i.metadata=e.metadata),typeof e.compression=="boolean"&&(i.compression=e.compression?As.S2:As.None);try{await this.jsm.streams.info(i.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(e,s,i={}){const o=await e.jetstreamManager(),c=new So(s,o,e);return await c.init(i),Promise.resolve(c)}}class K2{constructor(e){j(this,"js");this.js=e}kv(e,s={}){const i=this.js,{ok:o,min:c}=i.nc.features.get(Ye.JS_KV);return o?s.bindOnly?jo.bind(this.js,e,s):jo.create(this.js,e,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(e,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:o,min:c}=i.nc.features.get(Ye.JS_OBJECTSTORE);return o?So.create(this.js,e,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class pm extends Ro{constructor(s,i){super(s,i);j(this,"consumers");j(this,"streams");j(this,"consumerAPI");j(this,"streamAPI");this.consumerAPI=new mu(s,i),this.streamAPI=new mm(s,i),this.consumers=new qd(this.consumerAPI),this.streams=new V2(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 K2(this)}async publish(s,i=jn,o){o=o||{},o.expect=o.expect||{};const c=(o==null?void 0:o.headers)||Pr();o&&(o.msgID&&c.set(or.MsgIdHdr,o.msgID),o.expect.lastMsgID&&c.set(or.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&c.set(or.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&c.set(or.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&c.set(or.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const m=o.timeout||this.timeout,p={};m&&(p.timeout=m),o&&(p.headers=c);let{retries:g,retry_delay:u}=o;g=g||1,u=u||250;let d;for(let x=0;x<g;x++)try{d=await this.nc.request(s,i,p);break}catch(v){if(v.code==="503"&&x+1<g)await ia(u);else throw v}const b=this.parseJsResponse(d);if(b.stream==="")throw ge.errorForCode(fe.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,o=0){Jt(s),Qi(i);let c=this.timeout;o>c&&(c=o),o=o<0?0:dt(o);const m={batch:1,no_wait:o===0,expires:o},p=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{noMux:!0,timeout:c}),g=Xi(p);if(g)throw g;return ko(p,this.timeout)}fetch(s,i,o={}){Jt(s),Qi(i);let c=null;const m=(o.max_bytes??0)>0;let p=0;const g=m?o.max_bytes:0;let u=null;const d={};if(d.batch=o.batch||1,g){const q=this.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!q.ok)throw new Error(`max_bytes is only supported on servers ${q.min} or better`);d.max_bytes=g}d.no_wait=o.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const b=o.expires||0;if(b&&(d.expires=dt(b)),b===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const x=o.idle_heartbeat||0;x&&(d.idle_heartbeat=dt(x),o.delay_heartbeat===!0&&(d.idle_heartbeat=dt(x*4)));const v=new Ut,w=d.batch;let S=0;v.protocolFilterFn=(q,re=!1)=>Ad(q.msg)?(u==null||u.work(),!1):!0,v.dispatchedFn=q=>{if(q){if(m&&(p+=q.data.length),S++,c&&q.info.pending===0)return;(v.getPending()===1&&q.info.pending===0||w===S||g>0&&p>=g)&&v.stop()}};const C=Lr(this.nc.options.inboxPrefix),P=this.nc.subscribe(C,{max:o.batch,callback:(q,re)=>{q===null&&(q=Xi(re)),q!==null?(c&&(c.cancel(),c=null),yE(q)?v.stop(Rx(q)===null?void 0:q):v.stop(q)):(u==null||u.work(),v.received++,v.push(ko(re,this.timeout)))}});return b&&(c=na(b),c.catch(()=>{P.isClosed()||(P.drain().catch(()=>{}),c=null),u&&u.cancel()})),(async()=>{try{x&&(u=new hm(x,q=>(v.push(()=>{v.err=new ge(`${In.IdleHeartbeatMissed}: ${q}`,fe.JetStreamIdleHeartBeat)}),!0)))}catch{}await P.closed,c!==null&&(c.cancel(),c=null),u&&u.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{reply:C}),v}async pullSubscribe(s,i=ws()){const o=await this._processOptions(s,i);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=o.config.ack_policy;if(c===Bt.None||c===Bt.All)throw new Error("ack policy for pull consumers must be explicit");const m=this._buildTypedSubscriptionOpts(o),p=new W2(this,o.deliver,m);p.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw p.unsubscribe(),g}return p}async subscribe(s,i=ws()){const o=await this._processOptions(s,i);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(o),m=new Mx(this,o.deliver,c);m.info=o;try{await this._maybeCreateConsumer(o)}catch(p){throw m.unsubscribe(),p}return m._maybeSetupHbMonitoring(),m}async _processOptions(s,i=ws()){const o=eb(i)?i.getOpts():i;if(o.isBind=eb(i)?i.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==Bt.NotSet&&o.config.ack_policy!==Bt.None)throw new ge("ordered consumer: ack_policy can only be set to 'none'",fe.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ge("ordered consumer: durable_name cannot be set",fe.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ge("ordered consumer: deliver_subject cannot be set",fe.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ge("ordered consumer: max_deliver cannot be set",fe.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ge("ordered consumer: deliver_group cannot be set",fe.ApiError);o.config.deliver_subject=Lr(this.nc.options.inboxPrefix),o.config.ack_policy=Bt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||dt(5e3),o.config.ack_wait=dt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===Bt.NotSet&&(o.config.ack_policy=Bt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const c=await this.consumerAPI.info(o.stream,o.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=o.config.deliver_group??"";if(m===""&&c.push_bound===!0)throw new Error("duplicate subscription");const p=c.config.deliver_group??"";if(m!==p)throw p===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${p}'`);o.last=c,o.config=c.config,o.attached=!0,o.config.durable_name||(o.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||Lr(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=Z2(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=pm.ingestionFn(s.ordered),i.protocolFilterFn=(o,c=!1)=>{const m=o;return Od(m.msg)?(c||m.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Bt.None&&(i.dispatchedFn=nO),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:Et.All,ack_policy:Bt.Explicit,ack_wait:dt(30*1e3),replay_policy:ra.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,o)=>{var g;const c=o;if(!i)return{ingest:!1,protocol:!1};const m=i;if(Xi(m.msg)||(g=c.monitor)==null||g.work(),Ad(m.msg)){const u=s?c._checkHbOrderConsumer(m.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:u,protocol:!0}}else if(Od(m.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class ym{constructor(e){j(this,"options");j(this,"protocol");j(this,"draining");j(this,"listeners");j(this,"_services");this.draining=!1,this.options=g2(e),this.listeners=[]}static connect(e={}){return new Promise((s,i)=>{const o=new ym(e);yu.connect(o.options,o).then(c=>{o.protocol=c,(async function(){for await(const m of c.status())o.listeners.forEach(p=>{p.push(m)})})(),s(o)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(e,s,i){if(this.isClosed())throw ge.errorForCode(fe.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw ge.errorForCode(fe.ConnectionDraining);if(e=e||"",e.length===0)throw ge.errorForCode(fe.BadSubject)}publish(e,s,i){this._check(e,!1,!0),this.protocol.publish(e,s,i)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return e.reply?(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0):!1}subscribe(e,s={}){this._check(e,!0,!1);const i=new kx(this.protocol,e,s);return this.protocol.subscribe(i),i}_resub(e,s,i){this._check(s,!0,!1);const o=e;o.max=i,i&&(o.max=i+o.received),this.protocol.resub(o,s)}requestMany(e,s=jn,i={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Wn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new ge("timeout",fe.InvalidOption));const c=new Ut;function m(g){c.push(()=>{c.stop(g)})}function p(g,u){g||u===null?m(g===null?void 0:g):c.push(u)}if(i.noMux){const g=o?new Error().stack:null;let u=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const d=this.subscribe(Lr(this.options.inboxPrefix),{callback:(w,S)=>{var C,P;if(((C=S==null?void 0:S.data)==null?void 0:C.length)===0&&((P=S==null?void 0:S.headers)==null?void 0:P.status)===fe.NoResponders&&(w=ge.errorForCode(fe.NoResponders)),w){g&&(w.stack+=`
47
+ `),e.max=s)}resub(e,s){!e||this.isClosed()||(this.unsub(e),e.subject=s,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||(e=mt()),this.pongs.push(e),this.outbound.fill(fb),this.flushPending(),e}sendSubscriptions(){const e=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?e.push(`SUB ${i.subject} ${i.queue} ${i.sid}${ru}`):e.push(`SUB ${i.subject} ${i.sid}${ru}`)}),e.length&&this.transport.send(vo(e.join("")))}async _close(e){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(e),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(e),await this.closed.resolve(e))}close(){return this._close()}isClosed(){return this._closed}drain(){const e=this.subscriptions.all(),s=[];return e.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 e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new Nx(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}const O2="$SRV";class hb{constructor(e){j(this,"msg");this.msg=e}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(e,s){return this.msg.respond(e,s)}respondError(e,s,i,o){var c,m;return o=o||{},o.headers=o.headers||Pr(),(c=o.headers)==null||c.set(fu,`${e}`),(m=o.headers)==null||m.set(uu,s),this.msg.respond(i,o)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class Ao{constructor(e,s="",i=""){j(this,"subject");j(this,"queue");j(this,"srv");s!==""&&j2("service group",s);let o="";if(e instanceof Do)this.srv=e,o="";else if(e instanceof Ao){const c=e;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),o=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=i}calcSubject(e,s=""){return s===""?e:e!==""?`${e}.${s}`:s}addEndpoint(e="",s){s=s||{subject:e};const i=typeof s=="function"?{handler:s,subject:e}:s;go("endpoint",e);let{subject:o,handler:c,metadata:m,queue:p}=i;o=o||e,p=p||this.queue,A2("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:e,subject:o,queue:p,handler:c,metadata:m};return this.srv._addEndpoint(g)}addGroup(e="",s=""){return new Ao(this,e,s)}}function A2(n,e){if(e==="")throw new Error(`${n} cannot be empty`);if(e.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${e}'`);const s=e.split(".");s.forEach((i,o)=>{if(i===">"&&o!==s.length-1)throw new Error(`${n} cannot have internal '>': '${e}'`)})}function j2(n,e){if(e.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${e}'`);e.split(".").forEach(i=>{if(i===">")throw new Error(`${n} name cannot contain internal '>': '${e}'`)})}class Do{constructor(e,s={name:"",version:""}){j(this,"nc");j(this,"_id");j(this,"config");j(this,"handlers");j(this,"internal");j(this,"_stopped");j(this,"_done");j(this,"started");this.nc=e,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),go("name",this.config.name),go("queue",this.config.queue),ti(this.config.version),this._id=Os.next(),this.internal=[],this._done=mt(),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(e,s="",i="",o){const c=o??O2;return s===""&&i===""?`${c}.${e}`:(go("control subject name",s),i!==""?(go("control subject id",i),`${c}.${e}.${s}.${i}`):`${c}.${e}.${s}`)}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.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(e){const s=Pr();if(e instanceof hu){const i=e;s.set(uu,i.message),s.set(fu,`${i.code}`)}else s.set(uu,e.message),s.set(fu,"500");return s}setupHandler(e,s=!1){const i=s?"":e.queue?e.queue:this.config.queue,{name:o,subject:c,handler:m}=e,p=e;p.internal=s,s&&this.internal.push(p),p.stats=new k2(o,c,i),p.queue=i;const g=m?(u,d)=>{if(u){this.close(u);return}const b=Date.now();try{m(u,new hb(d))}catch(x){p.stats.countError(x),d==null||d.respond(jn,{headers:this.errorToHeader(x)})}finally{p.stats.countLatency(b)}}:void 0;return p.sub=this.nc.subscribe(c,{callback:g,queue:i}),p.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${e.subject} stopped`)).catch()}).catch(u=>{if(!this._stopped){const d=new Error(`required subscription ${e.subject} errored: ${u.message}`);d.stack=u.stack,this.close(d).catch()}}),p}info(){return{type:_o.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{const{subject:s,metadata:i,name:o,queue:c}=e;return{subject:s,metadata:i,name:o,queue_group:c}})}async stats(){const e=[];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)}e.push(s.stats.stats(s.qi))}return{type:_o.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,s){const i=`${e}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,e,s),this._doAddInternalHandler(`${i}-kind`,e,s,this.name),this._doAddInternalHandler(`${i}`,e,s,this.name,this.id)}_doAddInternalHandler(e,s,i,o="",c=""){const m={};m.name=e,m.subject=Do.controlSubject(s,o,c),m.handler=i,this.setupHandler(m,!0)}start(){const e=Zn(),s=(m,p)=>m?(this.close(m),Promise.reject(m)):this.stats().then(g=>(p==null||p.respond(e.encode(g)),Promise.resolve())),i=(m,p)=>m?(this.close(m),Promise.reject(m)):(p==null||p.respond(e.encode(this.info())),Promise.resolve()),o=e.encode(this.ping()),c=(m,p)=>m?(this.close(m).then().catch(),Promise.reject(m)):(p.respond(o),Promise.resolve());return this.addInternalHandler(vs.PING,c),this.addInternalHandler(vs.STATS,s),this.addInternalHandler(vs.INFO,i),this.handlers.forEach(m=>{const{subject:p}=m;typeof p=="string"&&m.handler!==null&&this.setupHandler(m)}),Promise.resolve(this)}close(e){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(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:_o.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const e of this.handlers)e.stats.reset(e.qi)}addGroup(e,s){return new Ao(this,e,s)}addEndpoint(e,s){return new Ao(this).addEndpoint(e,s)}_addEndpoint(e){const s=new Ut;s.noIterator=typeof e.handler=="function",s.noIterator||(e.handler=(o,c)=>{o?this.stop(o).catch():s.push(new hb(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(e,!1);return i.qi=s,this.handlers.push(i),s}}class k2{constructor(e,s,i=""){j(this,"name");j(this,"subject");j(this,"average_processing_time");j(this,"num_requests");j(this,"processing_time");j(this,"num_errors");j(this,"last_error");j(this,"data");j(this,"metadata");j(this,"queue");this.name=e,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(e){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=e;s&&(s.time=0,s.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=dt(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){const{name:e,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:m,last_error:p,data:g,queue:u}=this;return{name:e,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:m,last_error:p,data:g,queue_group:u}}stats(e){const s=e;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=dt(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 N2{constructor(e,s={strategy:Wn.JitterTimer,maxWait:2e3},i){j(this,"nc");j(this,"prefix");j(this,"opts");this.nc=e,this.prefix=i,this.opts=s}ping(e="",s=""){return this.q(vs.PING,e,s)}stats(e="",s=""){return this.q(vs.STATS,e,s)}info(e="",s=""){return this.q(vs.INFO,e,s)}async q(e,s="",i=""){const o=new Ut,c=Zn(),m=Do.controlSubject(e,s,i,this.prefix),p=await this.nc.requestMany(m,jn,this.opts);return(async()=>{for await(const g of p)try{const u=c.decode(g.data);o.push(u)}catch(u){o.push(()=>{o.stop(u)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Tx(){return{key:{encode(n){return n},decode(n){return n}},value:{encode(n){return n},decode(n){return n}}}}function T2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Tx(),storage:kd.File}}const gu="KV-Operation",db="$KV",C2=/^[-/=.\w]+$/,M2=/^[-/=.>*\w]+$/,R2=/^[-\w]+$/;function D2(n){if(n.startsWith(".")||n.endsWith(".")||!C2.test(n))throw new Error(`invalid key: ${n}`)}function L2(n){if(n.startsWith(".")||n.endsWith(".")||!M2.test(n))throw new Error(`invalid key: ${n}`)}function q2(n){if(n.startsWith(".")||n.endsWith("."))throw new Error(`invalid key: ${n}`);const e=n.split(".");let s=!1;for(let i=0;i<e.length;i++)switch(e[i]){case"*":s=!0;break;case">":if(i!==e.length-1)throw new Error(`invalid key: ${n}`);s=!0;break}return s}function su(n){if(!R2.test(n))throw new Error(`invalid bucket name: ${n}`)}var or;(function(n){n.MsgIdHdr="Nats-Msg-Id",n.ExpectedStreamHdr="Nats-Expected-Stream",n.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",n.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",n.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(or||(or={}));class jo{constructor(e,s,i){j(this,"js");j(this,"jsm");j(this,"stream");j(this,"bucket");j(this,"direct");j(this,"codec");j(this,"prefix");j(this,"editPrefix");j(this,"useJsPrefix");j(this,"_prefixLen");j(this,"validateKey",D2);j(this,"validateSearchKey",L2);j(this,"hasWildcards",q2);su(e),this.js=s,this.jsm=i,this.bucket=e,this.prefix=db,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,s,i={}){su(s);const o=await e.jetstreamManager(),c=new jo(s,e,o);return await c.init(i),c}static async bind(e,s,i={}){const o=await e.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};su(s);const m=new jo(s,e,o);return c.config.name=i.streamName??m.bucketName(),Object.assign(m,c),m.stream=c.config.name,m.codec=i.codec||Tx(),m.direct=c.config.allow_direct??!1,m.initializePrefixes(c),m}async init(e={}){const s=Object.assign(T2(),e);this.codec=s.codec;const i={};this.stream=i.name=e.streamName??this.bucketName(),i.retention=jd.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 o=e.placementCluster??"";if(o&&(e.placement={},e.placement.cluster=o,e.placement.tags=[]),e.placement&&(i.placement=e.placement),e.republish&&(i.republish=e.republish),e.description&&(i.description=e.description),e.mirror){const b=Object.assign({},e.mirror);b.name.startsWith(wn)||(b.name=`${wn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(e.sources){const b=e.sources.map(x=>{const v=Object.assign({},x),_=v.name.startsWith(wn)?v.name.substring(wn.length):v.name;return v.name.startsWith(wn)||(v.name=`${wn}${v.name}`),!x.external&&_!==this.bucket&&(v.subject_transforms=[{src:`$KV.${_}.>`,dest:`$KV.${this.bucket}.>`}]),v});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];e.metadata&&(i.metadata=e.metadata),typeof e.compression=="boolean"&&(i.compression=e.compression?As.S2:As.None);const c=this.js.nc,m=c.getServerVersion(),p=m?Td(m,ti("2.7.2"))>=0:!1;i.discard=p?Oo.New:Oo.Old;const{ok:g,min:u}=c.features.get(Ye.JS_ALLOW_DIRECT);if(!g&&e.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 ${u}`))}e.allow_direct=typeof e.allow_direct=="boolean"?e.allow_direct:g,i.allow_direct=e.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=dt(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(e){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=e.config;if(s){let i=s.name;if(i.startsWith(wn)&&(i=i.substring(wn.length)),s.external&&s.external.api!==""){const o=s.name.substring(wn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${wn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(e,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(e),i.join(".")}fullKeyName(e){return this.prefix!==""?`${this.prefix}.${e}`:`${db}.${this.bucket}.${e}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(e){const s=[];for(const i of e.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(e){const s=[];for(const i of e.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(e,s){const i=s&&s.get(Wt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):e.length}smToEntry(e){return new X2(this.bucket,this.prefixLen,e)}jmToEntry(e){const s=this.decodeKey(e.subject.substring(this.prefixLen));return new W2(this.bucket,s,e)}async create(e,s){var c;let i;try{const m=await this.put(e,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 o=0;try{const m=await this.get(e);return(m==null?void 0:m.operation)==="DEL"||(m==null?void 0:m.operation)==="PURGE"?(o=m!==null?m.revision:0,this.update(e,s,o)):Promise.reject(i)}catch(m){return Promise.reject(m)}}update(e,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(e,s,{previousSeq:i})}async put(e,s,i={}){var m,p;const o=this.encodeKey(e);this.validateKey(o);const c={};if(i.previousSeq!==void 0){const g=Pr();c.headers=g,g.set(or.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,c)).seq}catch(g){const u=g;return u.isJetStreamError()?(u.message=(m=u.api_error)==null?void 0:m.description,u.code=`${(p=u.api_error)==null?void 0:p.code}`,Promise.reject(u)):Promise.reject(g)}}async get(e,s){const i=this.encodeKey(e);this.validateKey(i);let o={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(o={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),o):c=await this.jsm.streams.getMessage(this.bucketName(),o);const m=this.smToEntry(c);return m.key!==i?null:m}catch(m){if(m.code===fe.JetStream404NoMessages)return null;throw m}}purge(e,s){return this._deleteOrPurge(e,"PURGE",s)}delete(e,s){return this._deleteOrPurge(e,"DEL",s)}async purgeDeletes(e=1800*1e3){const s=mt(),i=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,o.stop();const c=Date.now()-e,m=i.map(g=>{const u=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:u,keep:1}):this.jsm.streams.purge(this.stream,{filter:u,keep:0})}),p=await Promise.all(m);return p.unshift({success:!0,purged:0}),p.reduce((g,u)=>(g.purged+=u.purged,g))}async _deleteOrPurge(e,s,i){if(!this.hasWildcards(e))return this._doDeleteOrPurge(e,s,i);const o=await this.keys(e),c=[];for await(const m of o)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(e,s,i){const o=this.encodeKey(e);this.validateKey(o);const c=Pr();c.set(gu,s),s==="PURGE"&&c.set(Wt.RollupHdr,Wt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(or.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),jn,{headers:c})}_buildCC(e,s,i={}){let c=(Array.isArray(e)?e:[e]).map(g=>{const u=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(u)}),m=Et.LastPerSubject;s===Qn.AllHistory&&(m=Et.All),s===Qn.UpdatesOnly&&(m=Et.New);let p;return c.length===1&&(p=c[0],c=void 0),Object.assign({deliver_policy:m,ack_policy:Bt.None,filter_subjects:c,filter_subject:p,flow_control:!0,idle_heartbeat:dt(5*1e3)},i)}remove(e){return this.purge(e)}async history(e={}){const s=e.key??">",i=new Ut,o={};o.headers_only=e.headers_only||!1;let c;c=()=>{i.stop()};let m=0;const p=this._buildCC(s,Qn.AllHistory,o),g=p.filter_subject,u=ws(p);u.bindStream(this.stream),u.orderedConsumer(),u.callback((b,x)=>{if(b){i.stop(b);return}if(x){const v=this.jmToEntry(x);i.push(v),i.received++,(c&&m>0&&i.received>=m||x.info.pending===0)&&(i.push(c),c=void 0)}});const d=await this.js.subscribe(g,u);if(c){const{info:{last:b}}=d,x=b.num_pending+b.delivered.consumer_seq;if(x===0||i.received>=x)try{c()}catch(v){i.stop(v)}finally{c=void 0}else m=x}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(Ye.JS_NEW_CONSUMER_CREATE_API);return i}async watch(e={}){const s=e.key??">",i=new Ut,o={};o.headers_only=e.headers_only||!1;let c=Qn.LastValue;e.include===Qn.AllHistory?c=Qn.AllHistory:e.include===Qn.UpdatesOnly&&(c=Qn.UpdatesOnly);const m=e.ignoreDeletes===!0;let p=e.initializedFn,g=0;const u=this._buildCC(s,c,o),d=u.filter_subject,b=ws(u);this.canSetWatcherName()&&b.consumerName(Os.next()),b.bindStream(this.stream),e.resumeFromRevision&&e.resumeFromRevision>0&&b.startSequence(e.resumeFromRevision),b.orderedConsumer(),b.callback((v,_)=>{if(v){i.stop(v);return}if(_){const S=this.jmToEntry(_);if(m&&S.operation==="DEL")return;i.push(S),i.received++,p&&(g>0&&i.received>=g||_.info.pending===0)&&(i.push(p),p=void 0)}});const x=await this.js.subscribe(d,b);if(p){const{info:{last:v}}=x,_=v.num_pending+v.delivered.consumer_seq;if(_===0||i.received>=_)try{p()}catch(S){i.stop(S)}finally{p=void 0}else g=_}return i._data=x,i.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{i.stop()}).catch(v=>{i.stop(v)}),i}async keys(e=">"){const s=new Ut,i=this._buildCC(e,Qn.LastValue,{headers_only:!0}),o=Array.isArray(e)?">":i.filter_subject,c=ws(i);c.bindStream(this.stream),c.orderedConsumer();const m=await this.js.subscribe(o,c);return(async()=>{var g;for await(const u of m){const d=(g=u.headers)==null?void 0:g.get(gu);if(d!=="DEL"&&d!=="PURGE"){const b=this.decodeKey(u.subject.substring(this.prefixLen));s.push(b)}u.info.pending===0&&m.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),m.info.last.num_pending===0&&m.unsubscribe(),s}purgeBucket(e){return this.jsm.streams.purge(this.bucketName(),e)}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(),o=await this.jsm.streams.info(i);return new Cx(o,s)}}class Cx{constructor(e,s=""){j(this,"si");j(this,"cluster");this.si=e,this.cluster=s}get bucket(){return this.si.config.name.startsWith(wn)?this.si.config.name.substring(wn.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 um(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 e;return((e=this.si.config.placement)==null?void 0:e.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!==As.None:!1}}const dm="OBJ_",mb="SHA-256=";function P2(n){return su(n),`${dm}${n}`}function B2(n){return n.startsWith(dm)?n.substring(4):n}class Dd{constructor(e){j(this,"si");j(this,"backingStore");this.si=e,this.backingStore="JetStream"}get bucket(){return B2(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!==As.None:!1}}function cc(n){if(n===void 0)return;const{domain:e}=n;if(e===void 0)return n;const s=Object.assign({},n);if(delete s.domain,e==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${e}.API`},s}var zn;(function(n){n[n.Unset=-1]="Unset",n[n.Consume=0]="Consume",n[n.Fetch=1]="Fetch"})(zn||(zn={}));var lr;(function(n){n.HeartbeatsMissed="heartbeats_missed",n.ConsumerNotFound="consumer_not_found",n.StreamNotFound="stream_not_found",n.ConsumerDeleted="consumer_deleted",n.OrderedConsumerRecreated="ordered_consumer_recreated",n.NoResponders="no_responders"})(lr||(lr={}));var Zi;(function(n){n.DebugEvent="debug",n.Discard="discard",n.Reset="reset",n.Next="next"})(Zi||(Zi={}));const pb=Uint8Array.of(43,65,67,75),U2=Uint8Array.of(45,78,65,75),so=Uint8Array.of(43,87,80,73),z2=Uint8Array.of(43,78,88,84),I2=Uint8Array.of(43,84,69,82,77),$2=Uint8Array.of(32);function ko(n,e=5e3){return new iO(n,e)}class sd extends Ut{constructor(s,i,o=!1){super();j(this,"consumer");j(this,"opts");j(this,"sub");j(this,"monitor");j(this,"pending");j(this,"inbox");j(this,"refilling");j(this,"pong");j(this,"callback");j(this,"timeout");j(this,"cleanupHandler");j(this,"listeners");j(this,"statusIterator");j(this,"forOrderedConsumer");j(this,"resetHandler");j(this,"abortOnMissingResource");j(this,"bind");j(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,o),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=o,this.timeout=null,this.inbox=Lr(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:o,threshold_bytes:c,threshold_messages:m}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:p}=this;p&&p.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,u)=>{var b,x,v,_;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),u.subject===this.inbox){if(Ad(u))return;const S=(x=u.headers)==null?void 0:x.code,C=((_=(v=u.headers)==null?void 0:v.description)==null?void 0:_.toLowerCase())||"unknown",{msgsLeft:P,bytesLeft:q}=this.parseDiscard(u.headers);if(P>0||q>0)this.pending.msgs-=P,this.pending.bytes-=q,this.pending.requests--,this.notify(Zi.Discard,{msgsLeft:P,bytesLeft:q});else if(S===400){this.stop(new ge(C,`${S}`));return}else if(S===409&&C==="consumer deleted"){if(this.notify(lr.ConsumerDeleted,`${S} ${C}`),!this.refilling||this.abortOnMissingResource){const ne=new ge(C,`${S}`);this.stop(ne);return}}else if(S===503){if(this.notify(lr.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const ne=new ge("no responders",`${S}`);this.stop(ne);return}}else this.notify(Zi.DebugEvent,`${S} ${C}`)}else this._push(ko(u,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=u.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()})}),o&&(this.monitor=new hm(o,g=>(this.notify(lr.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var u;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const d of g)switch(d.type){case Dr.Disconnect:(u=this.monitor)==null||u.cancel();break;case Dr.Reconnect:this.resetPending().then(b=>{var x;b&&((x=this.monitor)==null||x.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(o){this.stop(o)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.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 o=cm([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(lr.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(m),!1}else if(m.message==="consumer not found"){if(s++,this.notify(lr.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 p=o.backoff(c),g=ia(p);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(Zi.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,o=dt(this.opts.idle_heartbeat),c=dt(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:o,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Wt.PendingMessagesHdr);o&&(i.msgsLeft=parseInt(o));const c=s==null?void 0:s.get(Wt.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,o;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,i){const c=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||c;const m=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||m}return o}status(){const s=new Ut;return this.listeners.push(s),Promise.resolve(s)}}class H2 extends Ut{constructor(){super();j(this,"src");j(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 o of i)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new Ut;return this.listeners.push(s),Promise.resolve(s)}}class Ld{constructor(e,s){j(this,"api");j(this,"_info");j(this,"stream");j(this,"name");this.api=e,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(e={max_messages:100,expires:3e4}){return Promise.resolve(new sd(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const s=new sd(this,e,!1),i=Math.round(s.opts.expires*1.05),o=na(i);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(e={expires:3e4}){const s=mt(),i=e;i.max_messages=1;const o=new sd(this,i,!1),c=Math.round(o.opts.expires*1.05);c>=6e4&&(async()=>{for await(const p of await o.status())if(p.type===lr.HeartbeatsMissed&&p.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const p of o){s.resolve(p);break}})().catch(()=>{});const m=na(c);return o.closed().then(p=>{p?s.reject(p):s.resolve(null)}).catch(p=>{s.reject(p)}).finally(()=>{m.cancel()}),m.catch(p=>{s.resolve(null),o.close().catch()}),o.trackTimeout(m),s}delete(){const{stream_name:e,name:s}=this._info;return this.api.delete(e,s)}info(e=!1){if(e)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(o=>(this._info=o,this._info))}}class F2{constructor(e,s,i={}){j(this,"api");j(this,"consumerOpts");j(this,"consumer");j(this,"opts");j(this,"cursor");j(this,"stream");j(this,"namePrefix");j(this,"serial");j(this,"currentConsumer");j(this,"userCallback");j(this,"iter");j(this,"type");j(this,"startSeq");j(this,"maxInitialReset");this.api=e,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Os.next(),typeof i.name_prefix=="string"&&(Au("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=zn.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(e){this.serial++;const s=`${this.namePrefix}_${this.serial}`;e=e===0?1:e;const i={name:s,deliver_policy:Et.StartSequence,opt_start_seq:e,ack_policy:Bt.None,inactive_threshold:dt(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),e===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||Et.StartSequence,(this.consumerOpts.deliver_policy===Et.LastPerSubject||this.consumerOpts.deliver_policy===Et.New||this.consumerOpts.deliver_policy===Et.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===Et.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=Et.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=dt(this.consumerOpts.inactive_threshold))),i}async resetConsumer(e=0){var m,p,g,u,d;Os.next();const s=this.serial===0;(m=this.consumer)==null||m.delete().catch(()=>{}),e=e===0?1:e,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(e);i.max_deliver=1,i.mem_storage=!0;const o=cm([((p=this.opts)==null?void 0:p.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(lr.OrderedConsumerRecreated,c.name);break}catch(x){if(x.message==="stream not found"&&((u=this.iter)==null||u.notify(lr.StreamNotFound,b),this.type===zn.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(x),Promise.reject(x);if(s&&b>=this.maxInitialReset)throw x;await ia(o.backoff(b+1))}return c}internalHandler(e){return s=>{var o;if(this.serial!==e)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):(o=this.iter)==null||o.push(s)}}async reset(e={max_messages:100,expires:3e4},s){var g,u;s=s||{};const i=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===zn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((u=this.iter)==null?void 0:u.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new H2),this.consumer=new Ld(this.api,this.currentConsumer);const c=e;c.callback=this.internalHandler(this.serial);let m=null;this.type===zn.Fetch&&i?m=await this.consumer.fetch(e):this.type===zn.Consume&&(m=await this.consumer.consume(e));const p=m;p.forOrderedConsumer=!0,p.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(p)}notifyOrderedResetAndReset(){var e;(e=this.iter)==null||e.notify(Zi.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===zn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===zn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=e;return i&&(this.userCallback=i),this.type=zn.Consume,this.opts=e,await this.reset(e),this.iter}async fetch(e={max_messages:100,expires:3e4}){var o;if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===zn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:i}=e;return i&&(this.userCallback=i),this.type=zn.Fetch,this.opts=e,await this.reset(e,{fromFetch:!0}),this.iter}async next(e={expires:3e4}){const s=e;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=mt();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(e=>Promise.resolve(e)).catch(e=>Promise.reject(e)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(e){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):e&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class qd{constructor(e){j(this,"api");j(this,"notified");this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(Ye.JS_SIMPLIFICATION);return e.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`))}getPullConsumerFor(e){if(e.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Ld(this.api,e)}async get(e,s={}){return typeof s=="object"?this.ordered(e,s):(await this.checkVersion(),this.api.info(e,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Ld(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(e,s){await this.checkVersion();const i=this.api;return new mm(i.nc,i.opts).info(e).then(c=>Promise.resolve(new F2(this.api,e,s))).catch(c=>Promise.reject(c))}}class ku{constructor(e,s){j(this,"api");j(this,"_info");this.api=e,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(e=>e.alternates?e.alternates:[])}async best(){if(await this.info(),this._info.alternates){const e=await this.api.info(this._info.alternates[0].name);return new ku(this.api,e)}else return this}info(e=!1,s){return e?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(e){return new qd(new mu(this.api.nc,this.api.opts)).getPullConsumerFor(e)}getConsumer(e){return new qd(new mu(this.api.nc,this.api.opts)).get(this.name,e)}getMessage(e){return this.api.getMessage(this.name,e)}deleteMessage(e,s){return this.api.deleteMessage(this.name,e,s)}}class mm extends Ro{constructor(e,s){super(e,s)}checkStreamConfigVersions(e){const s=this.nc;if(e.metadata){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${o}`)}if(e.first_seq){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${o}`)}if(e.subject_transform){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(e.compression){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${o}`)}if(e.consumer_limits){const{min:o,ok:c}=s.features.get(Ye.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function i(o,c){var p;if((((p=c==null?void 0:c.subject_transforms)==null?void 0:p.length)||0)>0){const{min:g,ok:u}=s.features.get(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!u)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}e.sources&&e.sources.forEach(o=>{i("stream sources",o)}),e.mirror&&i("stream mirror",e.mirror)}async add(e={}){var o;this.checkStreamConfigVersions(e),Jt(e.name),e.mirror=cc(e.mirror),e.sources=(o=e.sources)==null?void 0:o.map(cc);const i=await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`,e);return this._fixInfo(i),i}async delete(e){return Jt(e),(await this._request(`${this.prefix}.STREAM.DELETE.${e}`)).success}async update(e,s={}){var p;if(typeof e=="object"){const g=e;e=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),Jt(e);const i=await this.info(e),o=Object.assign(i.config,s);o.mirror=cc(o.mirror),o.sources=(p=o.sources)==null?void 0:p.map(cc);const m=await this._request(`${this.prefix}.STREAM.UPDATE.${e}`,o);return this._fixInfo(m),m}async info(e,s){Jt(e);const i=`${this.prefix}.STREAM.INFO.${e}`;let c=await this._request(i,s),{total:m,limit:p}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(m&&m>g){const u=[c],d=s||{};let b=0;for(;m>g;){b++,d.offset=p*b;const v=await this._request(i,d);m=v.total,u.push(v);const _=Object.getOwnPropertyNames(v.state.subjects).length;if(g+=_,_<p)break}let x={};for(let v=0;v<u.length;v++)c=u[v],c.state.subjects&&(x=Object.assign(x,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=x}return this._fixInfo(c),c}list(e=""){const s=e!=null&&e.length?{subject:e}:{},i=c=>{const m=c;return m.streams.forEach(p=>{this._fixInfo(p)}),m.streams},o=`${this.prefix}.STREAM.LIST`;return new bo(o,i,this,s)}_fixInfo(e){e.config.sealed=e.config.sealed||!1,e.config.deny_delete=e.config.deny_delete||!1,e.config.deny_purge=e.config.deny_purge||!1,e.config.allow_rollup_hdrs=e.config.allow_rollup_hdrs||!1}async purge(e,s){if(s){const{keep:o,seq:c}=s;if(typeof o=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Jt(e),await this._request(`${this.prefix}.STREAM.PURGE.${e}`,s)}async deleteMessage(e,s,i=!0){Jt(e);const o={seq:s};return i||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${e}`,o)).success}async getMessage(e,s){Jt(e);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${e}`,s);return new Mx(o)}find(e){return this.findStream(e)}listKvs(){const e=i=>{var g;const c=i.streams.filter(u=>u.config.name.startsWith(wn));c.forEach(u=>{this._fixInfo(u)});let m="";return c.length&&(m=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(u=>new Cx(u,m))},s=`${this.prefix}.STREAM.LIST`;return new bo(s,e,this)}listObjectStores(){const e=i=>{const c=i.streams.filter(p=>p.config.name.startsWith(dm));return c.forEach(p=>{this._fixInfo(p)}),c.map(p=>new Dd(p))},s=`${this.prefix}.STREAM.LIST`;return new bo(s,e,this)}names(e=""){const s=e!=null&&e.length?{subject:e}:{},i=c=>c.streams,o=`${this.prefix}.STREAM.NAMES`;return new bo(o,i,this,s)}async get(e){const s=await this.info(e);return Promise.resolve(new ku(this,s))}}class G2 extends Ro{constructor(e,s){super(e,s)}async getMessage(e,s){Jt(e);let i=s;const{last_by_subj:o}=i;o&&(i=null);const c=i?this.jc.encode(i):jn,m=this.opts.apiPrefix||"$JS.API",p=o?`${m}.DIRECT.GET.${e}.${o}`:`${m}.DIRECT.GET.${e}`,g=await this.nc.request(p,c,{timeout:this.timeout}),u=Xi(g);if(u)return Promise.reject(u);const d=new Pd(g);return Promise.resolve(d)}async getBatch(e,s){Jt(e);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${e}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,u)=>g==="up_to_time"&&u instanceof Date?u.toISOString():u),m=new Ut,p=await this.nc.requestMany(o,c,{strategy:Wn.SentinelMsg});return(async()=>{var b,x,v;let g=!1,u=!1,d;for await(const _ of p){if(!g){g=!0;const S=((b=_.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){d=(x=_.headers)==null?void 0:x.description.toLowerCase();break}if(((v=_.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){u=!0;break}}if(_.data.length===0)break;m.push(new Pd(_))}m.push(()=>{if(u)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 Pd{constructor(e){j(this,"data");j(this,"header");if(!e.headers)throw new Error("headers expected");this.data=e.data,this.header=e.headers}get subject(){return this.header.last(Ki.Subject)}get seq(){const e=this.header.last(Ki.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ki.TimeStamp)}get stream(){return this.header.last(Ki.Stream)}json(e){return Zn(e).decode(this.data)}string(){return En.decode(this.data)}}j(Pd,"jc");class V2 extends Ro{constructor(s,i){super(s,i);j(this,"streams");j(this,"consumers");j(this,"direct");this.streams=new mm(s,i),this.consumers=new mu(s,i),this.direct=new G2(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Ut;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,o)=>{if(i)throw i;try{const c=this.parseJsResponse(o),m=c.type.split("."),p=m[m.length-1];s.push({kind:p,data:c})}catch(c){s.stop(c)}}}),s}}class Mx{constructor(e){j(this,"_header");j(this,"smr");this.smr=e}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):jn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=_s.decode(e)}else this._header=Pr();return this._header}_parse(e){const s=atob(e),i=s.length,o=new Uint8Array(i);for(let c=0;c<i;c++)o[c]=s.charCodeAt(c);return o}json(e){return Zn(e).decode(this.data)}string(){return En.decode(this.data)}}j(Mx,"jc");class Y2{constructor(e){j(this,"api");this.api=e}get(e){return this.api.info(e).then(s=>new ku(this.api,s))}}class id{constructor(e){j(this,"info");j(this,"hdrs");this.info=e}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=_s.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 e,s;return((e=this.info.options)==null?void 0:e.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function yb(n){const e={name:n.name,description:n.description??"",options:n.options,metadata:n.metadata};if(n.headers){const s=n.headers;e.headers=s.toRecord()}return e}function K2(){return new ReadableStream({pull(n){n.enqueue(new Uint8Array(0)),n.close()}})}class So{constructor(e,s,i){j(this,"jsm");j(this,"js");j(this,"stream");j(this,"name");this.name=e,this.jsm=s,this.js=i}_checkNotEmpty(e){return!e||e.length===0?{name:e,error:new Error("name cannot be empty")}:{name:e}}async info(e){const s=await this.rawInfo(e);return s?new id(s):null}async list(){const e=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;e.push(i)}return Promise.resolve(e)}async rawInfo(e){const{name:s,error:i}=this._checkNotEmpty(e);if(i)return Promise.reject(i);const o=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),p=Zn().decode(c.data);return p.revision=c.seq,p}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(e){try{return await this.jsm.streams.info(this.stream,e)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let e=await this._si();return e===null?Promise.reject(new Error("object store not found")):(e.config.sealed=!0,e=await this.jsm.streams.update(this.stream,e.config),Promise.resolve(new Dd(e)))}async status(e){const s=await this._si(e);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Dd(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,s,i){var te;const o=this.js.getOptions();i=i||{timeout:o.timeout},i.timeout=i.timeout||o.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:m}=i,p=this.js.nc.info,g=(p==null?void 0:p.max_payload)||1024;e=e||{},e.options=e.options||{};let u=((te=e.options)==null?void 0:te.max_chunk_size)||128*1024;u=u>g?g:u,e.options.max_chunk_size=u;const d=await this.info(e.name),{name:b,error:x}=this._checkNotEmpty(e.name);if(x)return Promise.reject(x);const v=Os.next(),_=this._chunkSubject(v),S=this._metaSubject(b),C=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},yb(e)),P=mt(),q=[],ne=new sa;try{const M=s?s.getReader():null,U=ib.create();for(;;){const{done:ae,value:z}=M?await M.read():{done:!0,value:void 0};if(ae){if(ne.size()>0){const W=ne.drain();U.update(W),C.chunks++,C.size+=W.length,q.push(this.js.publish(_,W,{timeout:c}))}await Promise.all(q),q.length=0,C.mtime=new Date().toISOString();const I=Wi.encode(U.digest());C.digest=`${mb}${I}`,C.deleted=!1;const D=Pr();typeof m=="number"&&D.set(or.ExpectedLastSubjectSequenceHdr,`${m}`),D.set(Wt.RollupHdr,Wt.RollupValueSubject);const X=await this.js.publish(S,Zn().encode(C),{headers:D,timeout:c});if(C.revision=X.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}P.resolve(new id(C));break}if(z)for(ne.fill(z);ne.size()>u;){C.chunks++,C.size+=u;const I=ne.drain(e.options.max_chunk_size);U.update(I),q.push(this.js.publish(_,I,{timeout:c}))}}}catch(M){await this.jsm.streams.purge(this.stream,{filter:_}),P.reject(M)}return P}putBlob(e,s,i){function o(c){return new ReadableStream({pull(m){m.enqueue(c),m.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(e,o(s),i)}put(e,s,i){var o;return(o=e==null?void 0:e.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(e,s,i)}async getBlob(e){async function s(c){const m=new sa,p=c.getReader();for(;;){const{done:g,value:u}=await p.read();if(g)return m.drain();u&&u.length&&m.fill(u)}}const i=await this.get(e);if(i===null)return Promise.resolve(null);const o=await Promise.all([i.error,s(i.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(e){const s=await this.rawInfo(e);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 So.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(mb))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=Nd(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=mt(),c={info:new id(s),error:o};if(s.size===0)return c.data=K2(),o.resolve(null),Promise.resolve(c);let m;const p=ws();p.orderedConsumer();const g=ib.create(),u=`$O.${this.name}.C.${s.nuid}`,d=await this.js.subscribe(u,p);return(async()=>{for await(const b of d)b.data.length>0&&(g.update(b.data),m.enqueue(b.data)),b.info.pending===0&&(qE(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(()=>{o.resolve()}).catch(b=>{m.error(b),o.reject(b)}),c.data=new ReadableStream({start(b){m=b},cancel(){d.unsubscribe()}}),c}linkStore(e,s){if(!(s instanceof So))return Promise.reject("bucket required");const i=s,{name:o,error:c}=this._checkNotEmpty(e);if(c)return Promise.reject(c);const m={name:o,options:{link:{bucket:i.name}}};return this._put(m,null)}async link(e,s){const{name:i,error:o}=this._checkNotEmpty(e);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(e);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},p={name:i,bucket:s.bucket,options:{link:m}};await this.js.publish(this._metaSubject(e),JSON.stringify(p));const g=await this.info(e);return Promise.resolve(g)}async delete(e){const s=await this.rawInfo(e);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Zn(),o=Pr();return o.set(Wt.RollupHdr,Wt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(e,s={}){const i=await this.rawInfo(e);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:o,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(e!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const m=Object.assign({},i,yb(s)),p=await this.js.publish(this._metaSubject(m.name),JSON.stringify(m));return e!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(e)}),Promise.resolve(p)}async watch(e={}){e.includeHistory=e.includeHistory??!1,e.ignoreDeletes=e.ignoreDeletes??!1;let s=!1;const i=new Ut,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Zn(),m=ws();m.orderedConsumer(),e.includeHistory?m.deliverLastPerSubject():(s=!0,m.deliverNew()),m.callback((g,u)=>{var d;if(g){i.stop(g);return}if(u!==null){const b=c.decode(u.data);b.deleted&&e.ignoreDeletes===!0||i.push(b),((d=u.info)==null?void 0:d.pending)===0&&!s&&(s=!0,i.push(null))}});const p=await this.js.subscribe(o,m);return i._data=p,i.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(e){return`$O.${this.name}.C.${e}`}_metaSubject(e){return`$O.${this.name}.M.${Wi.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=P2(this.name)}catch(o){return Promise.reject(o)}const s=(e==null?void 0:e.ttl)||0;delete e.ttl;const i=Object.assign({max_age:s},e);i.name=this.stream,i.num_replicas=e.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=Oo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],e.placement&&(i.placement=e.placement),e.metadata&&(i.metadata=e.metadata),typeof e.compression=="boolean"&&(i.compression=e.compression?As.S2:As.None);try{await this.jsm.streams.info(i.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(e,s,i={}){const o=await e.jetstreamManager(),c=new So(s,o,e);return await c.init(i),Promise.resolve(c)}}class J2{constructor(e){j(this,"js");this.js=e}kv(e,s={}){const i=this.js,{ok:o,min:c}=i.nc.features.get(Ye.JS_KV);return o?s.bindOnly?jo.bind(this.js,e,s):jo.create(this.js,e,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(e,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:o,min:c}=i.nc.features.get(Ye.JS_OBJECTSTORE);return o?So.create(this.js,e,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class pm extends Ro{constructor(s,i){super(s,i);j(this,"consumers");j(this,"streams");j(this,"consumerAPI");j(this,"streamAPI");this.consumerAPI=new mu(s,i),this.streamAPI=new mm(s,i),this.consumers=new qd(this.consumerAPI),this.streams=new Y2(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 J2(this)}async publish(s,i=jn,o){o=o||{},o.expect=o.expect||{};const c=(o==null?void 0:o.headers)||Pr();o&&(o.msgID&&c.set(or.MsgIdHdr,o.msgID),o.expect.lastMsgID&&c.set(or.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&c.set(or.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&c.set(or.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&c.set(or.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const m=o.timeout||this.timeout,p={};m&&(p.timeout=m),o&&(p.headers=c);let{retries:g,retry_delay:u}=o;g=g||1,u=u||250;let d;for(let x=0;x<g;x++)try{d=await this.nc.request(s,i,p);break}catch(v){if(v.code==="503"&&x+1<g)await ia(u);else throw v}const b=this.parseJsResponse(d);if(b.stream==="")throw ge.errorForCode(fe.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,o=0){Jt(s),Qi(i);let c=this.timeout;o>c&&(c=o),o=o<0?0:dt(o);const m={batch:1,no_wait:o===0,expires:o},p=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{noMux:!0,timeout:c}),g=Xi(p);if(g)throw g;return ko(p,this.timeout)}fetch(s,i,o={}){Jt(s),Qi(i);let c=null;const m=(o.max_bytes??0)>0;let p=0;const g=m?o.max_bytes:0;let u=null;const d={};if(d.batch=o.batch||1,g){const q=this.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!q.ok)throw new Error(`max_bytes is only supported on servers ${q.min} or better`);d.max_bytes=g}d.no_wait=o.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const b=o.expires||0;if(b&&(d.expires=dt(b)),b===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const x=o.idle_heartbeat||0;x&&(d.idle_heartbeat=dt(x),o.delay_heartbeat===!0&&(d.idle_heartbeat=dt(x*4)));const v=new Ut,_=d.batch;let S=0;v.protocolFilterFn=(q,ne=!1)=>Ad(q.msg)?(u==null||u.work(),!1):!0,v.dispatchedFn=q=>{if(q){if(m&&(p+=q.data.length),S++,c&&q.info.pending===0)return;(v.getPending()===1&&q.info.pending===0||_===S||g>0&&p>=g)&&v.stop()}};const C=Lr(this.nc.options.inboxPrefix),P=this.nc.subscribe(C,{max:o.batch,callback:(q,ne)=>{q===null&&(q=Xi(ne)),q!==null?(c&&(c.cancel(),c=null),gE(q)?v.stop(Dx(q)===null?void 0:q):v.stop(q)):(u==null||u.work(),v.received++,v.push(ko(ne,this.timeout)))}});return b&&(c=na(b),c.catch(()=>{P.isClosed()||(P.drain().catch(()=>{}),c=null),u&&u.cancel()})),(async()=>{try{x&&(u=new hm(x,q=>(v.push(()=>{v.err=new ge(`${In.IdleHeartbeatMissed}: ${q}`,fe.JetStreamIdleHeartBeat)}),!0)))}catch{}await P.closed,c!==null&&(c.cancel(),c=null),u&&u.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{reply:C}),v}async pullSubscribe(s,i=ws()){const o=await this._processOptions(s,i);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=o.config.ack_policy;if(c===Bt.None||c===Bt.All)throw new Error("ack policy for pull consumers must be explicit");const m=this._buildTypedSubscriptionOpts(o),p=new Z2(this,o.deliver,m);p.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw p.unsubscribe(),g}return p}async subscribe(s,i=ws()){const o=await this._processOptions(s,i);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(o),m=new Rx(this,o.deliver,c);m.info=o;try{await this._maybeCreateConsumer(o)}catch(p){throw m.unsubscribe(),p}return m._maybeSetupHbMonitoring(),m}async _processOptions(s,i=ws()){const o=tb(i)?i.getOpts():i;if(o.isBind=tb(i)?i.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==Bt.NotSet&&o.config.ack_policy!==Bt.None)throw new ge("ordered consumer: ack_policy can only be set to 'none'",fe.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ge("ordered consumer: durable_name cannot be set",fe.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ge("ordered consumer: deliver_subject cannot be set",fe.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ge("ordered consumer: max_deliver cannot be set",fe.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ge("ordered consumer: deliver_group cannot be set",fe.ApiError);o.config.deliver_subject=Lr(this.nc.options.inboxPrefix),o.config.ack_policy=Bt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||dt(5e3),o.config.ack_wait=dt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===Bt.NotSet&&(o.config.ack_policy=Bt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const c=await this.consumerAPI.info(o.stream,o.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=o.config.deliver_group??"";if(m===""&&c.push_bound===!0)throw new Error("duplicate subscription");const p=c.config.deliver_group??"";if(m!==p)throw p===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${p}'`);o.last=c,o.config=c.config,o.attached=!0,o.config.durable_name||(o.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||Lr(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=eO(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=pm.ingestionFn(s.ordered),i.protocolFilterFn=(o,c=!1)=>{const m=o;return Od(m.msg)?(c||m.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Bt.None&&(i.dispatchedFn=rO),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:Et.All,ack_policy:Bt.Explicit,ack_wait:dt(30*1e3),replay_policy:ra.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,o)=>{var g;const c=o;if(!i)return{ingest:!1,protocol:!1};const m=i;if(Xi(m.msg)||(g=c.monitor)==null||g.work(),Ad(m.msg)){const u=s?c._checkHbOrderConsumer(m.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:u,protocol:!0}}else if(Od(m.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class ym{constructor(e){j(this,"options");j(this,"protocol");j(this,"draining");j(this,"listeners");j(this,"_services");this.draining=!1,this.options=b2(e),this.listeners=[]}static connect(e={}){return new Promise((s,i)=>{const o=new ym(e);yu.connect(o.options,o).then(c=>{o.protocol=c,(async function(){for await(const m of c.status())o.listeners.forEach(p=>{p.push(m)})})(),s(o)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(e,s,i){if(this.isClosed())throw ge.errorForCode(fe.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw ge.errorForCode(fe.ConnectionDraining);if(e=e||"",e.length===0)throw ge.errorForCode(fe.BadSubject)}publish(e,s,i){this._check(e,!1,!0),this.protocol.publish(e,s,i)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return e.reply?(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0):!1}subscribe(e,s={}){this._check(e,!0,!1);const i=new Nx(this.protocol,e,s);return this.protocol.subscribe(i),i}_resub(e,s,i){this._check(s,!0,!1);const o=e;o.max=i,i&&(o.max=i+o.received),this.protocol.resub(o,s)}requestMany(e,s=jn,i={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Wn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new ge("timeout",fe.InvalidOption));const c=new Ut;function m(g){c.push(()=>{c.stop(g)})}function p(g,u){g||u===null?m(g===null?void 0:g):c.push(u)}if(i.noMux){const g=o?new Error().stack:null;let u=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const d=this.subscribe(Lr(this.options.inboxPrefix),{callback:(_,S)=>{var C,P;if(((C=S==null?void 0:S.data)==null?void 0:C.length)===0&&((P=S==null?void 0:S.headers)==null?void 0:P.status)===fe.NoResponders&&(_=ge.errorForCode(fe.NoResponders)),_){g&&(_.stack+=`
48
48
 
49
- ${g}`),b(w);return}p(null,S),i.strategy===Wn.Count&&(u--,u===0&&b()),i.strategy===Wn.JitterTimer&&(v(),x=setTimeout(()=>{b()},300)),i.strategy===Wn.SentinelMsg&&S&&S.data.length===0&&b()}});d.requestSubject=e,d.closed.then(()=>{m()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),v(),d.drain().then(()=>{m()}).catch(S=>{m()})};c.iterClosed.then(()=>{v(),d==null||d.unsubscribe()}).catch(w=>{v(),d==null||d.unsubscribe()});try{this.publish(e,s,{reply:d.getSubject()})}catch(w){b(w)}let x=setTimeout(()=>{b()},i.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const g=i;g.callback=p,c.iterClosed.then(()=>{u.cancel()}).catch(d=>{u.cancel(d)});const u=new qE(this.protocol.muxSubscriptions,e,g);this.protocol.request(u);try{this.publish(e,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:i.headers})}catch(d){u.cancel(d)}}return Promise.resolve(c)}request(e,s,i={timeout:1e3,noMux:!1}){try{this._check(e,!0,!0)}catch(c){return Promise.reject(c)}const o=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new ge("timeout",fe.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new ge("reply can only be used with noMux",fe.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Lr(this.options.inboxPrefix),m=mt(),p=o?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(u,d)=>{u?(p&&u.code!==fe.Timeout&&(u.stack+=`
49
+ ${g}`),b(_);return}p(null,S),i.strategy===Wn.Count&&(u--,u===0&&b()),i.strategy===Wn.JitterTimer&&(v(),x=setTimeout(()=>{b()},300)),i.strategy===Wn.SentinelMsg&&S&&S.data.length===0&&b()}});d.requestSubject=e,d.closed.then(()=>{m()}).catch(_=>{c.stop(_)});const b=_=>{_&&c.push(()=>{throw _}),v(),d.drain().then(()=>{m()}).catch(S=>{m()})};c.iterClosed.then(()=>{v(),d==null||d.unsubscribe()}).catch(_=>{v(),d==null||d.unsubscribe()});try{this.publish(e,s,{reply:d.getSubject()})}catch(_){b(_)}let x=setTimeout(()=>{b()},i.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const g=i;g.callback=p,c.iterClosed.then(()=>{u.cancel()}).catch(d=>{u.cancel(d)});const u=new PE(this.protocol.muxSubscriptions,e,g);this.protocol.request(u);try{this.publish(e,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:i.headers})}catch(d){u.cancel(d)}}return Promise.resolve(c)}request(e,s,i={timeout:1e3,noMux:!1}){try{this._check(e,!0,!0)}catch(c){return Promise.reject(c)}const o=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new ge("timeout",fe.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new ge("reply can only be used with noMux",fe.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Lr(this.options.inboxPrefix),m=mt(),p=o?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(u,d)=>{u?(p&&u.code!==fe.Timeout&&(u.stack+=`
50
50
 
51
- ${p.stack}`),g.unsubscribe(),m.reject(u)):(u=xx(d),u?(p&&(u.stack+=`
51
+ ${p.stack}`),g.unsubscribe(),m.reject(u)):(u=vx(d),u?(p&&(u.stack+=`
52
52
 
53
- ${p.stack}`),m.reject(u)):m.resolve(d))}});return g.requestSubject=e,this.protocol.publish(e,s,{reply:c,headers:i.headers}),m}else{const c=new wx(this.protocol.muxSubscriptions,e,i,o);this.protocol.request(c);try{this.publish(e,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(p){c.cancel(p)}const m=Promise.race([c.timer,c.deferred]);return m.catch(()=>{c.cancel()}),m}}flush(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(ge.errorForCode(fe.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Ut;return e.iterClosed.then(()=>{const s=this.listeners.indexOf(e);this.listeners.splice(s,1)}),this.listeners.push(e),e}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(e={}){const s=new G2(this,e);if(e.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===fe.NoResponders&&(o.code=fe.JetStreamNotEnabled),o}return s}jetstream(e={}){return new pm(this,e)}getServerVersion(){const e=this.info;return e?ti(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ge.errorForCode(fe.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new J2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(ge.errorForCode(fe.ConnectionDraining)):this.protocol.reconnect()}}class J2{constructor(e){j(this,"nc");this.nc=e}add(e){try{return new Do(this.nc,e).start()}catch(s){return Promise.reject(s)}}client(e,s){return new k2(this.nc,e,s)}}class Q2{constructor(e,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=e,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(gu)||"PUT"}get length(){const e=this.sm.header.get(Wt.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class X2{constructor(e,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=e,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(um(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(gu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const e=((s=this.sm.headers)==null?void 0:s.get(Wt.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Mx extends zE{constructor(s,i,o){super(s.nc,i,o);j(this,"js");j(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=Lr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=Os.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=Et.StartSequence,c.config.opt_start_seq=s;const m={};m.stream_name=this.info.stream,m.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,m,{retries:-1}).then(g=>{const u=g,d=this.sub.info;d.last=u,this.info.config=u.config,this.info.name=u.name}).catch(g=>{const u=new ge(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,fe.RequestError,g);this.sub.callback(u,{})})}_maybeSetupHbMonitoring(){var i,o;const s=((o=(i=this.info)==null?void 0:i.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(um(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,m=p=>{var d,b,x,v;const g=vE(409,`${In.IdleHeartbeatMissed}: ${p}`,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=((x=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(w+1),(v=this.monitor)==null||v.restart(),!1}return!c.noIterator};this.monitor=new hm(s,m,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Wt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Wt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,o=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=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(o);return s.last=c,c}}class W2 extends Mx{constructor(e,s,i){super(e,s,i)}pull(e={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,m={};if(m.batch=e.batch||1,m.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const u=this.js.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);m.max_bytes=e.max_bytes}let p=0;e.expires&&e.expires>0&&(p=e.expires,m.expires=dt(p));let g=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(g=e.idle_heartbeat,m.idle_heartbeat=dt(g)),g&&p===0)throw new Error("idle_heartbeat requires expires");if(g>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&g&&(this.monitor?this.monitor._change(g,p):this._setupHbMonitoring(g,p));const u=this.info.api,d=`${u.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;u.nc.publish(d,u.jc.encode(m),{reply:b})}}}function Z2(n,e){return n?tO(e):eO(e)}function eO(n){return(e,s)=>e?[e,null]:(e=Xi(s),e?[e,null]:[null,ko(s,n)])}function tO(n){return(e,s)=>{if(e)return[e,null];const i=Xi(s);return i!==null?[Rx(i),null]:[null,ko(s,n)]}}function Rx(n){if(n!==null)switch(n.code){case fe.JetStream404NoMessages:case fe.JetStream408RequestTimeout:return null;case fe.JetStream409:return _E(n)?n:null;default:return n}return null}function nO(n){n&&n.ack()}function rO(n){const e=n.split(".");if(e.length===9&&e.splice(2,0,"_",""),e.length<11||e[0]!=="$JS"||e[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=e[2]==="_"?"":e[2],s.account_hash=e[3],s.stream=e[4],s.consumer=e[5],s.deliveryCount=parseInt(e[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(e[7],10),s.deliverySequence=parseInt(e[8],10),s.timestampNanos=parseInt(e[9],10),s.pending=parseInt(e[10],10),s}class sO{constructor(e,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=e,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=rO(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===so[0]&&e[1]===so[1]&&e[2]===so[2]&&e[3]===so[3]}async ackAck(e){var i;e=e||{},e.timeout=e.timeout||this.timeout;const s=mt();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),p=new wx(c.muxSubscriptions,this.msg.reply,{timeout:e.timeout},m);c.request(p);try{c.publish(this.msg.reply,mb,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),s.resolve(!0)}catch(g){p.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(mb)}nak(e){let s=B2;e&&(s=Ed().encode(`-NAK ${JSON.stringify({delay:dt(e)})}`)),this.doAck(s)}working(){this.doAck(so)}next(e,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=dt(s.expires));const o=Zn().encode(i),c=sa.concat(U2,I2,o),m=e?{reply:e}:void 0;this.msg.respond(c,m)}term(e=""){let s=z2;(e==null?void 0:e.length)>0&&(s=Ed().encode(`+TERM ${e}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const iO="1.30.3",aO="nats.ws";class oO{constructor(){j(this,"version");j(this,"lang");j(this,"closeError");j(this,"connected");j(this,"done");j(this,"socket");j(this,"options");j(this,"socketClosed");j(this,"encrypted");j(this,"peeked");j(this,"yields");j(this,"signal");j(this,"closedNotification");this.version=iO,this.lang=aO,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=mt(),this.closedNotification=mt()}async connect(e,s){const i=mt();if(s.tls)return i.reject(new ge("tls",fe.InvalidOption)),i;this.options=s;const o=e.src;if(s.wsFactory){const{socket:c,encrypted:m}=await s.wsFactory(e.src,s);this.socket=c,this.encrypted=m}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const m=sa.concat(...this.yields),p=VE(m);if(p!==""){const g=v2.exec(p);if(!g){s.debug&&console.error("!!!",ac(m)),i.reject(new Error("unexpected response from server"));return}try{const u=JSON.parse(g[1]);b2(u,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(u){i.reject(u);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,p=new ge(m.message,fe.Unknown,new Error(m.error));i.reject(p)},i}disconnect(){this._closed(void 0,!0)}async _closed(e,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ia(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}s&&this.closedNotification.resolve(e)}}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 e=this.yields;this.yields=[];for(let s=0;s<e.length;s++)this.options.debug&&console.info(`> ${ac(e[s])}`),yield e[s];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=mt())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${ac(e)}`);return}catch(s){this.options.debug&&console.error(`!!! ${ac(e)}: ${s}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function lO(n,e){/^(.*:\/\/)(.*)/.test(n)||(typeof e=="boolean"?n=`${e===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(e=!1),o==="wss:"&&(e=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,m;const p=i.hostname,g=i.pathname,u=i.search||"";switch(o){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||e===!0?"443":"80",c=e===!0?"wss:":"ws:";break}return`${c}//${p}:${m}${g}${u}`}function cO(n={}){return IE({defaultPort:443,urlParseFn:lO,factory:()=>new oO}),ym.connect(n)}const uO=null,fO=null,Xt="lt.events";function Dx(n,e){const s=n.split("."),i=e.split(".");for(let o=0;o<i.length;o++){const c=i[o];if(c===">")return!0;if(o>=s.length||c!=="*"&&c!==s[o])return!1}return s.length===i.length}const aa=E.createContext({connected:!1,subscribe:()=>()=>{}});function Lx(){const{connected:n}=E.useContext(aa);return{connected:n}}function An(n,e){const{subscribe:s}=E.useContext(aa),i=E.useRef(e);i.current=e,E.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function js(n,e){const{subscribe:s}=E.useContext(aa),i=E.useRef(e);i.current=e;const o=n.join(","),c=E.useMemo(()=>o.split(",").filter(Boolean),[o]);E.useEffect(()=>{const m=g=>i.current(g),p=c.map(g=>s(g,m));return()=>p.forEach(g=>g())},[s,c])}const qx=E.createContext({connected:!1,unavailable:!1,subscribe:()=>()=>{}});function hO(){const{connected:n,unavailable:e}=E.useContext(qx);return{connected:n,unavailable:e}}const dO=Ed();function mO({children:n,url:e,token:s,resolveCredentials:i,policy:o=yo,onReconnect:c,sessionKey:m}){const p=E.useRef(null),[g,u]=E.useState(!1),[d,b]=E.useState(!1),[x,v]=E.useState(!1),w=E.useRef({url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c});w.current={url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c};const S=E.useRef(new Map),C=E.useRef(new Map),P=E.useCallback((se,M)=>{(async()=>{for await(const U of M)try{if(!Dx(U.subject,se))continue;const ae=JSON.parse(dO.decode(U.data)),z=S.current.get(se);if(!z)continue;for(const I of z)try{I(ae)}catch{}}catch{}})()},[]),q=E.useCallback(se=>{var U;const M=p.current;if(!(!M||(U=M.isClosed)!=null&&U.call(M)||C.current.has(se)))try{const ae=M.subscribe(se);C.current.set(se,ae),P(se,ae)}catch{}},[P]),re=E.useCallback((se,M)=>{const U=S.current;return U.has(se)||U.set(se,new Set),U.get(se).add(M),q(se),()=>{const ae=U.get(se);if(ae&&(ae.delete(M),ae.size===0)){U.delete(se);const z=C.current.get(se);if(z){C.current.delete(se);try{z.unsubscribe()}catch{}}}}},[q]);return E.useEffect(()=>{let se=!1,M=!1,U=!1,ae=!1,z=0,I,D;v(!1);const X=()=>typeof document<"u"&&document.visibilityState==="hidden",W=async()=>{const{url:J,token:le,resolveCredentials:pe}=w.current;if(pe)return pe();const ye=J||uO;return ye?{kind:"ok",url:ye,token:le||fO||null}:{kind:"unavailable"}},he=(J=cE(z++,w.current.policy))=>{se||M||(I=setTimeout(Oe,J))},we=J=>{J.closed().then(()=>{p.current===J&&(p.current=null,C.current.clear(),u(!1),he(Fg(w.current.policy)))})};async function Oe(){if(I=void 0,!(se||M||U||p.current)&&!X()){U=!0;try{const J=await W();if(se)return;if(J.kind==="session-ended"){M=!0,v(!0);return}if(J.kind==="unavailable"){he();return}const le=await cO({servers:J.url,token:J.token??void 0,reconnect:!1});if(se){le.close().catch(()=>{});return}p.current=le,z=0,u(!0),C.current.clear();for(const pe of S.current.keys())q(pe);ae&&(D=setTimeout(()=>{var pe,ye;return(ye=(pe=w.current).onReconnect)==null?void 0:ye.call(pe)},Fg(w.current.policy))),ae=!0,we(le)}catch{se||he()}finally{U=!1}}}const F=()=>{se||M||U||p.current||X()||(I&&clearTimeout(I),z=0,Oe())};return document.addEventListener("visibilitychange",F),window.addEventListener("online",F),Oe(),()=>{se=!0,I&&clearTimeout(I),D&&clearTimeout(D),document.removeEventListener("visibilitychange",F),window.removeEventListener("online",F);for(const J of C.current.values())try{J.unsubscribe()}catch{}C.current.clear(),p.current&&(p.current.close().catch(()=>{}),p.current=null),u(!1)}},[q,m]),E.useEffect(()=>{if(g||x){b(!1);return}const se=setTimeout(()=>b(!0),o.noticeAfterMs);return()=>clearTimeout(se)},[g,x,o.noticeAfterMs]),h.jsx(qx.Provider,{value:{connected:g,unavailable:d,subscribe:re},children:h.jsx(aa.Provider,{value:{connected:g,subscribe:re},children:n})})}const ur=Object.create(null);ur.open="0";ur.close="1";ur.ping="2";ur.pong="3";ur.message="4";ur.upgrade="5";ur.noop="6";const iu=Object.create(null);Object.keys(ur).forEach(n=>{iu[ur[n]]=n});const Bd={type:"error",data:"parser error"},Px=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Bx=typeof ArrayBuffer=="function",Ux=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,gm=({type:n,data:e},s,i)=>Px&&e instanceof Blob?s?i(e):yb(e,i):Bx&&(e instanceof ArrayBuffer||Ux(e))?s?i(e):yb(new Blob([e]),i):i(ur[n]+(e||"")),yb=(n,e)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];e("b"+(i||""))},s.readAsDataURL(n)};function gb(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let ad;function pO(n,e){if(Px&&n.data instanceof Blob)return n.data.arrayBuffer().then(gb).then(e);if(Bx&&(n.data instanceof ArrayBuffer||Ux(n.data)))return e(gb(n.data));gm(n,!1,s=>{ad||(ad=new TextEncoder),e(ad.encode(s))})}const bb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<bb.length;n++)xo[bb.charCodeAt(n)]=n;const yO=n=>{let e=n.length*.75,s=n.length,i,o=0,c,m,p,g;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const u=new ArrayBuffer(e),d=new Uint8Array(u);for(i=0;i<s;i+=4)c=xo[n.charCodeAt(i)],m=xo[n.charCodeAt(i+1)],p=xo[n.charCodeAt(i+2)],g=xo[n.charCodeAt(i+3)],d[o++]=c<<2|m>>4,d[o++]=(m&15)<<4|p>>2,d[o++]=(p&3)<<6|g&63;return u},gO=typeof ArrayBuffer=="function",bm=(n,e)=>{if(typeof n!="string")return{type:"message",data:zx(n,e)};const s=n.charAt(0);return s==="b"?{type:"message",data:bO(n.substring(1),e)}:iu[s]?n.length>1?{type:iu[s],data:n.substring(1)}:{type:iu[s]}:Bd},bO=(n,e)=>{if(gO){const s=yO(n);return zx(s,e)}else return{base64:!0,data:n}},zx=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Ix="",xO=(n,e)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,m)=>{gm(c,!1,p=>{i[m]=p,++o===s&&e(i.join(Ix))})})},vO=(n,e)=>{const s=n.split(Ix),i=[];for(let o=0;o<s.length;o++){const c=bm(s[o],e);if(i.push(c),c.type==="error")break}return i};function _O(){return new TransformStream({transform(n,e){pO(n,s=>{const i=s.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(s)})}})}let od;function uc(n){return n.reduce((e,s)=>e+s.length,0)}function fc(n,e){if(n[0].length===e)return n.shift();const s=new Uint8Array(e);let i=0;for(let o=0;o<e;o++)s[o]=n[0][i++],i===n[0].length&&(n.shift(),i=0);return n.length&&i<n[0].length&&(n[0]=n[0].slice(i)),s}function wO(n,e){od||(od=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(m,p){for(s.push(m);;){if(i===0){if(uc(s)<1)break;const g=fc(s,1);c=(g[0]&128)===128,o=g[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(uc(s)<2)break;const g=fc(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(uc(s)<8)break;const g=fc(s,8),u=new DataView(g.buffer,g.byteOffset,g.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){p.enqueue(Bd);break}o=d*Math.pow(2,32)+u.getUint32(4),i=3}else{if(uc(s)<o)break;const g=fc(s,o);p.enqueue(bm(c?g:od.decode(g),e)),i=0}if(o===0||o>n){p.enqueue(Bd);break}}}})}const $x=4;function Tt(n){if(n)return SO(n)}function SO(n){for(var e in Tt.prototype)n[e]=Tt.prototype[e];return n}Tt.prototype.on=Tt.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};Tt.prototype.once=function(n,e){function s(){this.off(n,s),e.apply(this,arguments)}return s.fn=e,this.on(n,s),this};Tt.prototype.off=Tt.prototype.removeListener=Tt.prototype.removeAllListeners=Tt.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+n];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,o=0;o<s.length;o++)if(i=s[o],i===e||i.fn===e){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};Tt.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,e)}return this};Tt.prototype.emitReserved=Tt.prototype.emit;Tt.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Tt.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Nu=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,s)=>s(e,0),$n=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),EO="arraybuffer";function Hx(n,...e){return e.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const OO=$n.setTimeout,AO=$n.clearTimeout;function Tu(n,e){e.useNativeTimers?(n.setTimeoutFn=OO.bind($n),n.clearTimeoutFn=AO.bind($n)):(n.setTimeoutFn=$n.setTimeout.bind($n),n.clearTimeoutFn=$n.clearTimeout.bind($n))}const jO=1.33;function kO(n){return typeof n=="string"?NO(n):Math.ceil((n.byteLength||n.size)*jO)}function NO(n){let e=0,s=0;for(let i=0,o=n.length;i<o;i++)e=n.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function Fx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function TO(n){let e="";for(let s in n)n.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return e}function CO(n){let e={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class MO extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}}class xm extends Tt{constructor(e){super(),this.writable=!1,Tu(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new MO(e,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(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const s=bm(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_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(e){const s=TO(e);return s.length?"?"+s:""}}class RO extends xm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const s=()=>{this.readyState="paused",e()};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(e){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)};vO(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xO(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Fx()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}}let Gx=!1;try{Gx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const DO=Gx;function LO(){}class qO extends RO{constructor(e){if(super(e),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){const i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}}class cr extends Tt{constructor(e,s,i){super(),this.createRequest=e,Tu(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 e;const s=Hx(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 o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.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(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=cr.requestsCount++,cr.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=LO,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete cr.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}cr.requestsCount=0;cr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",xb);else if(typeof addEventListener=="function"){const n="onpagehide"in $n?"pagehide":"unload";addEventListener(n,xb,!1)}}function xb(){for(let n in cr.requests)cr.requests.hasOwnProperty(n)&&cr.requests[n].abort()}const PO=(function(){const n=Vx({xdomain:!1});return n&&n.responseType!==null})();class BO extends qO{constructor(e){super(e);const s=e&&e.forceBase64;this.supportsBinary=PO&&!s}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new cr(Vx,this.uri(),e)}}function Vx(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||DO))return new XMLHttpRequest}catch{}if(!e)try{return new $n[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Yx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class UO extends xm{get name(){return"websocket"}doOpen(){const e=this.uri(),s=this.opts.protocols,i=Yx?{}:Hx(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(e,s,i)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;gm(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&Nu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Fx()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}}const ld=$n.WebSocket||$n.MozWebSocket;class zO extends UO{createSocket(e,s,i){return Yx?new ld(e,s,i):s?new ld(e,s):new ld(e)}doWrite(e,s){this.ws.send(s)}}class IO extends xm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const s=wO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),o=_O();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const c=()=>{i.read().then(({done:p,value:g})=>{p||(this.onPacket(g),c())}).catch(p=>{})};c();const m={type:"open"};this.query.sid&&(m.data=`{"sid":"${this.query.sid}"}`),this._writer.write(m).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;this._writer.write(i).then(()=>{o&&Nu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const $O={websocket:zO,webtransport:IO,polling:BO},HO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,FO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ud(n){if(n.length>8e3)throw"URI too long";const e=n,s=n.indexOf("["),i=n.indexOf("]");s!=-1&&i!=-1&&(n=n.substring(0,s)+n.substring(s,i).replace(/:/g,";")+n.substring(i,n.length));let o=HO.exec(n||""),c={},m=14;for(;m--;)c[FO[m]]=o[m]||"";return s!=-1&&i!=-1&&(c.source=e,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=GO(c,c.path),c.queryKey=VO(c,c.query),c}function GO(n,e){const s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function VO(n,e){const s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const zd=typeof addEventListener=="function"&&typeof removeEventListener=="function",au=[];zd&&addEventListener("offline",()=>{au.forEach(n=>n())},!1);class Ss extends Tt{constructor(e,s){if(super(),this.binaryType=EO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){const i=Ud(e);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=Ud(s.host).host);Tu(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 o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=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=CO(this.opts.query)),zd&&(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"})},au.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const s=Object.assign({},this.opts.query);s.EIO=$x,s.transport=e,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[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Ss.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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",Ss.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.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=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.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 o=this.writeBuffer[i].data;if(o&&(s+=kO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Nu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,s,i,o){if(typeof s=="function"&&(o=s,s=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:e,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},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():e()}):this.upgrading?i():e()),this}_onError(e){if(Ss.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,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(),zd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=au.indexOf(this._offlineEventListener);i!==-1&&au.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}}Ss.protocol=$x;class YO extends Ss{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let s=this.createTransport(e),i=!1;Ss.priorWebsocketSuccess=!1;const o=()=>{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;Ss.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 x=new Error("probe error");x.transport=s.name,this.emitReserved("upgradeError",x)}}))};function c(){i||(i=!0,d(),s.close(),s=null)}const m=b=>{const x=new Error("probe error: "+b);x.transport=s.name,c(),this.emitReserved("upgradeError",x)};function p(){m("transport closed")}function g(){m("socket closed")}function u(b){s&&b.name!==s.name&&c()}const d=()=>{s.removeListener("open",o),s.removeListener("error",m),s.removeListener("close",p),this.off("close",g),this.off("upgrading",u)};s.once("open",o),s.once("error",m),s.once("close",p),this.once("close",g),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}}let KO=class extends YO{constructor(e,s={}){const i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>$O[o]).filter(o=>!!o)),super(e,i)}};function JO(n,e="",s){let i=n;s=s||typeof location<"u"&&location,n==null&&(n=s.protocol+"//"+s.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=s.protocol+n:n=s.host+n),/^(https?|wss?):\/\//.test(n)||(typeof s<"u"?n=s.protocol+"//"+n:n="https://"+n),i=Ud(n)),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+e,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const QO=typeof ArrayBuffer=="function",XO=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Kx=Object.prototype.toString,WO=typeof Blob=="function"||typeof Blob<"u"&&Kx.call(Blob)==="[object BlobConstructor]",ZO=typeof File=="function"||typeof File<"u"&&Kx.call(File)==="[object FileConstructor]";function vm(n){return QO&&(n instanceof ArrayBuffer||XO(n))||WO&&n instanceof Blob||ZO&&n instanceof File}function ou(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(ou(n[s]))return!0;return!1}if(vm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return ou(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&ou(n[s]))return!0;return!1}function eA(n){const e=[],s=n.data,i=n;return i.data=Id(s,e),i.attachments=e.length,{packet:i,buffers:e}}function Id(n,e){if(!n)return n;if(vm(n)){const s={_placeholder:!0,num:e.length};return e.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=Id(n[i],e);return s}else if(typeof n=="object"&&!(n instanceof Date)){const s={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[i]=Id(n[i],e));return s}return n}function tA(n,e){return n.data=$d(n.data,e),delete n.attachments,n}function $d(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=$d(n[s],e);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=$d(n[s],e));return n}const nA=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ve;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(Ve||(Ve={}));class rA{constructor(e){this.replacer=e}encode(e){return(e.type===Ve.EVENT||e.type===Ve.ACK)&&ou(e)?this.encodeAsBinary({type:e.type===Ve.EVENT?Ve.BINARY_EVENT:Ve.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===Ve.BINARY_EVENT||e.type===Ve.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),s}encodeAsBinary(e){const s=eA(e),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class _m extends Tt{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);const i=s.type===Ve.BINARY_EVENT;i||s.type===Ve.BINARY_ACK?(s.type=i?Ve.EVENT:Ve.ACK,this.reconstructor=new sA(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(vm(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),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: "+e)}decodeString(e){let s=0;const i={type:Number(e.charAt(0))};if(Ve[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ve.BINARY_EVENT||i.type===Ve.BINARY_ACK){const c=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);const m=e.substring(c,s);if(m!=Number(m)||e.charAt(s)!=="-")throw new Error("Illegal attachments");const p=Number(m);if(!iA(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=p}if(e.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(c,s)}else i.nsp="/";const o=e.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const m=e.charAt(s);if(m==null||Number(m)!=m){--s;break}if(s===e.length)break}i.id=Number(e.substring(c,s+1))}if(e.charAt(++s)){const c=this.tryParse(e.substr(s));if(_m.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,s){switch(e){case Ve.CONNECT:return vb(s);case Ve.DISCONNECT:return s===void 0;case Ve.CONNECT_ERROR:return typeof s=="string"||vb(s);case Ve.EVENT:case Ve.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&nA.indexOf(s[0])===-1);case Ve.ACK:case Ve.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class sA{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const s=tA(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const iA=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function vb(n){return Object.prototype.toString.call(n)==="[object Object]"}const aA=Object.freeze(Object.defineProperty({__proto__:null,Decoder:_m,Encoder:rA,get PacketType(){return Ve}},Symbol.toStringTag,{value:"Module"}));function Xn(n,e,s){return n.on(e,s),function(){n.off(e,s)}}const oA=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Jx extends Tt{constructor(e,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=e,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 e=this.io;this.subs=[Xn(e,"open",this.onopen.bind(this)),Xn(e,"packet",this.onpacket.bind(this)),Xn(e,"error",this.onerror.bind(this)),Xn(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,o,c;if(oA.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const m={type:Ve.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 p=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(e,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[e]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===e&&this.sendBuffer.splice(p,1);s.call(this,new Error("operation has timed out"))},o),m=(...p)=>{this.io.clearTimeoutFn(c),s.apply(this,p)};m.withError=!0,this.acks[e]=m}emitWithAck(e,...s){return new Promise((i,o)=>{const c=(m,p)=>m?o(m):i(p);c.withError=!0,s.push(c),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...c)=>(this._queue[0],o!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!e||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ve.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ve.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Ve.EVENT:case Ve.BINARY_EVENT:this.onevent(e);break;case Ve.ACK:case Ve.BINARY_ACK:this.onack(e);break;case Ve.DISCONNECT:this.ondisconnect();break;case Ve.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const s=e.data||[];e.id!=null&&s.push(this.ack(e.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Ve.ACK,id:e,data:o}))}}onack(e){const s=this.acks[e.id];typeof s=="function"&&(delete this.acks[e.id],s.withError&&e.data.unshift(null),s.apply(this,e.data))}onconnect(e,s){this.id=e,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ve.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,e.data)}}}function oa(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}oa.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};oa.prototype.reset=function(){this.attempts=0};oa.prototype.setMin=function(n){this.ms=n};oa.prototype.setMax=function(n){this.max=n};oa.prototype.setJitter=function(n){this.jitter=n};class Hd extends Tt{constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Tu(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 oa({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;const o=s.parser||aA;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new KO(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Xn(s,"open",function(){i.onopen(),e&&e()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),e?e(p):this.maybeReconnectOnOpen()},m=Xn(s,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(m),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Xn(e,"ping",this.onping.bind(this)),Xn(e,"data",this.ondata.bind(this)),Xn(e,"error",this.onerror.bind(this)),Xn(e,"close",this.onclose.bind(this)),Xn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){Nu(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new Jx(this,e,s),this.nsps[e]=i),i}_destroy(e){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(e){const s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const io={};function lu(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const s=JO(n,e.path||"/socket.io"),i=s.source,o=s.id,c=s.path,m=io[o]&&c in io[o].nsps,p=e.forceNew||e["force new connection"]||e.multiplex===!1||m;let g;return p?g=new Hd(i,e):(io[o]||(io[o]=new Hd(i,e)),g=io[o]),s.query&&!e.query&&(e.query=s.queryKey),g.socket(s.path,e)}Object.assign(lu,{Manager:Hd,Socket:Jx,io:lu,connect:lu});const lA=E.createContext({connected:!1,subscribe:()=>()=>{}});function cA({children:n}){const{isAuthenticated:e}=qt(),s=E.useRef(null),[i,o]=E.useState(!1),c=E.useRef(new Map),m=E.useCallback((g,u)=>{var b;const d=c.current;return d.has(g)||(d.set(g,new Set),(b=s.current)==null||b.emit("lt.subscribe",g)),d.get(g).add(u),()=>{var v;const x=d.get(g);x&&(x.delete(u),x.size===0&&(d.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),p=E.useCallback((g,u)=>{for(const[d,b]of c.current)if(Dx(g,d))for(const x of b)try{x(u)}catch{}},[]);return E.useEffect(()=>{if(!e)return;const g=lu({path:`${Vt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:u=>{const d=wd();u(d?{token:d}:{})}});return s.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),o(!0);for(const u of c.current.keys())g.emit("lt.subscribe",u)}),g.on("disconnect",u=>{console.log("[lt-socketio] disconnected:",u),o(!1)}),g.on("connect_error",u=>{console.warn("[lt-socketio] connect error:",u.message),o(!1)}),g.onAny((u,d)=>{if(u.startsWith("lt."))try{const b=typeof d=="string"?JSON.parse(d):d;p(u,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[p,e]),h.jsx(lA.Provider,{value:{connected:i,subscribe:m},children:h.jsx(aa.Provider,{value:{connected:i,subscribe:m},children:n})})}function uA({children:n}){const{isAuthenticated:e}=qt(),s=Be(),[i,o]=E.useState(null),[c,m]=E.useState({url:null,policy:Gg(null)});E.useEffect(()=>{let u=!1;async function d(){var b;try{console.log("[lt-transport] detecting event transport...");const x=await lm(),v=(b=x==null?void 0:x.events)==null?void 0:b.transport;console.log("[lt-transport] server reports:",v),u||(v==="nats"&&m({url:x.events.natsWsUrl??null,policy:Gg(x.events.reconnect)}),o(v==="nats"?"nats":"socketio"))}catch(x){console.warn("[lt-transport] settings fetch error, falling back to socketio",x),u||o("socketio")}}return d(),()=>{u=!0}},[e]);const p=E.useCallback(()=>lE(c.url),[c.url]),g=E.useCallback(()=>{s.invalidateQueries({refetchType:"active"})},[s]);return i==="nats"?h.jsx(mO,{resolveCredentials:p,policy:c.policy,onReconnect:g,sessionKey:e,children:n}):i==="socketio"?h.jsx(cA,{children:n}):h.jsx(h.Fragment,{children:n})}const wm="lt_view_as",Sm="lt_ai_override",Fd="lt_graph_enabled",Gd="lt_infrastructure_enabled",Em="lt_scan_override";function Qx(){try{const n=localStorage.getItem(Sm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function fA(n){try{localStorage.setItem(Sm,String(n))}catch{}}function hA(){try{localStorage.removeItem(Sm)}catch{}}function Om(){try{const n=localStorage.getItem(wm);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function dA(n){try{localStorage.setItem(wm,n)}catch{}window.location.reload()}function Vd(){try{localStorage.removeItem(wm)}catch{}window.location.reload()}function Xx(){try{return localStorage.getItem(Fd)==="true"}catch{return!1}}function mA(n){try{n?localStorage.setItem(Fd,"true"):localStorage.removeItem(Fd)}catch{}}function Wx(){try{return localStorage.getItem(Gd)==="true"}catch{return!1}}function pA(n){try{n?localStorage.setItem(Gd,"true"):localStorage.removeItem(Gd)}catch{}}function Zx(){try{const n=localStorage.getItem(Em);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function yA(n){try{localStorage.setItem(Em,String(n))}catch{}}function gA(){try{localStorage.removeItem(Em)}catch{}}function ev(){const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),i=Om(),o=n||s("engineer"),c=e("admin"),m=n||e("admin");return{isBuilder:i?!1:o,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":m,viewAs:i,realIsBuilder:o}}function tv(){var u;const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),{data:i}=er(),o=((u=i==null?void 0:i.features)==null?void 0:u.publicPaceBoard)!==!1,c=n?"superadmin":e("admin")?"admin":s("engineer")?"engineer":"operator",m=Om(),p=m==="admin"||m==="engineer"||m==="operator"?m:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}const nv=E.createContext(null);function Cu(){const n=E.useContext(nv);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function bA({children:n}){const[e,s]=E.useState(null),i=E.useRef(e);i.current=e,E.useEffect(()=>{if(!(e!=null&&e.expiresAt))return;const d=new Date(e.expiresAt).getTime()-Date.now();if(d<=0){s(null);return}const b=setTimeout(()=>s(null),d);return()=>clearTimeout(b)},[e]);const o=E.useCallback(d=>{var x;if(!d.actingToken||!d.actor)return null;const b=((x=i.current)==null?void 0:x.actingToken)??null;return s({actingToken:d.actingToken,actorId:d.actor.id,displayName:d.actor.displayName,expiresAt:d.expiresAt??null,subjectScoped:d.grantScope==="subject"}),b},[]),c=E.useCallback(()=>s(null),[]),m=E.useCallback((d,b)=>{const x=i.current;b===0&&(x==null?void 0:x.actingToken)===d&&s(null)},[]),p=E.useCallback((d,b)=>{const x=i.current;if(!x||x.actingToken!==d||!b.acting)return;const{consumed:v,remaining:w,bound:S}=b.acting;(v&&w===0||S&&b.clearSubject)&&s(null)},[]);E.useEffect(()=>(zg(()=>{var d;return((d=i.current)==null?void 0:d.actingToken)??null}),$g(c),Ig(m),()=>{zg(null),$g(null),Ig(null)}),[c,m]);const g=E.useCallback(()=>{var b;const d=(b=i.current)==null?void 0:b.expiresAt;return d?Math.max(0,Math.floor((new Date(d).getTime()-Date.now())/1e3)):0},[]),u=E.useMemo(()=>({identity:e,prime:o,clear:c,settle:p,remainingSeconds:g}),[e,o,c,p,g]);return h.jsx(nv.Provider,{value:u,children:n})}function xA(){const{user:n}=qt(),{identity:e}=Cu(),s=n==null?void 0:n.userId,i=e==null?void 0:e.actorId,o=E.useCallback(c=>!!c&&(c===i||c===s),[i,s]);return{viewerId:i??s,isViewer:o}}function rv(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function fr(n={}){const e=n.role?rv(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Xt}.system.escalation.${e}.${s}.${i}`}function Yd(n){return n.verbs.map(e=>fr({role:n.role,verb:e}))}function Am(n){const{user:e,isSuperAdmin:s,hasRoleType:i}=qt(),o=s||i("admin"),c=((e==null?void 0:e.roles)??[]).map(p=>p.role).sort().join(","),m=(n??[]).join(",");return E.useMemo(()=>{const p=m?m.split(","):null;return o||!c?p?Yd({verbs:p}):[fr({})]:c.split(",").flatMap(g=>p?Yd({role:g,verbs:p}):[fr({role:g})])},[o,c,m])}const Kd="/escalations/detail/";function vA(n){return n.startsWith(Kd)&&n.slice(Kd.length).split("/")[0]||void 0}function _A(){const{isViewer:n}=xA(),e=ni(),s=en(),i=E.useRef(s.pathname);i.current=s.pathname;const o=E.useRef(n);o.current=n;const c=E.useCallback(m=>{var b,x,v;if((m==null?void 0:m.assignedAtCreation)!==!0)return;const p=(m==null?void 0:m.escalationId)??((b=m==null?void 0:m.data)==null?void 0:b.id),g=(x=m==null?void 0:m.data)==null?void 0:x.assigned_to,u=(v=m==null?void 0:m.data)==null?void 0:v.parent_id;if(!p||!o.current(g)||!u||u!==vA(i.current))return;const d=`${Kd}${p}`;i.current!==d&&e(d)},[e]);js(Am(["claimed"]),c)}const sv=6048e5,wA=864e5,_b=6e4,wb=525600,Sb=43200,Eb=1440,Ob=Symbol.for("constructDateFrom");function Br(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&Ob in n?n[Ob](e):n instanceof Date?new n.constructor(e):new Date(e)}function kn(n,e){return Br(e||n,n)}let SA={};function Lo(){return SA}function No(n,e){var p,g,u,d;const s=Lo(),i=(e==null?void 0:e.weekStartsOn)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((d=(u=s.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,o=kn(n,e==null?void 0:e.in),c=o.getDay(),m=(c<i?7:0)+c-i;return o.setDate(o.getDate()-m),o.setHours(0,0,0,0),o}function bu(n,e){return No(n,{...e,weekStartsOn:1})}function iv(n,e){const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=Br(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=bu(o),m=Br(s,0);m.setFullYear(i,0,4),m.setHours(0,0,0,0);const p=bu(m);return s.getTime()>=c.getTime()?i+1:s.getTime()>=p.getTime()?i:i-1}function xu(n){const e=kn(n),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+n-+s}function av(n,...e){const s=Br.bind(null,n||e.find(i=>typeof i=="object"));return e.map(s)}function Ab(n,e){const s=kn(n,e==null?void 0:e.in);return s.setHours(0,0,0,0),s}function EA(n,e,s){const[i,o]=av(s==null?void 0:s.in,n,e),c=Ab(i),m=Ab(o),p=+c-xu(c),g=+m-xu(m);return Math.round((p-g)/wA)}function OA(n,e){const s=iv(n,e),i=Br(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),bu(i)}function AA(n,e){const s=+kn(n)-+kn(e);return s<0?-1:s>0?1:s}function jA(n){return Br(n,Date.now())}function kA(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function NA(n){return!(!kA(n)&&typeof n!="number"||isNaN(+kn(n)))}function TA(n){return e=>{const i=(n?Math[n]:Math.trunc)(e);return i===0?0:i}}function CA(n,e){const s=kn(n,e==null?void 0:e.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const MA={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"}},RA=(n,e,s)=>{let i;const o=MA[n];return typeof o=="string"?i=o:e===1?i=o.one:i=o.other.replace("{{count}}",e.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function cd(n){return(e={})=>{const s=e.width?String(e.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const DA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},LA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},qA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},PA={date:cd({formats:DA,defaultWidth:"full"}),time:cd({formats:LA,defaultWidth:"full"}),dateTime:cd({formats:qA,defaultWidth:"full"})},BA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},UA=(n,e,s,i)=>BA[n];function ao(n){return(e,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const m=n.defaultFormattingWidth||n.defaultWidth,p=s!=null&&s.width?String(s.width):m;o=n.formattingValues[p]||n.formattingValues[m]}else{const m=n.defaultWidth,p=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[p]||n.values[m]}const c=n.argumentCallback?n.argumentCallback(e):e;return o[c]}}const zA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},IA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$A={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"]},HA={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"]},FA={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"}},GA={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"}},VA=(n,e)=>{const s=Number(n),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"},YA={ordinalNumber:VA,era:ao({values:zA,defaultWidth:"wide"}),quarter:ao({values:IA,defaultWidth:"wide",argumentCallback:n=>n-1}),month:ao({values:$A,defaultWidth:"wide"}),day:ao({values:HA,defaultWidth:"wide"}),dayPeriod:ao({values:FA,defaultWidth:"wide",formattingValues:GA,defaultFormattingWidth:"wide"})};function oo(n){return(e,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=e.match(o);if(!c)return null;const m=c[0],p=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(p)?JA(p,b=>b.test(m)):KA(p,b=>b.test(m));let u;u=n.valueCallback?n.valueCallback(g):g,u=s.valueCallback?s.valueCallback(u):u;const d=e.slice(m.length);return{value:u,rest:d}}}function KA(n,e){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&e(n[s]))return s}function JA(n,e){for(let s=0;s<n.length;s++)if(e(n[s]))return s}function QA(n){return(e,s={})=>{const i=e.match(n.matchPattern);if(!i)return null;const o=i[0],c=e.match(n.parsePattern);if(!c)return null;let m=n.valueCallback?n.valueCallback(c[0]):c[0];m=s.valueCallback?s.valueCallback(m):m;const p=e.slice(o.length);return{value:m,rest:p}}}const XA=/^(\d+)(th|st|nd|rd)?/i,WA=/\d+/i,ZA={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},ej={any:[/^b/i,/^(a|c)/i]},tj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},nj={any:[/1/i,/2/i,/3/i,/4/i]},rj={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},sj={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]},ij={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},aj={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]},oj={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},lj={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}},cj={ordinalNumber:QA({matchPattern:XA,parsePattern:WA,valueCallback:n=>parseInt(n,10)}),era:oo({matchPatterns:ZA,defaultMatchWidth:"wide",parsePatterns:ej,defaultParseWidth:"any"}),quarter:oo({matchPatterns:tj,defaultMatchWidth:"wide",parsePatterns:nj,defaultParseWidth:"any",valueCallback:n=>n+1}),month:oo({matchPatterns:rj,defaultMatchWidth:"wide",parsePatterns:sj,defaultParseWidth:"any"}),day:oo({matchPatterns:ij,defaultMatchWidth:"wide",parsePatterns:aj,defaultParseWidth:"any"}),dayPeriod:oo({matchPatterns:oj,defaultMatchWidth:"any",parsePatterns:lj,defaultParseWidth:"any"})},ov={code:"en-US",formatDistance:RA,formatLong:PA,formatRelative:UA,localize:YA,match:cj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function uj(n,e){const s=kn(n,e==null?void 0:e.in);return EA(s,CA(s))+1}function fj(n,e){const s=kn(n,e==null?void 0:e.in),i=+bu(s)-+OA(s);return Math.round(i/sv)+1}function lv(n,e){var d,b,x,v;const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=Lo(),c=(e==null?void 0:e.firstWeekContainsDate)??((b=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((v=(x=o.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,m=Br((e==null?void 0:e.in)||n,0);m.setFullYear(i+1,0,c),m.setHours(0,0,0,0);const p=No(m,e),g=Br((e==null?void 0:e.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const u=No(g,e);return+s>=+p?i+1:+s>=+u?i:i-1}function hj(n,e){var p,g,u,d;const s=Lo(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((d=(u=s.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=lv(n,e),c=Br((e==null?void 0:e.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),No(c,e)}function dj(n,e){const s=kn(n,e==null?void 0:e.in),i=+No(s,e)-+hj(s,e);return Math.round(i/sv)+1}function tt(n,e){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return s+i}const ys={y(n,e){const s=n.getFullYear(),i=s>0?s:1-s;return tt(e==="yy"?i%100:i,e.length)},M(n,e){const s=n.getMonth();return e==="M"?String(s+1):tt(s+1,2)},d(n,e){return tt(n.getDate(),e.length)},a(n,e){const s=n.getHours()/12>=1?"pm":"am";switch(e){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(n,e){return tt(n.getHours()%12||12,e.length)},H(n,e){return tt(n.getHours(),e.length)},m(n,e){return tt(n.getMinutes(),e.length)},s(n,e){return tt(n.getSeconds(),e.length)},S(n,e){const s=e.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return tt(o,e.length)}},Hi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},jb={G:function(n,e,s){const i=n.getFullYear()>0?1:0;switch(e){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(n,e,s){if(e==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ys.y(n,e)},Y:function(n,e,s,i){const o=lv(n,i),c=o>0?o:1-o;if(e==="YY"){const m=c%100;return tt(m,2)}return e==="Yo"?s.ordinalNumber(c,{unit:"year"}):tt(c,e.length)},R:function(n,e){const s=iv(n);return tt(s,e.length)},u:function(n,e){const s=n.getFullYear();return tt(s,e.length)},Q:function(n,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return tt(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(n,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return tt(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(n,e,s){const i=n.getMonth();switch(e){case"M":case"MM":return ys.M(n,e);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(n,e,s){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return tt(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(n,e,s,i){const o=dj(n,i);return e==="wo"?s.ordinalNumber(o,{unit:"week"}):tt(o,e.length)},I:function(n,e,s){const i=fj(n);return e==="Io"?s.ordinalNumber(i,{unit:"week"}):tt(i,e.length)},d:function(n,e,s){return e==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ys.d(n,e)},D:function(n,e,s){const i=uj(n);return e==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):tt(i,e.length)},E:function(n,e,s){const i=n.getDay();switch(e){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(n,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(c);case"ee":return tt(c,2);case"eo":return s.ordinalNumber(c,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(n,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(c);case"cc":return tt(c,e.length);case"co":return s.ordinalNumber(c,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(n,e,s){const i=n.getDay(),o=i===0?7:i;switch(e){case"i":return String(o);case"ii":return tt(o,e.length);case"io":return s.ordinalNumber(o,{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(n,e,s){const o=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(n,e,s){const i=n.getHours();let o;switch(i===12?o=Hi.noon:i===0?o=Hi.midnight:o=i/12>=1?"pm":"am",e){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(n,e,s){const i=n.getHours();let o;switch(i>=17?o=Hi.evening:i>=12?o=Hi.afternoon:i>=4?o=Hi.morning:o=Hi.night,e){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(n,e,s){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ys.h(n,e)},H:function(n,e,s){return e==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ys.H(n,e)},K:function(n,e,s){const i=n.getHours()%12;return e==="Ko"?s.ordinalNumber(i,{unit:"hour"}):tt(i,e.length)},k:function(n,e,s){let i=n.getHours();return i===0&&(i=24),e==="ko"?s.ordinalNumber(i,{unit:"hour"}):tt(i,e.length)},m:function(n,e,s){return e==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ys.m(n,e)},s:function(n,e,s){return e==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ys.s(n,e)},S:function(n,e){return ys.S(n,e)},X:function(n,e,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Nb(i);case"XXXX":case"XX":return Ws(i);case"XXXXX":case"XXX":default:return Ws(i,":")}},x:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"x":return Nb(i);case"xxxx":case"xx":return Ws(i);case"xxxxx":case"xxx":default:return Ws(i,":")}},O:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+kb(i,":");case"OOOO":default:return"GMT"+Ws(i,":")}},z:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+kb(i,":");case"zzzz":default:return"GMT"+Ws(i,":")}},t:function(n,e,s){const i=Math.trunc(+n/1e3);return tt(i,e.length)},T:function(n,e,s){return tt(+n,e.length)}};function kb(n,e=""){const s=n>0?"-":"+",i=Math.abs(n),o=Math.trunc(i/60),c=i%60;return c===0?s+String(o):s+String(o)+e+tt(c,2)}function Nb(n,e){return n%60===0?(n>0?"-":"+")+tt(Math.abs(n)/60,2):Ws(n,e)}function Ws(n,e=""){const s=n>0?"-":"+",i=Math.abs(n),o=tt(Math.trunc(i/60),2),c=tt(i%60,2);return s+o+e+c}const Tb=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},cv=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},mj=(n,e)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return Tb(n,e);let c;switch(i){case"P":c=e.dateTime({width:"short"});break;case"PP":c=e.dateTime({width:"medium"});break;case"PPP":c=e.dateTime({width:"long"});break;case"PPPP":default:c=e.dateTime({width:"full"});break}return c.replace("{{date}}",Tb(i,e)).replace("{{time}}",cv(o,e))},pj={p:cv,P:mj},yj=/^D+$/,gj=/^Y+$/,bj=["D","DD","YY","YYYY"];function xj(n){return yj.test(n)}function vj(n){return gj.test(n)}function _j(n,e,s){const i=wj(n,e,s);if(console.warn(i),bj.includes(n))throw new RangeError(i)}function wj(n,e,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Sj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ej=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Oj=/^'([^]*?)'?$/,Aj=/''/g,jj=/[a-zA-Z]/;function kj(n,e,s){var d,b,x,v;const i=Lo(),o=i.locale??ov,c=i.firstWeekContainsDate??((b=(d=i.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??1,m=i.weekStartsOn??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,p=kn(n,s==null?void 0:s.in);if(!NA(p))throw new RangeError("Invalid time value");let g=e.match(Ej).map(w=>{const S=w[0];if(S==="p"||S==="P"){const C=pj[S];return C(w,o.formatLong)}return w}).join("").match(Sj).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:Nj(w)};if(jb[S])return{isToken:!0,value:w};if(S.match(jj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});o.localize.preprocessor&&(g=o.localize.preprocessor(p,g));const u={firstWeekContainsDate:c,weekStartsOn:m,locale:o};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(vj(S)||xj(S))&&_j(S,e,String(n));const C=jb[S[0]];return C(p,S,o.localize,u)}).join("")}function Nj(n){const e=n.match(Oj);return e?e[1].replace(Aj,"'"):n}function Tj(n,e,s){const i=Lo(),o=(s==null?void 0:s.locale)??i.locale??ov,c=AA(n,e);if(isNaN(c))throw new RangeError("Invalid time value");const m=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[p,g]=av(s==null?void 0:s.in,...c>0?[e,n]:[n,e]),u=TA((s==null?void 0:s.roundingMethod)??"round"),d=g.getTime()-p.getTime(),b=d/_b,x=xu(g)-xu(p),v=(d-x)/_b,w=s==null?void 0:s.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<Eb?S="hour":v<Sb?S="day":v<wb?S="month":S="year",S==="second"){const C=u(d/1e3);return o.formatDistance("xSeconds",C,m)}else if(S==="minute"){const C=u(b);return o.formatDistance("xMinutes",C,m)}else if(S==="hour"){const C=u(b/60);return o.formatDistance("xHours",C,m)}else if(S==="day"){const C=u(v/Eb);return o.formatDistance("xDays",C,m)}else if(S==="month"){const C=u(v/Sb);return C===12&&w!=="month"?o.formatDistance("xYears",1,m):o.formatDistance("xMonths",C,m)}else{const C=u(v/wb);return o.formatDistance("xYears",C,m)}}function Cj(n,e){return Tj(n,jA(n),e)}let vu=null;function Mj(n){vu=n||null}function Rj(){return vu}function Dj(n,e,s){const i=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...s?{second:"2-digit"}:{},hour12:!0}).formatToParts(n);return Object.fromEntries(i.map(o=>[o.type,o.value]))}function jm(n,e=!1){const s=typeof n=="string"?new Date(n):n;if(Number.isNaN(s.getTime()))return String(n);if(!vu)return kj(s,e?"MMM d, yyyy h:mm:ss a":"MMM d, yyyy h:mm a");const i=Dj(s,vu,e),o=`${i.hour}:${i.minute}${e?`:${i.second}`:""}`;return`${i.month} ${i.day}, ${i.year} ${o} ${i.dayPeriod}`}function Lj(n){const e=n??[];return e.length>0&&e.every(s=>s.type==="member"&&s.write_scope==="none")}const km={staleTime:5*6e4,refetchOnWindowFocus:!1};function h5(n={},e={}){const s=new URLSearchParams;return n.role&&s.set("role",n.role),n.roleType&&s.set("roleType",n.roleType),n.status&&s.set("status",n.status),n.search&&s.set("search",n.search),n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),qe({queryKey:["users",n],queryFn:()=>ue(`/users?${s}`),enabled:e.enabled??!0,...km})}const Cb=200;async function qj(n){const e=[];for(let s=0;s<n.length;s+=Cb){const i=await ue("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+Cb)})});e.push(...i.users??[])}return e}let Jd=[],Qd=new Map,Xd=!1;function Pj(){const n=Jd,e=Qd;Jd=[],Qd=new Map,Xd=!1,qj(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of e)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of e.values())i.reject(s)})}function Bj(n){return new Promise((e,s)=>{Jd.push(n),Qd.set(n,{resolve:e,reject:s}),Xd||(Xd=!0,setTimeout(Pj,0))})}function d5(n){return qe({queryKey:["user-name",n],queryFn:()=>Bj(n),enabled:!!n,...km})}function Uj(n){return qe({queryKey:["users",n,"roles"],queryFn:async()=>(await ue(`/users/${n}/roles`)).roles??[],enabled:!!n,...km})}function m5(){const n=Be();return Fe({mutationFn:e=>ue("/users",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function p5(){const n=Be();return Fe({mutationFn:({id:e,...s})=>ue(`/users/${e}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function y5(){const n=Be();return Fe({mutationFn:({id:e,ops:s})=>ue(`/users/${e}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function g5(){return qe({queryKey:["users","system-property-keys"],queryFn:()=>ue("/users/system-property-keys")})}function b5(){const n=Be();return Fe({mutationFn:e=>ue(`/users/${e}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function x5(){const n=Be();return Fe({mutationFn:({userId:e,role:s,type:i,read_scope:o,write_scope:c})=>ue(`/users/${e}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function v5(){const n=Be();return Fe({mutationFn:({userId:e,role:s})=>ue(`/users/${e}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}const _5={MAX_PORTALS:12,MAX_ROWS:4,MAX_COLS:6,MAX_COUNTS:8};function zj(){return qe({queryKey:["roles"],queryFn:()=>ue("/roles")})}function Mu(n){return qe({queryKey:["roles","details"],queryFn:()=>ue("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function w5(n,e,s=!0){return qe({queryKey:["roles",n,"schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function S5(n){return qe({queryKey:["roles",n,"schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function E5(n,e,s=!0){return qe({queryKey:["roles",n,"list-schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function O5(n){return qe({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function A5(){const n=Be();return Fe({mutationFn:e=>ue("/roles",{method:"POST",body:JSON.stringify({role:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function j5(){const n=Be();return Fe({mutationFn:({role:e,...s})=>ue(`/roles/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:e,...s})=>{await n.cancelQueries({queryKey:["roles","details"]});const i=n.getQueryData(["roles","details"]);return i&&n.setQueryData(["roles","details"],{roles:i.roles.map(o=>o.role===e?{...o,...s}:o)}),{previous:i}},onError:(e,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function k5(){const n=Be();return Fe({mutationFn:e=>ue(`/roles/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const uv="lt:station:kiosk-role:";function Wd(n){return`${uv}${n}`}const Zd=new Set;function Ij(){for(const n of Zd)n()}function $j(n){try{return localStorage.getItem(Wd(n))}catch{return null}}function Hj(n,e){try{e===null?localStorage.removeItem(Wd(n)):localStorage.setItem(Wd(n),e)}catch{}Ij()}function Fj(n){Zd.add(n);const e=s=>{(s.key===null||s.key.startsWith(uv))&&n()};try{window.addEventListener("storage",e)}catch{}return()=>{Zd.delete(n);try{window.removeEventListener("storage",e)}catch{}}}function Gj(n){return E.useSyncExternalStore(Fj,()=>n?$j(n):null)}const _u="/portal";function Vj(n){return n===_u||n.startsWith(`${_u}/`)}function Nm(n,e){const s=`${_u}/${encodeURIComponent(n)}`;return e?`${s}/${encodeURIComponent(e)}`:s}function ea(n){return Array.isArray(n==null?void 0:n.portals)?n.portals:[]}function Yj(n){return ea(n).length>0}function N5(n,e){const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"portal",i=new Set(e);if(!i.has(s))return s;let o=2;for(;i.has(`${s}-${o}`);)o+=1;return`${s}-${o}`}function fv(n,e){return e.length>0?Nm(n,e[0].key):`/escalations/available?role=${encodeURIComponent(n)}&status=available`}function Tm(){const{user:n}=qt(),e=(n==null?void 0:n.userId)??null,{data:s}=Uj(e),{data:i}=Mu(),o=Gj(e),c=E.useCallback(m=>{e&&Hj(e,m)},[e]);return E.useMemo(()=>{const m={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},p=s??[];if(p.length===0||p.some(v=>v.type!=="member"))return m;const g=v=>{var w;return(w=i==null?void 0:i.roles)==null?void 0:w.find(S=>S.role===v)},u=v=>{var w,S;return((S=(w=g(v))==null?void 0:w.properties)==null?void 0:S.kiosk)===!0},d=p.map(v=>v.role).filter(u),b=v=>({kiosk:!0,role:v,homePath:fv(v,ea(g(v))),targets:d,selectable:d.length>=2,selectRole:c});if(p.length===1)return d.length===1?b(d[0]):m;if(!Lj(p)||d.length===0)return m;const x=o&&d.includes(o)?o:d.length===1?d[0]:null;return x?b(x):{...m,targets:d,selectable:!0}},[s,i,o,c])}const Kj="/escalations/available",Jj=["/escalations",_u,"/scan","/login"];function Qj(n,e=""){if(n===Kj){const s=new URLSearchParams(e);if(!s.get("role")&&!s.get("facets"))return!1}return Jj.some(s=>n===s||n.startsWith(`${s}/`)||n.startsWith(`${s}?`))}const Cm=E.createContext(null),ud="lt_sidebar_collapsed",hv="(max-width: 1023px)";function Xj(){try{return window.matchMedia(hv).matches}catch{return!1}}function Wj({children:n}){const[e,s]=E.useState(()=>{if(Xj())return!0;try{return localStorage.getItem(ud)==="true"}catch{return!1}});E.useEffect(()=>{let o;try{o=window.matchMedia(hv)}catch{return}const c=m=>{if(m.matches)s(!0);else try{s(localStorage.getItem(ud)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=E.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(ud,String(c))}catch{}return c})},[]);return h.jsx(Cm.Provider,{value:{collapsed:e,toggle:i},children:n})}function Zj({children:n}){return h.jsx(Cm.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function Mm(){const n=E.useContext(Cm);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const Mb=380,Rm=E.createContext(null);function ek({children:n}){const[e,s]=E.useState({node:null,width:Mb,open:!1,ownerKey:null}),i=en(),o=E.useRef(i.pathname),c=E.useCallback((p,g)=>{s({node:p,width:(g==null?void 0:g.width)??Mb,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),m=E.useCallback(p=>{s(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return E.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[i.pathname]),h.jsx(Rm.Provider,{value:{...e,setPanel:c,closePanel:m},children:n})}function Dm(){const n=E.useContext(Rm);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function T5(){return E.useContext(Rm)}function tk({open:n,width:e=380,children:s,className:i=""}){const[o,c]=E.useState(n);return E.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?e:0,maxWidth:"50%"},onTransitionEnd:m=>{!n&&m.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:e},className:"h-full",children:o?s:null})})}function C5({label:n,children:e}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:n}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:e})]})}function M5({views:n,activeId:e,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:m}){const p=n.find(g=>g.id===e)??n[0];return p?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${m?"pt-10 pb-2":"pt-3"}`,children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:n.map(g=>{const u=g.icon,d=g.id===p.id;return h.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:h.jsx(u,{className:"w-3.5 h-3.5"})},g.id)})}),m&&h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:p.label})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o,i&&h.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:h.jsx(Zt,{className:"w-3.5 h-3.5"})})]})]}),!m&&h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:p.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${m?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function dv(n,e){var s,i,o,c,m;e.facets&&Object.keys(e.facets).length&&n.set("facets",JSON.stringify(e.facets)),(s=e.block)!=null&&s.length&&n.set("block",JSON.stringify(e.block)),(i=e.range)!=null&&i.length&&n.set("range",JSON.stringify(e.range)),(o=e.exists)!=null&&o.length&&n.set("exists",JSON.stringify(e.exists)),(c=e.roles)!=null&&c.length&&n.set("roles",JSON.stringify(e.roles)),(m=e.orderBy)!=null&&m.length&&n.set("orderBy",JSON.stringify(e.orderBy)),e.available!==void 0&&n.set("available",String(e.available)),e.jeopardy===!0&&n.set("jeopardy","1"),e.include&&n.set("include",e.include),e.groupBy&&n.set("groupBy",e.groupBy)}function R5(n,e,s){const i=n??"24h",o=e&&Object.keys(e).length?JSON.stringify(e):null;return qe({queryKey:["stationMetrics",i,o],queryFn:()=>ue(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function D5(n){const e=n?`?period=${n}`:"";return qe({queryKey:["escalationStats",n],queryFn:()=>ue(`/escalations/stats${e}`)})}function L5(){return qe({queryKey:["escalationTypes"],queryFn:()=>ue("/escalations/types")})}function q5(n=!0){return qe({queryKey:["escalationFacetKeys"],queryFn:()=>ue("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function nk(n){return qe({queryKey:["escalationFacetValues",n],queryFn:()=>ue(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function rk(n){const e=new URLSearchParams;return n.status&&e.set("status",n.status),n.role&&e.set("role",n.role),n.type&&e.set("type",n.type),n.subtype&&e.set("subtype",n.subtype),n.assigned_to&&e.set("assigned_to",n.assigned_to),n.parent_id&&e.set("parent_id",n.parent_id),n.claimed&&e.set("claimed","true"),n.priority&&e.set("priority",String(n.priority)),n.limit&&e.set("limit",String(n.limit)),n.offset!==void 0&&e.set("offset",String(n.offset)),n.sort_by&&e.set("sort_by",n.sort_by),n.order&&e.set("order",n.order),n.search&&e.set("search",n.search),dv(e,n),e}function sk(n){return{queryKey:["escalations",n],queryFn:()=>ue(`/escalations?${rk(n)}`)}}function mv(n){const{enabled:e=!0,staleTime:s,...i}=n;return qe({...sk(i),enabled:e,...s!==void 0?{staleTime:s}:{}})}function pv(n){const{enabled:e=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),dv(o,i),qe({queryKey:["escalations","available",i],queryFn:()=>ue(`/escalations/available?${o}`),enabled:e,...s!==void 0?{staleTime:s}:{}})}function P5(n){return qe({queryKey:["escalations","by-workflow",n],queryFn:()=>ue(`/escalations/by-workflow/${n}`),enabled:!!n})}function B5(n){return qe({queryKey:["escalations",n],queryFn:()=>ue(`/escalations/${n}`),enabled:!!n})}function U5(n,e){return qe({queryKey:["escalations",n,"lookups"],queryFn:()=>ue(`/escalations/${n}/lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function z5(){const n=Be();return Fe({mutationFn:({id:e,durationMinutes:s})=>ue(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function I5(){const n=Be();return Fe({mutationFn:e=>ue(`/escalations/${e}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function $5(){const n=Be();return Fe({mutationFn:({id:e,resolverPayload:s})=>ue(`/escalations/${e}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),n.resetQueries({queryKey:["tasks"]}),n.resetQueries({queryKey:["jobs"]})}})}function H5(){const n=Be();return Fe({mutationFn:({id:e,itemKey:s,payload:i})=>ue(`/escalations/${e}/accumulate`,{method:"POST",body:JSON.stringify({itemKey:s,...i?{payload:i}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function F5(){const n=Be();return Fe({mutationFn:({id:e,itemKey:s})=>ue(`/escalations/${e}/remove-item`,{method:"POST",body:JSON.stringify({itemKey:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function G5(){const n=Be();return Fe({mutationFn:({id:e,targetRole:s})=>ue(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function V5(){const n=Be();return Fe({mutationFn:({ids:e,priority:s})=>ue("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:e,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Y5(){const n=Be();return Fe({mutationFn:({ids:e,durationMinutes:s})=>ue("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:e,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function K5(){const n=Be();return Fe({mutationFn:({ids:e,targetUserId:s,durationMinutes:i,reassign:o})=>ue("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:e,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function J5(){const n=Be();return Fe({mutationFn:({ids:e})=>ue("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Q5(){const n=Be();return Fe({mutationFn:({ids:e,hint:s})=>ue("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:e,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function X5(){const n=Be();return Fe({mutationFn:e=>ue(`/escalations/${e}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function W5(){const n=Be();return Fe({mutationFn:({ids:e})=>ue("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Lm(n){const e=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":e.push(["tasks"]),e.push(["jobs"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),n.originId&&e.push(["processes",n.originId]);break;case"escalation":e.push(["escalations"]),e.push(["escalationStats"]),e.push(["stationMetrics"]),n.workflowId&&e.push(["workflowExecution",n.workflowId]);break;case"workflow":e.push(["jobs"]),e.push(["tasks"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId]),e.push(["mcpQueryResult",n.workflowId]),e.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&e.push(["mcpRunExecution",n.workflowId]),e.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),e.push(["tasks"]);break;case"knowledge":e.push(["knowledge"]);break;case"file":e.push(["files"]);break;case"agent":e.push(["agents"]);break;default:e.push(["jobs"]),e.push(["tasks"]);break}return e}const ik={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},Z5=300,Rb={DETAIL:0,LIST:1,SUMMARY:2};function ak(n){const e=new Map,s={},i={};let o=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function m(d){delete s[d],i[d]=Date.now();const b=[];for(const[v,w]of e)w===d&&b.push(v);for(const v of b)e.delete(v);if(b.length===0)return;const x=c();x&&(o=!0);for(const v of b)n.invalidateQueries({queryKey:JSON.parse(v),...x?{refetchType:"none"}:{}})}function p(d){if(s[d])return;const{coalesceMs:b,minIntervalMs:x}=ik[d],v=i[d],w=v===void 0?0:v+x-Date.now(),S=Math.max(b,w);s[d]=setTimeout(()=>m(d),S)}function g(d,b){for(const x of b){const v=JSON.stringify(x),w=e.get(v);(w===void 0||Rb[d]<Rb[w])&&e.set(v,d)}p(d)}const u=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",u),{request:g,dispose(){for(const d of Object.keys(s)){const b=s[d];b&&clearTimeout(b),delete s[d]}e.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",u)}}}const Db=new WeakMap;function ok(n){let e=Db.get(n);return e||(e=ak(n),Db.set(n,e)),e}function tn(n){const e=Be();return E.useCallback(s=>{ok(e).request(n,s)},[e,n])}function qm(n){return n?[`${Xt}.system.workflow.>`,`${Xt}.system.activity.>`,`${Xt}.system.milestone.>`,`${Xt}.system.task.>`,`${Xt}.system.escalation.>`]:[]}function eM(){const n=tn("LIST");An(`${Xt}.system.task.>`,()=>{n([["jobs"]])}),An(`${Xt}.system.workflow.>`,()=>{n([["jobs"]])})}function tM(n){const e=tn("DETAIL");js(qm(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],m=Lm(s);c==="escalation"&&m.push(["escalations","by-workflow",n]),e(m)})}function nM(n){const e=tn("DETAIL");js(qm(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],m=Lm(s);c==="escalation"&&m.push(["escalations","by-workflow",n]),e(m)})}function rM(n){const e=tn("DETAIL");js(qm(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=Lm(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),e(o)})}function sM(n){const e=tn("DETAIL"),s=E.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||e([["processes",n]]))},[n,e]);An(`${Xt}.system.task.>`,s),An(`${Xt}.system.workflow.>`,s),An(`${Xt}.system.escalation.>`,s)}function iM(){const n=tn("SUMMARY");An(fr({}),()=>{n([["escalationStats"]])})}function aM(){const n=tn("SUMMARY");An(fr({}),()=>{n([["stationMetrics"]])})}function oM(){const n=tn("SUMMARY");An(fr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function lM(n){const e=tn("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=E.useMemo(()=>{const c=i?i.split(","):null;return c?Yd({role:s,verbs:c}):[fr({role:s})]},[s,i]);js(o,()=>{e([["escalations"]])})}const lk=[["escalations","related"],["escalations","related-rows"]];function cM(n){const e=tn("LIST"),s=[...new Set(n)].sort().join(","),i=E.useMemo(()=>s?s.split(",").map(o=>fr({role:o})):[],[s]);js(i,()=>{e(lk)})}function uM(n){const e=tn("DETAIL");An(fr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||e([["escalations",n]])})}function fM(){const n=tn("LIST");An(`${Xt}.system.agent.>`,()=>{n([["agents"]])})}function hM(){const n=tn("LIST");An(`${Xt}.system.task.>`,()=>{n([["processes"]])}),An(`${Xt}.system.workflow.>`,()=>{n([["processes"]])})}function ck(){const{user:n}=qt(),e=n==null?void 0:n.userId,s=tn("SUMMARY");js(Am(),()=>{s([["escalations"]])});const{data:i}=pv({limit:1}),{data:o}=mv({assigned_to:e,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function Ru({size:n="sm",hideLabel:e=!1,className:s="",appName:i="LongTail",variant:o="full"}){const c=n==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Vt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Vt}/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",p=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 h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${m}`,style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${e?"opacity-0":""}`,children:i})]})}const uk="system.surfaces.dashboard",fk=`${Xt}.${uk}`;function yv(n=!0){return qe({queryKey:["announcements"],queryFn:()=>ue("/announcements"),enabled:n,staleTime:3e4})}function hk(){const n=Be();return Fe({mutationFn:e=>ue("/announcements",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function dk(){const n=Be();return Fe({mutationFn:e=>ue(`/announcements/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function dM(n){return n.toLocaleString()}function mM(n){return n>=1e9?`${(n/1e9).toFixed(1).replace(/\.0$/,"")}B`:n>=1e6?`${(n/1e6).toFixed(1).replace(/\.0$/,"")}M`:n>=1e4?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}K`:n.toLocaleString()}function mk(n){const e=new Date(n);return e.getTime()>Date.now()?"just now":Cj(e,{addSuffix:!0})}function pM(n){const e=Date.now()-new Date(n).getTime();if(e<0)return"now";const s=Math.floor(e/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const o=Math.floor(i/60);if(o<24)return`${o}h`;const c=Math.floor(o/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 yM(n){return n<=0?"Expired":Pm(n)}function pk(n){return n==null?"--":Pm(n)}function gM(n){return n?jm(n):"--"}function Pm(n){if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4){const m=n/1e3;return Number.isInteger(m)?`${m}s`:`${m.toFixed(1)}s`}const e=Math.floor(n/1e3),s=Math.floor(e/86400),i=Math.floor(e%86400/3600),o=Math.floor(e%3600/60),c=e%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?o>0?`${i}h ${o}m`:`${i}h`:c>0?`${o}m ${c}s`:`${o}m`}function bM(n,e){const s=new Date(n).getTime(),i=e?new Date(e).getTime():Date.now();return Pm(i-s)}function gv({options:n,children:e,className:s=""}){const[i,o]=E.useState(!1),[c,m]=E.useState(null),[p,g]=E.useState(null),u=E.useRef(null),d=E.useRef(void 0),b=E.useRef(void 0),x=220,v=E.useCallback(()=>{if(!u.current)return;const P=u.current.getBoundingClientRect(),q=window.innerWidth-x-8,re=Math.max(8,Math.min(P.left,q));g({top:P.bottom+4,left:re})},[]),w=E.useCallback(async(P,q)=>{try{await navigator.clipboard.writeText(P),m(q),clearTimeout(d.current),d.current=setTimeout(()=>m(null),1200)}catch{}},[]),S=E.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=E.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return E.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:u,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[e,i&&p&&sm.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:p.top,left:p.left},onMouseEnter:S,onMouseLeave:C,children:n.map(P=>h.jsxs("button",{onClick:q=>{q.stopPropagation(),w(P.value,P.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:P.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===P.label?"✓":P.value})]},P.label))}),document.body)]})}function yk(n,e){const s=new Date(n);switch(e){case"relative":return mk(n);case"datetime":return jm(s);case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:Rj()??void 0})}}function gk(n){const e=new Date(n);return[{label:"ms",value:String(e.getTime())},{label:"utc",value:e.toISOString()},{label:"local",value:jm(e,!0)}]}function bv({date:n,format:e="relative",className:s=""}){const[,i]=E.useState(0);E.useEffect(()=>{if(e!=="relative")return;const c=setInterval(()=>i(m=>m+1),3e4);return()=>clearInterval(c)},[e]);const o=E.useMemo(()=>gk(n),[n]);return h.jsx(gv,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:yk(n,e)})})}function bk({values:n,options:e,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const m=e.filter(p=>!n.includes(p));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(p=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==p)),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 ${p}`,children:[p,h.jsx(Zt,{className:"w-3 h-3",strokeWidth:1.5})]},p)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),m.length>0&&h.jsxs("select",{value:"",onChange:p=>p.target.value&&s([...n,p.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),m.map(p=>h.jsx("option",{value:p,children:p},p))]})]})}const xk=[{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 vk(){const{data:n}=yv(),{data:e}=zj(),s=hk(),i=dk(),[o,c]=E.useState(""),[m,p]=E.useState(""),[g,u]=E.useState(1440),[d,b]=E.useState([]),x=(n==null?void 0:n.announcements)??[],v=()=>{m.trim()&&s.mutate({body:m.trim(),...o.trim()?{title:o.trim()}:{},...d.length?{roles:d}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),p(""),b([])}})};return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),h.jsx("input",{type:"text",value:o,onChange:w=>c(w.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),h.jsx("textarea",{value:m,onChange:w=>p(w.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),h.jsx("select",{value:g,onChange:w=>u(Number(w.target.value)),className:"select text-xs w-full",children:xk.map(w=>h.jsx("option",{value:w.minutes,children:w.label},w.minutes))})]}),h.jsxs("div",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),h.jsx(bk,{values:d,options:(e==null?void 0:e.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&h.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),h.jsx("button",{onClick:v,disabled:!m.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),x.length>0&&h.jsxs("div",{className:"mt-6",children:[h.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),h.jsx("div",{className:"space-y-1",children:x.map(w=>h.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs text-text-primary truncate",children:w.title??w.body.split(`
54
- `)[0]}),h.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",h.jsx(bv,{date:w.expires_at,format:"relative"})]})]}),h.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:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},w.id))})]})]})}const _k=[{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"}],wk=["operator","engineer","admin","superadmin"];function Lb(n){return wk.indexOf(n)}function Sk(n,e){return Lb(n)>=Lb(e)}function Ek({onClose:n}){var Ne,Me,We,pt,Ct,Se,Re;const{isSuperAdmin:e,hasRoleType:s,hasRole:i}=qt(),{data:o}=er(),c=Om(),m=!!((Ne=o==null?void 0:o.ai)!=null&&Ne.enabled),p=Qx(),g=p!==null?p:m,[u,d]=E.useState(g),b=(Me=o==null?void 0:o.features)==null?void 0:Me.graphWorkflows,x=b==null,[v,w]=E.useState(b===!0||x&&Xx()),S=e||i("engineer"),[C,P]=E.useState(Wx()),q=!!((We=o==null?void 0:o.features)!=null&&We.scanCodes),re=Zx(),[se,M]=E.useState(re!==null?re:q),U=e?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ae=((pt=o==null?void 0:o.branding)==null?void 0:pt.appName)??"LongTail",z=(Ct=o==null?void 0:o.environment)==null?void 0:Ct.longTailVersion,I=(Se=o==null?void 0:o.environment)==null?void 0:Se.hotmeshVersion,D=(Re=o==null?void 0:o.environment)==null?void 0:Re.nodeEnv;E.useEffect(()=>{const ce=Ue=>{Ue.key==="Escape"&&n()};return document.addEventListener("keydown",ce),()=>document.removeEventListener("keydown",ce)},[n]);const X=_k.filter(ce=>Sk(U,ce.minTier)),W=X.length>1,he=U!=="operator",we=[...W?[{id:"viewas",label:"View As",icon:yS}]:[],{id:"features",label:"Features",icon:gS},...he?[{id:"alerts",label:"Alerts",icon:bS}]:[]],[Oe,F]=E.useState(we[0].id),J=ce=>{ce===null?Vd():dA(ce)},le=()=>{const ce=!u;d(ce),ce===m?hA():fA(ce),window.location.reload()},pe=()=>{const ce=!v;w(ce),mA(ce),window.location.reload()},ye=()=>{const ce=!C;P(ce),pA(ce),window.location.reload()},Ce=()=>{const ce=!se;M(ce),ce===q?gA():yA(ce),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:n,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:ce=>ce.stopPropagation(),children:[h.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Zt,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),z&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",z,I&&h.jsxs(h.Fragment,{children:[" · HotMesh v",I]}),D&&D!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:D})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),we.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:we.map(ce=>{const Ue=Oe===ce.id;return h.jsxs("button",{role:"tab","aria-selected":Ue,onClick:()=>F(ce.id),title:ce.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Ue?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(ce.icon,{className:"w-5 h-5",strokeWidth:1.5,...Ue?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:ce.label})]},ce.id)})}),Oe==="viewas"&&W&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),X.map(ce=>{const Ue=c===ce.id,Xe=ce.id===null?`Your view · ${U}`:ce.label;return h.jsxs("button",{onClick:()=>J(ce.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${Ue?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Ue&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${Ue?"text-accent":"text-text-primary group-hover:text-accent"}`,children:Xe}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:ce.description})]})]},String(ce.id))})]}),Oe==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:le,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:u?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${u?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${u?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:pe,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:v?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${v?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${v?"translate-x-4":"translate-x-0"}`})})]}),S&&h.jsxs("button",{onClick:ye,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group","data-testid":"feature-infrastructure",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Infrastructure"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:C?"Visible — Routers, Messages, and DB Maintenance in the sidebar":"Hidden — routers, message streams, and database maintenance"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${C?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]}),h.jsxs("button",{onClick:Ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:se?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${se?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${se?"translate-x-4":"translate-x-0"}`})})]})]}),Oe==="alerts"&&he&&h.jsx(vk,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const xv=[{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"}],qb="blue",vv="lt.theme";let _v=[];function Ok(n){const e=new Set(xv.map(i=>i.id)),s=new Set;_v=n.filter(i=>!(i!=null&&i.id)||e.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function Ak(){return[...xv,..._v]}function wv(){try{return localStorage.getItem(vv)||qb}catch{return qb}}function Sv(n){document.documentElement.dataset.theme=n}function jk(n){try{localStorage.setItem(vv,n)}catch{}Sv(n)}const kk=[8,12,13,14];function Nk(n){if(!/^[0-9]+$/.test(n)||!kk.includes(n.length))return!1;const e=n.split("").map(Number),s=e.pop();let i=0;for(let o=e.length-1,c=3;o>=0;o--,c=c===3?1:3)i+=e[o]*c;return(10-i%10)%10===s}function xM(n){return n.padStart(14,"0")}const cu={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},Ev="lt_scan_wedge_config";function Ov(){try{const n=localStorage.getItem(Ev);return n?{...cu,...JSON.parse(n)}:cu}catch{return cu}}function Tk(n){const e={...Ov(),...n};return localStorage.setItem(Ev,JSON.stringify(e)),e}const Bm=[{pattern:/(?:^|[^0-9])([1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+)$/,digitsOnly:!1},{pattern:/(?:^|[^0-9])([1-9][0-9]{7,})$/,digitsOnly:!0}];function Ck(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mk(n){const e=[];for(const s of n.filter(i=>i.enabled))if(s.encoding==="delimited"){const i=Ck(s.delimiter);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}${i}[0-9]${i}[a-zA-Z0-9._-]+)$`),digitsOnly:!1})}else if(s.encoding==="fixed"){const i=1+(s.target_length??0);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}[0-9]{${i},${i+1}})$`),digitsOnly:!0})}else s.encoding==="gtin"&&e.push({pattern:/(?:^|[^0-9])([0-9]{8}|[0-9]{12,14})$/,digitsOnly:!0,accept:Nk});return e.length?e:Bm}function Rk(n,e=Bm){var i;let s=null;for(const o of e){const c=(i=n.match(o.pattern))==null?void 0:i[1];!c||o.accept&&!o.accept(c)||(!s||c.length>s.code.length)&&(s={code:c,shape:o})}return s}const Dk=new Set(["Shift","CapsLock"]),hc={suppress:!1,emit:null};function Lk(n=cu,e=Bm){let s={buffer:"",times:[],lastKeyMs:0};function i(u){const d=s.times.slice(-u.length);return d.length<2?!1:(d[d.length-1]-d[0])/(d.length-1)<=n.autoFireMaxAvgKeyMs}function o(){const u=Rk(s.buffer,e);return!u||u.code.length<n.minLength||u.shape.digitsOnly&&!i(u.code)?null:u.code}function c(){s={buffer:"",times:[],lastKeyMs:0}}function m(u){const{key:d,timeMs:b,hasModifier:x,isRepeat:v}=u;if(Dk.has(d))return hc;if(n.terminators.includes(d)){const q=o();return c(),q?{suppress:!0,emit:q,consumedLength:q.length}:hc}if(x||v||d.length!==1)return c(),hc;const w=b-s.lastKeyMs,S=s.lastKeyMs>0&&w<=n.maxKeyGapMs,C=(S?s.buffer+d:d).slice(-128),P=(S?[...s.times,b]:[b]).slice(-128);return s={buffer:C,times:P,lastKeyMs:b},hc}function p(){return{buffer:s.buffer}}function g(){const u=o();return!u||!i(u)?null:{code:u,consumedLength:u.length}}return{step:m,reset:c,snapshot:p,pendingAutoFire:g}}function qk(){const n=document.activeElement;return n instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(n.type)?n:null:n instanceof HTMLTextAreaElement?n:null}function Pk(n,e,s){var c;const i=n instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,o=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;o?o.call(n,e):n.value=e;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function Pb(n){if(n<=0)return;const e=qk();if(!e)return;const s=e.selectionStart??e.value.length,i=Math.max(0,s-n);Pk(e,e.value.slice(0,i)+e.value.slice(s),i)}function Bk({active:n,wedgeConfig:e,tailShapes:s,diagnosticsOn:i,onScan:o,onDiag:c}){const m=E.useRef({diagnosticsOn:i,onScan:o,onDiag:c});m.current={diagnosticsOn:i,onScan:o,onDiag:c};const p=E.useRef(0),g=E.useRef(0);E.useEffect(()=>{if(!n)return;const u=Lk(e,s);let d=null;const b=()=>{d&&(clearTimeout(d),d=null)},x=(S,C,P)=>{C&&Pb(C),m.current.diagnosticsOn&&(console.debug("[scan]",P),m.current.onDiag({seq:++p.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:P})),m.current.onScan(S)},v=()=>{b(),u.pendingAutoFire()&&(d=setTimeout(()=>{d=null;const S=u.pendingAutoFire();S&&(u.reset(),x(S.code,S.consumedLength,`capture → ${S.code} (quiet period — no suffix)`))},e.autoFireQuietMs))},w=S=>{const C=u.snapshot().buffer,{suppress:P,emit:q,consumedLength:re}=u.step({key:S.key,timeMs:S.timeStamp,hasModifier:S.ctrlKey||S.metaKey||S.altKey,isRepeat:S.repeat});if(P&&(S.preventDefault(),S.stopPropagation()),m.current.diagnosticsOn){const se=u.snapshot().buffer,M=e.terminators.includes(S.key),U=q?`capture → ${q}`:M?`terminator — no code tail in "${C.slice(-24)}"`:se===C?C?"neutral (chord key)":"ignored":se===""?"reset (edit/chord/non-printable)":se.length<=1&&C.length>1?"gap — new episode":"accumulate",ae=g.current?Math.round(S.timeStamp-g.current):0,z={seq:++p.current,key:S.key,code:S.code!==S.key?S.code:"",deltaMs:ae,buffer:se.slice(-24),note:U};console.debug("[scan]",z.key,z.code,`${z.deltaMs}ms`,z.note),m.current.onDiag(z)}g.current=S.timeStamp,q?(b(),re&&Pb(re),m.current.onScan(q)):v()};return window.addEventListener("keydown",w,{capture:!0}),()=>{b(),window.removeEventListener("keydown",w,{capture:!0})}},[n,e,s])}const je={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",NO_OPEN_CONTAINER:"no_open_container",HELD:"held",REFUSED:"refused",SUBJECT_STALE:"subject_stale"},dc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",ACCUMULATE:"accumulate",PRESENT:"present",HOLD:"hold",FILL:"fill"},Uk={ACTION:"action",IDENTITY:"identity"};function zk(n,e){return ue("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...e!=null&&e.actingToken?{actingToken:e.actingToken}:{},...e!=null&&e.previousActingToken?{previousActingToken:e.previousActingToken}:{},...e!=null&&e.subject?{subject:e.subject}:{},...e!=null&&e.stationRole?{stationRole:e.stationRole}:{}})})}function vM(n){return ue("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function Av(n){return qe({queryKey:["scan-schemes"],queryFn:()=>ue("/scan-codes/schemes"),...n})}function _M(n){return qe({queryKey:["scan-schemes",n],queryFn:()=>ue(`/scan-codes/schemes/${n}`),enabled:n!=null})}function wM(){const n=Be();return Fe({mutationFn:e=>ue(`/scan-codes/schemes/${e.version}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function SM(){const n=Be();return Fe({mutationFn:e=>ue(`/scan-codes/schemes/${e}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function EM(){const n=Be();return Fe({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function OM(){const n=Be();return Fe({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"DELETE"}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const Ik=3e4;function $k(n,e=Date.now()){if(!(!n||Date.parse(n.expiresAt)<=e))return{code:n.code,escalationId:n.escalationId}}function Bb(n,e,s=Date.now()){if(e.outcome===je.HELD&&e.subject){const i=Math.max(0,Date.parse(e.subject.expiresAt)-s);return{...e.subject,ttlMs:i}}return e.clearSubject||!n?null:e.outcome===je.EXECUTED&&e.progress&&e.progress.remaining>0?{...n,expiresAt:new Date(s+n.ttlMs).toISOString()}:n}function Ub(n){return n.outcome===je.NOT_PRIMED&&n.replayable===!0}function Hk(n,e=Date.now()){return n&&e-n.at<=Ik?n:null}const Fk=[je.HELD,je.REFUSED,je.SUBJECT_STALE],To={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar"},Fi=n=>{if(n)try{return JSON.parse(n)}catch{return}},Zs=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function Gk(n){const e={},s=Fi(n.get("facets"));Zs(s)||(e.facets=s);const i=Fi(n.get("block"));Zs(i)||(e.block=i);const o=Fi(n.get("range"));Zs(o)||(e.range=o);const c=Fi(n.get("exists"));Zs(c)||(e.exists=c);const m=Fi(n.get("roles"));Zs(m)||(e.roles=m);const p=Fi(n.get("orderBy"));Zs(p)||(e.orderBy=p),n.get("available")!=null&&(e.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(e.jeopardy=!0),e}function AM(n,e){const s=(i,o)=>Zs(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",e.facets),s("block",e.block),s("range",e.range),s("exists",e.exists),s("roles",e.roles),s("orderBy",e.orderBy),e.available==null?n.delete("available"):n.set("available",String(e.available)),e.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const zb=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function jv(n,e){const s={};for(const[o,c]of Object.entries(n))s[o]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return e?`/escalations/available?role=${encodeURIComponent(e)}&facets=${i}${zb}`:`/escalations/available?facets=${i}${zb}`}function Vk(n,e,s){return jv({[n]:e},s)}function jM(n){var e,s,i;return Object.keys(n.facets??{}).length+(((e=n.block)==null?void 0:e.length)??0)+(((s=n.range)==null?void 0:s.length)??0)+(((i=n.exists)==null?void 0:i.length)??0)+(n.available!=null?1:0)+(n.jeopardy===!0?1:0)}function Um(){var s;const{data:n}=er(),e=Zx();return e!==null?e:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const zm=E.createContext(null);function Im(){const n=E.useContext(zm);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}function kM(){return E.useContext(zm)}const Yk="scanPendingAction",Kk="scanChoices",fd="/scan/station";function Jk({children:n}){const{user:e}=qt(),s=Um(),i=ni(),o=en(),{identity:c,prime:m,clear:p,settle:g}=Cu(),[u,d]=E.useState(null),[b,x]=E.useState(null),[v,w]=E.useState(null),{data:S}=Av({enabled:!!e&&s,staleTime:6e4}),C=E.useRef(null);C.current=Tm().role;const P=E.useMemo(()=>Mk((S==null?void 0:S.schemes)??[]),[S]),[q,re]=E.useState(!1),[se,M]=E.useState(()=>Ov()),[U,ae]=E.useState([]),[z,I]=E.useState(!1),D=E.useCallback(Se=>{var Ue;const{outcome:Re}=Se;if(Re===je.CONFIRM_REQUIRED&&Se.pendingAction)return i(`/escalations/detail/${Se.pendingAction.escalationId}`,{state:{[Yk]:Se.pendingAction}}),!0;const ce=Re===je.EXECUTED&&!!F.current;if(Fk.includes(Re)||Ub(Se)||ce)return le.current!==fd&&i(fd),!0;if(Re===je.EXECUTED&&Se.escalation){const Xe=[dc.SHOW_DETAIL,dc.CLAIM_SHOW_DETAIL,dc.CLAIM,dc.ESCALATE];return Se.verb&&Xe.includes(Se.verb)?(i(`/escalations/detail/${Se.escalation.id}`),!0):!1}if(Re===je.MATCHED_LIST&&Se.listQuery){const{targetFacet:Xe,target:cn,roles:Mt}=Se.listQuery;return i(jv({[Xe]:cn},(Mt==null?void 0:Mt[0])??null)),!0}return Re===je.CHOICES&&Se.choices?(i(fd,{state:{[Kk]:Se}}),!0):Re===je.NO_MATCH_FALLBACK&&((Ue=Se.fallback)!=null&&Ue.route)?(i(Se.fallback.route),!0):!1},[i]),X=E.useRef(null);X.current=(c==null?void 0:c.actingToken)??null;const W=E.useRef(null),he=E.useRef([]),we=E.useCallback(Se=>(he.current=[Se,...he.current],()=>{he.current=he.current.filter(Re=>Re!==Se)}),[]),Oe=E.useRef(null);Oe.current=b;const F=E.useRef(void 0),J=E.useRef(null);J.current=v;const le=E.useRef(o.pathname);le.current=o.pathname,E.useEffect(()=>{if(!b)return;const Se=Date.parse(b.expiresAt)-Date.now();if(Se<=0){x(null);return}const Re=setTimeout(()=>x(null),Se);return()=>clearTimeout(Re)},[b]);const pe=E.useCallback(async(Se,Re,ce)=>{re(!0);const Ue=Date.now();try{F.current=$k(Oe.current);const Xe=await zk(Se,{actingToken:ce??void 0,previousActingToken:W.current??void 0,subject:F.current,stationRole:C.current??void 0});if(ce&&g(ce,Xe),x(Mt=>Bb(Mt,Xe)),Xe.outcome===je.IDENTITY_PRIMED){W.current=m(Xe);const Mt=Hk(J.current);if(w(null),Mt&&Xe.actingToken){d({code:Se,source:Re,at:Ue,response:Xe,error:null,navigated:!1}),await pe(Mt.code,Re,Xe.actingToken);return}}else Ub(Xe)?w({code:Se,at:Ue}):w(null);Xe.outcome===je.NOT_PRIMED&&ce&&p();const cn=D(Xe);d({code:Se,source:Re,at:Ue,response:Xe,error:null,navigated:cn})}catch(Xe){d({code:Se,source:Re,at:Ue,response:null,error:Xe.message,navigated:!1})}finally{re(!1)}},[D,m,p,g]),ye=E.useCallback(async(Se,Re=To.MANUAL)=>{for(const ce of he.current)if(ce(Se))return;await pe(Se,Re,X.current)},[pe]),Ce=E.useCallback(()=>x(null),[]),Ne=E.useCallback(Se=>{x(Re=>Bb(Re,Se))},[]),Me=E.useCallback(()=>w(null),[]),We=E.useRef(ye);We.current=ye,Bk({active:!!e&&s,wedgeConfig:se,tailShapes:P,diagnosticsOn:z,onScan:Se=>void We.current(Se,To.KEYBOARD_WEDGE),onDiag:Se=>ae(Re=>[...Re.slice(-29),Se])});const pt=E.useCallback(Se=>{M(Tk(Se))},[]),Ct=E.useMemo(()=>({submitCode:ye,pushCodeInterceptor:we,lastResult:u,subject:b,dropSubject:Ce,adoptResponse:Ne,pendingScan:v,dropPendingScan:Me,busy:q,wedgeConfig:se,updateWedgeConfig:pt,diagnostics:U,diagnosticsOn:z,setDiagnosticsOn:I}),[ye,we,u,b,Ce,Ne,v,Me,q,se,pt,U,z]);return h.jsx(zm.Provider,{value:Ct,children:n})}var mc={},lo={},pc={},Ib;function Nn(){if(Ib)return pc;Ib=1,Object.defineProperty(pc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var e=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return pc.default=e,pc}var $b;function Qk(){if($b)return lo;$b=1,Object.defineProperty(lo,"__esModule",{value:!0}),lo.CODE39=void 0;var n=(function(){function S(C,P){for(var q=0;q<P.length;q++){var re=P[q];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(C,re.key,re)}}return function(C,P,q){return P&&S(C.prototype,P),q&&S(C,q),C}})(),e=Nn(),s=i(e);function i(S){return S&&S.__esModule?S:{default:S}}function o(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")}function c(S,C){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:S}function m(S,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);S.prototype=Object.create(C&&C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(S,C):S.__proto__=C)}var p=(function(S){m(C,S);function C(P,q){return o(this,C),P=P.toUpperCase(),q.mod43&&(P+=x(w(P))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,P,q))}return n(C,[{key:"encode",value:function(){for(var q=d("*"),re=0;re<this.data.length;re++)q+=d(this.data[re])+"0";return q+=d("*"),{data:q,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),C})(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","-","."," ","$","/","+","%","*"],u=[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(v(S))}function b(S){return u[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function w(S){for(var C=0,P=0;P<S.length;P++)C+=v(S[P]);return C=C%43,C}return lo.CODE39=p,lo}var Jn={},yc={},gc={},vt={},Hb;function qo(){if(Hb)return vt;Hb=1,Object.defineProperty(vt,"__esModule",{value:!0});var n;function e(g,u,d){return u in g?Object.defineProperty(g,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):g[u]=d,g}var s=vt.SET_A=0,i=vt.SET_B=1,o=vt.SET_C=2;vt.SHIFT=98;var c=vt.START_A=103,m=vt.START_B=104,p=vt.START_C=105;return vt.MODULO=103,vt.STOP=106,vt.FNC1=207,vt.SET_BY_CODE=(n={},e(n,c,s),e(n,m,i),e(n,p,o),n),vt.SWAP={101:s,100:i,99:o},vt.A_START_CHAR="Ð",vt.B_START_CHAR="Ñ",vt.C_START_CHAR="Ò",vt.A_CHARS="[\0-_È-Ï]",vt.B_CHARS="[ -È-Ï]",vt.C_CHARS="(Ï*[0-9]{2}Ï*)",vt.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],vt}var Fb;function Du(){if(Fb)return gc;Fb=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Nn(),s=o(e),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){c(this,d);var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b.substring(1),x));return v.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),v}return n(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.bytes,v=x.shift()-105,w=i.SET_BY_CODE[v];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&x.unshift(i.FNC1);var S=d.next(x,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(v)+S.result+d.getBar((S.checksum+v)%i.MODULO)+d.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var x=this.options.ean128||!1;return typeof x=="string"&&(x=x.toLowerCase()==="true"),x}}],[{key:"getBar",value:function(x){return i.BARS[x]?i.BARS[x].toString():""}},{key:"correctIndex",value:function(x,v){if(v===i.SET_A){var w=x.shift();return w<32?w+64:w-32}else return v===i.SET_B?x.shift()-32:(x.shift()-48)*10+x.shift()-48}},{key:"next",value:function(x,v,w){if(!x.length)return{result:"",checksum:0};var S=void 0,C=void 0;if(x[0]>=200){C=x.shift()-105;var P=i.SWAP[C];P!==void 0?S=d.next(x,v+1,P):((w===i.SET_A||w===i.SET_B)&&C===i.SHIFT&&(x[0]=w===i.SET_A?x[0]>95?x[0]-96:x[0]:x[0]<32?x[0]+96:x[0]),S=d.next(x,v+1,w))}else C=d.correctIndex(x,w),S=d.next(x,v+1,w);var q=d.getBar(C),re=C*v;return{result:q+S.result,checksum:re+S.checksum}}}]),d})(s.default);return gc.default=g,gc}var bc={},Gb;function Xk(){if(Gb)return bc;Gb=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=qo(),e=function(p){return p.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(p){return p.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(m,p){var g=p?n.A_CHARS:n.B_CHARS,u=m.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(u)return u[1]+"Ì"+c(m.substring(u[1].length));var d=m.match(new RegExp("^"+g+"+"))[0];return d.length===m.length?m:d+String.fromCharCode(p?205:206)+o(m.substring(d.length),!p)}function c(m){var p=i(m),g=p.length;if(g===m.length)return m;m=m.substring(g);var u=e(m)>=s(m);return p+String.fromCharCode(u?206:205)+o(m,u)}return bc.default=function(m){var p=void 0,g=i(m).length;if(g>=2)p=n.C_START_CHAR+c(m);else{var u=e(m)>s(m);p=(u?n.A_START_CHAR:n.B_START_CHAR)+o(m,u)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,b){return"Ë"+b})},bc}var Vb;function Wk(){if(Vb)return yc;Vb=1,Object.defineProperty(yc,"__esModule",{value:!0});var n=Du(),e=o(n),s=Xk(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){if(c(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,i.default)(b),x));else var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x));return m(v)}return d})(e.default);return yc.default=g,yc}var xc={},Yb;function Zk(){if(Yb)return xc;Yb=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Du(),s=o(e),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.A_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),d})(s.default);return xc.default=g,xc}var vc={},Kb;function eN(){if(Kb)return vc;Kb=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Du(),s=o(e),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.B_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),d})(s.default);return vc.default=g,vc}var _c={},Jb;function tN(){if(Jb)return _c;Jb=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Du(),s=o(e),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.C_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),d})(s.default);return _c.default=g,_c}var Qb;function nN(){if(Qb)return Jn;Qb=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.CODE128C=Jn.CODE128B=Jn.CODE128A=Jn.CODE128=void 0;var n=Wk(),e=g(n),s=Zk(),i=g(s),o=eN(),c=g(o),m=tN(),p=g(m);function g(u){return u&&u.__esModule?u:{default:u}}return Jn.CODE128=e.default,Jn.CODE128A=i.default,Jn.CODE128B=c.default,Jn.CODE128C=p.default,Jn}var Kt={},wc={},Rr={},Xb;function Po(){return Xb||(Xb=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.SIDE_BIN="101",Rr.MIDDLE_BIN="01010",Rr.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"]},Rr.EAN2_STRUCTURE=["LL","LG","GL","GG"],Rr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Rr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Rr}var Sc={},Ec={},Wb;function Bo(){if(Wb)return Ec;Wb=1,Object.defineProperty(Ec,"__esModule",{value:!0});var n=Po(),e=function(i,o,c){var m=i.split("").map(function(g,u){return n.BINARIES[o[u]]}).map(function(g,u){return g?g[i[u]]:""});if(c){var p=i.length-1;m=m.map(function(g,u){return u<p?g+c:g})}return m.join("")};return Ec.default=e,Ec}var Zb;function kv(){if(Zb)return Sc;Zb=1,Object.defineProperty(Sc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),e=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var d=(function(b){u(x,b);function x(v,w){p(this,x);var S=g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,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 n(x,[{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:e.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:e.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:e.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[e.SIDE_BIN,this.leftEncode(),e.MIDDLE_BIN,this.rightEncode(),e.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),x})(c.default);return Sc.default=d,Sc}var e1;function rN(){if(e1)return wc;e1=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),e=function b(x,v,w){x===null&&(x=Function.prototype);var S=Object.getOwnPropertyDescriptor(x,v);if(S===void 0){var C=Object.getPrototypeOf(x);return C===null?void 0:b(C,v,w)}else{if("value"in S)return S.value;var P=S.get;return P===void 0?void 0:P.call(w)}},s=Po(),i=kv(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=function(x){var v=x.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,C){return C%2?w+S*3:w+S},0);return(10-v%10)%10},d=(function(b){g(x,b);function x(v,w){m(this,x),v.search(/^[0-9]{12}$/)!==-1&&(v+=u(v));var S=p(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w));return S.lastChar=w.lastChar,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===u(this.data)}},{key:"leftText",value:function(){return e(x.prototype.__proto__||Object.getPrototypeOf(x.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 e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=e(x.prototype.__proto__||Object.getPrototypeOf(x.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}}]),x})(o.default);return wc.default=d,wc}var Oc={},t1;function sN(){if(t1)return Oc;t1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=(function(){function d(b,x){for(var v=0;v<x.length;v++){var w=x[v];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,x,v){return x&&d(b.prototype,x),v&&d(b,v),b}})(),e=function d(b,x,v){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,x);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:d(S,x,v)}else{if("value"in w)return w.value;var C=w.get;return C===void 0?void 0:C.call(v)}},s=kv(),i=o(s);function o(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 p(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 x=b.substr(0,7).split("").map(function(v){return+v}).reduce(function(v,w,S){return S%2?v+w:v+w*3},0);return(10-x%10)%10},u=(function(d){p(b,d);function b(x,v){return c(this,b),x.search(/^[0-9]{7}$/)!==-1&&(x+=g(x)),m(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x,v))}return n(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var v=this.data.substr(0,4);return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var v=this.data.substr(4,4);return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return Oc.default=u,Oc}var Ac={},n1;function iN(){if(n1)return Ac;n1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var n=(function(){function x(v,w){for(var S=0;S<w.length;S++){var C=w[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}return function(v,w,S){return w&&x(v.prototype,w),S&&x(v,S),v}})(),e=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(x){return x&&x.__esModule?x:{default:x}}function p(x,v){if(!(x instanceof v))throw new TypeError("Cannot call a class as a function")}function g(x,v){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:x}function u(x,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);x.prototype=Object.create(v&&v.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(x,v):x.__proto__=v)}var d=function(v){var w=v.split("").map(function(S){return+S}).reduce(function(S,C,P){return P%2?S+C*9:S+C*3},0);return w%10},b=(function(x){u(v,x);function v(w,S){return p(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,w,S))}return n(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=e.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return Ac.default=b,Ac}var jc={},r1;function aN(){if(r1)return jc;r1=1,Object.defineProperty(jc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),e=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var d=(function(b){u(x,b);function x(v,w){return p(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w))}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=e.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,w,"01"),text:this.text}}}]),x})(c.default);return jc.default=d,jc}var co={},s1;function Nv(){if(s1)return co;s1=1,Object.defineProperty(co,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})();co.checksum=d;var e=Bo(),s=c(e),i=Nn(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=(function(b){g(x,b);function x(v,w){m(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=d(v));var S=p(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,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 n(x,[{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}}]),x})(o.default);function d(b){var x=0,v;for(v=1;v<11;v+=2)x+=parseInt(b[v]);for(v=0;v<11;v+=2)x+=parseInt(b[v])*3;return(10-x%10)%10}return co.default=u,co}var kc={},i1;function oN(){if(i1)return kc;i1=1,Object.defineProperty(kc,"__esModule",{value:!0});var n=(function(){function w(S,C){for(var P=0;P<C.length;P++){var q=C[P];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(S,q.key,q)}}return function(S,C,P){return C&&w(S.prototype,C),P&&w(S,P),S}})(),e=Bo(),s=m(e),i=Nn(),o=m(i),c=Nv();function m(w){return w&&w.__esModule?w:{default:w}}function p(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 u(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"]],x=(function(w){u(S,w);function S(C,P){p(this,S);var q=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,P));if(q.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)q.middleDigits=C,q.upcA=v(C,"0"),q.text=P.text||""+q.upcA[0]+C+q.upcA[q.upcA.length-1],q.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(q.middleDigits=C.substring(1,C.length-1),q.upcA=v(q.middleDigits,C[0]),q.upcA[q.upcA.length-1]===C[C.length-1])q.isValid=!0;else return g(q);else return g(q);return q.displayValue=P.displayValue,P.fontSize>P.width*10?q.fontSize=P.width*10:q.fontSize=P.fontSize,q.guardHeight=P.height+q.fontSize/2+P.textMargin,q}return n(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 P="";return P+="101",P+=this.encodeMiddleDigits(),P+="010101",{data:P,text:this.text}}},{key:"guardedEncoding",value:function(){var P=[];return this.displayValue&&P.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),P.push({data:"101",options:{height:this.guardHeight}}),P.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),P.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&P.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),P}},{key:"encodeMiddleDigits",value:function(){var P=this.upcA[0],q=this.upcA[this.upcA.length-1],re=b[parseInt(q)][parseInt(P)];return(0,s.default)(this.middleDigits,re)}}]),S})(o.default);function v(w,S){for(var C=parseInt(w[w.length-1]),P=d[C],q="",re=0,se=0;se<P.length;se++){var M=P[se];M==="X"?q+=w[re++]:q+=M}return q=""+S+q,""+q+(0,c.checksum)(q)}return kc.default=x,kc}var a1;function lN(){if(a1)return Kt;a1=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.UPCE=Kt.UPC=Kt.EAN2=Kt.EAN5=Kt.EAN8=Kt.EAN13=void 0;var n=rN(),e=x(n),s=sN(),i=x(s),o=iN(),c=x(o),m=aN(),p=x(m),g=Nv(),u=x(g),d=oN(),b=x(d);function x(v){return v&&v.__esModule?v:{default:v}}return Kt.EAN13=e.default,Kt.EAN8=i.default,Kt.EAN5=c.default,Kt.EAN2=p.default,Kt.UPC=u.default,Kt.UPCE=b.default,Kt}var Qs={},Nc={},Gi={},o1;function cN(){return o1||(o1=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.START_BIN="1010",Gi.END_BIN="11101",Gi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Gi}var l1;function Tv(){if(l1)return Nc;l1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=cN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return n(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var x=this,v=this.data.match(/.{2}/g).map(function(w){return x.encodePair(w)}).join("");return{data:e.START_BIN+v+e.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=e.BINARIES[x[1]];return e.BINARIES[x[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),d})(i.default);return Nc.default=g,Nc}var Tc={},c1;function uN(){if(c1)return Tc;c1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Tv(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function c(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function m(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var p=function(d){var b=d.substr(0,13).split("").map(function(x){return parseInt(x,10)}).reduce(function(x,v,w){return x+v*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(u){m(d,u);function d(b,x){return o(this,d),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(b)),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===p(this.data)}}]),d})(s.default);return Tc.default=g,Tc}var u1;function fN(){if(u1)return Qs;u1=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.ITF14=Qs.ITF=void 0;var n=Tv(),e=o(n),s=uN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Qs.ITF=e.default,Qs.ITF14=i.default,Qs}var xn={},Cc={},f1;function Uo(){if(f1)return Cc;f1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Nn(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function c(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function m(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var p=(function(u){m(d,u);function d(b,x){return o(this,d),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"encode",value:function(){for(var x="110",v=0;v<this.data.length;v++){var w=parseInt(this.data[v]),S=w.toString(2);S=g(S,4-S.length);for(var C=0;C<S.length;C++)x+=S[C]=="0"?"100":"110"}return x+="1001",{data:x,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(s.default);function g(u,d){for(var b=0;b<d;b++)u="0"+u;return u}return Cc.default=p,Cc}var Mc={},uo={},h1;function Lu(){if(h1)return uo;h1=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.mod10=n,uo.mod11=e;function n(s){for(var i=0,o=0;o<s.length;o++){var c=parseInt(s[o]);(o+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function e(s){for(var i=0,o=[2,3,4,5,6,7],c=0;c<s.length;c++){var m=parseInt(s[s.length-1-c]);i+=o[c%o.length]*m}return(11-i%11)%11}return uo}var d1;function hN(){if(d1)return Mc;d1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=Uo(),e=i(n),s=Lu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d+(0,s.mod10)(d),b))}return u})(e.default);return Mc.default=p,Mc}var Rc={},m1;function dN(){if(m1)return Rc;m1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=Uo(),e=i(n),s=Lu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d+(0,s.mod11)(d),b))}return u})(e.default);return Rc.default=p,Rc}var Dc={},p1;function mN(){if(p1)return Dc;p1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var n=Uo(),e=i(n),s=Lu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),d+=(0,s.mod10)(d),d+=(0,s.mod10)(d),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return u})(e.default);return Dc.default=p,Dc}var Lc={},y1;function pN(){if(y1)return Lc;y1=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=Uo(),e=i(n),s=Lu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),d+=(0,s.mod11)(d),d+=(0,s.mod10)(d),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return u})(e.default);return Lc.default=p,Lc}var g1;function yN(){if(g1)return xn;g1=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.MSI1110=xn.MSI1010=xn.MSI11=xn.MSI10=xn.MSI=void 0;var n=Uo(),e=d(n),s=hN(),i=d(s),o=dN(),c=d(o),m=mN(),p=d(m),g=pN(),u=d(g);function d(b){return b&&b.__esModule?b:{default:b}}return xn.MSI=e.default,xn.MSI10=i.default,xn.MSI11=c.default,xn.MSI1010=p.default,xn.MSI1110=u.default,xn}var fo={},b1;function gN(){if(b1)return fo;b1=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.pharmacode=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){o(this,u);var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b));return x.number=parseInt(d,10),x}return n(u,[{key:"encode",value:function(){for(var b=this.number,x="";!isNaN(b)&&b!=0;)b%2===0?(x="11100"+x,b=(b-2)/2):(x="100"+x,b=(b-1)/2);return x=x.slice(0,-2),{data:x,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),u})(s.default);return fo.pharmacode=p,fo}var ho={},x1;function bN(){if(x1)return ho;x1=1,Object.defineProperty(ho,"__esModule",{value:!0}),ho.codabar=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){o(this,u),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(u,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],x=this.getEncodings(),v=0;v<this.data.length;v++)b.push(x[this.data.charAt(v)]),v!==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"}}}]),u})(s.default);return ho.codabar=p,ho}var Xs={},qc={},Vi={},v1;function xN(){return v1||(v1=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.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","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Vi.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"],Vi.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"]}),Vi}var _1;function Cv(){if(_1)return qc;_1=1,Object.defineProperty(qc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=xN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.data.split("").flatMap(function(C){return e.MULTI_SYMBOLS[C]||C}),v=x.map(function(C){return d.getEncoding(C)}).join(""),w=d.checksum(x,20),S=d.checksum(x.concat(w),15);return{text:this.text,data:d.getEncoding("ÿ")+v+d.getEncoding(w)+d.getEncoding(S)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(x){return e.BINARIES[d.symbolValue(x)]}},{key:"getSymbol",value:function(x){return e.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return e.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var w=x.slice().reverse().reduce(function(S,C,P){var q=P%v+1;return S+d.symbolValue(C)*q},0);return d.getSymbol(w%47)}}]),d})(i.default);return qc.default=g,qc}var Pc={},w1;function vN(){if(w1)return Pc;w1=1,Object.defineProperty(Pc,"__esModule",{value:!0});var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=Cv(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return n(u,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),u})(s.default);return Pc.default=p,Pc}var S1;function _N(){if(S1)return Xs;S1=1,Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.CODE93FullASCII=Xs.CODE93=void 0;var n=Cv(),e=o(n),s=vN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Xs.CODE93=e.default,Xs.CODE93FullASCII=i.default,Xs}var mo={},E1;function wN(){if(E1)return mo;E1=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.GenericBarcode=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return n(u,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),u})(s.default);return mo.GenericBarcode=p,mo}var O1;function SN(){if(O1)return mc;O1=1,Object.defineProperty(mc,"__esModule",{value:!0});var n=Qk(),e=nN(),s=lN(),i=fN(),o=yN(),c=gN(),m=bN(),p=_N(),g=wN();return mc.default={CODE39:n.CODE39,CODE128:e.CODE128,CODE128A:e.CODE128A,CODE128B:e.CODE128B,CODE128C:e.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:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:c.pharmacode,codabar:m.codabar,CODE93:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},mc}var Bc={},A1;function qu(){if(A1)return Bc;A1=1,Object.defineProperty(Bc,"__esModule",{value:!0});var n=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e};return Bc.default=function(e,s){return n({},e,s)},Bc}var Uc={},j1;function EN(){if(j1)return Uc;j1=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.default=n;function n(e){var s=[];function i(o){if(Array.isArray(o))for(var c=0;c<o.length;c++)i(o[c]);else o.text=o.text||"",o.data=o.data||"",s.push(o)}return i(e),s}return Uc}var zc={},k1;function ON(){if(k1)return zc;k1=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.default=n;function n(e){return e.marginTop=e.marginTop||e.margin,e.marginBottom=e.marginBottom||e.margin,e.marginRight=e.marginRight||e.margin,e.marginLeft=e.marginLeft||e.margin,e}return zc}var Ic={},$c={},Hc={},N1;function Mv(){if(N1)return Hc;N1=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.default=n;function n(e){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof e[i]=="string"&&(e[i]=parseInt(e[i],10)));return typeof e.displayValue=="string"&&(e.displayValue=e.displayValue!="false"),e}return Hc}var Fc={},T1;function Rv(){if(T1)return Fc;T1=1,Object.defineProperty(Fc,"__esModule",{value:!0});var n={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 Fc.default=n,Fc}var C1;function AN(){if(C1)return $c;C1=1,Object.defineProperty($c,"__esModule",{value:!0});var n=Mv(),e=o(n),s=Rv(),i=o(s);function o(m){return m&&m.__esModule?m:{default:m}}function c(m){var p={};for(var g in i.default)i.default.hasOwnProperty(g)&&(m.hasAttribute("jsbarcode-"+g.toLowerCase())&&(p[g]=m.getAttribute("jsbarcode-"+g.toLowerCase())),m.hasAttribute("data-"+g.toLowerCase())&&(p[g]=m.getAttribute("data-"+g.toLowerCase())));return p.value=m.getAttribute("jsbarcode-value")||m.getAttribute("data-value"),p=(0,e.default)(p),p}return $c.default=c,$c}var Gc={},Vc={},vn={},M1;function Dv(){if(M1)return vn;M1=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.getTotalWidthOfEncodings=vn.calculateEncodingAttributes=vn.getBarcodePadding=vn.getEncodingHeight=vn.getMaximumHeightOfEncodings=void 0;var n=qu(),e=s(n);function s(u){return u&&u.__esModule?u:{default:u}}function i(u,d){return d.height+(d.displayValue&&u.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function o(u,d,b){if(b.displayValue&&d<u){if(b.textAlign=="center")return Math.floor((u-d)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(u-d)}return 0}function c(u,d,b){for(var x=0;x<u.length;x++){var v=u[x],w=(0,e.default)(d,v.options),S;w.displayValue?S=g(v.text,w,b):S=0;var C=v.data.length*w.width;v.width=Math.ceil(Math.max(S,C)),v.height=i(v,w),v.barcodePadding=o(S,C,w)}}function m(u){for(var d=0,b=0;b<u.length;b++)d+=u[b].width;return d}function p(u){for(var d=0,b=0;b<u.length;b++)u[b].height>d&&(d=u[b].height);return d}function g(u,d,b){var x;if(b)x=b;else if(typeof document<"u")x=document.createElement("canvas").getContext("2d");else return 0;x.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var v=x.measureText(u);if(!v)return 0;var w=v.width;return w}return vn.getMaximumHeightOfEncodings=p,vn.getEncodingHeight=i,vn.getBarcodePadding=o,vn.calculateEncodingAttributes=c,vn.getTotalWidthOfEncodings=m,vn}var R1;function jN(){if(R1)return Vc;R1=1,Object.defineProperty(Vc,"__esModule",{value:!0});var n=(function(){function p(g,u){for(var d=0;d<u.length;d++){var b=u[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,u,d){return u&&p(g.prototype,u),d&&p(g,d),g}})(),e=qu(),s=o(e),i=Dv();function o(p){return p&&p.__esModule?p:{default:p}}function c(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")}var m=(function(){function p(g,u,d){c(this,p),this.canvas=g,this.encodings=u,this.options=d}return n(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var u=0;u<this.encodings.length;u++){var d=(0,s.default)(this.options,this.encodings[u].options);this.drawCanvasBarcode(d,this.encodings[u]),this.drawCanvasText(d,this.encodings[u]),this.moveCanvasDrawing(this.encodings[u])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var u=this.canvas.getContext("2d");u.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,u);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,u.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(u.fillStyle=this.options.background,u.fillRect(0,0,this.canvas.width,this.canvas.height)),u.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(u,d){var b=this.canvas.getContext("2d"),x=d.data,v;u.textPosition=="top"?v=u.marginTop+u.fontSize+u.textMargin:v=u.marginTop,b.fillStyle=u.lineColor;for(var w=0;w<x.length;w++){var S=w*u.width+d.barcodePadding;x[w]==="1"?b.fillRect(S,v,u.width,u.height):x[w]&&b.fillRect(S,v,u.width,u.height*x[w])}}},{key:"drawCanvasText",value:function(u,d){var b=this.canvas.getContext("2d"),x=u.fontOptions+" "+u.fontSize+"px "+u.font;if(u.displayValue){var v,w;u.textPosition=="top"?w=u.marginTop+u.fontSize-u.textMargin:w=u.height+u.textMargin+u.marginTop+u.fontSize,b.font=x,u.textAlign=="left"||d.barcodePadding>0?(v=0,b.textAlign="left"):u.textAlign=="right"?(v=d.width-1,b.textAlign="right"):(v=d.width/2,b.textAlign="center"),b.fillText(d.text,v,w)}}},{key:"moveCanvasDrawing",value:function(u){var d=this.canvas.getContext("2d");d.translate(u.width,0)}},{key:"restoreCanvas",value:function(){var u=this.canvas.getContext("2d");u.restore()}}]),p})();return Vc.default=m,Vc}var Yc={},D1;function kN(){if(D1)return Yc;D1=1,Object.defineProperty(Yc,"__esModule",{value:!0});var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=qu(),s=o(e),i=Dv();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}var m="http://www.w3.org/2000/svg",p=(function(){function g(u,d,b){c(this,g),this.svg=u,this.encodings=d,this.options=b,this.document=b.xmlDocument||document}return n(g,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var x=this.encodings[b],v=(0,s.default)(this.options,x.options),w=this.createGroup(d,v.marginTop,this.svg);this.setGroupOptions(w,v),this.drawSvgBarcode(w,v,x),this.drawSVGText(w,v,x),d+=x.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),x=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(x,b),this.options.background&&this.drawRect(0,0,x,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,b,x){var v=x.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,C=0,P=0;P<v.length;P++)C=P*b.width+x.barcodePadding,v[P]==="1"?S++:S>0&&(this.drawRect(C-b.width*S,w,b.width*S,b.height,d),S=0);S>0&&this.drawRect(C-b.width*(S-1),w,b.width*S,b.height,d)}},{key:"drawSVGText",value:function(d,b,x){var v=this.document.createElementNS(m,"text");if(b.displayValue){var w,S;v.setAttribute("font-family",b.font),v.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||x.barcodePadding>0?(w=0,v.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=x.width-1,v.setAttribute("text-anchor","end")):(w=x.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",w),v.setAttribute("y",S),v.appendChild(this.document.createTextNode(x.text)),d.appendChild(v)}}},{key:"setSvgAttributes",value:function(d,b){var x=this.svg;x.setAttribute("width",d+"px"),x.setAttribute("height",b+"px"),x.setAttribute("x","0px"),x.setAttribute("y","0px"),x.setAttribute("viewBox","0 0 "+d+" "+b),x.setAttribute("xmlns",m),x.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,b,x){var v=this.document.createElementNS(m,"g");return v.setAttribute("transform","translate("+d+", "+b+")"),x.appendChild(v),v}},{key:"setGroupOptions",value:function(d,b){d.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(d,b,x,v,w){var S=this.document.createElementNS(m,"rect");return S.setAttribute("x",d),S.setAttribute("y",b),S.setAttribute("width",x),S.setAttribute("height",v),w.appendChild(S),S}}]),g})();return Yc.default=p,Yc}var Kc={},L1;function NN(){if(L1)return Kc;L1=1,Object.defineProperty(Kc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var m=0;m<c.length;m++){var p=c[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,m){return c&&i(o.prototype,c),m&&i(o,m),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,m){e(this,i),this.object=o,this.encodings=c,this.options=m}return n(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Kc.default=s,Kc}var q1;function TN(){if(q1)return Gc;q1=1,Object.defineProperty(Gc,"__esModule",{value:!0});var n=jN(),e=m(n),s=kN(),i=m(s),o=NN(),c=m(o);function m(p){return p&&p.__esModule?p:{default:p}}return Gc.default={CanvasRenderer:e.default,SVGRenderer:i.default,ObjectRenderer:c.default},Gc}var Yi={},P1;function Lv(){if(P1)return Yi;P1=1,Object.defineProperty(Yi,"__esModule",{value:!0});function n(m,p){if(!(m instanceof p))throw new TypeError("Cannot call a class as a function")}function e(m,p){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:m}function s(m,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);m.prototype=Object.create(p&&p.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(m,p):m.__proto__=p)}var i=(function(m){s(p,m);function p(g,u){n(this,p);var d=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return d.name="InvalidInputException",d.symbology=g,d.input=u,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return p})(Error),o=(function(m){s(p,m);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return p})(Error),c=(function(m){s(p,m);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return p})(Error);return Yi.InvalidInputException=i,Yi.InvalidElementException=o,Yi.NoElementException=c,Yi}var B1;function CN(){if(B1)return Ic;B1=1,Object.defineProperty(Ic,"__esModule",{value:!0});var n=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},e=AN(),s=m(e),i=TN(),o=m(i),c=Lv();function m(d){return d&&d.__esModule?d:{default:d}}function p(d){if(typeof d=="string")return g(d);if(Array.isArray(d)){for(var b=[],x=0;x<d.length;x++)b.push(p(d[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return u(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,s.default)(d),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,s.default)(d),renderer:o.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:o.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":n(d))==="object"&&!d.nodeName)return{element:d,renderer:o.default.ObjectRenderer};throw new c.InvalidElementException}}function g(d){var b=document.querySelectorAll(d);if(b.length!==0){for(var x=[],v=0;v<b.length;v++)x.push(p(b[v]));return x}}function u(d){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(d),renderer:o.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",b.toDataURL())}}}return Ic.default=p,Ic}var Jc={},U1;function MN(){if(U1)return Jc;U1=1,Object.defineProperty(Jc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var m=0;m<c.length;m++){var p=c[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,m){return c&&i(o.prototype,c),m&&i(o,m),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){e(this,i),this.api=o}return n(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(p){return this.handleCatch(p),this.api}}}]),i})();return Jc.default=s,Jc}var hd,z1;function RN(){if(z1)return hd;z1=1;var n=SN(),e=P(n),s=qu(),i=P(s),o=EN(),c=P(o),m=ON(),p=P(m),g=CN(),u=P(g),d=Mv(),b=P(d),x=MN(),v=P(x),w=Lv(),S=Rv(),C=P(S);function P(I){return I&&I.__esModule?I:{default:I}}var q=function(){},re=function(D,X,W){var he=new q;if(typeof D>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,u.default)(D),he._encodings=[],he._options=C.default,he._errorHandler=new v.default(he),typeof X<"u"&&(W=W||{},W.format||(W.format=ae()),he.options(W)[W.format](X,W).render()),he};re.getModule=function(I){return e.default[I]};for(var se in e.default)e.default.hasOwnProperty(se)&&M(e.default,se);function M(I,D){q.prototype[D]=q.prototype[D.toUpperCase()]=q.prototype[D.toLowerCase()]=function(X,W){var he=this;return he._errorHandler.wrapBarcodeCall(function(){W.text=typeof W.text>"u"?void 0:""+W.text;var we=(0,i.default)(he._options,W);we=(0,b.default)(we);var Oe=I[D],F=U(X,Oe,we);return he._encodings.push(F),he})}}function U(I,D,X){I=""+I;var W=new D(I,X);if(!W.valid())throw new w.InvalidInputException(W.constructor.name,I);var he=W.encode();he=(0,c.default)(he);for(var we=0;we<he.length;we++)he[we].options=(0,i.default)(X,he[we].options);return he}function ae(){return e.default.CODE128?"CODE128":Object.keys(e.default)[0]}q.prototype.options=function(I){return this._options=(0,i.default)(this._options,I),this},q.prototype.blank=function(I){var D=new Array(I+1).join("0");return this._encodings.push({data:D}),this},q.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var I;for(var D in this._renderProperties){I=this._renderProperties[D];var X=(0,i.default)(this._options,I.options);X.format=="auto"&&(X.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var W=X.value,he=e.default[X.format.toUpperCase()],we=U(W,he,X);z(I,we,X)})}}},q.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var I=0;I<this._renderProperties.length;I++)z(this._renderProperties[I],this._encodings,this._options);else z(this._renderProperties,this._encodings,this._options);return this},q.prototype._defaults=C.default;function z(I,D,X){D=(0,c.default)(D);for(var W=0;W<D.length;W++)D[W].options=(0,i.default)(X,D[W].options),(0,p.default)(D[W].options);(0,p.default)(X);var he=I.renderer,we=new he(I.element,D,X);we.render(),I.afterRender&&I.afterRender()}return typeof window<"u"&&(window.JsBarcode=re),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(I,D){var X=[];return jQuery(this).each(function(){X.push(this)}),re(X,I,D)}),hd=re,hd}var DN=RN();const LN=cS(DN),qN={[je.EXECUTED]:"Executed",[je.MATCHED_LIST]:"Matched list",[je.CONFIRM_REQUIRED]:"Awaiting confirmation",[je.NO_MATCH_FALLBACK]:"No match",[je.UNCONFIGURED]:"Not configured",[je.INVALID_CODE]:"Invalid code",[je.FORBIDDEN]:"Not permitted",[je.CONFLICT]:"Conflict",[je.IDENTITY_PRIMED]:"Identity primed",[je.IDENTITY_UNKNOWN]:"Badge not recognized",[je.NOT_PRIMED]:"Badge required",[je.CHOICES]:"Choices presented",[je.NO_OPEN_CONTAINER]:"Container closing, scan again",[je.HELD]:"Holding",[je.REFUSED]:"Not placed",[je.SUBJECT_STALE]:"Scan it again"},PN={[je.EXECUTED]:"text-status-success",[je.MATCHED_LIST]:"text-status-success",[je.CONFIRM_REQUIRED]:"text-status-warning",[je.NO_MATCH_FALLBACK]:"text-text-secondary",[je.UNCONFIGURED]:"text-status-warning",[je.INVALID_CODE]:"text-status-error",[je.FORBIDDEN]:"text-status-error",[je.CONFLICT]:"text-status-warning",[je.IDENTITY_PRIMED]:"text-status-success",[je.IDENTITY_UNKNOWN]:"text-status-warning",[je.NOT_PRIMED]:"text-status-warning",[je.CHOICES]:"text-status-success",[je.NO_OPEN_CONTAINER]:"text-status-warning",[je.HELD]:"text-status-success",[je.REFUSED]:"text-status-error",[je.SUBJECT_STALE]:"text-status-warning"};function BN(n){return n.outcome===je.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${qN[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function UN(n){var e,s,i,o,c,m,p;return n.outcome===je.NO_MATCH_FALLBACK?((e=n.fallback)==null?void 0:e.markdown)??null:n.outcome===je.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===je.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:n.outcome===je.NO_OPEN_CONTAINER?((o=n.fallback)==null?void 0:o.markdown)??null:n.outcome===je.REFUSED?((c=n.refusal)==null?void 0:c.markdown)??n.error??null:n.outcome===je.HELD?((p=(m=n.subject)==null?void 0:m.expect)==null?void 0:p.prompt)??null:n.outcome===je.SUBJECT_STALE?n.error??null:null}function gs(n){return n.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 zN({content:n,compact:e,inherit:s}){const i=[],o=/^```(\w*)\n([\s\S]*?)^```$/gm;let c=0,m;for(;(m=o.exec(n))!==null;)m.index>c&&i.push({type:"text",text:n.slice(c,m.index)}),i.push({type:"code",lang:m[1],code:m[2].replace(/\n$/,"")}),c=m.index+m[0].length;c<n.length&&i.push({type:"text",text:n.slice(c)});const p=s?{text:"",heading:"",list:"",code:"text-[0.85em]",tone:""}:e?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs",tone:"text-text-secondary"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs",tone:"text-text-secondary"},g=[];for(const u of i){if(u.type==="code"){const d=u.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");g.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${p.code} font-mono text-text-secondary leading-relaxed">${d}</code></pre>`);continue}g.push(...IN(u.text,p))}return h.jsx("div",{className:s?void 0:"prose-sm",dangerouslySetInnerHTML:{__html:g.join(`
55
- `)}})}function IN(n,e){const s=n.split(`
56
- `),i=[];let o=!1,c=!1,m=[];for(const p of s){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const u=g.slice(1,-1).split("|").map(d=>d.trim());if(u.every(d=>/^[-:]+$/.test(d)))continue;c||(c=!0,m=[]),m.push(u);continue}if(c){c=!1;const[u,...d]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of u)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of d){i.push("<tr>");for(const x of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(x)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),m=[]}if(!g){o&&(i.push("</ul>"),o=!1);continue}if(g.startsWith("### ")){o&&(i.push("</ul>"),o=!1),i.push(`<h4 class="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){o&&(i.push("</ul>"),o=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){o||(i.push('<ul class="space-y-1 my-1">'),o=!0),i.push(`<li class="${e.list} ${e.tone} flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${gs(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${e.text} ${e.tone} my-1">${gs(g)}</p>`)}if(c&&m.length){const[p,...g]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of p)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(u)}</th>`);i.push("</tr></thead><tbody>");for(const u of g){i.push("<tr>");for(const d of u)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(d)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function $m({result:n,compact:e=!1}){const{response:s}=n,i=e?"text-xs":"text-sm",o=s?UN(s):null,c=s!=null&&s.error&&s.error!==o?s.error:null;return h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:`${i} font-mono text-text-secondary truncate`,children:n.code}),s?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`${i} font-medium ${PN[s.outcome]}`,children:BN(s)}),c&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c}),o&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(zN,{content:o,compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function qv(n){return n.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 $N(n){const e=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&e.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...e]}function HN({value:n}){const e=E.useRef(null),[s,i]=E.useState(!1);return E.useEffect(()=>{if(!(!e.current||!n))try{LN(e.current,n,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[n]),n?h.jsxs("div",{children:[h.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?h.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",h.jsx("span",{className:"font-mono",children:$N(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:e,className:"max-w-full"})})]}):null}function FN({onClose:n}){const{submitCode:e,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:m,diagnosticsOn:p,setDiagnosticsOn:g}=Im(),[u,d]=E.useState(""),[b,x]=E.useState(!1),v=w=>{w.preventDefault();const S=u.trim();S&&(d(""),e(S))};return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[h.jsx(Mo,{className:"w-4 h-4"}),"Scan"]}),h.jsx("button",{type:"button",onClick:n,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:h.jsx(Zt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[h.jsxs("form",{onSubmit:v,className:"space-y-2",children:[h.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:u,onChange:w=>d(qv(w.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}),h.jsx("button",{type:"submit",disabled:i||!u.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),h.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."})]}),h.jsx(HN,{value:u.trim()}),s&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),h.jsx($m,{result:s})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{type:"button",onClick:()=>x(w=>!w),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block text-sm text-text-primary",children:[h.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"}),h.jsx("input",{type:"number",min:100,max:2e3,step:50,value:o.maxKeyGapMs,onChange:w=>c({maxKeyGapMs:Number(w.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),h.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[h.jsx("input",{type:"checkbox",checked:p,onChange:w=>g(w.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&h.jsxs("div",{className:"border border-surface-border rounded",children:[h.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"}),h.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[m.length===0&&h.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),m.map(w=>h.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${w.buffer}`,children:[h.jsxs("span",{className:"text-text-tertiary",children:[String(w.deltaMs).padStart(4),"ms "]}),h.jsx("span",{className:"text",children:JSON.stringify(w.key)}),w.code&&h.jsxs("span",{className:"text-text-tertiary",children:[" (",w.code,")"]}),h.jsxs("span",{className:"text-text-tertiary",children:[" — ",w.note]})]},w.seq))]}),h.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"," ",h.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",h.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'," ",h.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Pv=/^\{lt:([A-Za-z0-9_]+)\}$/,I1="me";function NM(n){return`{lt:${n}}`}const Bv="lt:station:link-vars:";function em(n){return`${Bv}${n}`}const tm=new Set;function GN(){for(const n of tm)n()}let wu,Qc={};function Uv(n){let e=null;try{e=localStorage.getItem(em(n))}catch{e=null}if(e===wu)return Qc;wu=e;try{const s=e?JSON.parse(e):{};Qc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Qc={}}return Qc}function VN(n,e,s){const i={...Uv(n)};s===null||s===""?delete i[e]:i[e]=s;try{Object.keys(i).length===0?localStorage.removeItem(em(n)):localStorage.setItem(em(n),JSON.stringify(i))}catch{}wu=void 0,GN()}function YN(n){tm.add(n);const e=s=>{(s.key===null||s.key.startsWith(Bv))&&(wu=void 0,n())};try{window.addEventListener("storage",e)}catch{}return()=>{tm.delete(n);try{window.removeEventListener("storage",e)}catch{}}}const KN={};function JN(n){return E.useSyncExternalStore(YN,()=>n?Uv(n):KN)}function QN(n,e,s,i={}){let o;try{o=new URL(n,"http://local")}catch{return n}const c=o.searchParams.get("facets");if(!c)return n;let m;try{const g=JSON.parse(c);if(!g||typeof g!="object"||Array.isArray(g))return n;m=g}catch{return n}let p=!1;for(const[g,u]of Object.entries(m)){if(typeof u!="string")continue;const d=Pv.exec(u);if(!d)continue;const b=i[d[1]]??e[d[1]]??s[d[1]];typeof b=="string"&&b!==""?m[g]=b:delete m[g],p=!0}return p?(Object.keys(m).length===0?o.searchParams.delete("facets"):o.searchParams.set("facets",JSON.stringify(m)),o.pathname+o.search):n}function TM(n){let e;try{e=new URL(n,"http://local")}catch{return[]}const s=e.searchParams.get("facets");if(!s)return[];try{const i=JSON.parse(s);if(!i||typeof i!="object"||Array.isArray(i))return[];const o=[];for(const c of Object.values(i)){if(typeof c!="string")continue;const m=Pv.exec(c);m&&!o.includes(m[1])&&o.push(m[1])}return o}catch{return[]}}function Hm(){const{user:n,isSuperAdmin:e,hasRoleType:s}=qt(),i=(n==null?void 0:n.userId)??null,o=e||s("admin"),c=E.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(x=>x.role)),[n]),{data:m}=Mu({enabled:o||c.size>0}),p=JN(i),g=E.useMemo(()=>{var w;const x=[],v=new Set;for(const S of(m==null?void 0:m.roles)??[]){if(!o&&!c.has(S.role))continue;const C=(w=S.properties)==null?void 0:w.link_variables;if(Array.isArray(C))for(const P of C){const q=P==null?void 0:P.name;if(typeof q!="string"||q===""||q===I1||v.has(q))continue;v.add(q);const re=P.label,se=P.default;x.push({name:q,...typeof re=="string"&&re!==""?{label:re}:{},...typeof se=="string"&&se!==""?{default:se}:{},fromRole:S.role})}}return x},[m,c,o]),u=E.useMemo(()=>{const x={};for(const v of g)v.default!==void 0&&(x[v.name]=v.default);return x},[g]),d=E.useCallback(x=>QN(x,p,u,i?{[I1]:i}:{}),[p,u,i]),b=E.useCallback((x,v)=>{i&&VN(i,x,v)},[i]);return{declarations:g,values:p,defaults:u,resolveUrl:d,setValue:b}}function XN({open:n,onClose:e,title:s,children:i,maxWidth:o,closeOnBackdrop:c=!0}){return E.useEffect(()=>{if(!n)return;const m=p=>{p.key==="Escape"&&e()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n,e]),n?sm.createPortal(h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-text-primary/30",onClick:c?e:void 0}),h.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"lt-modal-title",className:`relative bg-surface-raised border border-surface-border rounded-lg shadow-xl w-full ${o??"max-w-md"} mx-4 max-h-[85vh] flex flex-col`,children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b shrink-0",children:[h.jsx("h2",{id:"lt-modal-title",className:"text-sm font-medium text-text-primary",children:s}),h.jsx("button",{onClick:e,"aria-label":"Close dialog",className:"text-text-tertiary hover:text-text-primary text-lg leading-none",children:"×"})]}),h.jsx("div",{className:"px-6 py-5 overflow-y-auto",children:i})]})]}),document.body):null}function WN({open:n,onClose:e}){const{declarations:s,values:i,setValue:o}=Hm();return h.jsxs(XN,{open:n,onClose:e,title:"Link Variables",maxWidth:"max-w-lg",children:[h.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed mb-4",children:"Values bound on this device. Pinned links and the Pace Board open scoped to the value applied; an unbound variable falls back to the role's default, or applies no filter at all."}),h.jsx("div",{className:"divide-y divide-surface-border",children:s.map((c,m)=>h.jsx(ZN,{declaration:c,value:i[c.name]??"",autoFocus:m===0,onChange:p=>o(c.name,p),onClear:()=>o(c.name,null),onEnter:e},c.name))}),s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary",children:"Your roles declare no link variables."}),s.length>0&&h.jsx("div",{className:"flex justify-end pt-4",children:h.jsx("button",{onClick:e,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function ZN({declaration:n,value:e,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const m=E.useId(),{data:p}=nk(n.name),g=(p==null?void 0:p.values)??[];return h.jsxs("div",{className:"py-3 flex items-center gap-3","data-testid":"link-var-row",children:[h.jsxs("div",{className:"w-40 shrink-0 min-w-0",children:[h.jsx("p",{className:"text-xs font-mono text-text-primary truncate",title:n.name,children:n.name}),h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:`declared by ${n.fromRole}`,children:n.label??n.fromRole})]}),h.jsx("input",{type:"text",list:m,autoFocus:s,value:e,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&c()},placeholder:n.default?`${n.default} (default)`:"no filter","aria-label":`Value for ${n.name}`,className:"input text-xs font-mono flex-1 min-w-0"}),h.jsx("datalist",{id:m,children:g.map(u=>h.jsx("option",{value:u},u))}),h.jsx("button",{onClick:o,disabled:e==="",title:`Clear ${n.name}`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0",children:"×"})]})}const $1=["escalationId","workflowId"],eT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,zv="lt:search:mode",tT="lt:search:facet",Lt={FACET:"facet",COMMAND:"command"};function nT(n,e){return{version:n.version,category:e.category,name:e.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length}}function Co(n){return n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function rT(n,e){if(n.encoding==="delimited")return sT(n,e)?{code:e}:{code:`${Co(n)}${e}`};if(!/^[0-9]+$/.test(e))return{error:`${n.name} takes digits only`};const s=n.targetLength;return s&&e.length!==s&&e.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${Co(n)}${e}`}}function sT(n,e){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(e)}function iT(n,e){return n==="escalationId"||n==="workflowId"?null:Vk(n,e)}function aT(n){return n.kind===Lt.FACET?n.facet:n.command.name}function oT(n){return n.kind===Lt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function lT(n){return n.kind===Lt.FACET?{kind:Lt.FACET,facet:n.facet}:{kind:Lt.COMMAND,version:n.command.version,category:n.command.category}}function cT(n,e,s){if((n==null?void 0:n.kind)===Lt.FACET&&e.includes(n.facet))return{kind:Lt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===Lt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:Lt.COMMAND,command:i}}return e.length>0?{kind:Lt.FACET,facet:e[0]}:s.length>0?{kind:Lt.COMMAND,command:s[0]}:null}function uT(){try{const n=localStorage.getItem(zv);if(n){const s=JSON.parse(n);if(s.kind===Lt.FACET&&typeof s.facet=="string"||s.kind===Lt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const e=localStorage.getItem(tT);return e?{kind:Lt.FACET,facet:e}:null}catch{return null}}function fT(n){try{localStorage.setItem(zv,JSON.stringify(n))}catch{}}const H1=5*6e4,hT=n=>({rules:n.map(e=>{var s;return((s=e.data)==null?void 0:s.rules)??null}),loading:n.some(e=>e.isLoading)});function dT(n){const e=Av({enabled:n,staleTime:H1}),s=E.useMemo(()=>{var m;return(((m=e.data)==null?void 0:m.schemes)??[]).filter(p=>p.enabled&&p.kind===Uk.ACTION).sort((p,g)=>p.version-g.version)},[e.data]),{rules:i,loading:o}=uS({queries:s.map(m=>({queryKey:["scan-schemes",m.version,"actions"],queryFn:()=>ue(`/scan-codes/schemes/${m.version}/actions`),enabled:n,staleTime:H1})),combine:hT});return{commands:E.useMemo(()=>s.flatMap((m,p)=>(i[p]??[]).filter(g=>g.enabled).sort((g,u)=>g.category.localeCompare(u.category)).map(g=>nT(m,g))),[s,i]),loading:e.isLoading||o}}const mT={escalationId:"opens the item",workflowId:"opens the run"};function pT({mode:n,facets:e,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,m]=E.useState(!1),p=E.useRef(null);E.useEffect(()=>{if(!c)return;const x=w=>{p.current&&!p.current.contains(w.target)&&m(!1)},v=w=>{w.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v)}},[c]);const g=n.kind===Lt.COMMAND,u=g?`${n.command.schemeName} · ${n.command.name} — ${Co(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,d=yT(s),b=x=>{i(x),m(!1)};return h.jsxs("div",{ref:p,className:"relative h-full shrink-0",children:[h.jsxs("button",{type:"button",onClick:()=>m(x=>!x),"aria-expanded":c,"aria-haspopup":"listbox","aria-label":"Search or run as",title:u,className:"group flex items-center gap-1 h-full pl-2.5 pr-2 border-l border-surface-field-border hover:bg-surface-hover transition-colors rounded-r-[var(--lt-radius-field)]","data-testid":"search-mode",children:[h.jsx("span",{className:`text-2xs whitespace-nowrap truncate max-w-[9rem] ${g?"font-medium text-accent":"font-mono text-text-tertiary"}`,children:aT(n)}),h.jsx(im,{className:`w-3 h-3 shrink-0 text-text-quaternary group-hover:text-accent transition-transform ${c?"rotate-180":""}`,strokeWidth:1.5})]}),c&&h.jsxs("div",{role:"listbox","aria-label":"Search or run as",className:"absolute z-50 top-full right-0 mt-1.5 min-w-[17rem] max-w-[24rem] max-h-[70vh] overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[e.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(F1,{children:"Find"}),e.map(x=>h.jsx(G1,{label:x,mono:!0,note:mT[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:Lt.FACET,facet:x})},x))]}),d.map(({schemeName:x,targetFacet:v,items:w})=>h.jsxs("div",{children:[h.jsxs(F1,{note:v,children:["Run · ",x]}),w.map(S=>h.jsx(G1,{label:S.name,note:Co(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:Lt.COMMAND,command:S})},`${S.version}:${S.category}`))]},x)),o&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/60 my-1"}),h.jsxs("button",{type:"button",onClick:()=>{m(!1),o()},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-accent hover:bg-surface-hover","data-testid":"search-mode-scan-panel",children:[h.jsx(Mo,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function yT(n){const e=[];for(const s of n){const i=e.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):e.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return e}function F1({children:n,note:e}){return h.jsxs("p",{className:"px-3 pt-2 pb-1 flex items-baseline gap-2 text-2xs font-semibold uppercase tracking-widest text-text-quaternary first:pt-1",children:[h.jsx("span",{className:"truncate",children:n}),e&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:e})]})}function G1({label:n,note:e,active:s,mono:i,noteMono:o,onClick:c}){return h.jsxs("button",{type:"button",role:"option","aria-selected":s,onClick:c,className:`w-full text-left pl-3 pr-3 py-1.5 flex items-baseline gap-3 border-l-2 transition-colors ${s?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[h.jsx("span",{className:`text-xs font-medium truncate ${i?"font-mono":""}`,children:n}),h.jsx("span",{className:`ml-auto text-2xs shrink-0 ${o?"font-mono tabular-nums":""} ${s?"text-accent/70":"text-text-quaternary"}`,children:e})]})}const gT=6e3;function bT({onOpenScanPanel:n}){const e=ni(),{data:s}=er(),i=Um(),{submitCode:o,busy:c,lastResult:m}=Im(),{commands:p}=dT(i),[g,u]=E.useState(""),[d,b]=E.useState(!1),[x,v]=E.useState(null),[w,S]=E.useState(null),[C,P]=E.useState(""),[q,re]=E.useState(null),[se,M]=E.useState(uT),U=E.useRef(null),ae=E.useMemo(()=>{var le;if(!((le=s==null?void 0:s.search)!=null&&le.enabled))return[];const J=(s.search.facets??[]).filter(pe=>!$1.includes(pe));return[...$1,...J]},[s]),z=E.useMemo(()=>cT(se,ae,p),[se,ae,p]),I=(m==null?void 0:m.source)===To.TOOLBAR&&!m.navigated&&q!==m.at?m:null;E.useEffect(()=>{if(!I)return;const J=setTimeout(()=>re(I.at),gT);return()=>clearTimeout(J)},[I]);const D=()=>{v(null),S(null),m&&re(m.at)},X=J=>{var pe;const le=lT(J);M(le),fT(le),D(),(pe=U.current)==null||pe.focus()},W=(J,le)=>{const pe=rT(J.command,qv(le));if("error"in pe){v(pe.error);return}u(""),o(pe.code,To.TOOLBAR)},he=async(J,le)=>{const pe=iT(J,le);if(pe){u(""),e(pe);return}if(J==="escalationId"&&!eT.test(le)){v("That is not a valid escalation id");return}b(!0);try{if(J==="escalationId")await ue(`/escalations/${encodeURIComponent(le)}`),u(""),e(`/escalations/detail/${encodeURIComponent(le)}`);else{const ye=await ue(`/escalations/by-workflow/${encodeURIComponent(le)}`),Ce=(ye==null?void 0:ye.escalations)??[];Ce.length===1?(u(""),e(`/escalations/detail/${Ce[0].id}`)):(P(le),S(Ce))}}catch{v(`No ${J==="escalationId"?"escalation":"workflow"} found for "${le}"`)}finally{b(!1)}},we=()=>{const J=g.trim();!J||d||c||!z||(D(),z.kind===Lt.COMMAND?W(z,J):he(z.facet,J))};if(!z)return null;const Oe=z.kind===Lt.COMMAND,F=d||c;return h.jsxs("div",{className:"relative w-full max-w-[28rem]","data-testid":"global-search",children:[h.jsxs("div",{className:"flex items-center h-8 bg-surface-field border border-surface-field-border rounded-[var(--lt-radius-field)] focus-within:border-accent focus-within:bg-surface-field-focus transition-colors",children:[h.jsxs("label",{htmlFor:"global-search-input",className:"flex items-center gap-1.5 pl-2.5 shrink-0 cursor-text",children:[Oe?h.jsx(Mo,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(xS,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),Oe&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:Co(z.command)})]}),h.jsx("input",{ref:U,id:"global-search-input",type:"text",value:g,onChange:J=>{u(J.target.value),D()},onKeyDown:J=>{J.key==="Enter"&&we(),J.key==="Escape"&&(u(""),D())},placeholder:oT(z),"aria-label":Oe?"Run target":"Global search",autoComplete:"off",spellCheck:!1,className:`flex-1 min-w-0 h-full bg-transparent text-xs text-text-primary placeholder:text-text-quaternary focus:outline-none ${Oe?"pl-0.5 pr-2 font-mono":"px-2"}`}),F&&h.jsx("span",{className:"w-1.5 h-1.5 mr-2 rounded-full bg-accent animate-pulse shrink-0","aria-label":"Working"}),h.jsx(pT,{mode:z,facets:ae,commands:p,onSelect:X,onOpenScanPanel:n})]}),x&&h.jsx("p",{className:"absolute top-full left-0 mt-1 text-2xs text-status-error whitespace-nowrap",role:"alert",children:x}),I&&h.jsx("div",{role:"status",className:"absolute top-full left-0 mt-1.5 z-50 w-full max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg px-3 py-2 animate-fade-in","data-testid":"search-run-outcome",children:h.jsx($m,{result:I,compact:!0})}),w!==null&&h.jsxs("div",{className:"absolute top-full left-0 mt-1.5 z-50 min-w-72 max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1","data-testid":"search-workflow-results",children:[w.map(J=>h.jsxs(ar,{to:`/escalations/detail/${J.id}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-hover truncate",children:[h.jsx("span",{className:"font-medium text-text-primary",children:J.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),J.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:J.type})]},J.id)),w.length===0&&h.jsx("p",{className:"px-3 py-1.5 text-2xs text-text-tertiary",children:"No escalations for this workflow."}),h.jsx("hr",{className:"border-surface-border/60 my-0.5"}),h.jsx(ar,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function xT(){const{identity:n,remainingSeconds:e}=Cu(),[,s]=E.useState(0);return E.useEffect(()=>{if(!(n!=null&&n.expiresAt))return;const i=setInterval(()=>s(o=>o+1),1e3);return()=>clearInterval(i)},[n]),e()}function vT(n){return n>=60?`${Math.floor(n/60)} min`:`${n} s`}function _T(){const{identity:n}=Cu(),e=xT();return n?h.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-text-secondary whitespace-nowrap min-w-0",title:`Scans act as ${n.displayName}`,"data-testid":"badge-grant-indicator",children:[h.jsx(vS,{className:"w-4 h-4 text-status-success shrink-0",strokeWidth:1.5}),h.jsx("span",{className:"hidden sm:inline",children:"Badged:"}),h.jsx("span",{className:"font-medium text-text-primary truncate max-w-[10rem]",children:n.displayName}),n.expiresAt&&h.jsxs("span",{className:"tabular-nums text-text-tertiary","data-testid":"badge-grant-remaining",children:["· ",vT(e)]})]}):null}function wT(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function nm(n){var e;return((e=n.title)==null?void 0:e.trim())||wT(n.role)}const Iv="lt:bookmarks",Xc="scan";function ST(){try{const n=localStorage.getItem(Iv);if(!n)return[];const e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function V1(n){try{localStorage.setItem(Iv,JSON.stringify(n))}catch{}}function ET({onToggleEventFeed:n,onToggleDocs:e,onToggleNav:s}){var Ue,Xe,cn,Mt;const i=ni(),{user:o,logout:c,isSuperAdmin:m,hasRoleType:p}=qt(),{viewAs:g,realIsBuilder:u}=ev(),{available:d,mine:b}=ck();tv();const{connected:x}=Lx(),{data:v}=er(),{role:w,targets:S,selectable:C,selectRole:P}=Tm(),{declarations:q,values:re}=Hm(),[se,M]=E.useState(!1),{data:U}=Mu(),ae=E.useMemo(()=>{const be=(U==null?void 0:U.roles)??[],it=new Set(((o==null?void 0:o.roles)??[]).map(Ot=>Ot.role)),yt=m||p("admin");return be.filter(Ot=>ea(Ot).length>0&&(yt||it.has(Ot.role))).map(Ot=>({role:Ot.role,title:nm(Ot),portals:ea(Ot)}))},[U,o,m,p]),{setPanel:z,closePanel:I,open:D,ownerKey:X}=Dm(),W=Um(),he=en(),we=()=>{D&&X===Xc?I(Xc):z(h.jsx(FN,{onClose:()=>I(Xc)}),{width:360,key:Xc})},[Oe,F]=E.useState(!1),[J,le]=E.useState(!1),[pe,ye]=E.useState(wv),[Ce,Ne]=E.useState(ST),Me=E.useRef(null),We=(Ue=v==null?void 0:v.branding)==null?void 0:Ue.appName,pt=(Xe=v==null?void 0:v.branding)==null?void 0:Xe.themes,Ct=E.useMemo(()=>(Ok(pt??[]),Ak()),[pt]),Se=be=>{jk(be),ye(be)},Re=()=>{const be=window.prompt("Bookmark label:");if(!(be!=null&&be.trim()))return;const it=he.pathname+he.search,yt=[...Ce,{label:be.trim(),url:it}].sort((Ot,Ur)=>Ot.label.localeCompare(Ur.label));Ne(yt),V1(yt),F(!1)},ce=be=>{const it=Ce.filter(yt=>!(yt.label===be.label&&yt.url===be.url));Ne(it),V1(it)};return E.useEffect(()=>{if(!Oe)return;const be=it=>{Me.current&&!Me.current.contains(it.target)&&F(!1)};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[Oe]),h.jsxs(h.Fragment,{children:[h.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 ${Oe?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(_S,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(ar,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:be=>{(be.ctrlKey||be.metaKey)&&(be.preventDefault(),le(!0))},children:h.jsx(Ru,{appName:We,className:"flex"})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(lx,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(gd,{className:"w-5 h-5",strokeWidth:2})})]}),(((cn=v==null?void 0:v.search)==null?void 0:cn.enabled)||W)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(bT,{onOpenScanPanel:W?we:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsx(_T,{}),h.jsxs(ar,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${d>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(bd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),d>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:d})]}),h.jsxs(ar,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${b>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(bd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),b>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:b})]}),g&&h.jsx(h.Fragment,{children:h.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:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[g," View"]}),h.jsx("button",{onClick:Vd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Zt,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:Me,children:[h.jsxs("button",{onClick:()=>F(be=>!be),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(wS,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),g&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),Oe&&h.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:[h.jsx(ar,{to:"/credentials",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),((Mt=v==null?void 0:v.auth)==null?void 0:Mt.oauthServer)&&h.jsx(ar,{to:"/connected-apps",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Connected apps"}),W&&h.jsx("button",{onClick:()=>{F(!1),we()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-scan",children:"Scan a code"}),h.jsx("button",{onClick:()=>{F(!1),x?n==null||n():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:x?"Events":"Reconnect events"}),u&&h.jsx("button",{onClick:()=>{F(!1),e==null||e()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-docs",children:"Docs"}),g&&h.jsxs("button",{onClick:()=>{F(!1),Vd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",g," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Ct.map(be=>h.jsx("button",{type:"button",onClick:()=>Se(be.id),title:be.label,"aria-label":`${be.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${pe===be.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:be.swatch}},be.id))})]}),C&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("button",{type:"button",onClick:()=>{F(!1),P(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${w?"text-text-secondary":"text-accent"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${w?"bg-surface-border":"bg-accent"}`}),h.jsx("span",{className:"truncate",children:"Full dashboard"})]}),S.map(be=>{var Ot;const it=(Ot=U==null?void 0:U.roles)==null?void 0:Ot.find(Ur=>Ur.role===be),yt=be===w;return h.jsxs("button",{type:"button",onClick:()=>{F(!1),P(be),i(fv(be,ea(it)))},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${yt?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${yt?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:nm({role:be,title:it==null?void 0:it.title})})]},be)})]})]}),ae.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60","data-testid":"menu-portals",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Portals"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:ae.map(be=>h.jsxs("div",{children:[ae.length>1&&h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:be.role,children:be.title}),be.portals.map(it=>{const yt=Nm(be.role,it.key),Ot=he.pathname===yt;return h.jsxs("button",{type:"button",onClick:()=>{F(!1),i(yt)},className:`flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded hover:bg-surface-hover ${Ot?"text-accent":"text-text-secondary"}`,"data-testid":`menu-portal-${be.role}-${it.key}`,children:[h.jsx(xd,{className:"w-3.5 h-3.5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate",children:it.label})]},it.key)})]},be.role))})]}),q.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Link variables"}),h.jsxs("button",{type:"button",onClick:()=>{F(!1),M(!0)},className:"flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded text-text-secondary hover:bg-surface-hover","data-testid":"link-vars-menu-entry",children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Object.keys(re).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(re).length>0?Object.entries(re).map(([be,it])=>`${be} = ${it}`).join(", "):"Set values for this device"})]})]}),h.jsx("button",{onClick:()=>{F(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[Ce.map(be=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(ar,{to:be.url,onClick:()=>F(!1),title:be.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:be.label}),h.jsx("button",{type:"button",onClick:()=>ce(be),title:`Remove "${be.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:h.jsx(Zt,{className:"w-3 h-3"})})]},`${be.label}::${be.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:Re,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(SS,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),J&&h.jsx(Ek,{onClose:()=>le(!1)}),h.jsx(WN,{open:se,onClose:()=>M(!1)})]})}function Fm({open:n,children:e}){const[s,i]=E.useState(n);return E.useEffect(()=>{n&&i(!0)},[n]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${n?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{n||i(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?e:null})})}function rm(n){return({isActive:e})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return n?`${s} justify-center w-10 h-10 mx-auto ${e?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${e?i:o}`}}function OT(){return({isActive:n})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${n?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function AT({group:n,collapsed:e}){const{pathname:s}=en(),i=n.matchPaths.some(p=>s.startsWith(p)),[o,c]=E.useState(i),m=o||i;return e?h.jsx(h.Fragment,{children:n.items.map(p=>h.jsx(Es,{to:p.to,className:rm(!0),title:p.label,children:p.icon&&h.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(p=>!p),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:[h.jsxs("span",{className:"flex items-center gap-3",children:[n.icon&&h.jsx(n.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:n.label})]}),h.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:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(Fm,{open:m,children:n.items.map(p=>h.jsxs(Es,{to:p.to,end:p.end,className:OT(),children:[p.icon&&h.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:p.label})]},p.to))})]})}function jT(n){return n.kind==="group"}function kT({entry:n,collapsed:e}){const{pathname:s,search:i}=en(),o=n.to.includes("?"),c=n.icon&&h.jsx(n.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${n.iconClassName??""}`,strokeWidth:1.5,...n.solid?{fill:"currentColor"}:{}});if(o){const[m,p]=n.to.split("?"),g=s===m&&i===`?${p}`,u=rm(e)({isActive:g});return h.jsxs(Es,{to:n.to,className:u,title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}return h.jsxs(Es,{to:n.to,end:n.end,className:rm(e),title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}function qr({heading:n,entries:e}){const{collapsed:s}=Mm();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:n}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:n}),e.map(i=>jT(i)?h.jsx(AT,{group:i,collapsed:s},i.label):h.jsx(kT,{entry:i,collapsed:s},i.to))]})}function NT({aiEnabled:n=!1,isBuilder:e=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1}){const c=[{to:"/pace",label:"Pace Board",icon:ES},{to:"/trends",label:"Trend Board",icon:OS}];if(!e&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(qr,{heading:"Monitor",entries:c}):null;if(!e)return h.jsx(qr,{heading:"Monitor",entries:o?c:[]});const m=[...o?c:[],{to:"/topics",label:"Event Topics",icon:cx},{to:"/agents",label:n?"Agents":"Automations",icon:AS},{to:"/capabilities",label:"Capabilities",icon:jS}];return h.jsx(qr,{heading:"Monitor",entries:m})}function TT(){return qe({queryKey:["me","preferences"],queryFn:()=>ue("/me/preferences"),staleTime:6e4})}function CT(){const n=Be();return Fe({mutationFn:e=>ue("/me/preferences",{method:"PATCH",body:JSON.stringify(e)}),onSuccess:e=>{n.setQueryData(["me","preferences"],e)}})}const xs={TABLE:"table",RICH:"rich",TIMELINE:"timeline"},Y1={COMPACT:"compact",CARDS:"cards"},dd={AVAILABLE:"/escalations/available",ALL:"/escalations"},ta={AVAILABLE:"available",CLAIMED:"claimed",RESOLVED:"resolved",CANCELLED:"cancelled",EXPIRED:"expired"},MT={[ta.RESOLVED]:"resolved",[ta.CANCELLED]:"cancelled",[ta.EXPIRED]:"expired"};function RT(n){const e=n===ta.CLAIMED;return{available:n===ta.AVAILABLE,claimed:e,apiStatus:e?"pending":MT[n]}}function DT(n){return n===xs.TABLE||n===xs.RICH||n===xs.TIMELINE}function LT(n){return n===Y1.COMPACT||n===Y1.CARDS}function qT(n,e=""){const s=n.get("priority"),i=n.get("view"),o=n.get("layout");return{statusFilter:n.get("status")||e,role:n.get("role")||void 0,type:n.get("type")||void 0,subtype:n.get("subtype")||void 0,priority:s?parseInt(s,10):void 0,search:n.get("search")||void 0,facets:Gk(n),view:DT(i)?i:null,layout:LT(o)?o:null}}function PT(n){let e;try{e=new URL(n,"http://local")}catch{return null}if(e.pathname!==dd.AVAILABLE&&e.pathname!==dd.ALL)return null;const s=e.pathname===dd.AVAILABLE?ta.AVAILABLE:"";return qT(e.searchParams,s)}function CM(n){var e;return n.role||(((e=n.facets.roles)==null?void 0:e.length)===1?n.facets.roles[0]:null)}function MM(n,e){return n===xs.TIMELINE?xs.TIMELINE:e&&(!n||n===xs.RICH)?xs.RICH:xs.TABLE}function BT(n,e){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(p=>p.label)),c=[...s],m=new Set;for(const{role:p,pins:g}of e)for(const u of g)o.has(u.label)||i.has(u.label)||m.has(u.label)||(m.add(u.label),c.push({...u,id:`role:${p}:${u.label}`,fromRole:p}));return c}function UT(n){const e=PT(n);if(!e)return null;const{available:s,claimed:i,apiStatus:o}=RT(e.statusFilter);return{available:s,params:{...e.facets,role:e.role,type:e.type,subtype:e.subtype,priority:e.priority,status:o,...i?{claimed:!0}:{},search:e.search}}}function zT(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function IT(){var I;const{collapsed:n}=Mm(),{user:e}=qt(),s=TT(),i=CT(),o=E.useMemo(()=>new Set(((e==null?void 0:e.roles)??[]).map(D=>D.role)),[e]),{data:c}=Mu({enabled:o.size>0}),m=tn("SUMMARY");js(Am(),()=>{m([["escalations"]])});const p=(I=s.data)==null?void 0:I.preferences,g=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Array.isArray(D.default_pins)&&D.default_pins.length>0).map(D=>({role:D.role,pins:D.default_pins})),[c,o]),{resolveUrl:u}=Hm(),d=E.useMemo(()=>BT(p,g),[p,g]),b=E.useMemo(()=>new Map(d.map(D=>[D.id,D.url])),[d]),x=E.useMemo(()=>d.map(D=>({...D,url:u(D.url)})),[d,u]),v=E.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(D=>[D.role,nm(D)])),[c]),w=E.useMemo(()=>x.filter(D=>!D.fromRole),[x]),S=E.useMemo(()=>new Set(((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Yj(D)).map(D=>D.role)),[c,o]),C=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>S.has(D.role)||g.some(X=>X.role===D.role)).map(D=>({role:D.role,title:v.get(D.role)??D.role,portals:S.has(D.role)?ea(D):[],pins:x.filter(X=>X.fromRole===D.role)})).filter(D=>D.portals.length>0||D.pins.length>0),[c,g,S,v,x]),P=(p==null?void 0:p.pinnedViews)??[],q=E.useRef(null),re=D=>i.mutate({pinnedViews:D}),se=D=>re(P.filter(X=>X.id!==D)),M=D=>re([...P,{id:zT(),label:D.label,url:b.get(D.id)??D.url,badge:D.badge}]),U=D=>i.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],D]}),ae=(D,X)=>{if(D===X)return;const W=[...P],[he]=W.splice(D,1);W.splice(X,0,he),re(W)};if(x.length===0&&S.size===0)return null;const z="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return h.jsxs("div",{className:"space-y-1",children:[n&&h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!n&&w.length>0&&h.jsx("p",{className:z,children:"Pinned"}),w.map(D=>{const X=P.findIndex(W=>W.id===D.id);return h.jsx(K1,{pin:D,collapsed:n,draggable:X!==-1,onDragStart:()=>{q.current=X},onDropOn:()=>{q.current!==null&&X!==-1&&ae(q.current,X),q.current=null},onRemove:()=>se(D.id)},D.id)}),C.map(D=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:z,title:`${D.title} — pins from the ${D.role} role`,"data-testid":"pin-group-label",children:D.title}),D.portals.map(X=>h.jsx($T,{role:D.role,portal:X,collapsed:n},X.key)),D.pins.map(X=>h.jsx(K1,{pin:X,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>M(X),onHide:()=>U(X.label)},X.id))]},D.role))]})}function $T({role:n,portal:e,collapsed:s}){const i=Nm(n,e.key),o="flex items-center rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",c=`portal-link-${n}-${e.key}`;return s?h.jsx(Es,{to:i,className:`${o} justify-center w-10 h-10 mx-auto`,title:e.label,"data-testid":c,children:h.jsx(xd,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs(Es,{to:i,title:e.label,className:({isActive:m})=>`${o} gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] ${m?"bg-surface-hover text-text-primary font-medium":""}`,"data-testid":c,children:[h.jsx(xd,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:e.label})]})}function K1({pin:n,collapsed:e,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:m,onHide:p}){const{pathname:g,search:u}=en(),[d,b=""]=n.url.split("?"),x=g===d&&u===(b?`?${b}`:""),v="group flex items-center rounded-md transition-colors duration-150",w=x?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return e?h.jsx(Es,{to:n.url,className:`${v} ${w} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(Cg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${v} ${w} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:o,children:[h.jsxs(Es,{to:n.url,title:n.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[h.jsx(Cg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...n.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:n.label}),n.badge&&h.jsx(HT,{url:n.url})]}),h.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&&h.jsx("button",{onClick:m,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(ux,{className:"w-3 h-3"})}),p&&h.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(kS,{className:"w-3 h-3"})}),c&&h.jsx("button",{onClick:c,title:`Remove "${n.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Zt,{className:"w-3 h-3"})})]})]})}function HT({url:n}){var m;const e=E.useMemo(()=>UT(n),[n]),s={limit:1,staleTime:15e3},i=pv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&e.available}),o=mv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&!e.available});if(!e)return null;const c=e.available?i:o;return c.isError||((m=c.data)==null?void 0:m.total)===void 0?null:h.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 FT(){var c;const{data:n}=er(),e=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=e===!0||e!==!1&&Xx(),i=[{to:"/workflows/registry",label:"Registry",icon:Mg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:vd},{to:"/workflows/executions",label:"Executions",icon:Rg}],o=s?[{kind:"group",label:"Procedural",icon:NS,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:am,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Mg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:vd},{to:"/mcp/executions",label:"Executions",icon:Rg}]}]:i;return h.jsx(qr,{heading:"Orchestrate",entries:o})}function RM(){return qe({queryKey:["activeWorkers"],queryFn:async()=>(await ue("/workflows/workers")).workers})}function DM(){return qe({queryKey:["discoveredWorkflows"],queryFn:async()=>(await ue("/workflows/discovered")).workflows})}function LM(){return qe({queryKey:["workflowConfigs"],queryFn:async()=>(await ue("/workflows/config")).workflows})}function $v(){return qe({queryKey:["invocableWorkflows"],queryFn:async()=>(await ue("/workflows/invocable")).workflows})}function qM(n){return Object.fromEntries(n.filter(e=>!e.missing).map(e=>[e.as??e.key,e.data]))}function PM(n,e){return qe({queryKey:["workflows",n,"input-lookups"],queryFn:()=>ue(`/workflows/${encodeURIComponent(n)}/input-lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function BM(){return qe({queryKey:["cronStatus"],queryFn:async()=>(await ue("/workflows/cron/status")).schedules})}function UM(n){return qe({queryKey:["workflowExecution",n],queryFn:()=>ue(`/workflow-states/${n}/execution`),enabled:!!n})}function zM(n,e){const s=new URLSearchParams;return n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),n.entity&&s.set("entity",n.entity),n.search&&s.set("search",n.search),n.status&&s.set("status",n.status),n.sort_by&&s.set("sort_by",n.sort_by),n.order&&s.set("order",n.order),n.registered&&s.set("registered",n.registered),n.namespace&&s.set("namespace",n.namespace),qe({queryKey:["jobs",n],queryFn:()=>ue(`/workflow-states/jobs?${s}`),enabled:(e==null?void 0:e.enabled)??!0})}function IM(){const n=Be();return Fe({mutationFn:e=>ue(`/workflows/${e}/terminate`,{method:"POST"}),onSuccess:(e,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function $M(){const n=Be();return Fe({mutationFn:({workflow_type:e,...s})=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function HM(){const n=Be();return Fe({mutationFn:e=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function FM(){const n=Be();return Fe({mutationFn:({workflowType:e,data:s,metadata:i,execute_as:o})=>ue(`/workflows/${e}/invoke`,{method:"POST",body:JSON.stringify({data:s,metadata:i,...o?{execute_as:o}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function GT(){const{data:n}=$v();return n!=null&&n.length?h.jsx(qr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:vd}]}):null}const VT=[{to:"/mcp/queries",label:"Designer",icon:TS},{to:"/mcp/servers",label:"Servers & Tools",icon:CS}];function YT(){return h.jsx(qr,{heading:"Design",entries:VT})}const KT=[{to:"/files",label:"Files",icon:MS},{to:"/knowledge",label:"Knowledge Base",icon:fx}];function JT(){return h.jsx(qr,{heading:"Storage",entries:KT})}function QT({isBuilder:n=!1,isOps:e=!1}){var m;const{data:s}=er(),i=((m=s==null?void 0:s.features)==null?void 0:m.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:RS},...n||e?[{to:"/admin/roles",label:"Roles",icon:bd},{to:"/admin/personas",label:"Personas",icon:DS},{to:"/admin/scan-codes",label:"Scan Codes",icon:Mo}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:LS},{to:"/admin/streams",label:"Messages",icon:fx},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:qS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(qr,{heading:"Identity & Access",entries:o}),n&&Wx()&&h.jsx(qr,{heading:"Infrastructure",entries:c})]})}function Hv({aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o}){return h.jsxs(h.Fragment,{children:[h.jsx(NT,{aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o}),h.jsx(IT,{}),!e&&h.jsx(GT,{}),e&&h.jsx(FT,{}),e&&n&&h.jsx(YT,{}),e&&h.jsx(JT,{}),(e||s)&&h.jsx(QT,{isBuilder:e,isOps:s})]})}function XT({open:n,onClose:e,...s}){const i=en();return E.useEffect(()=>{e()},[i.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${n?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${n?"opacity-100":"opacity-0"}`,onClick:e,"aria-hidden":!0}),h.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 ${n?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:e,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Zt,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Zj,{children:h.jsx(Hv,{...s})})})]})]})}const Fv="lt_event_feed_patterns";function WT(n,e){if(n.startsWith("/topics/")){const m=decodeURIComponent(n.replace("/topics/",""));if(m&&!m.includes("/"))return`lt.events.${m}`}const s=n.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(n.startsWith("/escalations")){const m=new URLSearchParams(e).get("role");return m?`lt.events.system.escalation.${rv(m)}.>`:"lt.events.system.escalation.>"}const i=n.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(n.startsWith("/workflows"))return"lt.events.system.workflow.>";const o=n.match(/^\/agents\/([^/]+)$/);if(o&&o[1]!=="new")return`lt.events.system.agent.${o[1]}.>`;if(n.startsWith("/agents"))return"lt.events.system.agent.>";if(n.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(n.startsWith("/files"))return"lt.events.system.file.>";if(n==="/")return"lt.events.system.>";const c=n.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(n.startsWith("/mcp"),"lt.events.system.>")}function ZT(){try{const n=localStorage.getItem(Fv);return n?JSON.parse(n):[]}catch{return[]}}function md(n){try{localStorage.setItem(Fv,JSON.stringify(n))}catch{}}function eC(){const{pathname:n,search:e}=en(),[s,i]=E.useState(ZT),o=E.useMemo(()=>WT(n,e),[n,e]),c=E.useMemo(()=>{const u=new Set([o,...s]);return Array.from(u)},[o,s]),m=E.useCallback(u=>{const d=u.startsWith("lt.events.")?u:`lt.events.${u}`;i(b=>{if(b.includes(d))return b;const x=[...b,d];return md(x),x})},[]),p=E.useCallback(u=>{i(d=>{const b=d.filter(x=>x!==u);return md(b),b})},[]),g=E.useCallback(()=>{i([]),md([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:m,removePattern:p,clearUserPatterns:g}}function tC({children:n,className:e=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${e}`,children:n})}const pd=280,J1="cubic-bezier(0.4, 0, 0.2, 1)",Wc=40;function nC(n){if(!n)return"scale(0.92)";const e=window.innerWidth,s=window.innerHeight,i=e-Wc*2,o=s-Wc*2,c=n.width/i,m=n.height/o,p=n.left+n.width/2-(Wc+i/2),g=n.top+n.height/2-(Wc+o/2);return`translate(${p}px, ${g}px) scale(${c}, ${m})`}function Gv({open:n,onClose:e,sourceRef:s,children:i}){const[o,c]=E.useState(null),m=E.useRef(null),p=E.useRef(!1);E.useEffect(()=>{var x,v;n&&!p.current?(m.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&p.current&&o==="open"&&(m.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),p.current=n},[n,s,o]),E.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),E.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),E.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&e()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,e]);const g=E.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(E.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),pd+50);return()=>clearTimeout(x)},[o]),!o)return null;const u=o==="entering"||o==="exiting",d=u?nC(m.current):"none",b=u?0:1;return sm.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${pd}ms ${J1}, opacity ${pd}ms ${J1}`,transform:d,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function rC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function sC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function iC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 aC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function oC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 lC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 cC(n){const e=n.trim().split(`
57
- `);if(e.length<2)return n;const s=p=>p.split("|").map(g=>g.trim()).filter(Boolean),i=s(e[0]),o=e.slice(2),c=i.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),m=o.map(p=>`<tr class="border-t border-surface-border">${s(p).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 Zc(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function uC(n){const e=[];let s=n.replace(/```(\w*)\n([\s\S]*?)```/g,(g,u,d)=>{const b=e.length;return e.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,u,d,b)=>cC(`${u}
53
+ ${p.stack}`),m.reject(u)):m.resolve(d))}});return g.requestSubject=e,this.protocol.publish(e,s,{reply:c,headers:i.headers}),m}else{const c=new Sx(this.protocol.muxSubscriptions,e,i,o);this.protocol.request(c);try{this.publish(e,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(p){c.cancel(p)}const m=Promise.race([c.timer,c.deferred]);return m.catch(()=>{c.cancel()}),m}}flush(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(ge.errorForCode(fe.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Ut;return e.iterClosed.then(()=>{const s=this.listeners.indexOf(e);this.listeners.splice(s,1)}),this.listeners.push(e),e}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(e={}){const s=new V2(this,e);if(e.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===fe.NoResponders&&(o.code=fe.JetStreamNotEnabled),o}return s}jetstream(e={}){return new pm(this,e)}getServerVersion(){const e=this.info;return e?ti(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ge.errorForCode(fe.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new Q2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(ge.errorForCode(fe.ConnectionDraining)):this.protocol.reconnect()}}class Q2{constructor(e){j(this,"nc");this.nc=e}add(e){try{return new Do(this.nc,e).start()}catch(s){return Promise.reject(s)}}client(e,s){return new N2(this.nc,e,s)}}class X2{constructor(e,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=e,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(gu)||"PUT"}get length(){const e=this.sm.header.get(Wt.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class W2{constructor(e,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=e,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(um(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(gu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const e=((s=this.sm.headers)==null?void 0:s.get(Wt.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Rx extends IE{constructor(s,i,o){super(s.nc,i,o);j(this,"js");j(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=Lr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=Os.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=Et.StartSequence,c.config.opt_start_seq=s;const m={};m.stream_name=this.info.stream,m.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,m,{retries:-1}).then(g=>{const u=g,d=this.sub.info;d.last=u,this.info.config=u.config,this.info.name=u.name}).catch(g=>{const u=new ge(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,fe.RequestError,g);this.sub.callback(u,{})})}_maybeSetupHbMonitoring(){var i,o;const s=((o=(i=this.info)==null?void 0:i.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(um(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,m=p=>{var d,b,x,v;const g=_E(409,`${In.IdleHeartbeatMissed}: ${p}`,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 _=((x=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(_+1),(v=this.monitor)==null||v.restart(),!1}return!c.noIterator};this.monitor=new hm(s,m,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Wt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Wt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,o=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=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(o);return s.last=c,c}}class Z2 extends Rx{constructor(e,s,i){super(e,s,i)}pull(e={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,m={};if(m.batch=e.batch||1,m.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const u=this.js.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);m.max_bytes=e.max_bytes}let p=0;e.expires&&e.expires>0&&(p=e.expires,m.expires=dt(p));let g=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(g=e.idle_heartbeat,m.idle_heartbeat=dt(g)),g&&p===0)throw new Error("idle_heartbeat requires expires");if(g>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&g&&(this.monitor?this.monitor._change(g,p):this._setupHbMonitoring(g,p));const u=this.info.api,d=`${u.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;u.nc.publish(d,u.jc.encode(m),{reply:b})}}}function eO(n,e){return n?nO(e):tO(e)}function tO(n){return(e,s)=>e?[e,null]:(e=Xi(s),e?[e,null]:[null,ko(s,n)])}function nO(n){return(e,s)=>{if(e)return[e,null];const i=Xi(s);return i!==null?[Dx(i),null]:[null,ko(s,n)]}}function Dx(n){if(n!==null)switch(n.code){case fe.JetStream404NoMessages:case fe.JetStream408RequestTimeout:return null;case fe.JetStream409:return wE(n)?n:null;default:return n}return null}function rO(n){n&&n.ack()}function sO(n){const e=n.split(".");if(e.length===9&&e.splice(2,0,"_",""),e.length<11||e[0]!=="$JS"||e[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=e[2]==="_"?"":e[2],s.account_hash=e[3],s.stream=e[4],s.consumer=e[5],s.deliveryCount=parseInt(e[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(e[7],10),s.deliverySequence=parseInt(e[8],10),s.timestampNanos=parseInt(e[9],10),s.pending=parseInt(e[10],10),s}class iO{constructor(e,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=e,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=sO(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===so[0]&&e[1]===so[1]&&e[2]===so[2]&&e[3]===so[3]}async ackAck(e){var i;e=e||{},e.timeout=e.timeout||this.timeout;const s=mt();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),p=new Sx(c.muxSubscriptions,this.msg.reply,{timeout:e.timeout},m);c.request(p);try{c.publish(this.msg.reply,pb,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),s.resolve(!0)}catch(g){p.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(pb)}nak(e){let s=U2;e&&(s=Ed().encode(`-NAK ${JSON.stringify({delay:dt(e)})}`)),this.doAck(s)}working(){this.doAck(so)}next(e,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=dt(s.expires));const o=Zn().encode(i),c=sa.concat(z2,$2,o),m=e?{reply:e}:void 0;this.msg.respond(c,m)}term(e=""){let s=I2;(e==null?void 0:e.length)>0&&(s=Ed().encode(`+TERM ${e}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const aO="1.30.3",oO="nats.ws";class lO{constructor(){j(this,"version");j(this,"lang");j(this,"closeError");j(this,"connected");j(this,"done");j(this,"socket");j(this,"options");j(this,"socketClosed");j(this,"encrypted");j(this,"peeked");j(this,"yields");j(this,"signal");j(this,"closedNotification");this.version=aO,this.lang=oO,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=mt(),this.closedNotification=mt()}async connect(e,s){const i=mt();if(s.tls)return i.reject(new ge("tls",fe.InvalidOption)),i;this.options=s;const o=e.src;if(s.wsFactory){const{socket:c,encrypted:m}=await s.wsFactory(e.src,s);this.socket=c,this.encrypted=m}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const m=sa.concat(...this.yields),p=YE(m);if(p!==""){const g=_2.exec(p);if(!g){s.debug&&console.error("!!!",ac(m)),i.reject(new Error("unexpected response from server"));return}try{const u=JSON.parse(g[1]);x2(u,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(u){i.reject(u);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,p=new ge(m.message,fe.Unknown,new Error(m.error));i.reject(p)},i}disconnect(){this._closed(void 0,!0)}async _closed(e,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ia(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}s&&this.closedNotification.resolve(e)}}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 e=this.yields;this.yields=[];for(let s=0;s<e.length;s++)this.options.debug&&console.info(`> ${ac(e[s])}`),yield e[s];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=mt())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${ac(e)}`);return}catch(s){this.options.debug&&console.error(`!!! ${ac(e)}: ${s}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function cO(n,e){/^(.*:\/\/)(.*)/.test(n)||(typeof e=="boolean"?n=`${e===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(e=!1),o==="wss:"&&(e=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,m;const p=i.hostname,g=i.pathname,u=i.search||"";switch(o){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||e===!0?"443":"80",c=e===!0?"wss:":"ws:";break}return`${c}//${p}:${m}${g}${u}`}function uO(n={}){return $E({defaultPort:443,urlParseFn:cO,factory:()=>new lO}),ym.connect(n)}const fO=null,hO=null,Xt="lt.events";function Lx(n,e){const s=n.split("."),i=e.split(".");for(let o=0;o<i.length;o++){const c=i[o];if(c===">")return!0;if(o>=s.length||c!=="*"&&c!==s[o])return!1}return s.length===i.length}const aa=E.createContext({connected:!1,subscribe:()=>()=>{}});function qx(){const{connected:n}=E.useContext(aa);return{connected:n}}function An(n,e){const{subscribe:s}=E.useContext(aa),i=E.useRef(e);i.current=e,E.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function js(n,e){const{subscribe:s}=E.useContext(aa),i=E.useRef(e);i.current=e;const o=n.join(","),c=E.useMemo(()=>o.split(",").filter(Boolean),[o]);E.useEffect(()=>{const m=g=>i.current(g),p=c.map(g=>s(g,m));return()=>p.forEach(g=>g())},[s,c])}const Px=E.createContext({connected:!1,unavailable:!1,subscribe:()=>()=>{}});function dO(){const{connected:n,unavailable:e}=E.useContext(Px);return{connected:n,unavailable:e}}const mO=Ed();function pO({children:n,url:e,token:s,resolveCredentials:i,policy:o=yo,onReconnect:c,sessionKey:m}){const p=E.useRef(null),[g,u]=E.useState(!1),[d,b]=E.useState(!1),[x,v]=E.useState(!1),_=E.useRef({url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c});_.current={url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c};const S=E.useRef(new Map),C=E.useRef(new Map),P=E.useCallback((te,M)=>{(async()=>{for await(const U of M)try{if(!Lx(U.subject,te))continue;const ae=JSON.parse(mO.decode(U.data)),z=S.current.get(te);if(!z)continue;for(const I of z)try{I(ae)}catch{}}catch{}})()},[]),q=E.useCallback(te=>{var U;const M=p.current;if(!(!M||(U=M.isClosed)!=null&&U.call(M)||C.current.has(te)))try{const ae=M.subscribe(te);C.current.set(te,ae),P(te,ae)}catch{}},[P]),ne=E.useCallback((te,M)=>{const U=S.current;return U.has(te)||U.set(te,new Set),U.get(te).add(M),q(te),()=>{const ae=U.get(te);if(ae&&(ae.delete(M),ae.size===0)){U.delete(te);const z=C.current.get(te);if(z){C.current.delete(te);try{z.unsubscribe()}catch{}}}}},[q]);return E.useEffect(()=>{let te=!1,M=!1,U=!1,ae=!1,z=0,I,D;v(!1);const X=()=>typeof document<"u"&&document.visibilityState==="hidden",W=async()=>{const{url:J,token:le,resolveCredentials:pe}=_.current;if(pe)return pe();const ye=J||fO;return ye?{kind:"ok",url:ye,token:le||hO||null}:{kind:"unavailable"}},he=(J=uE(z++,_.current.policy))=>{te||M||(I=setTimeout(Oe,J))},we=J=>{J.closed().then(()=>{p.current===J&&(p.current=null,C.current.clear(),u(!1),he(Gg(_.current.policy)))})};async function Oe(){if(I=void 0,!(te||M||U||p.current)&&!X()){U=!0;try{const J=await W();if(te)return;if(J.kind==="session-ended"){M=!0,v(!0);return}if(J.kind==="unavailable"){he();return}const le=await uO({servers:J.url,token:J.token??void 0,reconnect:!1});if(te){le.close().catch(()=>{});return}p.current=le,z=0,u(!0),C.current.clear();for(const pe of S.current.keys())q(pe);ae&&(D=setTimeout(()=>{var pe,ye;return(ye=(pe=_.current).onReconnect)==null?void 0:ye.call(pe)},Gg(_.current.policy))),ae=!0,we(le)}catch{te||he()}finally{U=!1}}}const F=()=>{te||M||U||p.current||X()||(I&&clearTimeout(I),z=0,Oe())};return document.addEventListener("visibilitychange",F),window.addEventListener("online",F),Oe(),()=>{te=!0,I&&clearTimeout(I),D&&clearTimeout(D),document.removeEventListener("visibilitychange",F),window.removeEventListener("online",F);for(const J of C.current.values())try{J.unsubscribe()}catch{}C.current.clear(),p.current&&(p.current.close().catch(()=>{}),p.current=null),u(!1)}},[q,m]),E.useEffect(()=>{if(g||x){b(!1);return}const te=setTimeout(()=>b(!0),o.noticeAfterMs);return()=>clearTimeout(te)},[g,x,o.noticeAfterMs]),h.jsx(Px.Provider,{value:{connected:g,unavailable:d,subscribe:ne},children:h.jsx(aa.Provider,{value:{connected:g,subscribe:ne},children:n})})}const ur=Object.create(null);ur.open="0";ur.close="1";ur.ping="2";ur.pong="3";ur.message="4";ur.upgrade="5";ur.noop="6";const iu=Object.create(null);Object.keys(ur).forEach(n=>{iu[ur[n]]=n});const Bd={type:"error",data:"parser error"},Bx=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Ux=typeof ArrayBuffer=="function",zx=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,gm=({type:n,data:e},s,i)=>Bx&&e instanceof Blob?s?i(e):gb(e,i):Ux&&(e instanceof ArrayBuffer||zx(e))?s?i(e):gb(new Blob([e]),i):i(ur[n]+(e||"")),gb=(n,e)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];e("b"+(i||""))},s.readAsDataURL(n)};function bb(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let ad;function yO(n,e){if(Bx&&n.data instanceof Blob)return n.data.arrayBuffer().then(bb).then(e);if(Ux&&(n.data instanceof ArrayBuffer||zx(n.data)))return e(bb(n.data));gm(n,!1,s=>{ad||(ad=new TextEncoder),e(ad.encode(s))})}const xb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<xb.length;n++)xo[xb.charCodeAt(n)]=n;const gO=n=>{let e=n.length*.75,s=n.length,i,o=0,c,m,p,g;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const u=new ArrayBuffer(e),d=new Uint8Array(u);for(i=0;i<s;i+=4)c=xo[n.charCodeAt(i)],m=xo[n.charCodeAt(i+1)],p=xo[n.charCodeAt(i+2)],g=xo[n.charCodeAt(i+3)],d[o++]=c<<2|m>>4,d[o++]=(m&15)<<4|p>>2,d[o++]=(p&3)<<6|g&63;return u},bO=typeof ArrayBuffer=="function",bm=(n,e)=>{if(typeof n!="string")return{type:"message",data:Ix(n,e)};const s=n.charAt(0);return s==="b"?{type:"message",data:xO(n.substring(1),e)}:iu[s]?n.length>1?{type:iu[s],data:n.substring(1)}:{type:iu[s]}:Bd},xO=(n,e)=>{if(bO){const s=gO(n);return Ix(s,e)}else return{base64:!0,data:n}},Ix=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},$x="",vO=(n,e)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,m)=>{gm(c,!1,p=>{i[m]=p,++o===s&&e(i.join($x))})})},_O=(n,e)=>{const s=n.split($x),i=[];for(let o=0;o<s.length;o++){const c=bm(s[o],e);if(i.push(c),c.type==="error")break}return i};function wO(){return new TransformStream({transform(n,e){yO(n,s=>{const i=s.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(s)})}})}let od;function uc(n){return n.reduce((e,s)=>e+s.length,0)}function fc(n,e){if(n[0].length===e)return n.shift();const s=new Uint8Array(e);let i=0;for(let o=0;o<e;o++)s[o]=n[0][i++],i===n[0].length&&(n.shift(),i=0);return n.length&&i<n[0].length&&(n[0]=n[0].slice(i)),s}function SO(n,e){od||(od=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(m,p){for(s.push(m);;){if(i===0){if(uc(s)<1)break;const g=fc(s,1);c=(g[0]&128)===128,o=g[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(uc(s)<2)break;const g=fc(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(uc(s)<8)break;const g=fc(s,8),u=new DataView(g.buffer,g.byteOffset,g.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){p.enqueue(Bd);break}o=d*Math.pow(2,32)+u.getUint32(4),i=3}else{if(uc(s)<o)break;const g=fc(s,o);p.enqueue(bm(c?g:od.decode(g),e)),i=0}if(o===0||o>n){p.enqueue(Bd);break}}}})}const Hx=4;function Tt(n){if(n)return EO(n)}function EO(n){for(var e in Tt.prototype)n[e]=Tt.prototype[e];return n}Tt.prototype.on=Tt.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};Tt.prototype.once=function(n,e){function s(){this.off(n,s),e.apply(this,arguments)}return s.fn=e,this.on(n,s),this};Tt.prototype.off=Tt.prototype.removeListener=Tt.prototype.removeAllListeners=Tt.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+n];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,o=0;o<s.length;o++)if(i=s[o],i===e||i.fn===e){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};Tt.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,e)}return this};Tt.prototype.emitReserved=Tt.prototype.emit;Tt.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Tt.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Nu=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,s)=>s(e,0),$n=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),OO="arraybuffer";function Fx(n,...e){return e.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const AO=$n.setTimeout,jO=$n.clearTimeout;function Tu(n,e){e.useNativeTimers?(n.setTimeoutFn=AO.bind($n),n.clearTimeoutFn=jO.bind($n)):(n.setTimeoutFn=$n.setTimeout.bind($n),n.clearTimeoutFn=$n.clearTimeout.bind($n))}const kO=1.33;function NO(n){return typeof n=="string"?TO(n):Math.ceil((n.byteLength||n.size)*kO)}function TO(n){let e=0,s=0;for(let i=0,o=n.length;i<o;i++)e=n.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function Gx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function CO(n){let e="";for(let s in n)n.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return e}function MO(n){let e={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class RO extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}}class xm extends Tt{constructor(e){super(),this.writable=!1,Tu(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new RO(e,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(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const s=bm(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_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(e){const s=CO(e);return s.length?"?"+s:""}}class DO extends xm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const s=()=>{this.readyState="paused",e()};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(e){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)};_O(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,vO(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Gx()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}}let Vx=!1;try{Vx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const LO=Vx;function qO(){}class PO extends DO{constructor(e){if(super(e),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){const i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}}class cr extends Tt{constructor(e,s,i){super(),this.createRequest=e,Tu(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 e;const s=Fx(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 o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.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(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=cr.requestsCount++,cr.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=qO,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete cr.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}cr.requestsCount=0;cr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",vb);else if(typeof addEventListener=="function"){const n="onpagehide"in $n?"pagehide":"unload";addEventListener(n,vb,!1)}}function vb(){for(let n in cr.requests)cr.requests.hasOwnProperty(n)&&cr.requests[n].abort()}const BO=(function(){const n=Yx({xdomain:!1});return n&&n.responseType!==null})();class UO extends PO{constructor(e){super(e);const s=e&&e.forceBase64;this.supportsBinary=BO&&!s}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new cr(Yx,this.uri(),e)}}function Yx(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||LO))return new XMLHttpRequest}catch{}if(!e)try{return new $n[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Kx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class zO extends xm{get name(){return"websocket"}doOpen(){const e=this.uri(),s=this.opts.protocols,i=Kx?{}:Fx(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(e,s,i)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;gm(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&Nu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Gx()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}}const ld=$n.WebSocket||$n.MozWebSocket;class IO extends zO{createSocket(e,s,i){return Kx?new ld(e,s,i):s?new ld(e,s):new ld(e)}doWrite(e,s){this.ws.send(s)}}class $O extends xm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const s=SO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),o=wO();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const c=()=>{i.read().then(({done:p,value:g})=>{p||(this.onPacket(g),c())}).catch(p=>{})};c();const m={type:"open"};this.query.sid&&(m.data=`{"sid":"${this.query.sid}"}`),this._writer.write(m).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;this._writer.write(i).then(()=>{o&&Nu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const HO={websocket:IO,webtransport:$O,polling:UO},FO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,GO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ud(n){if(n.length>8e3)throw"URI too long";const e=n,s=n.indexOf("["),i=n.indexOf("]");s!=-1&&i!=-1&&(n=n.substring(0,s)+n.substring(s,i).replace(/:/g,";")+n.substring(i,n.length));let o=FO.exec(n||""),c={},m=14;for(;m--;)c[GO[m]]=o[m]||"";return s!=-1&&i!=-1&&(c.source=e,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=VO(c,c.path),c.queryKey=YO(c,c.query),c}function VO(n,e){const s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function YO(n,e){const s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const zd=typeof addEventListener=="function"&&typeof removeEventListener=="function",au=[];zd&&addEventListener("offline",()=>{au.forEach(n=>n())},!1);class Ss extends Tt{constructor(e,s){if(super(),this.binaryType=OO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){const i=Ud(e);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=Ud(s.host).host);Tu(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 o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=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=MO(this.opts.query)),zd&&(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"})},au.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const s=Object.assign({},this.opts.query);s.EIO=Hx,s.transport=e,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[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Ss.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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",Ss.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.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=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.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 o=this.writeBuffer[i].data;if(o&&(s+=NO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Nu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,s,i,o){if(typeof s=="function"&&(o=s,s=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:e,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},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():e()}):this.upgrading?i():e()),this}_onError(e){if(Ss.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,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(),zd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=au.indexOf(this._offlineEventListener);i!==-1&&au.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}}Ss.protocol=Hx;class KO extends Ss{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let s=this.createTransport(e),i=!1;Ss.priorWebsocketSuccess=!1;const o=()=>{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;Ss.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 x=new Error("probe error");x.transport=s.name,this.emitReserved("upgradeError",x)}}))};function c(){i||(i=!0,d(),s.close(),s=null)}const m=b=>{const x=new Error("probe error: "+b);x.transport=s.name,c(),this.emitReserved("upgradeError",x)};function p(){m("transport closed")}function g(){m("socket closed")}function u(b){s&&b.name!==s.name&&c()}const d=()=>{s.removeListener("open",o),s.removeListener("error",m),s.removeListener("close",p),this.off("close",g),this.off("upgrading",u)};s.once("open",o),s.once("error",m),s.once("close",p),this.once("close",g),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}}let JO=class extends KO{constructor(e,s={}){const i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>HO[o]).filter(o=>!!o)),super(e,i)}};function QO(n,e="",s){let i=n;s=s||typeof location<"u"&&location,n==null&&(n=s.protocol+"//"+s.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=s.protocol+n:n=s.host+n),/^(https?|wss?):\/\//.test(n)||(typeof s<"u"?n=s.protocol+"//"+n:n="https://"+n),i=Ud(n)),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+e,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const XO=typeof ArrayBuffer=="function",WO=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Jx=Object.prototype.toString,ZO=typeof Blob=="function"||typeof Blob<"u"&&Jx.call(Blob)==="[object BlobConstructor]",eA=typeof File=="function"||typeof File<"u"&&Jx.call(File)==="[object FileConstructor]";function vm(n){return XO&&(n instanceof ArrayBuffer||WO(n))||ZO&&n instanceof Blob||eA&&n instanceof File}function ou(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(ou(n[s]))return!0;return!1}if(vm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return ou(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&ou(n[s]))return!0;return!1}function tA(n){const e=[],s=n.data,i=n;return i.data=Id(s,e),i.attachments=e.length,{packet:i,buffers:e}}function Id(n,e){if(!n)return n;if(vm(n)){const s={_placeholder:!0,num:e.length};return e.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=Id(n[i],e);return s}else if(typeof n=="object"&&!(n instanceof Date)){const s={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[i]=Id(n[i],e));return s}return n}function nA(n,e){return n.data=$d(n.data,e),delete n.attachments,n}function $d(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=$d(n[s],e);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=$d(n[s],e));return n}const rA=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ve;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(Ve||(Ve={}));class sA{constructor(e){this.replacer=e}encode(e){return(e.type===Ve.EVENT||e.type===Ve.ACK)&&ou(e)?this.encodeAsBinary({type:e.type===Ve.EVENT?Ve.BINARY_EVENT:Ve.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===Ve.BINARY_EVENT||e.type===Ve.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),s}encodeAsBinary(e){const s=tA(e),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class _m extends Tt{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);const i=s.type===Ve.BINARY_EVENT;i||s.type===Ve.BINARY_ACK?(s.type=i?Ve.EVENT:Ve.ACK,this.reconstructor=new iA(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(vm(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),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: "+e)}decodeString(e){let s=0;const i={type:Number(e.charAt(0))};if(Ve[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ve.BINARY_EVENT||i.type===Ve.BINARY_ACK){const c=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);const m=e.substring(c,s);if(m!=Number(m)||e.charAt(s)!=="-")throw new Error("Illegal attachments");const p=Number(m);if(!aA(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=p}if(e.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(c,s)}else i.nsp="/";const o=e.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const m=e.charAt(s);if(m==null||Number(m)!=m){--s;break}if(s===e.length)break}i.id=Number(e.substring(c,s+1))}if(e.charAt(++s)){const c=this.tryParse(e.substr(s));if(_m.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,s){switch(e){case Ve.CONNECT:return _b(s);case Ve.DISCONNECT:return s===void 0;case Ve.CONNECT_ERROR:return typeof s=="string"||_b(s);case Ve.EVENT:case Ve.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&rA.indexOf(s[0])===-1);case Ve.ACK:case Ve.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class iA{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const s=nA(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const aA=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function _b(n){return Object.prototype.toString.call(n)==="[object Object]"}const oA=Object.freeze(Object.defineProperty({__proto__:null,Decoder:_m,Encoder:sA,get PacketType(){return Ve}},Symbol.toStringTag,{value:"Module"}));function Xn(n,e,s){return n.on(e,s),function(){n.off(e,s)}}const lA=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Qx extends Tt{constructor(e,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=e,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 e=this.io;this.subs=[Xn(e,"open",this.onopen.bind(this)),Xn(e,"packet",this.onpacket.bind(this)),Xn(e,"error",this.onerror.bind(this)),Xn(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,o,c;if(lA.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const m={type:Ve.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 p=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(e,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[e]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===e&&this.sendBuffer.splice(p,1);s.call(this,new Error("operation has timed out"))},o),m=(...p)=>{this.io.clearTimeoutFn(c),s.apply(this,p)};m.withError=!0,this.acks[e]=m}emitWithAck(e,...s){return new Promise((i,o)=>{const c=(m,p)=>m?o(m):i(p);c.withError=!0,s.push(c),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...c)=>(this._queue[0],o!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!e||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ve.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ve.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Ve.EVENT:case Ve.BINARY_EVENT:this.onevent(e);break;case Ve.ACK:case Ve.BINARY_ACK:this.onack(e);break;case Ve.DISCONNECT:this.ondisconnect();break;case Ve.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const s=e.data||[];e.id!=null&&s.push(this.ack(e.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Ve.ACK,id:e,data:o}))}}onack(e){const s=this.acks[e.id];typeof s=="function"&&(delete this.acks[e.id],s.withError&&e.data.unshift(null),s.apply(this,e.data))}onconnect(e,s){this.id=e,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ve.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,e.data)}}}function oa(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}oa.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};oa.prototype.reset=function(){this.attempts=0};oa.prototype.setMin=function(n){this.ms=n};oa.prototype.setMax=function(n){this.max=n};oa.prototype.setJitter=function(n){this.jitter=n};class Hd extends Tt{constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Tu(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 oa({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;const o=s.parser||oA;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new JO(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Xn(s,"open",function(){i.onopen(),e&&e()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),e?e(p):this.maybeReconnectOnOpen()},m=Xn(s,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(m),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Xn(e,"ping",this.onping.bind(this)),Xn(e,"data",this.ondata.bind(this)),Xn(e,"error",this.onerror.bind(this)),Xn(e,"close",this.onclose.bind(this)),Xn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){Nu(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new Qx(this,e,s),this.nsps[e]=i),i}_destroy(e){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(e){const s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const io={};function lu(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const s=QO(n,e.path||"/socket.io"),i=s.source,o=s.id,c=s.path,m=io[o]&&c in io[o].nsps,p=e.forceNew||e["force new connection"]||e.multiplex===!1||m;let g;return p?g=new Hd(i,e):(io[o]||(io[o]=new Hd(i,e)),g=io[o]),s.query&&!e.query&&(e.query=s.queryKey),g.socket(s.path,e)}Object.assign(lu,{Manager:Hd,Socket:Qx,io:lu,connect:lu});const cA=E.createContext({connected:!1,subscribe:()=>()=>{}});function uA({children:n}){const{isAuthenticated:e}=qt(),s=E.useRef(null),[i,o]=E.useState(!1),c=E.useRef(new Map),m=E.useCallback((g,u)=>{var b;const d=c.current;return d.has(g)||(d.set(g,new Set),(b=s.current)==null||b.emit("lt.subscribe",g)),d.get(g).add(u),()=>{var v;const x=d.get(g);x&&(x.delete(u),x.size===0&&(d.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),p=E.useCallback((g,u)=>{for(const[d,b]of c.current)if(Lx(g,d))for(const x of b)try{x(u)}catch{}},[]);return E.useEffect(()=>{if(!e)return;const g=lu({path:`${Vt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:u=>{const d=wd();u(d?{token:d}:{})}});return s.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),o(!0);for(const u of c.current.keys())g.emit("lt.subscribe",u)}),g.on("disconnect",u=>{console.log("[lt-socketio] disconnected:",u),o(!1)}),g.on("connect_error",u=>{console.warn("[lt-socketio] connect error:",u.message),o(!1)}),g.onAny((u,d)=>{if(u.startsWith("lt."))try{const b=typeof d=="string"?JSON.parse(d):d;p(u,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[p,e]),h.jsx(cA.Provider,{value:{connected:i,subscribe:m},children:h.jsx(aa.Provider,{value:{connected:i,subscribe:m},children:n})})}function fA({children:n}){const{isAuthenticated:e}=qt(),s=Be(),[i,o]=E.useState(null),[c,m]=E.useState({url:null,policy:Vg(null)});E.useEffect(()=>{let u=!1;async function d(){var b;try{console.log("[lt-transport] detecting event transport...");const x=await lm(),v=(b=x==null?void 0:x.events)==null?void 0:b.transport;console.log("[lt-transport] server reports:",v),u||(v==="nats"&&m({url:x.events.natsWsUrl??null,policy:Vg(x.events.reconnect)}),o(v==="nats"?"nats":"socketio"))}catch(x){console.warn("[lt-transport] settings fetch error, falling back to socketio",x),u||o("socketio")}}return d(),()=>{u=!0}},[e]);const p=E.useCallback(()=>cE(c.url),[c.url]),g=E.useCallback(()=>{s.invalidateQueries({refetchType:"active"})},[s]);return i==="nats"?h.jsx(pO,{resolveCredentials:p,policy:c.policy,onReconnect:g,sessionKey:e,children:n}):i==="socketio"?h.jsx(uA,{children:n}):h.jsx(h.Fragment,{children:n})}const wm="lt_view_as",Sm="lt_ai_override",Fd="lt_graph_enabled",Gd="lt_infrastructure_enabled",Em="lt_scan_override";function Xx(){try{const n=localStorage.getItem(Sm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function hA(n){try{localStorage.setItem(Sm,String(n))}catch{}}function dA(){try{localStorage.removeItem(Sm)}catch{}}function Om(){try{const n=localStorage.getItem(wm);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function mA(n){try{localStorage.setItem(wm,n)}catch{}window.location.reload()}function Vd(){try{localStorage.removeItem(wm)}catch{}window.location.reload()}function Wx(){try{return localStorage.getItem(Fd)==="true"}catch{return!1}}function pA(n){try{n?localStorage.setItem(Fd,"true"):localStorage.removeItem(Fd)}catch{}}function Zx(){try{return localStorage.getItem(Gd)==="true"}catch{return!1}}function yA(n){try{n?localStorage.setItem(Gd,"true"):localStorage.removeItem(Gd)}catch{}}function ev(){try{const n=localStorage.getItem(Em);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function gA(n){try{localStorage.setItem(Em,String(n))}catch{}}function bA(){try{localStorage.removeItem(Em)}catch{}}function tv(){const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),i=Om(),o=n||s("engineer"),c=e("admin"),m=n||e("admin");return{isBuilder:i?!1:o,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":m,viewAs:i,realIsBuilder:o}}function nv(){var u;const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),{data:i}=er(),o=((u=i==null?void 0:i.features)==null?void 0:u.publicPaceBoard)!==!1,c=n?"superadmin":e("admin")?"admin":s("engineer")?"engineer":"operator",m=Om(),p=m==="admin"||m==="engineer"||m==="operator"?m:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}const Am=E.createContext(null);function Cu(){const n=E.useContext(Am);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function xA(){var n;return((n=E.useContext(Am))==null?void 0:n.identity)??null}function vA({children:n}){const[e,s]=E.useState(null),i=E.useRef(e);i.current=e,E.useEffect(()=>{if(!(e!=null&&e.expiresAt))return;const d=new Date(e.expiresAt).getTime()-Date.now();if(d<=0){s(null);return}const b=setTimeout(()=>s(null),d);return()=>clearTimeout(b)},[e]);const o=E.useCallback(d=>{var x;if(!d.actingToken||!d.actor)return null;const b=((x=i.current)==null?void 0:x.actingToken)??null;return s({actingToken:d.actingToken,actorId:d.actor.id,displayName:d.actor.displayName,expiresAt:d.expiresAt??null,subjectScoped:d.grantScope==="subject"}),b},[]),c=E.useCallback(()=>s(null),[]),m=E.useCallback((d,b)=>{const x=i.current;b===0&&(x==null?void 0:x.actingToken)===d&&s(null)},[]),p=E.useCallback((d,b)=>{const x=i.current;if(!x||x.actingToken!==d||!b.acting)return;const{consumed:v,remaining:_,bound:S}=b.acting;(v&&_===0||S&&b.clearSubject)&&s(null)},[]);E.useEffect(()=>(Ig(()=>{var d;return((d=i.current)==null?void 0:d.actingToken)??null}),Hg(c),$g(m),()=>{Ig(null),Hg(null),$g(null)}),[c,m]);const g=E.useCallback(()=>{var b;const d=(b=i.current)==null?void 0:b.expiresAt;return d?Math.max(0,Math.floor((new Date(d).getTime()-Date.now())/1e3)):0},[]),u=E.useMemo(()=>({identity:e,prime:o,clear:c,settle:p,remainingSeconds:g}),[e,o,c,p,g]);return h.jsx(Am.Provider,{value:u,children:n})}function _A(){const{user:n}=qt(),{identity:e}=Cu(),s=n==null?void 0:n.userId,i=e==null?void 0:e.actorId,o=E.useCallback(c=>!!c&&(c===i||c===s),[i,s]);return{viewerId:i??s,isViewer:o}}function rv(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function fr(n={}){const e=n.role?rv(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Xt}.system.escalation.${e}.${s}.${i}`}function Yd(n){return n.verbs.map(e=>fr({role:n.role,verb:e}))}function jm(n){const{user:e,isSuperAdmin:s,hasRoleType:i}=qt(),o=s||i("admin"),c=((e==null?void 0:e.roles)??[]).map(p=>p.role).sort().join(","),m=(n??[]).join(",");return E.useMemo(()=>{const p=m?m.split(","):null;return o||!c?p?Yd({verbs:p}):[fr({})]:c.split(",").flatMap(g=>p?Yd({role:g,verbs:p}):[fr({role:g})])},[o,c,m])}const Kd="/escalations/detail/";function wA(n){return n.startsWith(Kd)&&n.slice(Kd.length).split("/")[0]||void 0}function SA(){const{isViewer:n}=_A(),e=ni(),s=en(),i=E.useRef(s.pathname);i.current=s.pathname;const o=E.useRef(n);o.current=n;const c=E.useCallback(m=>{var b,x,v;if((m==null?void 0:m.assignedAtCreation)!==!0)return;const p=(m==null?void 0:m.escalationId)??((b=m==null?void 0:m.data)==null?void 0:b.id),g=(x=m==null?void 0:m.data)==null?void 0:x.assigned_to,u=(v=m==null?void 0:m.data)==null?void 0:v.parent_id;if(!p||!o.current(g)||!u||u!==wA(i.current))return;const d=`${Kd}${p}`;i.current!==d&&e(d)},[e]);js(jm(["claimed"]),c)}const sv=6048e5,EA=864e5,wb=6e4,Sb=525600,Eb=43200,Ob=1440,Ab=Symbol.for("constructDateFrom");function Br(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&Ab in n?n[Ab](e):n instanceof Date?new n.constructor(e):new Date(e)}function kn(n,e){return Br(e||n,n)}let OA={};function Lo(){return OA}function No(n,e){var p,g,u,d;const s=Lo(),i=(e==null?void 0:e.weekStartsOn)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((d=(u=s.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,o=kn(n,e==null?void 0:e.in),c=o.getDay(),m=(c<i?7:0)+c-i;return o.setDate(o.getDate()-m),o.setHours(0,0,0,0),o}function bu(n,e){return No(n,{...e,weekStartsOn:1})}function iv(n,e){const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=Br(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=bu(o),m=Br(s,0);m.setFullYear(i,0,4),m.setHours(0,0,0,0);const p=bu(m);return s.getTime()>=c.getTime()?i+1:s.getTime()>=p.getTime()?i:i-1}function xu(n){const e=kn(n),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+n-+s}function av(n,...e){const s=Br.bind(null,n||e.find(i=>typeof i=="object"));return e.map(s)}function jb(n,e){const s=kn(n,e==null?void 0:e.in);return s.setHours(0,0,0,0),s}function AA(n,e,s){const[i,o]=av(s==null?void 0:s.in,n,e),c=jb(i),m=jb(o),p=+c-xu(c),g=+m-xu(m);return Math.round((p-g)/EA)}function jA(n,e){const s=iv(n,e),i=Br(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),bu(i)}function kA(n,e){const s=+kn(n)-+kn(e);return s<0?-1:s>0?1:s}function NA(n){return Br(n,Date.now())}function TA(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function CA(n){return!(!TA(n)&&typeof n!="number"||isNaN(+kn(n)))}function MA(n){return e=>{const i=(n?Math[n]:Math.trunc)(e);return i===0?0:i}}function RA(n,e){const s=kn(n,e==null?void 0:e.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const DA={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"}},LA=(n,e,s)=>{let i;const o=DA[n];return typeof o=="string"?i=o:e===1?i=o.one:i=o.other.replace("{{count}}",e.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function cd(n){return(e={})=>{const s=e.width?String(e.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const qA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},PA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},BA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},UA={date:cd({formats:qA,defaultWidth:"full"}),time:cd({formats:PA,defaultWidth:"full"}),dateTime:cd({formats:BA,defaultWidth:"full"})},zA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},IA=(n,e,s,i)=>zA[n];function ao(n){return(e,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const m=n.defaultFormattingWidth||n.defaultWidth,p=s!=null&&s.width?String(s.width):m;o=n.formattingValues[p]||n.formattingValues[m]}else{const m=n.defaultWidth,p=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[p]||n.values[m]}const c=n.argumentCallback?n.argumentCallback(e):e;return o[c]}}const $A={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},HA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},FA={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"]},GA={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"]},VA={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"}},YA={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"}},KA=(n,e)=>{const s=Number(n),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"},JA={ordinalNumber:KA,era:ao({values:$A,defaultWidth:"wide"}),quarter:ao({values:HA,defaultWidth:"wide",argumentCallback:n=>n-1}),month:ao({values:FA,defaultWidth:"wide"}),day:ao({values:GA,defaultWidth:"wide"}),dayPeriod:ao({values:VA,defaultWidth:"wide",formattingValues:YA,defaultFormattingWidth:"wide"})};function oo(n){return(e,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=e.match(o);if(!c)return null;const m=c[0],p=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(p)?XA(p,b=>b.test(m)):QA(p,b=>b.test(m));let u;u=n.valueCallback?n.valueCallback(g):g,u=s.valueCallback?s.valueCallback(u):u;const d=e.slice(m.length);return{value:u,rest:d}}}function QA(n,e){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&e(n[s]))return s}function XA(n,e){for(let s=0;s<n.length;s++)if(e(n[s]))return s}function WA(n){return(e,s={})=>{const i=e.match(n.matchPattern);if(!i)return null;const o=i[0],c=e.match(n.parsePattern);if(!c)return null;let m=n.valueCallback?n.valueCallback(c[0]):c[0];m=s.valueCallback?s.valueCallback(m):m;const p=e.slice(o.length);return{value:m,rest:p}}}const ZA=/^(\d+)(th|st|nd|rd)?/i,ej=/\d+/i,tj={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},nj={any:[/^b/i,/^(a|c)/i]},rj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},sj={any:[/1/i,/2/i,/3/i,/4/i]},ij={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},aj={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]},oj={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},lj={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]},cj={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},uj={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}},fj={ordinalNumber:WA({matchPattern:ZA,parsePattern:ej,valueCallback:n=>parseInt(n,10)}),era:oo({matchPatterns:tj,defaultMatchWidth:"wide",parsePatterns:nj,defaultParseWidth:"any"}),quarter:oo({matchPatterns:rj,defaultMatchWidth:"wide",parsePatterns:sj,defaultParseWidth:"any",valueCallback:n=>n+1}),month:oo({matchPatterns:ij,defaultMatchWidth:"wide",parsePatterns:aj,defaultParseWidth:"any"}),day:oo({matchPatterns:oj,defaultMatchWidth:"wide",parsePatterns:lj,defaultParseWidth:"any"}),dayPeriod:oo({matchPatterns:cj,defaultMatchWidth:"any",parsePatterns:uj,defaultParseWidth:"any"})},ov={code:"en-US",formatDistance:LA,formatLong:UA,formatRelative:IA,localize:JA,match:fj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function hj(n,e){const s=kn(n,e==null?void 0:e.in);return AA(s,RA(s))+1}function dj(n,e){const s=kn(n,e==null?void 0:e.in),i=+bu(s)-+jA(s);return Math.round(i/sv)+1}function lv(n,e){var d,b,x,v;const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=Lo(),c=(e==null?void 0:e.firstWeekContainsDate)??((b=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((v=(x=o.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,m=Br((e==null?void 0:e.in)||n,0);m.setFullYear(i+1,0,c),m.setHours(0,0,0,0);const p=No(m,e),g=Br((e==null?void 0:e.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const u=No(g,e);return+s>=+p?i+1:+s>=+u?i:i-1}function mj(n,e){var p,g,u,d;const s=Lo(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((d=(u=s.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=lv(n,e),c=Br((e==null?void 0:e.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),No(c,e)}function pj(n,e){const s=kn(n,e==null?void 0:e.in),i=+No(s,e)-+mj(s,e);return Math.round(i/sv)+1}function tt(n,e){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return s+i}const ys={y(n,e){const s=n.getFullYear(),i=s>0?s:1-s;return tt(e==="yy"?i%100:i,e.length)},M(n,e){const s=n.getMonth();return e==="M"?String(s+1):tt(s+1,2)},d(n,e){return tt(n.getDate(),e.length)},a(n,e){const s=n.getHours()/12>=1?"pm":"am";switch(e){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(n,e){return tt(n.getHours()%12||12,e.length)},H(n,e){return tt(n.getHours(),e.length)},m(n,e){return tt(n.getMinutes(),e.length)},s(n,e){return tt(n.getSeconds(),e.length)},S(n,e){const s=e.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return tt(o,e.length)}},Hi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},kb={G:function(n,e,s){const i=n.getFullYear()>0?1:0;switch(e){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(n,e,s){if(e==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ys.y(n,e)},Y:function(n,e,s,i){const o=lv(n,i),c=o>0?o:1-o;if(e==="YY"){const m=c%100;return tt(m,2)}return e==="Yo"?s.ordinalNumber(c,{unit:"year"}):tt(c,e.length)},R:function(n,e){const s=iv(n);return tt(s,e.length)},u:function(n,e){const s=n.getFullYear();return tt(s,e.length)},Q:function(n,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return tt(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(n,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return tt(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(n,e,s){const i=n.getMonth();switch(e){case"M":case"MM":return ys.M(n,e);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(n,e,s){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return tt(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(n,e,s,i){const o=pj(n,i);return e==="wo"?s.ordinalNumber(o,{unit:"week"}):tt(o,e.length)},I:function(n,e,s){const i=dj(n);return e==="Io"?s.ordinalNumber(i,{unit:"week"}):tt(i,e.length)},d:function(n,e,s){return e==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ys.d(n,e)},D:function(n,e,s){const i=hj(n);return e==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):tt(i,e.length)},E:function(n,e,s){const i=n.getDay();switch(e){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(n,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(c);case"ee":return tt(c,2);case"eo":return s.ordinalNumber(c,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(n,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(c);case"cc":return tt(c,e.length);case"co":return s.ordinalNumber(c,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(n,e,s){const i=n.getDay(),o=i===0?7:i;switch(e){case"i":return String(o);case"ii":return tt(o,e.length);case"io":return s.ordinalNumber(o,{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(n,e,s){const o=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(n,e,s){const i=n.getHours();let o;switch(i===12?o=Hi.noon:i===0?o=Hi.midnight:o=i/12>=1?"pm":"am",e){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(n,e,s){const i=n.getHours();let o;switch(i>=17?o=Hi.evening:i>=12?o=Hi.afternoon:i>=4?o=Hi.morning:o=Hi.night,e){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(n,e,s){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ys.h(n,e)},H:function(n,e,s){return e==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ys.H(n,e)},K:function(n,e,s){const i=n.getHours()%12;return e==="Ko"?s.ordinalNumber(i,{unit:"hour"}):tt(i,e.length)},k:function(n,e,s){let i=n.getHours();return i===0&&(i=24),e==="ko"?s.ordinalNumber(i,{unit:"hour"}):tt(i,e.length)},m:function(n,e,s){return e==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ys.m(n,e)},s:function(n,e,s){return e==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ys.s(n,e)},S:function(n,e){return ys.S(n,e)},X:function(n,e,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Tb(i);case"XXXX":case"XX":return Ws(i);case"XXXXX":case"XXX":default:return Ws(i,":")}},x:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"x":return Tb(i);case"xxxx":case"xx":return Ws(i);case"xxxxx":case"xxx":default:return Ws(i,":")}},O:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Nb(i,":");case"OOOO":default:return"GMT"+Ws(i,":")}},z:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Nb(i,":");case"zzzz":default:return"GMT"+Ws(i,":")}},t:function(n,e,s){const i=Math.trunc(+n/1e3);return tt(i,e.length)},T:function(n,e,s){return tt(+n,e.length)}};function Nb(n,e=""){const s=n>0?"-":"+",i=Math.abs(n),o=Math.trunc(i/60),c=i%60;return c===0?s+String(o):s+String(o)+e+tt(c,2)}function Tb(n,e){return n%60===0?(n>0?"-":"+")+tt(Math.abs(n)/60,2):Ws(n,e)}function Ws(n,e=""){const s=n>0?"-":"+",i=Math.abs(n),o=tt(Math.trunc(i/60),2),c=tt(i%60,2);return s+o+e+c}const Cb=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},cv=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},yj=(n,e)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return Cb(n,e);let c;switch(i){case"P":c=e.dateTime({width:"short"});break;case"PP":c=e.dateTime({width:"medium"});break;case"PPP":c=e.dateTime({width:"long"});break;case"PPPP":default:c=e.dateTime({width:"full"});break}return c.replace("{{date}}",Cb(i,e)).replace("{{time}}",cv(o,e))},gj={p:cv,P:yj},bj=/^D+$/,xj=/^Y+$/,vj=["D","DD","YY","YYYY"];function _j(n){return bj.test(n)}function wj(n){return xj.test(n)}function Sj(n,e,s){const i=Ej(n,e,s);if(console.warn(i),vj.includes(n))throw new RangeError(i)}function Ej(n,e,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Oj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Aj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,jj=/^'([^]*?)'?$/,kj=/''/g,Nj=/[a-zA-Z]/;function Tj(n,e,s){var d,b,x,v;const i=Lo(),o=i.locale??ov,c=i.firstWeekContainsDate??((b=(d=i.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??1,m=i.weekStartsOn??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,p=kn(n,s==null?void 0:s.in);if(!CA(p))throw new RangeError("Invalid time value");let g=e.match(Aj).map(_=>{const S=_[0];if(S==="p"||S==="P"){const C=gj[S];return C(_,o.formatLong)}return _}).join("").match(Oj).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const S=_[0];if(S==="'")return{isToken:!1,value:Cj(_)};if(kb[S])return{isToken:!0,value:_};if(S.match(Nj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:_}});o.localize.preprocessor&&(g=o.localize.preprocessor(p,g));const u={firstWeekContainsDate:c,weekStartsOn:m,locale:o};return g.map(_=>{if(!_.isToken)return _.value;const S=_.value;(wj(S)||_j(S))&&Sj(S,e,String(n));const C=kb[S[0]];return C(p,S,o.localize,u)}).join("")}function Cj(n){const e=n.match(jj);return e?e[1].replace(kj,"'"):n}function Mj(n,e,s){const i=Lo(),o=(s==null?void 0:s.locale)??i.locale??ov,c=kA(n,e);if(isNaN(c))throw new RangeError("Invalid time value");const m=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[p,g]=av(s==null?void 0:s.in,...c>0?[e,n]:[n,e]),u=MA((s==null?void 0:s.roundingMethod)??"round"),d=g.getTime()-p.getTime(),b=d/wb,x=xu(g)-xu(p),v=(d-x)/wb,_=s==null?void 0:s.unit;let S;if(_?S=_:b<1?S="second":b<60?S="minute":b<Ob?S="hour":v<Eb?S="day":v<Sb?S="month":S="year",S==="second"){const C=u(d/1e3);return o.formatDistance("xSeconds",C,m)}else if(S==="minute"){const C=u(b);return o.formatDistance("xMinutes",C,m)}else if(S==="hour"){const C=u(b/60);return o.formatDistance("xHours",C,m)}else if(S==="day"){const C=u(v/Ob);return o.formatDistance("xDays",C,m)}else if(S==="month"){const C=u(v/Eb);return C===12&&_!=="month"?o.formatDistance("xYears",1,m):o.formatDistance("xMonths",C,m)}else{const C=u(v/Sb);return o.formatDistance("xYears",C,m)}}function Rj(n,e){return Mj(n,NA(n),e)}let vu=null;function Dj(n){vu=n||null}function Lj(){return vu}function qj(n,e,s){const i=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...s?{second:"2-digit"}:{},hour12:!0}).formatToParts(n);return Object.fromEntries(i.map(o=>[o.type,o.value]))}function km(n,e=!1){const s=typeof n=="string"?new Date(n):n;if(Number.isNaN(s.getTime()))return String(n);if(!vu)return Tj(s,e?"MMM d, yyyy h:mm:ss a":"MMM d, yyyy h:mm a");const i=qj(s,vu,e),o=`${i.hour}:${i.minute}${e?`:${i.second}`:""}`;return`${i.month} ${i.day}, ${i.year} ${o} ${i.dayPeriod}`}function uv(n){const e=n??[];return e.length>0&&e.every(s=>s.type==="member"&&s.write_scope==="none")}function d5(n,e,s){return!e||!uv(n)?!0:!!s&&!s.subjectScoped}const Nm={staleTime:5*6e4,refetchOnWindowFocus:!1};function m5(n={},e={}){const s=new URLSearchParams;return n.role&&s.set("role",n.role),n.roleType&&s.set("roleType",n.roleType),n.status&&s.set("status",n.status),n.search&&s.set("search",n.search),n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),qe({queryKey:["users",n],queryFn:()=>ue(`/users?${s}`),enabled:e.enabled??!0,...Nm})}const Mb=200;async function Pj(n){const e=[];for(let s=0;s<n.length;s+=Mb){const i=await ue("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+Mb)})});e.push(...i.users??[])}return e}let Jd=[],Qd=new Map,Xd=!1;function Bj(){const n=Jd,e=Qd;Jd=[],Qd=new Map,Xd=!1,Pj(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of e)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of e.values())i.reject(s)})}function Uj(n){return new Promise((e,s)=>{Jd.push(n),Qd.set(n,{resolve:e,reject:s}),Xd||(Xd=!0,setTimeout(Bj,0))})}function p5(n){return qe({queryKey:["user-name",n],queryFn:()=>Uj(n),enabled:!!n,...Nm})}function zj(n){return qe({queryKey:["users",n,"roles"],queryFn:async()=>(await ue(`/users/${n}/roles`)).roles??[],enabled:!!n,...Nm})}function y5(){const n=Be();return Fe({mutationFn:e=>ue("/users",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function g5(){const n=Be();return Fe({mutationFn:({id:e,...s})=>ue(`/users/${e}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function b5(){const n=Be();return Fe({mutationFn:({id:e,ops:s})=>ue(`/users/${e}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function x5(){return qe({queryKey:["users","system-property-keys"],queryFn:()=>ue("/users/system-property-keys")})}function v5(){const n=Be();return Fe({mutationFn:e=>ue(`/users/${e}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function _5(){const n=Be();return Fe({mutationFn:({userId:e,role:s,type:i,read_scope:o,write_scope:c})=>ue(`/users/${e}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function w5(){const n=Be();return Fe({mutationFn:({userId:e,role:s})=>ue(`/users/${e}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}const S5={MAX_PORTALS:12,MAX_ROWS:4,MAX_COLS:6,MAX_COUNTS:8};function Ij(){return qe({queryKey:["roles"],queryFn:()=>ue("/roles")})}function Mu(n){return qe({queryKey:["roles","details"],queryFn:()=>ue("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function E5(n,e,s=!0){return qe({queryKey:["roles",n,"schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function O5(n){return qe({queryKey:["roles",n,"schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function A5(n,e,s=!0){return qe({queryKey:["roles",n,"list-schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function j5(n){return qe({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function k5(){const n=Be();return Fe({mutationFn:e=>ue("/roles",{method:"POST",body:JSON.stringify({role:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function N5(){const n=Be();return Fe({mutationFn:({role:e,...s})=>ue(`/roles/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:e,...s})=>{await n.cancelQueries({queryKey:["roles","details"]});const i=n.getQueryData(["roles","details"]);return i&&n.setQueryData(["roles","details"],{roles:i.roles.map(o=>o.role===e?{...o,...s}:o)}),{previous:i}},onError:(e,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function T5(){const n=Be();return Fe({mutationFn:e=>ue(`/roles/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const fv="lt:station:kiosk-role:";function Wd(n){return`${fv}${n}`}const Zd=new Set;function $j(){for(const n of Zd)n()}function Hj(n){try{return localStorage.getItem(Wd(n))}catch{return null}}function Fj(n,e){try{e===null?localStorage.removeItem(Wd(n)):localStorage.setItem(Wd(n),e)}catch{}$j()}function Gj(n){Zd.add(n);const e=s=>{(s.key===null||s.key.startsWith(fv))&&n()};try{window.addEventListener("storage",e)}catch{}return()=>{Zd.delete(n);try{window.removeEventListener("storage",e)}catch{}}}function Vj(n){return E.useSyncExternalStore(Gj,()=>n?Hj(n):null)}const _u="/portal";function Yj(n){return n===_u||n.startsWith(`${_u}/`)}function Tm(n,e){const s=`${_u}/${encodeURIComponent(n)}`;return e?`${s}/${encodeURIComponent(e)}`:s}function ea(n){return Array.isArray(n==null?void 0:n.portals)?n.portals:[]}function Kj(n){return ea(n).length>0}function C5(n,e){const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"portal",i=new Set(e);if(!i.has(s))return s;let o=2;for(;i.has(`${s}-${o}`);)o+=1;return`${s}-${o}`}function hv(n,e){return e.length>0?Tm(n,e[0].key):`/escalations/available?role=${encodeURIComponent(n)}&status=available`}function Cm(){const{user:n}=qt(),e=(n==null?void 0:n.userId)??null,{data:s}=zj(e),{data:i}=Mu(),o=Vj(e),c=E.useCallback(m=>{e&&Fj(e,m)},[e]);return E.useMemo(()=>{const m={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},p=s??[];if(p.length===0||p.some(v=>v.type!=="member"))return m;const g=v=>{var _;return(_=i==null?void 0:i.roles)==null?void 0:_.find(S=>S.role===v)},u=v=>{var _,S;return((S=(_=g(v))==null?void 0:_.properties)==null?void 0:S.kiosk)===!0},d=p.map(v=>v.role).filter(u),b=v=>({kiosk:!0,role:v,homePath:hv(v,ea(g(v))),targets:d,selectable:d.length>=2,selectRole:c});if(p.length===1)return d.length===1?b(d[0]):m;if(!uv(p)||d.length===0)return m;const x=o&&d.includes(o)?o:d.length===1?d[0]:null;return x?b(x):{...m,targets:d,selectable:!0}},[s,i,o,c])}const Jj="/escalations/available",Qj=["/escalations",_u,"/scan","/login"];function Xj(n,e=""){if(n===Jj){const s=new URLSearchParams(e);if(!s.get("role")&&!s.get("facets"))return!1}return Qj.some(s=>n===s||n.startsWith(`${s}/`)||n.startsWith(`${s}?`))}const Mm=E.createContext(null),ud="lt_sidebar_collapsed",dv="(max-width: 1023px)";function Wj(){try{return window.matchMedia(dv).matches}catch{return!1}}function Zj({children:n}){const[e,s]=E.useState(()=>{if(Wj())return!0;try{return localStorage.getItem(ud)==="true"}catch{return!1}});E.useEffect(()=>{let o;try{o=window.matchMedia(dv)}catch{return}const c=m=>{if(m.matches)s(!0);else try{s(localStorage.getItem(ud)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=E.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(ud,String(c))}catch{}return c})},[]);return h.jsx(Mm.Provider,{value:{collapsed:e,toggle:i},children:n})}function ek({children:n}){return h.jsx(Mm.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function Rm(){const n=E.useContext(Mm);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const Rb=380,Dm=E.createContext(null);function tk({children:n}){const[e,s]=E.useState({node:null,width:Rb,open:!1,ownerKey:null}),i=en(),o=E.useRef(i.pathname),c=E.useCallback((p,g)=>{s({node:p,width:(g==null?void 0:g.width)??Rb,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),m=E.useCallback(p=>{s(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return E.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[i.pathname]),h.jsx(Dm.Provider,{value:{...e,setPanel:c,closePanel:m},children:n})}function Lm(){const n=E.useContext(Dm);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function M5(){return E.useContext(Dm)}function nk({open:n,width:e=380,children:s,className:i=""}){const[o,c]=E.useState(n);return E.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?e:0,maxWidth:"50%"},onTransitionEnd:m=>{!n&&m.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:e},className:"h-full",children:o?s:null})})}function R5({label:n,children:e}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:n}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:e})]})}function D5({views:n,activeId:e,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:m}){const p=n.find(g=>g.id===e)??n[0];return p?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${m?"pt-10 pb-2":"pt-3"}`,children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:n.map(g=>{const u=g.icon,d=g.id===p.id;return h.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:h.jsx(u,{className:"w-3.5 h-3.5"})},g.id)})}),m&&h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:p.label})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o,i&&h.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:h.jsx(Zt,{className:"w-3.5 h-3.5"})})]})]}),!m&&h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:p.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${m?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function mv(n,e){var s,i,o,c,m;e.facets&&Object.keys(e.facets).length&&n.set("facets",JSON.stringify(e.facets)),(s=e.block)!=null&&s.length&&n.set("block",JSON.stringify(e.block)),(i=e.range)!=null&&i.length&&n.set("range",JSON.stringify(e.range)),(o=e.exists)!=null&&o.length&&n.set("exists",JSON.stringify(e.exists)),(c=e.roles)!=null&&c.length&&n.set("roles",JSON.stringify(e.roles)),(m=e.orderBy)!=null&&m.length&&n.set("orderBy",JSON.stringify(e.orderBy)),e.available!==void 0&&n.set("available",String(e.available)),e.jeopardy===!0&&n.set("jeopardy","1"),e.include&&n.set("include",e.include),e.groupBy&&n.set("groupBy",e.groupBy)}function L5(n,e,s){const i=n??"24h",o=e&&Object.keys(e).length?JSON.stringify(e):null;return qe({queryKey:["stationMetrics",i,o],queryFn:()=>ue(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function q5(n){const e=n?`?period=${n}`:"";return qe({queryKey:["escalationStats",n],queryFn:()=>ue(`/escalations/stats${e}`)})}function P5(){return qe({queryKey:["escalationTypes"],queryFn:()=>ue("/escalations/types")})}function B5(n=!0){return qe({queryKey:["escalationFacetKeys"],queryFn:()=>ue("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function rk(n){return qe({queryKey:["escalationFacetValues",n],queryFn:()=>ue(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function sk(n){const e=new URLSearchParams;return n.status&&e.set("status",n.status),n.role&&e.set("role",n.role),n.type&&e.set("type",n.type),n.subtype&&e.set("subtype",n.subtype),n.assigned_to&&e.set("assigned_to",n.assigned_to),n.parent_id&&e.set("parent_id",n.parent_id),n.claimed&&e.set("claimed","true"),n.priority&&e.set("priority",String(n.priority)),n.limit&&e.set("limit",String(n.limit)),n.offset!==void 0&&e.set("offset",String(n.offset)),n.sort_by&&e.set("sort_by",n.sort_by),n.order&&e.set("order",n.order),n.search&&e.set("search",n.search),mv(e,n),e}function ik(n){return{queryKey:["escalations",n],queryFn:()=>ue(`/escalations?${sk(n)}`)}}function pv(n){const{enabled:e=!0,staleTime:s,...i}=n;return qe({...ik(i),enabled:e,...s!==void 0?{staleTime:s}:{}})}function yv(n){const{enabled:e=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),mv(o,i),qe({queryKey:["escalations","available",i],queryFn:()=>ue(`/escalations/available?${o}`),enabled:e,...s!==void 0?{staleTime:s}:{}})}function U5(n){return qe({queryKey:["escalations","by-workflow",n],queryFn:()=>ue(`/escalations/by-workflow/${n}`),enabled:!!n})}function z5(n){return qe({queryKey:["escalations",n],queryFn:()=>ue(`/escalations/${n}`),enabled:!!n})}function I5(n,e){return qe({queryKey:["escalations",n,"lookups"],queryFn:()=>ue(`/escalations/${n}/lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function $5(){const n=Be();return Fe({mutationFn:({id:e,durationMinutes:s})=>ue(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function H5(){const n=Be();return Fe({mutationFn:e=>ue(`/escalations/${e}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function F5(){const n=Be();return Fe({mutationFn:({id:e,resolverPayload:s})=>ue(`/escalations/${e}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),n.resetQueries({queryKey:["tasks"]}),n.resetQueries({queryKey:["jobs"]})}})}function G5(){const n=Be();return Fe({mutationFn:({id:e,itemKey:s,payload:i})=>ue(`/escalations/${e}/accumulate`,{method:"POST",body:JSON.stringify({itemKey:s,...i?{payload:i}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function V5(){const n=Be();return Fe({mutationFn:({id:e,itemKey:s})=>ue(`/escalations/${e}/remove-item`,{method:"POST",body:JSON.stringify({itemKey:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function Y5(){const n=Be();return Fe({mutationFn:({id:e,targetRole:s})=>ue(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function K5(){const n=Be();return Fe({mutationFn:({ids:e,priority:s})=>ue("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:e,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function J5(){const n=Be();return Fe({mutationFn:({ids:e,durationMinutes:s})=>ue("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:e,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Q5(){const n=Be();return Fe({mutationFn:({ids:e,targetUserId:s,durationMinutes:i,reassign:o})=>ue("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:e,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function X5(){const n=Be();return Fe({mutationFn:({ids:e})=>ue("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function W5(){const n=Be();return Fe({mutationFn:({ids:e,hint:s})=>ue("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:e,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Z5(){const n=Be();return Fe({mutationFn:e=>ue(`/escalations/${e}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function eM(){const n=Be();return Fe({mutationFn:({ids:e})=>ue("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function qm(n){const e=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":e.push(["tasks"]),e.push(["jobs"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),n.originId&&e.push(["processes",n.originId]);break;case"escalation":e.push(["escalations"]),e.push(["escalationStats"]),e.push(["stationMetrics"]),n.workflowId&&e.push(["workflowExecution",n.workflowId]);break;case"workflow":e.push(["jobs"]),e.push(["tasks"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId]),e.push(["mcpQueryResult",n.workflowId]),e.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&e.push(["mcpRunExecution",n.workflowId]),e.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),e.push(["tasks"]);break;case"knowledge":e.push(["knowledge"]);break;case"file":e.push(["files"]);break;case"agent":e.push(["agents"]);break;default:e.push(["jobs"]),e.push(["tasks"]);break}return e}const ak={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},tM=300,Db={DETAIL:0,LIST:1,SUMMARY:2};function ok(n){const e=new Map,s={},i={};let o=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function m(d){delete s[d],i[d]=Date.now();const b=[];for(const[v,_]of e)_===d&&b.push(v);for(const v of b)e.delete(v);if(b.length===0)return;const x=c();x&&(o=!0);for(const v of b)n.invalidateQueries({queryKey:JSON.parse(v),...x?{refetchType:"none"}:{}})}function p(d){if(s[d])return;const{coalesceMs:b,minIntervalMs:x}=ak[d],v=i[d],_=v===void 0?0:v+x-Date.now(),S=Math.max(b,_);s[d]=setTimeout(()=>m(d),S)}function g(d,b){for(const x of b){const v=JSON.stringify(x),_=e.get(v);(_===void 0||Db[d]<Db[_])&&e.set(v,d)}p(d)}const u=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",u),{request:g,dispose(){for(const d of Object.keys(s)){const b=s[d];b&&clearTimeout(b),delete s[d]}e.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",u)}}}const Lb=new WeakMap;function lk(n){let e=Lb.get(n);return e||(e=ok(n),Lb.set(n,e)),e}function tn(n){const e=Be();return E.useCallback(s=>{lk(e).request(n,s)},[e,n])}function Pm(n){return n?[`${Xt}.system.workflow.>`,`${Xt}.system.activity.>`,`${Xt}.system.milestone.>`,`${Xt}.system.task.>`,`${Xt}.system.escalation.>`]:[]}function nM(){const n=tn("LIST");An(`${Xt}.system.task.>`,()=>{n([["jobs"]])}),An(`${Xt}.system.workflow.>`,()=>{n([["jobs"]])})}function rM(n){const e=tn("DETAIL");js(Pm(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],m=qm(s);c==="escalation"&&m.push(["escalations","by-workflow",n]),e(m)})}function sM(n){const e=tn("DETAIL");js(Pm(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],m=qm(s);c==="escalation"&&m.push(["escalations","by-workflow",n]),e(m)})}function iM(n){const e=tn("DETAIL");js(Pm(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=qm(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),e(o)})}function aM(n){const e=tn("DETAIL"),s=E.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||e([["processes",n]]))},[n,e]);An(`${Xt}.system.task.>`,s),An(`${Xt}.system.workflow.>`,s),An(`${Xt}.system.escalation.>`,s)}function oM(){const n=tn("SUMMARY");An(fr({}),()=>{n([["escalationStats"]])})}function lM(){const n=tn("SUMMARY");An(fr({}),()=>{n([["stationMetrics"]])})}function cM(){const n=tn("SUMMARY");An(fr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function uM(n){const e=tn("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=E.useMemo(()=>{const c=i?i.split(","):null;return c?Yd({role:s,verbs:c}):[fr({role:s})]},[s,i]);js(o,()=>{e([["escalations"]])})}const ck=[["escalations","related"],["escalations","related-rows"]];function fM(n){const e=tn("LIST"),s=[...new Set(n)].sort().join(","),i=E.useMemo(()=>s?s.split(",").map(o=>fr({role:o})):[],[s]);js(i,()=>{e(ck)})}function hM(n){const e=tn("DETAIL");An(fr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||e([["escalations",n]])})}function dM(){const n=tn("LIST");An(`${Xt}.system.agent.>`,()=>{n([["agents"]])})}function mM(){const n=tn("LIST");An(`${Xt}.system.task.>`,()=>{n([["processes"]])}),An(`${Xt}.system.workflow.>`,()=>{n([["processes"]])})}function uk(){const{user:n}=qt(),e=n==null?void 0:n.userId,s=tn("SUMMARY");js(jm(),()=>{s([["escalations"]])});const{data:i}=yv({limit:1}),{data:o}=pv({assigned_to:e,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function Ru({size:n="sm",hideLabel:e=!1,className:s="",appName:i="LongTail",variant:o="full"}){const c=n==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Vt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Vt}/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",p=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 h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${m}`,style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${e?"opacity-0":""}`,children:i})]})}const fk="system.surfaces.dashboard",hk=`${Xt}.${fk}`;function gv(n=!0){return qe({queryKey:["announcements"],queryFn:()=>ue("/announcements"),enabled:n,staleTime:3e4})}function dk(){const n=Be();return Fe({mutationFn:e=>ue("/announcements",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function mk(){const n=Be();return Fe({mutationFn:e=>ue(`/announcements/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function pM(n){return n.toLocaleString()}function yM(n){return n>=1e9?`${(n/1e9).toFixed(1).replace(/\.0$/,"")}B`:n>=1e6?`${(n/1e6).toFixed(1).replace(/\.0$/,"")}M`:n>=1e4?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}K`:n.toLocaleString()}function pk(n){const e=new Date(n);return e.getTime()>Date.now()?"just now":Rj(e,{addSuffix:!0})}function gM(n){const e=Date.now()-new Date(n).getTime();if(e<0)return"now";const s=Math.floor(e/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const o=Math.floor(i/60);if(o<24)return`${o}h`;const c=Math.floor(o/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 bM(n){return n<=0?"Expired":Bm(n)}function yk(n){return n==null?"--":Bm(n)}function xM(n){return n?km(n):"--"}function Bm(n){if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4){const m=n/1e3;return Number.isInteger(m)?`${m}s`:`${m.toFixed(1)}s`}const e=Math.floor(n/1e3),s=Math.floor(e/86400),i=Math.floor(e%86400/3600),o=Math.floor(e%3600/60),c=e%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?o>0?`${i}h ${o}m`:`${i}h`:c>0?`${o}m ${c}s`:`${o}m`}function vM(n,e){const s=new Date(n).getTime(),i=e?new Date(e).getTime():Date.now();return Bm(i-s)}function bv({options:n,children:e,className:s=""}){const[i,o]=E.useState(!1),[c,m]=E.useState(null),[p,g]=E.useState(null),u=E.useRef(null),d=E.useRef(void 0),b=E.useRef(void 0),x=220,v=E.useCallback(()=>{if(!u.current)return;const P=u.current.getBoundingClientRect(),q=window.innerWidth-x-8,ne=Math.max(8,Math.min(P.left,q));g({top:P.bottom+4,left:ne})},[]),_=E.useCallback(async(P,q)=>{try{await navigator.clipboard.writeText(P),m(q),clearTimeout(d.current),d.current=setTimeout(()=>m(null),1200)}catch{}},[]),S=E.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=E.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return E.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:u,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[e,i&&p&&sm.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:p.top,left:p.left},onMouseEnter:S,onMouseLeave:C,children:n.map(P=>h.jsxs("button",{onClick:q=>{q.stopPropagation(),_(P.value,P.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:P.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===P.label?"✓":P.value})]},P.label))}),document.body)]})}function gk(n,e){const s=new Date(n);switch(e){case"relative":return pk(n);case"datetime":return km(s);case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:Lj()??void 0})}}function bk(n){const e=new Date(n);return[{label:"ms",value:String(e.getTime())},{label:"utc",value:e.toISOString()},{label:"local",value:km(e,!0)}]}function xv({date:n,format:e="relative",className:s=""}){const[,i]=E.useState(0);E.useEffect(()=>{if(e!=="relative")return;const c=setInterval(()=>i(m=>m+1),3e4);return()=>clearInterval(c)},[e]);const o=E.useMemo(()=>bk(n),[n]);return h.jsx(bv,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:gk(n,e)})})}function xk({values:n,options:e,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const m=e.filter(p=>!n.includes(p));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(p=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==p)),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 ${p}`,children:[p,h.jsx(Zt,{className:"w-3 h-3",strokeWidth:1.5})]},p)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),m.length>0&&h.jsxs("select",{value:"",onChange:p=>p.target.value&&s([...n,p.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),m.map(p=>h.jsx("option",{value:p,children:p},p))]})]})}const vk=[{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 _k(){const{data:n}=gv(),{data:e}=Ij(),s=dk(),i=mk(),[o,c]=E.useState(""),[m,p]=E.useState(""),[g,u]=E.useState(1440),[d,b]=E.useState([]),x=(n==null?void 0:n.announcements)??[],v=()=>{m.trim()&&s.mutate({body:m.trim(),...o.trim()?{title:o.trim()}:{},...d.length?{roles:d}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),p(""),b([])}})};return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),h.jsx("input",{type:"text",value:o,onChange:_=>c(_.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),h.jsx("textarea",{value:m,onChange:_=>p(_.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),h.jsx("select",{value:g,onChange:_=>u(Number(_.target.value)),className:"select text-xs w-full",children:vk.map(_=>h.jsx("option",{value:_.minutes,children:_.label},_.minutes))})]}),h.jsxs("div",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),h.jsx(xk,{values:d,options:(e==null?void 0:e.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&h.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),h.jsx("button",{onClick:v,disabled:!m.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),x.length>0&&h.jsxs("div",{className:"mt-6",children:[h.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),h.jsx("div",{className:"space-y-1",children:x.map(_=>h.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs text-text-primary truncate",children:_.title??_.body.split(`
54
+ `)[0]}),h.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",h.jsx(xv,{date:_.expires_at,format:"relative"})]})]}),h.jsx("button",{onClick:()=>i.mutate(_.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${_.title??"announcement"}`,children:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},_.id))})]})]})}const wk=[{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"}],Sk=["operator","engineer","admin","superadmin"];function qb(n){return Sk.indexOf(n)}function Ek(n,e){return qb(n)>=qb(e)}function Ok({onClose:n}){var Ne,Me,We,pt,Ct,Se,Re;const{isSuperAdmin:e,hasRoleType:s,hasRole:i}=qt(),{data:o}=er(),c=Om(),m=!!((Ne=o==null?void 0:o.ai)!=null&&Ne.enabled),p=Xx(),g=p!==null?p:m,[u,d]=E.useState(g),b=(Me=o==null?void 0:o.features)==null?void 0:Me.graphWorkflows,x=b==null,[v,_]=E.useState(b===!0||x&&Wx()),S=e||i("engineer"),[C,P]=E.useState(Zx()),q=!!((We=o==null?void 0:o.features)!=null&&We.scanCodes),ne=ev(),[te,M]=E.useState(ne!==null?ne:q),U=e?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ae=((pt=o==null?void 0:o.branding)==null?void 0:pt.appName)??"LongTail",z=(Ct=o==null?void 0:o.environment)==null?void 0:Ct.longTailVersion,I=(Se=o==null?void 0:o.environment)==null?void 0:Se.hotmeshVersion,D=(Re=o==null?void 0:o.environment)==null?void 0:Re.nodeEnv;E.useEffect(()=>{const ce=Ue=>{Ue.key==="Escape"&&n()};return document.addEventListener("keydown",ce),()=>document.removeEventListener("keydown",ce)},[n]);const X=wk.filter(ce=>Ek(U,ce.minTier)),W=X.length>1,he=U!=="operator",we=[...W?[{id:"viewas",label:"View As",icon:gS}]:[],{id:"features",label:"Features",icon:bS},...he?[{id:"alerts",label:"Alerts",icon:xS}]:[]],[Oe,F]=E.useState(we[0].id),J=ce=>{ce===null?Vd():mA(ce)},le=()=>{const ce=!u;d(ce),ce===m?dA():hA(ce),window.location.reload()},pe=()=>{const ce=!v;_(ce),pA(ce),window.location.reload()},ye=()=>{const ce=!C;P(ce),yA(ce),window.location.reload()},Ce=()=>{const ce=!te;M(ce),ce===q?bA():gA(ce),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:n,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:ce=>ce.stopPropagation(),children:[h.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Zt,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),z&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",z,I&&h.jsxs(h.Fragment,{children:[" · HotMesh v",I]}),D&&D!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:D})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),we.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:we.map(ce=>{const Ue=Oe===ce.id;return h.jsxs("button",{role:"tab","aria-selected":Ue,onClick:()=>F(ce.id),title:ce.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Ue?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(ce.icon,{className:"w-5 h-5",strokeWidth:1.5,...Ue?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:ce.label})]},ce.id)})}),Oe==="viewas"&&W&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),X.map(ce=>{const Ue=c===ce.id,Xe=ce.id===null?`Your view · ${U}`:ce.label;return h.jsxs("button",{onClick:()=>J(ce.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${Ue?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Ue&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${Ue?"text-accent":"text-text-primary group-hover:text-accent"}`,children:Xe}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:ce.description})]})]},String(ce.id))})]}),Oe==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:le,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:u?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${u?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${u?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:pe,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:v?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${v?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${v?"translate-x-4":"translate-x-0"}`})})]}),S&&h.jsxs("button",{onClick:ye,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group","data-testid":"feature-infrastructure",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Infrastructure"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:C?"Visible — Routers, Messages, and DB Maintenance in the sidebar":"Hidden — routers, message streams, and database maintenance"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${C?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]}),h.jsxs("button",{onClick:Ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:te?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${te?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${te?"translate-x-4":"translate-x-0"}`})})]})]}),Oe==="alerts"&&he&&h.jsx(_k,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const vv=[{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"}],Pb="blue",_v="lt.theme";let wv=[];function Ak(n){const e=new Set(vv.map(i=>i.id)),s=new Set;wv=n.filter(i=>!(i!=null&&i.id)||e.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function jk(){return[...vv,...wv]}function Sv(){try{return localStorage.getItem(_v)||Pb}catch{return Pb}}function Ev(n){document.documentElement.dataset.theme=n}function kk(n){try{localStorage.setItem(_v,n)}catch{}Ev(n)}const Nk=[8,12,13,14];function Tk(n){if(!/^[0-9]+$/.test(n)||!Nk.includes(n.length))return!1;const e=n.split("").map(Number),s=e.pop();let i=0;for(let o=e.length-1,c=3;o>=0;o--,c=c===3?1:3)i+=e[o]*c;return(10-i%10)%10===s}function _M(n){return n.padStart(14,"0")}const cu={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},Ov="lt_scan_wedge_config";function Av(){try{const n=localStorage.getItem(Ov);return n?{...cu,...JSON.parse(n)}:cu}catch{return cu}}function Ck(n){const e={...Av(),...n};return localStorage.setItem(Ov,JSON.stringify(e)),e}const Um=[{pattern:/(?:^|[^0-9])([1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+)$/,digitsOnly:!1},{pattern:/(?:^|[^0-9])([1-9][0-9]{7,})$/,digitsOnly:!0}];function Mk(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rk(n){const e=[];for(const s of n.filter(i=>i.enabled))if(s.encoding==="delimited"){const i=Mk(s.delimiter);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}${i}[0-9]${i}[a-zA-Z0-9._-]+)$`),digitsOnly:!1})}else if(s.encoding==="fixed"){const i=1+(s.target_length??0);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}[0-9]{${i},${i+1}})$`),digitsOnly:!0})}else s.encoding==="gtin"&&e.push({pattern:/(?:^|[^0-9])([0-9]{8}|[0-9]{12,14})$/,digitsOnly:!0,accept:Tk});return e.length?e:Um}function Dk(n,e=Um){var i;let s=null;for(const o of e){const c=(i=n.match(o.pattern))==null?void 0:i[1];!c||o.accept&&!o.accept(c)||(!s||c.length>s.code.length)&&(s={code:c,shape:o})}return s}const Lk=new Set(["Shift","CapsLock"]),hc={suppress:!1,emit:null};function qk(n=cu,e=Um){let s={buffer:"",times:[],lastKeyMs:0};function i(u){const d=s.times.slice(-u.length);return d.length<2?!1:(d[d.length-1]-d[0])/(d.length-1)<=n.autoFireMaxAvgKeyMs}function o(){const u=Dk(s.buffer,e);return!u||u.code.length<n.minLength||u.shape.digitsOnly&&!i(u.code)?null:u.code}function c(){s={buffer:"",times:[],lastKeyMs:0}}function m(u){const{key:d,timeMs:b,hasModifier:x,isRepeat:v}=u;if(Lk.has(d))return hc;if(n.terminators.includes(d)){const q=o();return c(),q?{suppress:!0,emit:q,consumedLength:q.length}:hc}if(x||v||d.length!==1)return c(),hc;const _=b-s.lastKeyMs,S=s.lastKeyMs>0&&_<=n.maxKeyGapMs,C=(S?s.buffer+d:d).slice(-128),P=(S?[...s.times,b]:[b]).slice(-128);return s={buffer:C,times:P,lastKeyMs:b},hc}function p(){return{buffer:s.buffer}}function g(){const u=o();return!u||!i(u)?null:{code:u,consumedLength:u.length}}return{step:m,reset:c,snapshot:p,pendingAutoFire:g}}function Pk(){const n=document.activeElement;return n instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(n.type)?n:null:n instanceof HTMLTextAreaElement?n:null}function Bk(n,e,s){var c;const i=n instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,o=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;o?o.call(n,e):n.value=e;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function Bb(n){if(n<=0)return;const e=Pk();if(!e)return;const s=e.selectionStart??e.value.length,i=Math.max(0,s-n);Bk(e,e.value.slice(0,i)+e.value.slice(s),i)}function Uk({active:n,wedgeConfig:e,tailShapes:s,diagnosticsOn:i,onScan:o,onDiag:c}){const m=E.useRef({diagnosticsOn:i,onScan:o,onDiag:c});m.current={diagnosticsOn:i,onScan:o,onDiag:c};const p=E.useRef(0),g=E.useRef(0);E.useEffect(()=>{if(!n)return;const u=qk(e,s);let d=null;const b=()=>{d&&(clearTimeout(d),d=null)},x=(S,C,P)=>{C&&Bb(C),m.current.diagnosticsOn&&(console.debug("[scan]",P),m.current.onDiag({seq:++p.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:P})),m.current.onScan(S)},v=()=>{b(),u.pendingAutoFire()&&(d=setTimeout(()=>{d=null;const S=u.pendingAutoFire();S&&(u.reset(),x(S.code,S.consumedLength,`capture → ${S.code} (quiet period — no suffix)`))},e.autoFireQuietMs))},_=S=>{const C=u.snapshot().buffer,{suppress:P,emit:q,consumedLength:ne}=u.step({key:S.key,timeMs:S.timeStamp,hasModifier:S.ctrlKey||S.metaKey||S.altKey,isRepeat:S.repeat});if(P&&(S.preventDefault(),S.stopPropagation()),m.current.diagnosticsOn){const te=u.snapshot().buffer,M=e.terminators.includes(S.key),U=q?`capture → ${q}`:M?`terminator — no code tail in "${C.slice(-24)}"`:te===C?C?"neutral (chord key)":"ignored":te===""?"reset (edit/chord/non-printable)":te.length<=1&&C.length>1?"gap — new episode":"accumulate",ae=g.current?Math.round(S.timeStamp-g.current):0,z={seq:++p.current,key:S.key,code:S.code!==S.key?S.code:"",deltaMs:ae,buffer:te.slice(-24),note:U};console.debug("[scan]",z.key,z.code,`${z.deltaMs}ms`,z.note),m.current.onDiag(z)}g.current=S.timeStamp,q?(b(),ne&&Bb(ne),m.current.onScan(q)):v()};return window.addEventListener("keydown",_,{capture:!0}),()=>{b(),window.removeEventListener("keydown",_,{capture:!0})}},[n,e,s])}const je={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",NO_OPEN_CONTAINER:"no_open_container",HELD:"held",REFUSED:"refused",SUBJECT_STALE:"subject_stale"},dc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",ACCUMULATE:"accumulate",PRESENT:"present",HOLD:"hold",FILL:"fill"},zk={ACTION:"action",IDENTITY:"identity"};function Ik(n,e){return ue("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...e!=null&&e.actingToken?{actingToken:e.actingToken}:{},...e!=null&&e.previousActingToken?{previousActingToken:e.previousActingToken}:{},...e!=null&&e.subject?{subject:e.subject}:{},...e!=null&&e.stationRole?{stationRole:e.stationRole}:{}})})}function wM(n){return ue("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function jv(n){return qe({queryKey:["scan-schemes"],queryFn:()=>ue("/scan-codes/schemes"),...n})}function SM(n){return qe({queryKey:["scan-schemes",n],queryFn:()=>ue(`/scan-codes/schemes/${n}`),enabled:n!=null})}function EM(){const n=Be();return Fe({mutationFn:e=>ue(`/scan-codes/schemes/${e.version}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function OM(){const n=Be();return Fe({mutationFn:e=>ue(`/scan-codes/schemes/${e}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function AM(){const n=Be();return Fe({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function jM(){const n=Be();return Fe({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"DELETE"}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const $k=3e4;function Hk(n,e=Date.now()){if(!(!n||Date.parse(n.expiresAt)<=e))return{code:n.code,escalationId:n.escalationId}}function Ub(n,e,s=Date.now()){if(e.outcome===je.HELD&&e.subject){const i=Math.max(0,Date.parse(e.subject.expiresAt)-s);return{...e.subject,ttlMs:i}}return e.clearSubject||!n?null:e.outcome===je.EXECUTED&&e.progress&&e.progress.remaining>0?{...n,expiresAt:new Date(s+n.ttlMs).toISOString()}:n}function zb(n){return n.outcome===je.NOT_PRIMED&&n.replayable===!0}function Fk(n,e=Date.now()){return n&&e-n.at<=$k?n:null}const Gk=[je.HELD,je.REFUSED,je.SUBJECT_STALE],To={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar"},Fi=n=>{if(n)try{return JSON.parse(n)}catch{return}},Zs=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function Vk(n){const e={},s=Fi(n.get("facets"));Zs(s)||(e.facets=s);const i=Fi(n.get("block"));Zs(i)||(e.block=i);const o=Fi(n.get("range"));Zs(o)||(e.range=o);const c=Fi(n.get("exists"));Zs(c)||(e.exists=c);const m=Fi(n.get("roles"));Zs(m)||(e.roles=m);const p=Fi(n.get("orderBy"));Zs(p)||(e.orderBy=p),n.get("available")!=null&&(e.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(e.jeopardy=!0),e}function kM(n,e){const s=(i,o)=>Zs(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",e.facets),s("block",e.block),s("range",e.range),s("exists",e.exists),s("roles",e.roles),s("orderBy",e.orderBy),e.available==null?n.delete("available"):n.set("available",String(e.available)),e.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const Ib=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function kv(n,e){const s={};for(const[o,c]of Object.entries(n))s[o]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return e?`/escalations/available?role=${encodeURIComponent(e)}&facets=${i}${Ib}`:`/escalations/available?facets=${i}${Ib}`}function Yk(n,e,s){return kv({[n]:e},s)}function NM(n){var e,s,i;return Object.keys(n.facets??{}).length+(((e=n.block)==null?void 0:e.length)??0)+(((s=n.range)==null?void 0:s.length)??0)+(((i=n.exists)==null?void 0:i.length)??0)+(n.available!=null?1:0)+(n.jeopardy===!0?1:0)}function zm(){var s;const{data:n}=er(),e=ev();return e!==null?e:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const Im=E.createContext(null);function $m(){const n=E.useContext(Im);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}function TM(){return E.useContext(Im)}const Kk="scanPendingAction",Jk="scanChoices",fd="/scan/station";function Qk({children:n}){const{user:e}=qt(),s=zm(),i=ni(),o=en(),{identity:c,prime:m,clear:p,settle:g}=Cu(),[u,d]=E.useState(null),[b,x]=E.useState(null),[v,_]=E.useState(null),{data:S}=jv({enabled:!!e&&s,staleTime:6e4}),C=E.useRef(null);C.current=Cm().role;const P=E.useMemo(()=>Rk((S==null?void 0:S.schemes)??[]),[S]),[q,ne]=E.useState(!1),[te,M]=E.useState(()=>Av()),[U,ae]=E.useState([]),[z,I]=E.useState(!1),D=E.useCallback(Se=>{var Ue;const{outcome:Re}=Se;if(Re===je.CONFIRM_REQUIRED&&Se.pendingAction)return i(`/escalations/detail/${Se.pendingAction.escalationId}`,{state:{[Kk]:Se.pendingAction}}),!0;const ce=Re===je.EXECUTED&&!!F.current;if(Gk.includes(Re)||zb(Se)||ce)return le.current!==fd&&i(fd),!0;if(Re===je.EXECUTED&&Se.escalation){const Xe=[dc.SHOW_DETAIL,dc.CLAIM_SHOW_DETAIL,dc.CLAIM,dc.ESCALATE];return Se.verb&&Xe.includes(Se.verb)?(i(`/escalations/detail/${Se.escalation.id}`),!0):!1}if(Re===je.MATCHED_LIST&&Se.listQuery){const{targetFacet:Xe,target:cn,roles:Mt}=Se.listQuery;return i(kv({[Xe]:cn},(Mt==null?void 0:Mt[0])??null)),!0}return Re===je.CHOICES&&Se.choices?(i(fd,{state:{[Jk]:Se}}),!0):Re===je.NO_MATCH_FALLBACK&&((Ue=Se.fallback)!=null&&Ue.route)?(i(Se.fallback.route),!0):!1},[i]),X=E.useRef(null);X.current=(c==null?void 0:c.actingToken)??null;const W=E.useRef(null),he=E.useRef([]),we=E.useCallback(Se=>(he.current=[Se,...he.current],()=>{he.current=he.current.filter(Re=>Re!==Se)}),[]),Oe=E.useRef(null);Oe.current=b;const F=E.useRef(void 0),J=E.useRef(null);J.current=v;const le=E.useRef(o.pathname);le.current=o.pathname,E.useEffect(()=>{if(!b)return;const Se=Date.parse(b.expiresAt)-Date.now();if(Se<=0){x(null);return}const Re=setTimeout(()=>x(null),Se);return()=>clearTimeout(Re)},[b]);const pe=E.useCallback(async(Se,Re,ce)=>{ne(!0);const Ue=Date.now();try{F.current=Hk(Oe.current);const Xe=await Ik(Se,{actingToken:ce??void 0,previousActingToken:W.current??void 0,subject:F.current,stationRole:C.current??void 0});if(ce&&g(ce,Xe),x(Mt=>Ub(Mt,Xe)),Xe.outcome===je.IDENTITY_PRIMED){W.current=m(Xe);const Mt=Fk(J.current);if(_(null),Mt&&Xe.actingToken){d({code:Se,source:Re,at:Ue,response:Xe,error:null,navigated:!1}),await pe(Mt.code,Re,Xe.actingToken);return}}else zb(Xe)?_({code:Se,at:Ue}):_(null);Xe.outcome===je.NOT_PRIMED&&ce&&p();const cn=D(Xe);d({code:Se,source:Re,at:Ue,response:Xe,error:null,navigated:cn})}catch(Xe){d({code:Se,source:Re,at:Ue,response:null,error:Xe.message,navigated:!1})}finally{ne(!1)}},[D,m,p,g]),ye=E.useCallback(async(Se,Re=To.MANUAL)=>{for(const ce of he.current)if(ce(Se))return;await pe(Se,Re,X.current)},[pe]),Ce=E.useCallback(()=>x(null),[]),Ne=E.useCallback(Se=>{x(Re=>Ub(Re,Se))},[]),Me=E.useCallback(()=>_(null),[]),We=E.useRef(ye);We.current=ye,Uk({active:!!e&&s,wedgeConfig:te,tailShapes:P,diagnosticsOn:z,onScan:Se=>void We.current(Se,To.KEYBOARD_WEDGE),onDiag:Se=>ae(Re=>[...Re.slice(-29),Se])});const pt=E.useCallback(Se=>{M(Ck(Se))},[]),Ct=E.useMemo(()=>({submitCode:ye,pushCodeInterceptor:we,lastResult:u,subject:b,dropSubject:Ce,adoptResponse:Ne,pendingScan:v,dropPendingScan:Me,busy:q,wedgeConfig:te,updateWedgeConfig:pt,diagnostics:U,diagnosticsOn:z,setDiagnosticsOn:I}),[ye,we,u,b,Ce,Ne,v,Me,q,te,pt,U,z]);return h.jsx(Im.Provider,{value:Ct,children:n})}var mc={},lo={},pc={},$b;function Nn(){if($b)return pc;$b=1,Object.defineProperty(pc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var e=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return pc.default=e,pc}var Hb;function Xk(){if(Hb)return lo;Hb=1,Object.defineProperty(lo,"__esModule",{value:!0}),lo.CODE39=void 0;var n=(function(){function S(C,P){for(var q=0;q<P.length;q++){var ne=P[q];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(C,ne.key,ne)}}return function(C,P,q){return P&&S(C.prototype,P),q&&S(C,q),C}})(),e=Nn(),s=i(e);function i(S){return S&&S.__esModule?S:{default:S}}function o(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")}function c(S,C){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:S}function m(S,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);S.prototype=Object.create(C&&C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(S,C):S.__proto__=C)}var p=(function(S){m(C,S);function C(P,q){return o(this,C),P=P.toUpperCase(),q.mod43&&(P+=x(_(P))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,P,q))}return n(C,[{key:"encode",value:function(){for(var q=d("*"),ne=0;ne<this.data.length;ne++)q+=d(this.data[ne])+"0";return q+=d("*"),{data:q,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),C})(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","-","."," ","$","/","+","%","*"],u=[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(v(S))}function b(S){return u[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function _(S){for(var C=0,P=0;P<S.length;P++)C+=v(S[P]);return C=C%43,C}return lo.CODE39=p,lo}var Jn={},yc={},gc={},vt={},Fb;function qo(){if(Fb)return vt;Fb=1,Object.defineProperty(vt,"__esModule",{value:!0});var n;function e(g,u,d){return u in g?Object.defineProperty(g,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):g[u]=d,g}var s=vt.SET_A=0,i=vt.SET_B=1,o=vt.SET_C=2;vt.SHIFT=98;var c=vt.START_A=103,m=vt.START_B=104,p=vt.START_C=105;return vt.MODULO=103,vt.STOP=106,vt.FNC1=207,vt.SET_BY_CODE=(n={},e(n,c,s),e(n,m,i),e(n,p,o),n),vt.SWAP={101:s,100:i,99:o},vt.A_START_CHAR="Ð",vt.B_START_CHAR="Ñ",vt.C_START_CHAR="Ò",vt.A_CHARS="[\0-_È-Ï]",vt.B_CHARS="[ -È-Ï]",vt.C_CHARS="(Ï*[0-9]{2}Ï*)",vt.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],vt}var Gb;function Du(){if(Gb)return gc;Gb=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Nn(),s=o(e),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){c(this,d);var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b.substring(1),x));return v.bytes=b.split("").map(function(_){return _.charCodeAt(0)}),v}return n(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.bytes,v=x.shift()-105,_=i.SET_BY_CODE[v];if(_===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&x.unshift(i.FNC1);var S=d.next(x,1,_);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(v)+S.result+d.getBar((S.checksum+v)%i.MODULO)+d.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var x=this.options.ean128||!1;return typeof x=="string"&&(x=x.toLowerCase()==="true"),x}}],[{key:"getBar",value:function(x){return i.BARS[x]?i.BARS[x].toString():""}},{key:"correctIndex",value:function(x,v){if(v===i.SET_A){var _=x.shift();return _<32?_+64:_-32}else return v===i.SET_B?x.shift()-32:(x.shift()-48)*10+x.shift()-48}},{key:"next",value:function(x,v,_){if(!x.length)return{result:"",checksum:0};var S=void 0,C=void 0;if(x[0]>=200){C=x.shift()-105;var P=i.SWAP[C];P!==void 0?S=d.next(x,v+1,P):((_===i.SET_A||_===i.SET_B)&&C===i.SHIFT&&(x[0]=_===i.SET_A?x[0]>95?x[0]-96:x[0]:x[0]<32?x[0]+96:x[0]),S=d.next(x,v+1,_))}else C=d.correctIndex(x,_),S=d.next(x,v+1,_);var q=d.getBar(C),ne=C*v;return{result:q+S.result,checksum:ne+S.checksum}}}]),d})(s.default);return gc.default=g,gc}var bc={},Vb;function Wk(){if(Vb)return bc;Vb=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=qo(),e=function(p){return p.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(p){return p.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(m,p){var g=p?n.A_CHARS:n.B_CHARS,u=m.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(u)return u[1]+"Ì"+c(m.substring(u[1].length));var d=m.match(new RegExp("^"+g+"+"))[0];return d.length===m.length?m:d+String.fromCharCode(p?205:206)+o(m.substring(d.length),!p)}function c(m){var p=i(m),g=p.length;if(g===m.length)return m;m=m.substring(g);var u=e(m)>=s(m);return p+String.fromCharCode(u?206:205)+o(m,u)}return bc.default=function(m){var p=void 0,g=i(m).length;if(g>=2)p=n.C_START_CHAR+c(m);else{var u=e(m)>s(m);p=(u?n.A_START_CHAR:n.B_START_CHAR)+o(m,u)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,b){return"Ë"+b})},bc}var Yb;function Zk(){if(Yb)return yc;Yb=1,Object.defineProperty(yc,"__esModule",{value:!0});var n=Du(),e=o(n),s=Wk(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){if(c(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,i.default)(b),x));else var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x));return m(v)}return d})(e.default);return yc.default=g,yc}var xc={},Kb;function eN(){if(Kb)return xc;Kb=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Du(),s=o(e),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.A_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),d})(s.default);return xc.default=g,xc}var vc={},Jb;function tN(){if(Jb)return vc;Jb=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Du(),s=o(e),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.B_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),d})(s.default);return vc.default=g,vc}var _c={},Qb;function nN(){if(Qb)return _c;Qb=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Du(),s=o(e),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.C_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),d})(s.default);return _c.default=g,_c}var Xb;function rN(){if(Xb)return Jn;Xb=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.CODE128C=Jn.CODE128B=Jn.CODE128A=Jn.CODE128=void 0;var n=Zk(),e=g(n),s=eN(),i=g(s),o=tN(),c=g(o),m=nN(),p=g(m);function g(u){return u&&u.__esModule?u:{default:u}}return Jn.CODE128=e.default,Jn.CODE128A=i.default,Jn.CODE128B=c.default,Jn.CODE128C=p.default,Jn}var Kt={},wc={},Rr={},Wb;function Po(){return Wb||(Wb=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.SIDE_BIN="101",Rr.MIDDLE_BIN="01010",Rr.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"]},Rr.EAN2_STRUCTURE=["LL","LG","GL","GG"],Rr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Rr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Rr}var Sc={},Ec={},Zb;function Bo(){if(Zb)return Ec;Zb=1,Object.defineProperty(Ec,"__esModule",{value:!0});var n=Po(),e=function(i,o,c){var m=i.split("").map(function(g,u){return n.BINARIES[o[u]]}).map(function(g,u){return g?g[i[u]]:""});if(c){var p=i.length-1;m=m.map(function(g,u){return u<p?g+c:g})}return m.join("")};return Ec.default=e,Ec}var e1;function Nv(){if(e1)return Sc;e1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),e=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var d=(function(b){u(x,b);function x(v,_){p(this,x);var S=g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.fontSize=!_.flat&&_.fontSize>_.width*10?_.width*10:_.fontSize,S.guardHeight=_.height+S.fontSize/2+_.textMargin,S}return n(x,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(_,S){return this.text.substr(_,S)}},{key:"leftEncode",value:function(_,S){return(0,i.default)(_,S)}},{key:"rightText",value:function(_,S){return this.text.substr(_,S)}},{key:"rightEncode",value:function(_,S){return(0,i.default)(_,S)}},{key:"encodeGuarded",value:function(){var _={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:e.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:_},{data:e.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:_},{data:e.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var _=[e.SIDE_BIN,this.leftEncode(),e.MIDDLE_BIN,this.rightEncode(),e.SIDE_BIN];return{data:_.join(""),text:this.text}}}]),x})(c.default);return Sc.default=d,Sc}var t1;function sN(){if(t1)return wc;t1=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),e=function b(x,v,_){x===null&&(x=Function.prototype);var S=Object.getOwnPropertyDescriptor(x,v);if(S===void 0){var C=Object.getPrototypeOf(x);return C===null?void 0:b(C,v,_)}else{if("value"in S)return S.value;var P=S.get;return P===void 0?void 0:P.call(_)}},s=Po(),i=Nv(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=function(x){var v=x.substr(0,12).split("").map(function(_){return+_}).reduce(function(_,S,C){return C%2?_+S*3:_+S},0);return(10-v%10)%10},d=(function(b){g(x,b);function x(v,_){m(this,x),v.search(/^[0-9]{12}$/)!==-1&&(v+=u(v));var S=p(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.lastChar=_.lastChar,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===u(this.data)}},{key:"leftText",value:function(){return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var _=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,_,S)}},{key:"rightText",value:function(){return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var _=this.data.substr(7,6);return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,_,"RRRRRR")}},{key:"encodeGuarded",value:function(){var _=e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(_.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(_.push({data:"00"}),_.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),_}}]),x})(o.default);return wc.default=d,wc}var Oc={},n1;function iN(){if(n1)return Oc;n1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=(function(){function d(b,x){for(var v=0;v<x.length;v++){var _=x[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(b,_.key,_)}}return function(b,x,v){return x&&d(b.prototype,x),v&&d(b,v),b}})(),e=function d(b,x,v){b===null&&(b=Function.prototype);var _=Object.getOwnPropertyDescriptor(b,x);if(_===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:d(S,x,v)}else{if("value"in _)return _.value;var C=_.get;return C===void 0?void 0:C.call(v)}},s=Nv(),i=o(s);function o(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 p(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 x=b.substr(0,7).split("").map(function(v){return+v}).reduce(function(v,_,S){return S%2?v+_:v+_*3},0);return(10-x%10)%10},u=(function(d){p(b,d);function b(x,v){return c(this,b),x.search(/^[0-9]{7}$/)!==-1&&(x+=g(x)),m(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x,v))}return n(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var v=this.data.substr(0,4);return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var v=this.data.substr(4,4);return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return Oc.default=u,Oc}var Ac={},r1;function aN(){if(r1)return Ac;r1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var n=(function(){function x(v,_){for(var S=0;S<_.length;S++){var C=_[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}return function(v,_,S){return _&&x(v.prototype,_),S&&x(v,S),v}})(),e=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(x){return x&&x.__esModule?x:{default:x}}function p(x,v){if(!(x instanceof v))throw new TypeError("Cannot call a class as a function")}function g(x,v){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:x}function u(x,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);x.prototype=Object.create(v&&v.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(x,v):x.__proto__=v)}var d=function(v){var _=v.split("").map(function(S){return+S}).reduce(function(S,C,P){return P%2?S+C*9:S+C*3},0);return _%10},b=(function(x){u(v,x);function v(_,S){return p(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,S))}return n(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=e.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return Ac.default=b,Ac}var jc={},s1;function oN(){if(s1)return jc;s1=1,Object.defineProperty(jc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),e=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var d=(function(b){u(x,b);function x(v,_){return p(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_))}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var _=e.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,_,"01"),text:this.text}}}]),x})(c.default);return jc.default=d,jc}var co={},i1;function Tv(){if(i1)return co;i1=1,Object.defineProperty(co,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})();co.checksum=d;var e=Bo(),s=c(e),i=Nn(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=(function(b){g(x,b);function x(v,_){m(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=d(v));var S=p(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.displayValue=_.displayValue,_.fontSize>_.width*10?S.fontSize=_.width*10:S.fontSize=_.fontSize,S.guardHeight=_.height+S.fontSize/2+_.textMargin,S}return n(x,[{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 _="";return _+="101",_+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),_+="01010",_+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),_+="101",{data:_,text:this.text}}},{key:"guardedEncoding",value:function(){var _=[];return this.displayValue&&_.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),_.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),_.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),_.push({data:"01010",options:{height:this.guardHeight}}),_.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),_.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&_.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),_}}]),x})(o.default);function d(b){var x=0,v;for(v=1;v<11;v+=2)x+=parseInt(b[v]);for(v=0;v<11;v+=2)x+=parseInt(b[v])*3;return(10-x%10)%10}return co.default=u,co}var kc={},a1;function lN(){if(a1)return kc;a1=1,Object.defineProperty(kc,"__esModule",{value:!0});var n=(function(){function _(S,C){for(var P=0;P<C.length;P++){var q=C[P];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(S,q.key,q)}}return function(S,C,P){return C&&_(S.prototype,C),P&&_(S,P),S}})(),e=Bo(),s=m(e),i=Nn(),o=m(i),c=Tv();function m(_){return _&&_.__esModule?_:{default:_}}function p(_,S){if(!(_ instanceof S))throw new TypeError("Cannot call a class as a function")}function g(_,S){if(!_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:_}function u(_,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);_.prototype=Object.create(S&&S.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(_,S):_.__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"]],x=(function(_){u(S,_);function S(C,P){p(this,S);var q=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,P));if(q.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)q.middleDigits=C,q.upcA=v(C,"0"),q.text=P.text||""+q.upcA[0]+C+q.upcA[q.upcA.length-1],q.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(q.middleDigits=C.substring(1,C.length-1),q.upcA=v(q.middleDigits,C[0]),q.upcA[q.upcA.length-1]===C[C.length-1])q.isValid=!0;else return g(q);else return g(q);return q.displayValue=P.displayValue,P.fontSize>P.width*10?q.fontSize=P.width*10:q.fontSize=P.fontSize,q.guardHeight=P.height+q.fontSize/2+P.textMargin,q}return n(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 P="";return P+="101",P+=this.encodeMiddleDigits(),P+="010101",{data:P,text:this.text}}},{key:"guardedEncoding",value:function(){var P=[];return this.displayValue&&P.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),P.push({data:"101",options:{height:this.guardHeight}}),P.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),P.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&P.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),P}},{key:"encodeMiddleDigits",value:function(){var P=this.upcA[0],q=this.upcA[this.upcA.length-1],ne=b[parseInt(q)][parseInt(P)];return(0,s.default)(this.middleDigits,ne)}}]),S})(o.default);function v(_,S){for(var C=parseInt(_[_.length-1]),P=d[C],q="",ne=0,te=0;te<P.length;te++){var M=P[te];M==="X"?q+=_[ne++]:q+=M}return q=""+S+q,""+q+(0,c.checksum)(q)}return kc.default=x,kc}var o1;function cN(){if(o1)return Kt;o1=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.UPCE=Kt.UPC=Kt.EAN2=Kt.EAN5=Kt.EAN8=Kt.EAN13=void 0;var n=sN(),e=x(n),s=iN(),i=x(s),o=aN(),c=x(o),m=oN(),p=x(m),g=Tv(),u=x(g),d=lN(),b=x(d);function x(v){return v&&v.__esModule?v:{default:v}}return Kt.EAN13=e.default,Kt.EAN8=i.default,Kt.EAN5=c.default,Kt.EAN2=p.default,Kt.UPC=u.default,Kt.UPCE=b.default,Kt}var Qs={},Nc={},Gi={},l1;function uN(){return l1||(l1=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.START_BIN="1010",Gi.END_BIN="11101",Gi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Gi}var c1;function Cv(){if(c1)return Nc;c1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=uN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return n(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var x=this,v=this.data.match(/.{2}/g).map(function(_){return x.encodePair(_)}).join("");return{data:e.START_BIN+v+e.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=e.BINARIES[x[1]];return e.BINARIES[x[0]].split("").map(function(_,S){return(_==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),d})(i.default);return Nc.default=g,Nc}var Tc={},u1;function fN(){if(u1)return Tc;u1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Cv(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function c(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function m(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var p=function(d){var b=d.substr(0,13).split("").map(function(x){return parseInt(x,10)}).reduce(function(x,v,_){return x+v*(3-_%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(u){m(d,u);function d(b,x){return o(this,d),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(b)),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===p(this.data)}}]),d})(s.default);return Tc.default=g,Tc}var f1;function hN(){if(f1)return Qs;f1=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.ITF14=Qs.ITF=void 0;var n=Cv(),e=o(n),s=fN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Qs.ITF=e.default,Qs.ITF14=i.default,Qs}var xn={},Cc={},h1;function Uo(){if(h1)return Cc;h1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=Nn(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function c(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function m(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var p=(function(u){m(d,u);function d(b,x){return o(this,d),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"encode",value:function(){for(var x="110",v=0;v<this.data.length;v++){var _=parseInt(this.data[v]),S=_.toString(2);S=g(S,4-S.length);for(var C=0;C<S.length;C++)x+=S[C]=="0"?"100":"110"}return x+="1001",{data:x,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(s.default);function g(u,d){for(var b=0;b<d;b++)u="0"+u;return u}return Cc.default=p,Cc}var Mc={},uo={},d1;function Lu(){if(d1)return uo;d1=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.mod10=n,uo.mod11=e;function n(s){for(var i=0,o=0;o<s.length;o++){var c=parseInt(s[o]);(o+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function e(s){for(var i=0,o=[2,3,4,5,6,7],c=0;c<s.length;c++){var m=parseInt(s[s.length-1-c]);i+=o[c%o.length]*m}return(11-i%11)%11}return uo}var m1;function dN(){if(m1)return Mc;m1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=Uo(),e=i(n),s=Lu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d+(0,s.mod10)(d),b))}return u})(e.default);return Mc.default=p,Mc}var Rc={},p1;function mN(){if(p1)return Rc;p1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=Uo(),e=i(n),s=Lu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d+(0,s.mod11)(d),b))}return u})(e.default);return Rc.default=p,Rc}var Dc={},y1;function pN(){if(y1)return Dc;y1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var n=Uo(),e=i(n),s=Lu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),d+=(0,s.mod10)(d),d+=(0,s.mod10)(d),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return u})(e.default);return Dc.default=p,Dc}var Lc={},g1;function yN(){if(g1)return Lc;g1=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=Uo(),e=i(n),s=Lu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),d+=(0,s.mod11)(d),d+=(0,s.mod10)(d),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return u})(e.default);return Lc.default=p,Lc}var b1;function gN(){if(b1)return xn;b1=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.MSI1110=xn.MSI1010=xn.MSI11=xn.MSI10=xn.MSI=void 0;var n=Uo(),e=d(n),s=dN(),i=d(s),o=mN(),c=d(o),m=pN(),p=d(m),g=yN(),u=d(g);function d(b){return b&&b.__esModule?b:{default:b}}return xn.MSI=e.default,xn.MSI10=i.default,xn.MSI11=c.default,xn.MSI1010=p.default,xn.MSI1110=u.default,xn}var fo={},x1;function bN(){if(x1)return fo;x1=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.pharmacode=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){o(this,u);var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b));return x.number=parseInt(d,10),x}return n(u,[{key:"encode",value:function(){for(var b=this.number,x="";!isNaN(b)&&b!=0;)b%2===0?(x="11100"+x,b=(b-2)/2):(x="100"+x,b=(b-1)/2);return x=x.slice(0,-2),{data:x,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),u})(s.default);return fo.pharmacode=p,fo}var ho={},v1;function xN(){if(v1)return ho;v1=1,Object.defineProperty(ho,"__esModule",{value:!0}),ho.codabar=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){o(this,u),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(u,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],x=this.getEncodings(),v=0;v<this.data.length;v++)b.push(x[this.data.charAt(v)]),v!==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"}}}]),u})(s.default);return ho.codabar=p,ho}var Xs={},qc={},Vi={},_1;function vN(){return _1||(_1=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.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","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Vi.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"],Vi.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"]}),Vi}var w1;function Mv(){if(w1)return qc;w1=1,Object.defineProperty(qc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),e=vN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.data.split("").flatMap(function(C){return e.MULTI_SYMBOLS[C]||C}),v=x.map(function(C){return d.getEncoding(C)}).join(""),_=d.checksum(x,20),S=d.checksum(x.concat(_),15);return{text:this.text,data:d.getEncoding("ÿ")+v+d.getEncoding(_)+d.getEncoding(S)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(x){return e.BINARIES[d.symbolValue(x)]}},{key:"getSymbol",value:function(x){return e.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return e.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var _=x.slice().reverse().reduce(function(S,C,P){var q=P%v+1;return S+d.symbolValue(C)*q},0);return d.getSymbol(_%47)}}]),d})(i.default);return qc.default=g,qc}var Pc={},S1;function _N(){if(S1)return Pc;S1=1,Object.defineProperty(Pc,"__esModule",{value:!0});var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=Mv(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return n(u,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),u})(s.default);return Pc.default=p,Pc}var E1;function wN(){if(E1)return Xs;E1=1,Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.CODE93FullASCII=Xs.CODE93=void 0;var n=Mv(),e=o(n),s=_N(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Xs.CODE93=e.default,Xs.CODE93FullASCII=i.default,Xs}var mo={},O1;function SN(){if(O1)return mo;O1=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.GenericBarcode=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return n(u,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),u})(s.default);return mo.GenericBarcode=p,mo}var A1;function EN(){if(A1)return mc;A1=1,Object.defineProperty(mc,"__esModule",{value:!0});var n=Xk(),e=rN(),s=cN(),i=hN(),o=gN(),c=bN(),m=xN(),p=wN(),g=SN();return mc.default={CODE39:n.CODE39,CODE128:e.CODE128,CODE128A:e.CODE128A,CODE128B:e.CODE128B,CODE128C:e.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:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:c.pharmacode,codabar:m.codabar,CODE93:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},mc}var Bc={},j1;function qu(){if(j1)return Bc;j1=1,Object.defineProperty(Bc,"__esModule",{value:!0});var n=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e};return Bc.default=function(e,s){return n({},e,s)},Bc}var Uc={},k1;function ON(){if(k1)return Uc;k1=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.default=n;function n(e){var s=[];function i(o){if(Array.isArray(o))for(var c=0;c<o.length;c++)i(o[c]);else o.text=o.text||"",o.data=o.data||"",s.push(o)}return i(e),s}return Uc}var zc={},N1;function AN(){if(N1)return zc;N1=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.default=n;function n(e){return e.marginTop=e.marginTop||e.margin,e.marginBottom=e.marginBottom||e.margin,e.marginRight=e.marginRight||e.margin,e.marginLeft=e.marginLeft||e.margin,e}return zc}var Ic={},$c={},Hc={},T1;function Rv(){if(T1)return Hc;T1=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.default=n;function n(e){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof e[i]=="string"&&(e[i]=parseInt(e[i],10)));return typeof e.displayValue=="string"&&(e.displayValue=e.displayValue!="false"),e}return Hc}var Fc={},C1;function Dv(){if(C1)return Fc;C1=1,Object.defineProperty(Fc,"__esModule",{value:!0});var n={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 Fc.default=n,Fc}var M1;function jN(){if(M1)return $c;M1=1,Object.defineProperty($c,"__esModule",{value:!0});var n=Rv(),e=o(n),s=Dv(),i=o(s);function o(m){return m&&m.__esModule?m:{default:m}}function c(m){var p={};for(var g in i.default)i.default.hasOwnProperty(g)&&(m.hasAttribute("jsbarcode-"+g.toLowerCase())&&(p[g]=m.getAttribute("jsbarcode-"+g.toLowerCase())),m.hasAttribute("data-"+g.toLowerCase())&&(p[g]=m.getAttribute("data-"+g.toLowerCase())));return p.value=m.getAttribute("jsbarcode-value")||m.getAttribute("data-value"),p=(0,e.default)(p),p}return $c.default=c,$c}var Gc={},Vc={},vn={},R1;function Lv(){if(R1)return vn;R1=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.getTotalWidthOfEncodings=vn.calculateEncodingAttributes=vn.getBarcodePadding=vn.getEncodingHeight=vn.getMaximumHeightOfEncodings=void 0;var n=qu(),e=s(n);function s(u){return u&&u.__esModule?u:{default:u}}function i(u,d){return d.height+(d.displayValue&&u.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function o(u,d,b){if(b.displayValue&&d<u){if(b.textAlign=="center")return Math.floor((u-d)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(u-d)}return 0}function c(u,d,b){for(var x=0;x<u.length;x++){var v=u[x],_=(0,e.default)(d,v.options),S;_.displayValue?S=g(v.text,_,b):S=0;var C=v.data.length*_.width;v.width=Math.ceil(Math.max(S,C)),v.height=i(v,_),v.barcodePadding=o(S,C,_)}}function m(u){for(var d=0,b=0;b<u.length;b++)d+=u[b].width;return d}function p(u){for(var d=0,b=0;b<u.length;b++)u[b].height>d&&(d=u[b].height);return d}function g(u,d,b){var x;if(b)x=b;else if(typeof document<"u")x=document.createElement("canvas").getContext("2d");else return 0;x.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var v=x.measureText(u);if(!v)return 0;var _=v.width;return _}return vn.getMaximumHeightOfEncodings=p,vn.getEncodingHeight=i,vn.getBarcodePadding=o,vn.calculateEncodingAttributes=c,vn.getTotalWidthOfEncodings=m,vn}var D1;function kN(){if(D1)return Vc;D1=1,Object.defineProperty(Vc,"__esModule",{value:!0});var n=(function(){function p(g,u){for(var d=0;d<u.length;d++){var b=u[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,u,d){return u&&p(g.prototype,u),d&&p(g,d),g}})(),e=qu(),s=o(e),i=Lv();function o(p){return p&&p.__esModule?p:{default:p}}function c(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")}var m=(function(){function p(g,u,d){c(this,p),this.canvas=g,this.encodings=u,this.options=d}return n(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var u=0;u<this.encodings.length;u++){var d=(0,s.default)(this.options,this.encodings[u].options);this.drawCanvasBarcode(d,this.encodings[u]),this.drawCanvasText(d,this.encodings[u]),this.moveCanvasDrawing(this.encodings[u])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var u=this.canvas.getContext("2d");u.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,u);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,u.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(u.fillStyle=this.options.background,u.fillRect(0,0,this.canvas.width,this.canvas.height)),u.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(u,d){var b=this.canvas.getContext("2d"),x=d.data,v;u.textPosition=="top"?v=u.marginTop+u.fontSize+u.textMargin:v=u.marginTop,b.fillStyle=u.lineColor;for(var _=0;_<x.length;_++){var S=_*u.width+d.barcodePadding;x[_]==="1"?b.fillRect(S,v,u.width,u.height):x[_]&&b.fillRect(S,v,u.width,u.height*x[_])}}},{key:"drawCanvasText",value:function(u,d){var b=this.canvas.getContext("2d"),x=u.fontOptions+" "+u.fontSize+"px "+u.font;if(u.displayValue){var v,_;u.textPosition=="top"?_=u.marginTop+u.fontSize-u.textMargin:_=u.height+u.textMargin+u.marginTop+u.fontSize,b.font=x,u.textAlign=="left"||d.barcodePadding>0?(v=0,b.textAlign="left"):u.textAlign=="right"?(v=d.width-1,b.textAlign="right"):(v=d.width/2,b.textAlign="center"),b.fillText(d.text,v,_)}}},{key:"moveCanvasDrawing",value:function(u){var d=this.canvas.getContext("2d");d.translate(u.width,0)}},{key:"restoreCanvas",value:function(){var u=this.canvas.getContext("2d");u.restore()}}]),p})();return Vc.default=m,Vc}var Yc={},L1;function NN(){if(L1)return Yc;L1=1,Object.defineProperty(Yc,"__esModule",{value:!0});var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),e=qu(),s=o(e),i=Lv();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}var m="http://www.w3.org/2000/svg",p=(function(){function g(u,d,b){c(this,g),this.svg=u,this.encodings=d,this.options=b,this.document=b.xmlDocument||document}return n(g,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var x=this.encodings[b],v=(0,s.default)(this.options,x.options),_=this.createGroup(d,v.marginTop,this.svg);this.setGroupOptions(_,v),this.drawSvgBarcode(_,v,x),this.drawSVGText(_,v,x),d+=x.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),x=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(x,b),this.options.background&&this.drawRect(0,0,x,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,b,x){var v=x.data,_;b.textPosition=="top"?_=b.fontSize+b.textMargin:_=0;for(var S=0,C=0,P=0;P<v.length;P++)C=P*b.width+x.barcodePadding,v[P]==="1"?S++:S>0&&(this.drawRect(C-b.width*S,_,b.width*S,b.height,d),S=0);S>0&&this.drawRect(C-b.width*(S-1),_,b.width*S,b.height,d)}},{key:"drawSVGText",value:function(d,b,x){var v=this.document.createElementNS(m,"text");if(b.displayValue){var _,S;v.setAttribute("font-family",b.font),v.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||x.barcodePadding>0?(_=0,v.setAttribute("text-anchor","start")):b.textAlign=="right"?(_=x.width-1,v.setAttribute("text-anchor","end")):(_=x.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",_),v.setAttribute("y",S),v.appendChild(this.document.createTextNode(x.text)),d.appendChild(v)}}},{key:"setSvgAttributes",value:function(d,b){var x=this.svg;x.setAttribute("width",d+"px"),x.setAttribute("height",b+"px"),x.setAttribute("x","0px"),x.setAttribute("y","0px"),x.setAttribute("viewBox","0 0 "+d+" "+b),x.setAttribute("xmlns",m),x.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,b,x){var v=this.document.createElementNS(m,"g");return v.setAttribute("transform","translate("+d+", "+b+")"),x.appendChild(v),v}},{key:"setGroupOptions",value:function(d,b){d.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(d,b,x,v,_){var S=this.document.createElementNS(m,"rect");return S.setAttribute("x",d),S.setAttribute("y",b),S.setAttribute("width",x),S.setAttribute("height",v),_.appendChild(S),S}}]),g})();return Yc.default=p,Yc}var Kc={},q1;function TN(){if(q1)return Kc;q1=1,Object.defineProperty(Kc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var m=0;m<c.length;m++){var p=c[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,m){return c&&i(o.prototype,c),m&&i(o,m),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,m){e(this,i),this.object=o,this.encodings=c,this.options=m}return n(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Kc.default=s,Kc}var P1;function CN(){if(P1)return Gc;P1=1,Object.defineProperty(Gc,"__esModule",{value:!0});var n=kN(),e=m(n),s=NN(),i=m(s),o=TN(),c=m(o);function m(p){return p&&p.__esModule?p:{default:p}}return Gc.default={CanvasRenderer:e.default,SVGRenderer:i.default,ObjectRenderer:c.default},Gc}var Yi={},B1;function qv(){if(B1)return Yi;B1=1,Object.defineProperty(Yi,"__esModule",{value:!0});function n(m,p){if(!(m instanceof p))throw new TypeError("Cannot call a class as a function")}function e(m,p){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:m}function s(m,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);m.prototype=Object.create(p&&p.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(m,p):m.__proto__=p)}var i=(function(m){s(p,m);function p(g,u){n(this,p);var d=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return d.name="InvalidInputException",d.symbology=g,d.input=u,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return p})(Error),o=(function(m){s(p,m);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return p})(Error),c=(function(m){s(p,m);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return p})(Error);return Yi.InvalidInputException=i,Yi.InvalidElementException=o,Yi.NoElementException=c,Yi}var U1;function MN(){if(U1)return Ic;U1=1,Object.defineProperty(Ic,"__esModule",{value:!0});var n=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},e=jN(),s=m(e),i=CN(),o=m(i),c=qv();function m(d){return d&&d.__esModule?d:{default:d}}function p(d){if(typeof d=="string")return g(d);if(Array.isArray(d)){for(var b=[],x=0;x<d.length;x++)b.push(p(d[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return u(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,s.default)(d),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,s.default)(d),renderer:o.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:o.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":n(d))==="object"&&!d.nodeName)return{element:d,renderer:o.default.ObjectRenderer};throw new c.InvalidElementException}}function g(d){var b=document.querySelectorAll(d);if(b.length!==0){for(var x=[],v=0;v<b.length;v++)x.push(p(b[v]));return x}}function u(d){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(d),renderer:o.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",b.toDataURL())}}}return Ic.default=p,Ic}var Jc={},z1;function RN(){if(z1)return Jc;z1=1,Object.defineProperty(Jc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var m=0;m<c.length;m++){var p=c[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,m){return c&&i(o.prototype,c),m&&i(o,m),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){e(this,i),this.api=o}return n(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(p){return this.handleCatch(p),this.api}}}]),i})();return Jc.default=s,Jc}var hd,I1;function DN(){if(I1)return hd;I1=1;var n=EN(),e=P(n),s=qu(),i=P(s),o=ON(),c=P(o),m=AN(),p=P(m),g=MN(),u=P(g),d=Rv(),b=P(d),x=RN(),v=P(x),_=qv(),S=Dv(),C=P(S);function P(I){return I&&I.__esModule?I:{default:I}}var q=function(){},ne=function(D,X,W){var he=new q;if(typeof D>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,u.default)(D),he._encodings=[],he._options=C.default,he._errorHandler=new v.default(he),typeof X<"u"&&(W=W||{},W.format||(W.format=ae()),he.options(W)[W.format](X,W).render()),he};ne.getModule=function(I){return e.default[I]};for(var te in e.default)e.default.hasOwnProperty(te)&&M(e.default,te);function M(I,D){q.prototype[D]=q.prototype[D.toUpperCase()]=q.prototype[D.toLowerCase()]=function(X,W){var he=this;return he._errorHandler.wrapBarcodeCall(function(){W.text=typeof W.text>"u"?void 0:""+W.text;var we=(0,i.default)(he._options,W);we=(0,b.default)(we);var Oe=I[D],F=U(X,Oe,we);return he._encodings.push(F),he})}}function U(I,D,X){I=""+I;var W=new D(I,X);if(!W.valid())throw new _.InvalidInputException(W.constructor.name,I);var he=W.encode();he=(0,c.default)(he);for(var we=0;we<he.length;we++)he[we].options=(0,i.default)(X,he[we].options);return he}function ae(){return e.default.CODE128?"CODE128":Object.keys(e.default)[0]}q.prototype.options=function(I){return this._options=(0,i.default)(this._options,I),this},q.prototype.blank=function(I){var D=new Array(I+1).join("0");return this._encodings.push({data:D}),this},q.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var I;for(var D in this._renderProperties){I=this._renderProperties[D];var X=(0,i.default)(this._options,I.options);X.format=="auto"&&(X.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var W=X.value,he=e.default[X.format.toUpperCase()],we=U(W,he,X);z(I,we,X)})}}},q.prototype.render=function(){if(!this._renderProperties)throw new _.NoElementException;if(Array.isArray(this._renderProperties))for(var I=0;I<this._renderProperties.length;I++)z(this._renderProperties[I],this._encodings,this._options);else z(this._renderProperties,this._encodings,this._options);return this},q.prototype._defaults=C.default;function z(I,D,X){D=(0,c.default)(D);for(var W=0;W<D.length;W++)D[W].options=(0,i.default)(X,D[W].options),(0,p.default)(D[W].options);(0,p.default)(X);var he=I.renderer,we=new he(I.element,D,X);we.render(),I.afterRender&&I.afterRender()}return typeof window<"u"&&(window.JsBarcode=ne),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(I,D){var X=[];return jQuery(this).each(function(){X.push(this)}),ne(X,I,D)}),hd=ne,hd}var LN=DN();const qN=uS(LN),PN={[je.EXECUTED]:"Executed",[je.MATCHED_LIST]:"Matched list",[je.CONFIRM_REQUIRED]:"Awaiting confirmation",[je.NO_MATCH_FALLBACK]:"No match",[je.UNCONFIGURED]:"Not configured",[je.INVALID_CODE]:"Invalid code",[je.FORBIDDEN]:"Not permitted",[je.CONFLICT]:"Conflict",[je.IDENTITY_PRIMED]:"Identity primed",[je.IDENTITY_UNKNOWN]:"Badge not recognized",[je.NOT_PRIMED]:"Badge required",[je.CHOICES]:"Choices presented",[je.NO_OPEN_CONTAINER]:"Container closing, scan again",[je.HELD]:"Holding",[je.REFUSED]:"Not placed",[je.SUBJECT_STALE]:"Scan it again"},BN={[je.EXECUTED]:"text-status-success",[je.MATCHED_LIST]:"text-status-success",[je.CONFIRM_REQUIRED]:"text-status-warning",[je.NO_MATCH_FALLBACK]:"text-text-secondary",[je.UNCONFIGURED]:"text-status-warning",[je.INVALID_CODE]:"text-status-error",[je.FORBIDDEN]:"text-status-error",[je.CONFLICT]:"text-status-warning",[je.IDENTITY_PRIMED]:"text-status-success",[je.IDENTITY_UNKNOWN]:"text-status-warning",[je.NOT_PRIMED]:"text-status-warning",[je.CHOICES]:"text-status-success",[je.NO_OPEN_CONTAINER]:"text-status-warning",[je.HELD]:"text-status-success",[je.REFUSED]:"text-status-error",[je.SUBJECT_STALE]:"text-status-warning"};function UN(n){return n.outcome===je.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${PN[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function zN(n){var e,s,i,o,c,m,p;return n.outcome===je.NO_MATCH_FALLBACK?((e=n.fallback)==null?void 0:e.markdown)??null:n.outcome===je.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===je.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:n.outcome===je.NO_OPEN_CONTAINER?((o=n.fallback)==null?void 0:o.markdown)??null:n.outcome===je.REFUSED?((c=n.refusal)==null?void 0:c.markdown)??n.error??null:n.outcome===je.HELD?((p=(m=n.subject)==null?void 0:m.expect)==null?void 0:p.prompt)??null:n.outcome===je.SUBJECT_STALE?n.error??null:null}function gs(n){return n.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 IN({content:n,compact:e,inherit:s}){const i=[],o=/^```(\w*)\n([\s\S]*?)^```$/gm;let c=0,m;for(;(m=o.exec(n))!==null;)m.index>c&&i.push({type:"text",text:n.slice(c,m.index)}),i.push({type:"code",lang:m[1],code:m[2].replace(/\n$/,"")}),c=m.index+m[0].length;c<n.length&&i.push({type:"text",text:n.slice(c)});const p=s?{text:"",heading:"",list:"",code:"text-[0.85em]",tone:""}:e?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs",tone:"text-text-secondary"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs",tone:"text-text-secondary"},g=[];for(const u of i){if(u.type==="code"){const d=u.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");g.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${p.code} font-mono text-text-secondary leading-relaxed">${d}</code></pre>`);continue}g.push(...$N(u.text,p))}return h.jsx("div",{className:s?void 0:"prose-sm",dangerouslySetInnerHTML:{__html:g.join(`
55
+ `)}})}function $N(n,e){const s=n.split(`
56
+ `),i=[];let o=!1,c=!1,m=[];for(const p of s){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const u=g.slice(1,-1).split("|").map(d=>d.trim());if(u.every(d=>/^[-:]+$/.test(d)))continue;c||(c=!0,m=[]),m.push(u);continue}if(c){c=!1;const[u,...d]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of u)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of d){i.push("<tr>");for(const x of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(x)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),m=[]}if(!g){o&&(i.push("</ul>"),o=!1);continue}if(g.startsWith("### ")){o&&(i.push("</ul>"),o=!1),i.push(`<h4 class="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){o&&(i.push("</ul>"),o=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){o||(i.push('<ul class="space-y-1 my-1">'),o=!0),i.push(`<li class="${e.list} ${e.tone} flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${gs(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${e.text} ${e.tone} my-1">${gs(g)}</p>`)}if(c&&m.length){const[p,...g]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of p)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(u)}</th>`);i.push("</tr></thead><tbody>");for(const u of g){i.push("<tr>");for(const d of u)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(d)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function Hm({result:n,compact:e=!1}){const{response:s}=n,i=e?"text-xs":"text-sm",o=s?zN(s):null,c=s!=null&&s.error&&s.error!==o?s.error:null;return h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:`${i} font-mono text-text-secondary truncate`,children:n.code}),s?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`${i} font-medium ${BN[s.outcome]}`,children:UN(s)}),c&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c}),o&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(IN,{content:o,compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function Pv(n){return n.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 HN(n){const e=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&e.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...e]}function FN({value:n}){const e=E.useRef(null),[s,i]=E.useState(!1);return E.useEffect(()=>{if(!(!e.current||!n))try{qN(e.current,n,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[n]),n?h.jsxs("div",{children:[h.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?h.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",h.jsx("span",{className:"font-mono",children:HN(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:e,className:"max-w-full"})})]}):null}function GN({onClose:n}){const{submitCode:e,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:m,diagnosticsOn:p,setDiagnosticsOn:g}=$m(),[u,d]=E.useState(""),[b,x]=E.useState(!1),v=_=>{_.preventDefault();const S=u.trim();S&&(d(""),e(S))};return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[h.jsx(Mo,{className:"w-4 h-4"}),"Scan"]}),h.jsx("button",{type:"button",onClick:n,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:h.jsx(Zt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[h.jsxs("form",{onSubmit:v,className:"space-y-2",children:[h.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:u,onChange:_=>d(Pv(_.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}),h.jsx("button",{type:"submit",disabled:i||!u.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),h.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."})]}),h.jsx(FN,{value:u.trim()}),s&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),h.jsx(Hm,{result:s})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{type:"button",onClick:()=>x(_=>!_),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block text-sm text-text-primary",children:[h.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"}),h.jsx("input",{type:"number",min:100,max:2e3,step:50,value:o.maxKeyGapMs,onChange:_=>c({maxKeyGapMs:Number(_.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),h.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[h.jsx("input",{type:"checkbox",checked:p,onChange:_=>g(_.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&h.jsxs("div",{className:"border border-surface-border rounded",children:[h.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"}),h.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[m.length===0&&h.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),m.map(_=>h.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${_.buffer}`,children:[h.jsxs("span",{className:"text-text-tertiary",children:[String(_.deltaMs).padStart(4),"ms "]}),h.jsx("span",{className:"text",children:JSON.stringify(_.key)}),_.code&&h.jsxs("span",{className:"text-text-tertiary",children:[" (",_.code,")"]}),h.jsxs("span",{className:"text-text-tertiary",children:[" — ",_.note]})]},_.seq))]}),h.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"," ",h.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",h.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'," ",h.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Bv=/^\{lt:([A-Za-z0-9_]+)\}$/,$1="me";function CM(n){return`{lt:${n}}`}const Uv="lt:station:link-vars:";function em(n){return`${Uv}${n}`}const tm=new Set;function VN(){for(const n of tm)n()}let wu,Qc={};function zv(n){let e=null;try{e=localStorage.getItem(em(n))}catch{e=null}if(e===wu)return Qc;wu=e;try{const s=e?JSON.parse(e):{};Qc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Qc={}}return Qc}function YN(n,e,s){const i={...zv(n)};s===null||s===""?delete i[e]:i[e]=s;try{Object.keys(i).length===0?localStorage.removeItem(em(n)):localStorage.setItem(em(n),JSON.stringify(i))}catch{}wu=void 0,VN()}function KN(n){tm.add(n);const e=s=>{(s.key===null||s.key.startsWith(Uv))&&(wu=void 0,n())};try{window.addEventListener("storage",e)}catch{}return()=>{tm.delete(n);try{window.removeEventListener("storage",e)}catch{}}}const JN={};function QN(n){return E.useSyncExternalStore(KN,()=>n?zv(n):JN)}function XN(n,e,s,i={}){let o;try{o=new URL(n,"http://local")}catch{return n}const c=o.searchParams.get("facets");if(!c)return n;let m;try{const g=JSON.parse(c);if(!g||typeof g!="object"||Array.isArray(g))return n;m=g}catch{return n}let p=!1;for(const[g,u]of Object.entries(m)){if(typeof u!="string")continue;const d=Bv.exec(u);if(!d)continue;const b=i[d[1]]??e[d[1]]??s[d[1]];typeof b=="string"&&b!==""?m[g]=b:delete m[g],p=!0}return p?(Object.keys(m).length===0?o.searchParams.delete("facets"):o.searchParams.set("facets",JSON.stringify(m)),o.pathname+o.search):n}function MM(n){let e;try{e=new URL(n,"http://local")}catch{return[]}const s=e.searchParams.get("facets");if(!s)return[];try{const i=JSON.parse(s);if(!i||typeof i!="object"||Array.isArray(i))return[];const o=[];for(const c of Object.values(i)){if(typeof c!="string")continue;const m=Bv.exec(c);m&&!o.includes(m[1])&&o.push(m[1])}return o}catch{return[]}}function Fm(){var v;const{user:n,isSuperAdmin:e,hasRoleType:s}=qt(),i=(n==null?void 0:n.userId)??null,o=e||s("admin"),c=E.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(_=>_.role)),[n]),{data:m}=Mu({enabled:o||c.size>0}),p=QN(i),g=((v=xA())==null?void 0:v.actorId)??i,u=E.useMemo(()=>{var C;const _=[],S=new Set;for(const P of(m==null?void 0:m.roles)??[]){if(!o&&!c.has(P.role))continue;const q=(C=P.properties)==null?void 0:C.link_variables;if(Array.isArray(q))for(const ne of q){const te=ne==null?void 0:ne.name;if(typeof te!="string"||te===""||te===$1||S.has(te))continue;S.add(te);const M=ne.label,U=ne.default;_.push({name:te,...typeof M=="string"&&M!==""?{label:M}:{},...typeof U=="string"&&U!==""?{default:U}:{},fromRole:P.role})}}return _},[m,c,o]),d=E.useMemo(()=>{const _={};for(const S of u)S.default!==void 0&&(_[S.name]=S.default);return _},[u]),b=E.useCallback(_=>XN(_,p,d,g?{[$1]:g}:{}),[p,d,g]),x=E.useCallback((_,S)=>{i&&YN(i,_,S)},[i]);return{declarations:u,values:p,defaults:d,resolveUrl:b,setValue:x}}function WN({open:n,onClose:e,title:s,children:i,maxWidth:o,closeOnBackdrop:c=!0}){return E.useEffect(()=>{if(!n)return;const m=p=>{p.key==="Escape"&&e()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n,e]),n?sm.createPortal(h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-text-primary/30",onClick:c?e:void 0}),h.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"lt-modal-title",className:`relative bg-surface-raised border border-surface-border rounded-lg shadow-xl w-full ${o??"max-w-md"} mx-4 max-h-[85vh] flex flex-col`,children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b shrink-0",children:[h.jsx("h2",{id:"lt-modal-title",className:"text-sm font-medium text-text-primary",children:s}),h.jsx("button",{onClick:e,"aria-label":"Close dialog",className:"text-text-tertiary hover:text-text-primary text-lg leading-none",children:"×"})]}),h.jsx("div",{className:"px-6 py-5 overflow-y-auto",children:i})]})]}),document.body):null}function ZN({open:n,onClose:e}){const{declarations:s,values:i,setValue:o}=Fm();return h.jsxs(WN,{open:n,onClose:e,title:"Link Variables",maxWidth:"max-w-lg",children:[h.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed mb-4",children:"Values bound on this device. Pinned links and the Pace Board open scoped to the value applied; an unbound variable falls back to the role's default, or applies no filter at all."}),h.jsx("div",{className:"divide-y divide-surface-border",children:s.map((c,m)=>h.jsx(eT,{declaration:c,value:i[c.name]??"",autoFocus:m===0,onChange:p=>o(c.name,p),onClear:()=>o(c.name,null),onEnter:e},c.name))}),s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary",children:"Your roles declare no link variables."}),s.length>0&&h.jsx("div",{className:"flex justify-end pt-4",children:h.jsx("button",{onClick:e,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function eT({declaration:n,value:e,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const m=E.useId(),{data:p}=rk(n.name),g=(p==null?void 0:p.values)??[];return h.jsxs("div",{className:"py-3 flex items-center gap-3","data-testid":"link-var-row",children:[h.jsxs("div",{className:"w-40 shrink-0 min-w-0",children:[h.jsx("p",{className:"text-xs font-mono text-text-primary truncate",title:n.name,children:n.name}),h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:`declared by ${n.fromRole}`,children:n.label??n.fromRole})]}),h.jsx("input",{type:"text",list:m,autoFocus:s,value:e,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&c()},placeholder:n.default?`${n.default} (default)`:"no filter","aria-label":`Value for ${n.name}`,className:"input text-xs font-mono flex-1 min-w-0"}),h.jsx("datalist",{id:m,children:g.map(u=>h.jsx("option",{value:u},u))}),h.jsx("button",{onClick:o,disabled:e==="",title:`Clear ${n.name}`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0",children:"×"})]})}const H1=["escalationId","workflowId"],tT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Iv="lt:search:mode",nT="lt:search:facet",Lt={FACET:"facet",COMMAND:"command"};function rT(n,e){return{version:n.version,category:e.category,name:e.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length}}function Co(n){return n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function sT(n,e){if(n.encoding==="delimited")return iT(n,e)?{code:e}:{code:`${Co(n)}${e}`};if(!/^[0-9]+$/.test(e))return{error:`${n.name} takes digits only`};const s=n.targetLength;return s&&e.length!==s&&e.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${Co(n)}${e}`}}function iT(n,e){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(e)}function aT(n,e){return n==="escalationId"||n==="workflowId"?null:Yk(n,e)}function oT(n){return n.kind===Lt.FACET?n.facet:n.command.name}function lT(n){return n.kind===Lt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function cT(n){return n.kind===Lt.FACET?{kind:Lt.FACET,facet:n.facet}:{kind:Lt.COMMAND,version:n.command.version,category:n.command.category}}function uT(n,e,s){if((n==null?void 0:n.kind)===Lt.FACET&&e.includes(n.facet))return{kind:Lt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===Lt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:Lt.COMMAND,command:i}}return e.length>0?{kind:Lt.FACET,facet:e[0]}:s.length>0?{kind:Lt.COMMAND,command:s[0]}:null}function fT(){try{const n=localStorage.getItem(Iv);if(n){const s=JSON.parse(n);if(s.kind===Lt.FACET&&typeof s.facet=="string"||s.kind===Lt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const e=localStorage.getItem(nT);return e?{kind:Lt.FACET,facet:e}:null}catch{return null}}function hT(n){try{localStorage.setItem(Iv,JSON.stringify(n))}catch{}}const F1=5*6e4,dT=n=>({rules:n.map(e=>{var s;return((s=e.data)==null?void 0:s.rules)??null}),loading:n.some(e=>e.isLoading)});function mT(n){const e=jv({enabled:n,staleTime:F1}),s=E.useMemo(()=>{var m;return(((m=e.data)==null?void 0:m.schemes)??[]).filter(p=>p.enabled&&p.kind===zk.ACTION).sort((p,g)=>p.version-g.version)},[e.data]),{rules:i,loading:o}=fS({queries:s.map(m=>({queryKey:["scan-schemes",m.version,"actions"],queryFn:()=>ue(`/scan-codes/schemes/${m.version}/actions`),enabled:n,staleTime:F1})),combine:dT});return{commands:E.useMemo(()=>s.flatMap((m,p)=>(i[p]??[]).filter(g=>g.enabled).sort((g,u)=>g.category.localeCompare(u.category)).map(g=>rT(m,g))),[s,i]),loading:e.isLoading||o}}const pT={escalationId:"opens the item",workflowId:"opens the run"};function yT({mode:n,facets:e,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,m]=E.useState(!1),p=E.useRef(null);E.useEffect(()=>{if(!c)return;const x=_=>{p.current&&!p.current.contains(_.target)&&m(!1)},v=_=>{_.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v)}},[c]);const g=n.kind===Lt.COMMAND,u=g?`${n.command.schemeName} · ${n.command.name} — ${Co(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,d=gT(s),b=x=>{i(x),m(!1)};return h.jsxs("div",{ref:p,className:"relative h-full shrink-0",children:[h.jsxs("button",{type:"button",onClick:()=>m(x=>!x),"aria-expanded":c,"aria-haspopup":"listbox","aria-label":"Search or run as",title:u,className:"group flex items-center gap-1 h-full pl-2.5 pr-2 border-l border-surface-field-border hover:bg-surface-hover transition-colors rounded-r-[var(--lt-radius-field)]","data-testid":"search-mode",children:[h.jsx("span",{className:`text-2xs whitespace-nowrap truncate max-w-[9rem] ${g?"font-medium text-accent":"font-mono text-text-tertiary"}`,children:oT(n)}),h.jsx(im,{className:`w-3 h-3 shrink-0 text-text-quaternary group-hover:text-accent transition-transform ${c?"rotate-180":""}`,strokeWidth:1.5})]}),c&&h.jsxs("div",{role:"listbox","aria-label":"Search or run as",className:"absolute z-50 top-full right-0 mt-1.5 min-w-[17rem] max-w-[24rem] max-h-[70vh] overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[e.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(G1,{children:"Find"}),e.map(x=>h.jsx(V1,{label:x,mono:!0,note:pT[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:Lt.FACET,facet:x})},x))]}),d.map(({schemeName:x,targetFacet:v,items:_})=>h.jsxs("div",{children:[h.jsxs(G1,{note:v,children:["Run · ",x]}),_.map(S=>h.jsx(V1,{label:S.name,note:Co(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:Lt.COMMAND,command:S})},`${S.version}:${S.category}`))]},x)),o&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/60 my-1"}),h.jsxs("button",{type:"button",onClick:()=>{m(!1),o()},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-accent hover:bg-surface-hover","data-testid":"search-mode-scan-panel",children:[h.jsx(Mo,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function gT(n){const e=[];for(const s of n){const i=e.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):e.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return e}function G1({children:n,note:e}){return h.jsxs("p",{className:"px-3 pt-2 pb-1 flex items-baseline gap-2 text-2xs font-semibold uppercase tracking-widest text-text-quaternary first:pt-1",children:[h.jsx("span",{className:"truncate",children:n}),e&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:e})]})}function V1({label:n,note:e,active:s,mono:i,noteMono:o,onClick:c}){return h.jsxs("button",{type:"button",role:"option","aria-selected":s,onClick:c,className:`w-full text-left pl-3 pr-3 py-1.5 flex items-baseline gap-3 border-l-2 transition-colors ${s?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[h.jsx("span",{className:`text-xs font-medium truncate ${i?"font-mono":""}`,children:n}),h.jsx("span",{className:`ml-auto text-2xs shrink-0 ${o?"font-mono tabular-nums":""} ${s?"text-accent/70":"text-text-quaternary"}`,children:e})]})}const bT=6e3;function xT({onOpenScanPanel:n}){const e=ni(),{data:s}=er(),i=zm(),{submitCode:o,busy:c,lastResult:m}=$m(),{commands:p}=mT(i),[g,u]=E.useState(""),[d,b]=E.useState(!1),[x,v]=E.useState(null),[_,S]=E.useState(null),[C,P]=E.useState(""),[q,ne]=E.useState(null),[te,M]=E.useState(fT),U=E.useRef(null),ae=E.useMemo(()=>{var le;if(!((le=s==null?void 0:s.search)!=null&&le.enabled))return[];const J=(s.search.facets??[]).filter(pe=>!H1.includes(pe));return[...H1,...J]},[s]),z=E.useMemo(()=>uT(te,ae,p),[te,ae,p]),I=(m==null?void 0:m.source)===To.TOOLBAR&&!m.navigated&&q!==m.at?m:null;E.useEffect(()=>{if(!I)return;const J=setTimeout(()=>ne(I.at),bT);return()=>clearTimeout(J)},[I]);const D=()=>{v(null),S(null),m&&ne(m.at)},X=J=>{var pe;const le=cT(J);M(le),hT(le),D(),(pe=U.current)==null||pe.focus()},W=(J,le)=>{const pe=sT(J.command,Pv(le));if("error"in pe){v(pe.error);return}u(""),o(pe.code,To.TOOLBAR)},he=async(J,le)=>{const pe=aT(J,le);if(pe){u(""),e(pe);return}if(J==="escalationId"&&!tT.test(le)){v("That is not a valid escalation id");return}b(!0);try{if(J==="escalationId")await ue(`/escalations/${encodeURIComponent(le)}`),u(""),e(`/escalations/detail/${encodeURIComponent(le)}`);else{const ye=await ue(`/escalations/by-workflow/${encodeURIComponent(le)}`),Ce=(ye==null?void 0:ye.escalations)??[];Ce.length===1?(u(""),e(`/escalations/detail/${Ce[0].id}`)):(P(le),S(Ce))}}catch{v(`No ${J==="escalationId"?"escalation":"workflow"} found for "${le}"`)}finally{b(!1)}},we=()=>{const J=g.trim();!J||d||c||!z||(D(),z.kind===Lt.COMMAND?W(z,J):he(z.facet,J))};if(!z)return null;const Oe=z.kind===Lt.COMMAND,F=d||c;return h.jsxs("div",{className:"relative w-full max-w-[28rem]","data-testid":"global-search",children:[h.jsxs("div",{className:"flex items-center h-8 bg-surface-field border border-surface-field-border rounded-[var(--lt-radius-field)] focus-within:border-accent focus-within:bg-surface-field-focus transition-colors",children:[h.jsxs("label",{htmlFor:"global-search-input",className:"flex items-center gap-1.5 pl-2.5 shrink-0 cursor-text",children:[Oe?h.jsx(Mo,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(vS,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),Oe&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:Co(z.command)})]}),h.jsx("input",{ref:U,id:"global-search-input",type:"text",value:g,onChange:J=>{u(J.target.value),D()},onKeyDown:J=>{J.key==="Enter"&&we(),J.key==="Escape"&&(u(""),D())},placeholder:lT(z),"aria-label":Oe?"Run target":"Global search",autoComplete:"off",spellCheck:!1,className:`flex-1 min-w-0 h-full bg-transparent text-xs text-text-primary placeholder:text-text-quaternary focus:outline-none ${Oe?"pl-0.5 pr-2 font-mono":"px-2"}`}),F&&h.jsx("span",{className:"w-1.5 h-1.5 mr-2 rounded-full bg-accent animate-pulse shrink-0","aria-label":"Working"}),h.jsx(yT,{mode:z,facets:ae,commands:p,onSelect:X,onOpenScanPanel:n})]}),x&&h.jsx("p",{className:"absolute top-full left-0 mt-1 text-2xs text-status-error whitespace-nowrap",role:"alert",children:x}),I&&h.jsx("div",{role:"status",className:"absolute top-full left-0 mt-1.5 z-50 w-full max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg px-3 py-2 animate-fade-in","data-testid":"search-run-outcome",children:h.jsx(Hm,{result:I,compact:!0})}),_!==null&&h.jsxs("div",{className:"absolute top-full left-0 mt-1.5 z-50 min-w-72 max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1","data-testid":"search-workflow-results",children:[_.map(J=>h.jsxs(ar,{to:`/escalations/detail/${J.id}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-hover truncate",children:[h.jsx("span",{className:"font-medium text-text-primary",children:J.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),J.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:J.type})]},J.id)),_.length===0&&h.jsx("p",{className:"px-3 py-1.5 text-2xs text-text-tertiary",children:"No escalations for this workflow."}),h.jsx("hr",{className:"border-surface-border/60 my-0.5"}),h.jsx(ar,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function vT(){const{identity:n,remainingSeconds:e}=Cu(),[,s]=E.useState(0);return E.useEffect(()=>{if(!(n!=null&&n.expiresAt))return;const i=setInterval(()=>s(o=>o+1),1e3);return()=>clearInterval(i)},[n]),e()}function _T(n){return n>=60?`${Math.floor(n/60)} min`:`${n} s`}function wT(){const{identity:n}=Cu(),e=vT();return n?h.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-text-secondary whitespace-nowrap min-w-0",title:`Scans act as ${n.displayName}`,"data-testid":"badge-grant-indicator",children:[h.jsx(_S,{className:"w-4 h-4 text-status-success shrink-0",strokeWidth:1.5}),h.jsx("span",{className:"hidden sm:inline",children:"Badged:"}),h.jsx("span",{className:"font-medium text-text-primary truncate max-w-[10rem]",children:n.displayName}),n.expiresAt&&h.jsxs("span",{className:"tabular-nums text-text-tertiary","data-testid":"badge-grant-remaining",children:["· ",_T(e)]})]}):null}function ST(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function nm(n){var e;return((e=n.title)==null?void 0:e.trim())||ST(n.role)}const $v="lt:bookmarks",Xc="scan";function ET(){try{const n=localStorage.getItem($v);if(!n)return[];const e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function Y1(n){try{localStorage.setItem($v,JSON.stringify(n))}catch{}}function OT({onToggleEventFeed:n,onToggleDocs:e,onToggleNav:s}){var Ue,Xe,cn,Mt;const i=ni(),{user:o,logout:c,isSuperAdmin:m,hasRoleType:p}=qt(),{viewAs:g,realIsBuilder:u}=tv(),{available:d,mine:b}=uk();nv();const{connected:x}=qx(),{data:v}=er(),{role:_,targets:S,selectable:C,selectRole:P}=Cm(),{declarations:q,values:ne}=Fm(),[te,M]=E.useState(!1),{data:U}=Mu(),ae=E.useMemo(()=>{const be=(U==null?void 0:U.roles)??[],it=new Set(((o==null?void 0:o.roles)??[]).map(Ot=>Ot.role)),yt=m||p("admin");return be.filter(Ot=>ea(Ot).length>0&&(yt||it.has(Ot.role))).map(Ot=>({role:Ot.role,title:nm(Ot),portals:ea(Ot)}))},[U,o,m,p]),{setPanel:z,closePanel:I,open:D,ownerKey:X}=Lm(),W=zm(),he=en(),we=()=>{D&&X===Xc?I(Xc):z(h.jsx(GN,{onClose:()=>I(Xc)}),{width:360,key:Xc})},[Oe,F]=E.useState(!1),[J,le]=E.useState(!1),[pe,ye]=E.useState(Sv),[Ce,Ne]=E.useState(ET),Me=E.useRef(null),We=(Ue=v==null?void 0:v.branding)==null?void 0:Ue.appName,pt=(Xe=v==null?void 0:v.branding)==null?void 0:Xe.themes,Ct=E.useMemo(()=>(Ak(pt??[]),jk()),[pt]),Se=be=>{kk(be),ye(be)},Re=()=>{const be=window.prompt("Bookmark label:");if(!(be!=null&&be.trim()))return;const it=he.pathname+he.search,yt=[...Ce,{label:be.trim(),url:it}].sort((Ot,Ur)=>Ot.label.localeCompare(Ur.label));Ne(yt),Y1(yt),F(!1)},ce=be=>{const it=Ce.filter(yt=>!(yt.label===be.label&&yt.url===be.url));Ne(it),Y1(it)};return E.useEffect(()=>{if(!Oe)return;const be=it=>{Me.current&&!Me.current.contains(it.target)&&F(!1)};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[Oe]),h.jsxs(h.Fragment,{children:[h.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 ${Oe?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(wS,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(ar,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:be=>{(be.ctrlKey||be.metaKey)&&(be.preventDefault(),le(!0))},children:h.jsx(Ru,{appName:We,className:"flex"})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(cx,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(gd,{className:"w-5 h-5",strokeWidth:2})})]}),(((cn=v==null?void 0:v.search)==null?void 0:cn.enabled)||W)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(xT,{onOpenScanPanel:W?we:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsx(wT,{}),h.jsxs(ar,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${d>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(bd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),d>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:d})]}),h.jsxs(ar,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${b>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(bd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),b>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:b})]}),g&&h.jsx(h.Fragment,{children:h.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:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[g," View"]}),h.jsx("button",{onClick:Vd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Zt,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:Me,children:[h.jsxs("button",{onClick:()=>F(be=>!be),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(SS,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),g&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),Oe&&h.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:[h.jsx(ar,{to:"/credentials",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),((Mt=v==null?void 0:v.auth)==null?void 0:Mt.oauthServer)&&h.jsx(ar,{to:"/connected-apps",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Connected apps"}),W&&h.jsx("button",{onClick:()=>{F(!1),we()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-scan",children:"Scan a code"}),h.jsx("button",{onClick:()=>{F(!1),x?n==null||n():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:x?"Events":"Reconnect events"}),u&&h.jsx("button",{onClick:()=>{F(!1),e==null||e()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-docs",children:"Docs"}),g&&h.jsxs("button",{onClick:()=>{F(!1),Vd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",g," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Ct.map(be=>h.jsx("button",{type:"button",onClick:()=>Se(be.id),title:be.label,"aria-label":`${be.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${pe===be.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:be.swatch}},be.id))})]}),C&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("button",{type:"button",onClick:()=>{F(!1),P(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${_?"text-text-secondary":"text-accent"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${_?"bg-surface-border":"bg-accent"}`}),h.jsx("span",{className:"truncate",children:"Full dashboard"})]}),S.map(be=>{var Ot;const it=(Ot=U==null?void 0:U.roles)==null?void 0:Ot.find(Ur=>Ur.role===be),yt=be===_;return h.jsxs("button",{type:"button",onClick:()=>{F(!1),P(be),i(hv(be,ea(it)))},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${yt?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${yt?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:nm({role:be,title:it==null?void 0:it.title})})]},be)})]})]}),ae.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60","data-testid":"menu-portals",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Portals"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:ae.map(be=>h.jsxs("div",{children:[ae.length>1&&h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:be.role,children:be.title}),be.portals.map(it=>{const yt=Tm(be.role,it.key),Ot=he.pathname===yt;return h.jsxs("button",{type:"button",onClick:()=>{F(!1),i(yt)},className:`flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded hover:bg-surface-hover ${Ot?"text-accent":"text-text-secondary"}`,"data-testid":`menu-portal-${be.role}-${it.key}`,children:[h.jsx(xd,{className:"w-3.5 h-3.5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate",children:it.label})]},it.key)})]},be.role))})]}),q.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Link variables"}),h.jsxs("button",{type:"button",onClick:()=>{F(!1),M(!0)},className:"flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded text-text-secondary hover:bg-surface-hover","data-testid":"link-vars-menu-entry",children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Object.keys(ne).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(ne).length>0?Object.entries(ne).map(([be,it])=>`${be} = ${it}`).join(", "):"Set values for this device"})]})]}),h.jsx("button",{onClick:()=>{F(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[Ce.map(be=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(ar,{to:be.url,onClick:()=>F(!1),title:be.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:be.label}),h.jsx("button",{type:"button",onClick:()=>ce(be),title:`Remove "${be.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:h.jsx(Zt,{className:"w-3 h-3"})})]},`${be.label}::${be.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:Re,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(ES,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),J&&h.jsx(Ok,{onClose:()=>le(!1)}),h.jsx(ZN,{open:te,onClose:()=>M(!1)})]})}function Gm({open:n,children:e}){const[s,i]=E.useState(n);return E.useEffect(()=>{n&&i(!0)},[n]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${n?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{n||i(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?e:null})})}function rm(n){return({isActive:e})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return n?`${s} justify-center w-10 h-10 mx-auto ${e?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${e?i:o}`}}function AT(){return({isActive:n})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${n?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function jT({group:n,collapsed:e}){const{pathname:s}=en(),i=n.matchPaths.some(p=>s.startsWith(p)),[o,c]=E.useState(i),m=o||i;return e?h.jsx(h.Fragment,{children:n.items.map(p=>h.jsx(Es,{to:p.to,className:rm(!0),title:p.label,children:p.icon&&h.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(p=>!p),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:[h.jsxs("span",{className:"flex items-center gap-3",children:[n.icon&&h.jsx(n.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:n.label})]}),h.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:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(Gm,{open:m,children:n.items.map(p=>h.jsxs(Es,{to:p.to,end:p.end,className:AT(),children:[p.icon&&h.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:p.label})]},p.to))})]})}function kT(n){return n.kind==="group"}function NT({entry:n,collapsed:e}){const{pathname:s,search:i}=en(),o=n.to.includes("?"),c=n.icon&&h.jsx(n.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${n.iconClassName??""}`,strokeWidth:1.5,...n.solid?{fill:"currentColor"}:{}});if(o){const[m,p]=n.to.split("?"),g=s===m&&i===`?${p}`,u=rm(e)({isActive:g});return h.jsxs(Es,{to:n.to,className:u,title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}return h.jsxs(Es,{to:n.to,end:n.end,className:rm(e),title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}function qr({heading:n,entries:e}){const{collapsed:s}=Rm();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:n}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:n}),e.map(i=>kT(i)?h.jsx(jT,{group:i,collapsed:s},i.label):h.jsx(NT,{entry:i,collapsed:s},i.to))]})}function TT({aiEnabled:n=!1,isBuilder:e=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1}){const c=[{to:"/pace",label:"Pace Board",icon:OS},{to:"/trends",label:"Trend Board",icon:AS}];if(!e&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(qr,{heading:"Monitor",entries:c}):null;if(!e)return h.jsx(qr,{heading:"Monitor",entries:o?c:[]});const m=[...o?c:[],{to:"/topics",label:"Event Topics",icon:ux},{to:"/agents",label:n?"Agents":"Automations",icon:jS},{to:"/capabilities",label:"Capabilities",icon:kS}];return h.jsx(qr,{heading:"Monitor",entries:m})}function CT(){return qe({queryKey:["me","preferences"],queryFn:()=>ue("/me/preferences"),staleTime:6e4})}function MT(){const n=Be();return Fe({mutationFn:e=>ue("/me/preferences",{method:"PATCH",body:JSON.stringify(e)}),onSuccess:e=>{n.setQueryData(["me","preferences"],e)}})}const xs={TABLE:"table",RICH:"rich",TIMELINE:"timeline"},K1={COMPACT:"compact",CARDS:"cards"},dd={AVAILABLE:"/escalations/available",ALL:"/escalations"},ta={AVAILABLE:"available",CLAIMED:"claimed",RESOLVED:"resolved",CANCELLED:"cancelled",EXPIRED:"expired"},RT={[ta.RESOLVED]:"resolved",[ta.CANCELLED]:"cancelled",[ta.EXPIRED]:"expired"};function DT(n){const e=n===ta.CLAIMED;return{available:n===ta.AVAILABLE,claimed:e,apiStatus:e?"pending":RT[n]}}function LT(n){return n===xs.TABLE||n===xs.RICH||n===xs.TIMELINE}function qT(n){return n===K1.COMPACT||n===K1.CARDS}function PT(n,e=""){const s=n.get("priority"),i=n.get("view"),o=n.get("layout");return{statusFilter:n.get("status")||e,role:n.get("role")||void 0,type:n.get("type")||void 0,subtype:n.get("subtype")||void 0,priority:s?parseInt(s,10):void 0,search:n.get("search")||void 0,facets:Vk(n),view:LT(i)?i:null,layout:qT(o)?o:null}}function BT(n){let e;try{e=new URL(n,"http://local")}catch{return null}if(e.pathname!==dd.AVAILABLE&&e.pathname!==dd.ALL)return null;const s=e.pathname===dd.AVAILABLE?ta.AVAILABLE:"";return PT(e.searchParams,s)}function RM(n){var e;return n.role||(((e=n.facets.roles)==null?void 0:e.length)===1?n.facets.roles[0]:null)}function DM(n,e){return n===xs.TIMELINE?xs.TIMELINE:e&&(!n||n===xs.RICH)?xs.RICH:xs.TABLE}function UT(n,e){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(p=>p.label)),c=[...s],m=new Set;for(const{role:p,pins:g}of e)for(const u of g)o.has(u.label)||i.has(u.label)||m.has(u.label)||(m.add(u.label),c.push({...u,id:`role:${p}:${u.label}`,fromRole:p}));return c}function zT(n){const e=BT(n);if(!e)return null;const{available:s,claimed:i,apiStatus:o}=DT(e.statusFilter);return{available:s,params:{...e.facets,role:e.role,type:e.type,subtype:e.subtype,priority:e.priority,status:o,...i?{claimed:!0}:{},search:e.search}}}function IT(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function $T(){var I;const{collapsed:n}=Rm(),{user:e}=qt(),s=CT(),i=MT(),o=E.useMemo(()=>new Set(((e==null?void 0:e.roles)??[]).map(D=>D.role)),[e]),{data:c}=Mu({enabled:o.size>0}),m=tn("SUMMARY");js(jm(),()=>{m([["escalations"]])});const p=(I=s.data)==null?void 0:I.preferences,g=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Array.isArray(D.default_pins)&&D.default_pins.length>0).map(D=>({role:D.role,pins:D.default_pins})),[c,o]),{resolveUrl:u}=Fm(),d=E.useMemo(()=>UT(p,g),[p,g]),b=E.useMemo(()=>new Map(d.map(D=>[D.id,D.url])),[d]),x=E.useMemo(()=>d.map(D=>({...D,url:u(D.url)})),[d,u]),v=E.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(D=>[D.role,nm(D)])),[c]),_=E.useMemo(()=>x.filter(D=>!D.fromRole),[x]),S=E.useMemo(()=>new Set(((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Kj(D)).map(D=>D.role)),[c,o]),C=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>S.has(D.role)||g.some(X=>X.role===D.role)).map(D=>({role:D.role,title:v.get(D.role)??D.role,portals:S.has(D.role)?ea(D):[],pins:x.filter(X=>X.fromRole===D.role)})).filter(D=>D.portals.length>0||D.pins.length>0),[c,g,S,v,x]),P=(p==null?void 0:p.pinnedViews)??[],q=E.useRef(null),ne=D=>i.mutate({pinnedViews:D}),te=D=>ne(P.filter(X=>X.id!==D)),M=D=>ne([...P,{id:IT(),label:D.label,url:b.get(D.id)??D.url,badge:D.badge}]),U=D=>i.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],D]}),ae=(D,X)=>{if(D===X)return;const W=[...P],[he]=W.splice(D,1);W.splice(X,0,he),ne(W)};if(x.length===0&&S.size===0)return null;const z="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return h.jsxs("div",{className:"space-y-1",children:[n&&h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!n&&_.length>0&&h.jsx("p",{className:z,children:"Pinned"}),_.map(D=>{const X=P.findIndex(W=>W.id===D.id);return h.jsx(J1,{pin:D,collapsed:n,draggable:X!==-1,onDragStart:()=>{q.current=X},onDropOn:()=>{q.current!==null&&X!==-1&&ae(q.current,X),q.current=null},onRemove:()=>te(D.id)},D.id)}),C.map(D=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:z,title:`${D.title} — pins from the ${D.role} role`,"data-testid":"pin-group-label",children:D.title}),D.portals.map(X=>h.jsx(HT,{role:D.role,portal:X,collapsed:n},X.key)),D.pins.map(X=>h.jsx(J1,{pin:X,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>M(X),onHide:()=>U(X.label)},X.id))]},D.role))]})}function HT({role:n,portal:e,collapsed:s}){const i=Tm(n,e.key),o="flex items-center rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",c=`portal-link-${n}-${e.key}`;return s?h.jsx(Es,{to:i,className:`${o} justify-center w-10 h-10 mx-auto`,title:e.label,"data-testid":c,children:h.jsx(xd,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs(Es,{to:i,title:e.label,className:({isActive:m})=>`${o} gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] ${m?"bg-surface-hover text-text-primary font-medium":""}`,"data-testid":c,children:[h.jsx(xd,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:e.label})]})}function J1({pin:n,collapsed:e,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:m,onHide:p}){const{pathname:g,search:u}=en(),[d,b=""]=n.url.split("?"),x=g===d&&u===(b?`?${b}`:""),v="group flex items-center rounded-md transition-colors duration-150",_=x?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return e?h.jsx(Es,{to:n.url,className:`${v} ${_} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(Mg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${v} ${_} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:o,children:[h.jsxs(Es,{to:n.url,title:n.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[h.jsx(Mg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...n.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:n.label}),n.badge&&h.jsx(FT,{url:n.url})]}),h.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&&h.jsx("button",{onClick:m,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(fx,{className:"w-3 h-3"})}),p&&h.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(NS,{className:"w-3 h-3"})}),c&&h.jsx("button",{onClick:c,title:`Remove "${n.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Zt,{className:"w-3 h-3"})})]})]})}function FT({url:n}){var m;const e=E.useMemo(()=>zT(n),[n]),s={limit:1,staleTime:15e3},i=yv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&e.available}),o=pv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&!e.available});if(!e)return null;const c=e.available?i:o;return c.isError||((m=c.data)==null?void 0:m.total)===void 0?null:h.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 GT(){var c;const{data:n}=er(),e=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=e===!0||e!==!1&&Wx(),i=[{to:"/workflows/registry",label:"Registry",icon:Rg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:vd},{to:"/workflows/executions",label:"Executions",icon:Dg}],o=s?[{kind:"group",label:"Procedural",icon:TS,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:am,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Rg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:vd},{to:"/mcp/executions",label:"Executions",icon:Dg}]}]:i;return h.jsx(qr,{heading:"Orchestrate",entries:o})}function LM(){return qe({queryKey:["activeWorkers"],queryFn:async()=>(await ue("/workflows/workers")).workers})}function qM(){return qe({queryKey:["discoveredWorkflows"],queryFn:async()=>(await ue("/workflows/discovered")).workflows})}function PM(){return qe({queryKey:["workflowConfigs"],queryFn:async()=>(await ue("/workflows/config")).workflows})}function Hv(){return qe({queryKey:["invocableWorkflows"],queryFn:async()=>(await ue("/workflows/invocable")).workflows})}function BM(n){return Object.fromEntries(n.filter(e=>!e.missing).map(e=>[e.as??e.key,e.data]))}function UM(n,e){return qe({queryKey:["workflows",n,"input-lookups"],queryFn:()=>ue(`/workflows/${encodeURIComponent(n)}/input-lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function zM(){return qe({queryKey:["cronStatus"],queryFn:async()=>(await ue("/workflows/cron/status")).schedules})}function IM(n){return qe({queryKey:["workflowExecution",n],queryFn:()=>ue(`/workflow-states/${n}/execution`),enabled:!!n})}function $M(n,e){const s=new URLSearchParams;return n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),n.entity&&s.set("entity",n.entity),n.search&&s.set("search",n.search),n.status&&s.set("status",n.status),n.sort_by&&s.set("sort_by",n.sort_by),n.order&&s.set("order",n.order),n.registered&&s.set("registered",n.registered),n.namespace&&s.set("namespace",n.namespace),qe({queryKey:["jobs",n],queryFn:()=>ue(`/workflow-states/jobs?${s}`),enabled:(e==null?void 0:e.enabled)??!0})}function HM(){const n=Be();return Fe({mutationFn:e=>ue(`/workflows/${e}/terminate`,{method:"POST"}),onSuccess:(e,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function FM(){const n=Be();return Fe({mutationFn:({workflow_type:e,...s})=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function GM(){const n=Be();return Fe({mutationFn:e=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function VM(){const n=Be();return Fe({mutationFn:({workflowType:e,data:s,metadata:i,execute_as:o})=>ue(`/workflows/${e}/invoke`,{method:"POST",body:JSON.stringify({data:s,metadata:i,...o?{execute_as:o}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function VT(){const{data:n}=Hv();return n!=null&&n.length?h.jsx(qr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:vd}]}):null}const YT=[{to:"/mcp/queries",label:"Designer",icon:CS},{to:"/mcp/servers",label:"Servers & Tools",icon:MS}];function KT(){return h.jsx(qr,{heading:"Design",entries:YT})}const JT=[{to:"/files",label:"Files",icon:RS},{to:"/knowledge",label:"Knowledge Base",icon:hx}];function QT(){return h.jsx(qr,{heading:"Storage",entries:JT})}function XT({isBuilder:n=!1,isOps:e=!1}){var m;const{data:s}=er(),i=((m=s==null?void 0:s.features)==null?void 0:m.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:DS},...n||e?[{to:"/admin/roles",label:"Roles",icon:bd},{to:"/admin/personas",label:"Personas",icon:LS},{to:"/admin/scan-codes",label:"Scan Codes",icon:Mo}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:qS},{to:"/admin/streams",label:"Messages",icon:hx},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:PS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(qr,{heading:"Identity & Access",entries:o}),n&&Zx()&&h.jsx(qr,{heading:"Infrastructure",entries:c})]})}function Fv({aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o}){return h.jsxs(h.Fragment,{children:[h.jsx(TT,{aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o}),h.jsx($T,{}),!e&&h.jsx(VT,{}),e&&h.jsx(GT,{}),e&&n&&h.jsx(KT,{}),e&&h.jsx(QT,{}),(e||s)&&h.jsx(XT,{isBuilder:e,isOps:s})]})}function WT({open:n,onClose:e,...s}){const i=en();return E.useEffect(()=>{e()},[i.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${n?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${n?"opacity-100":"opacity-0"}`,onClick:e,"aria-hidden":!0}),h.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 ${n?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:e,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Zt,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(ek,{children:h.jsx(Fv,{...s})})})]})]})}const Gv="lt_event_feed_patterns";function ZT(n,e){if(n.startsWith("/topics/")){const m=decodeURIComponent(n.replace("/topics/",""));if(m&&!m.includes("/"))return`lt.events.${m}`}const s=n.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(n.startsWith("/escalations")){const m=new URLSearchParams(e).get("role");return m?`lt.events.system.escalation.${rv(m)}.>`:"lt.events.system.escalation.>"}const i=n.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(n.startsWith("/workflows"))return"lt.events.system.workflow.>";const o=n.match(/^\/agents\/([^/]+)$/);if(o&&o[1]!=="new")return`lt.events.system.agent.${o[1]}.>`;if(n.startsWith("/agents"))return"lt.events.system.agent.>";if(n.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(n.startsWith("/files"))return"lt.events.system.file.>";if(n==="/")return"lt.events.system.>";const c=n.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(n.startsWith("/mcp"),"lt.events.system.>")}function eC(){try{const n=localStorage.getItem(Gv);return n?JSON.parse(n):[]}catch{return[]}}function md(n){try{localStorage.setItem(Gv,JSON.stringify(n))}catch{}}function tC(){const{pathname:n,search:e}=en(),[s,i]=E.useState(eC),o=E.useMemo(()=>ZT(n,e),[n,e]),c=E.useMemo(()=>{const u=new Set([o,...s]);return Array.from(u)},[o,s]),m=E.useCallback(u=>{const d=u.startsWith("lt.events.")?u:`lt.events.${u}`;i(b=>{if(b.includes(d))return b;const x=[...b,d];return md(x),x})},[]),p=E.useCallback(u=>{i(d=>{const b=d.filter(x=>x!==u);return md(b),b})},[]),g=E.useCallback(()=>{i([]),md([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:m,removePattern:p,clearUserPatterns:g}}function nC({children:n,className:e=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${e}`,children:n})}const pd=280,Q1="cubic-bezier(0.4, 0, 0.2, 1)",Wc=40;function rC(n){if(!n)return"scale(0.92)";const e=window.innerWidth,s=window.innerHeight,i=e-Wc*2,o=s-Wc*2,c=n.width/i,m=n.height/o,p=n.left+n.width/2-(Wc+i/2),g=n.top+n.height/2-(Wc+o/2);return`translate(${p}px, ${g}px) scale(${c}, ${m})`}function Vv({open:n,onClose:e,sourceRef:s,children:i}){const[o,c]=E.useState(null),m=E.useRef(null),p=E.useRef(!1);E.useEffect(()=>{var x,v;n&&!p.current?(m.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&p.current&&o==="open"&&(m.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),p.current=n},[n,s,o]),E.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),E.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),E.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&e()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,e]);const g=E.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(E.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),pd+50);return()=>clearTimeout(x)},[o]),!o)return null;const u=o==="entering"||o==="exiting",d=u?rC(m.current):"none",b=u?0:1;return sm.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${pd}ms ${Q1}, opacity ${pd}ms ${Q1}`,transform:d,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function sC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function iC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function aC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 oC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function lC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 cC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 uC(n){const e=n.trim().split(`
57
+ `);if(e.length<2)return n;const s=p=>p.split("|").map(g=>g.trim()).filter(Boolean),i=s(e[0]),o=e.slice(2),c=i.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),m=o.map(p=>`<tr class="border-t border-surface-border">${s(p).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 Zc(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function fC(n){const e=[];let s=n.replace(/```(\w*)\n([\s\S]*?)```/g,(g,u,d)=>{const b=e.length;return e.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,u,d,b)=>uC(`${u}
58
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,u)=>`<h4 id="${Zc(u)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${u}</h4>`).replace(/^### (.+)$/gm,(g,u)=>`<h3 id="${Zc(u)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${u}</h3>`).replace(/^## (.+)$/gm,(g,u)=>`<h2 id="${Zc(u)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${u}</h2>`).replace(/^# (.+)$/gm,(g,u)=>`<h1 id="${Zc(u)}" class="text-lg font-bold text-text-primary mb-3">${u}</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 u=g.replace(/^> /gm,"").trim(),d=/⚠️|warning|caution/i.test(u),b=/note:|ℹ️|info/i.test(u);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">${u}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${o(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,u)=>e[parseInt(u,10)]);const m="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const u=g.trim();if(!u)return"";const d=[];let b=u,x;for(;(x=p.exec(b))!==null;){const v=x.index+x[0].length;d.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),p.lastIndex=0}return b&&d.push(b),d.map(v=>{const w=v.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 fC=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function hC(n){return fC.test(n)}function Pu({content:n,className:e,onClick:s}){const i=E.useMemo(()=>uC(n),[n]);return h.jsx("div",{className:e,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function Su({data:n,depth:e=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:e>0,[c,m]=E.useState(o),[p,g]=E.useState(s);if(s!==void 0&&s!==p&&(g(s),m(s%2===0&&e>0)),n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',n,'"']});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?h.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["[",n.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:n.map((u,d)=>h.jsxs("div",{children:[h.jsx(Su,{data:u,depth:e+1,generation:s}),d<n.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof n=="object"){const u=Object.entries(n);return u.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?h.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:u.map(([d,b],x)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:d}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(Su,{data:b,depth:e+1,generation:s}),x<u.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(n)})}function Eo({data:n,depth:e=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&hC(n)?h.jsx(Pu,{content:n}):h.jsx("span",{className:"text-text-primary",children:n});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:n.map((s,i)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(Eo,{data:s,depth:e+1})})]},i))});if(typeof n=="object"){const s=Object.entries(n);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:e>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,o])=>{const c=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Eo,{data:o,depth:e+1})}):h.jsx(Eo,{data:o,depth:e+1})]},i)})})}return h.jsx("span",{children:String(n)})}function Q1({mode:n,setMode:e,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:m,onClose:p,large:g}){const u=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 h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[n==="json"&&h.jsx("button",{onClick:i,className:d,title:s?"Expand all":"Collapse all",children:s?h.jsx(lC,{className:u}):h.jsx(oC,{className:u})}),h.jsx("button",{onClick:()=>e(n==="json"?"tree":"json"),className:d,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(rC,{className:u}):h.jsx(sC,{className:u})}),h.jsx("button",{onClick:o,className:d,title:"Copy to clipboard",children:c?h.jsx(aC,{className:`${u} text-status-success`}):h.jsx(iC,{className:u})}),m&&h.jsx("button",{onClick:m,className:d,title:"Fullscreen",children:h.jsx(hx,{className:u})}),p&&h.jsx("button",{onClick:p,className:d,title:"Close (Esc)",children:h.jsx(dx,{className:u})})]})}function dC({data:n,label:e,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=E.useRef(null),[m,p]=E.useState(o??"json"),[g,u]=E.useState(!1),[d,b]=E.useState(!1),[x,v]=E.useState(i?0:1),[w,S]=E.useState(1),C=x%2===0,P=w%2===0,q=E.useCallback(()=>v(D=>D+1),[]),re=E.useCallback(()=>S(D=>D+1),[]);let se=n;if(typeof n=="string")try{se=JSON.parse(n)}catch{}const M=async()=>{const D=typeof n=="string"?n:JSON.stringify(se,null,2);await navigator.clipboard.writeText(D),u(!0),setTimeout(()=>u(!1),2e3)},U=E.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",z=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",I=ae?"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 h.jsxs("div",{className:z,children:[e&&h.jsx(tC,{children:e}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(Q1,{mode:m,setMode:p,isCollapsed:C,onToggleCollapse:q,onCopy:M,copied:g,onFullscreen:U})}),h.jsx("div",{className:I,children:m==="json"?h.jsx(Su,{data:se,generation:x}):h.jsx(Eo,{data:se})})]}),h.jsxs(Gv,{open:d,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(Q1,{mode:m,setMode:p,isCollapsed:P,onToggleCollapse:re,onCopy:M,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:m==="json"?h.jsx(Su,{data:se,generation:w}):h.jsx(Eo,{data:se})})]})]})}const mC=100,X1=500;let pC=0;const Vv={"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 Yv(n){const e=n.split(".");return e[0]==="system"&&e.length>=3?`${e[1]}.${e[e.length-1]}`:n}function W1({event:n,forceExpanded:e=!1}){var x,v;const[s,i]=E.useState(e),o=Vv[Yv(n.type)]||"text-text-tertiary";E.useEffect(()=>{i(e)},[e]);const c=e,m=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",u=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 h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>i(!s),className:`flex items-center gap-2 ${d} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${m} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(n.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${p} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:n.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(x=n.data)!=null&&x.workflowId?String(n.data.workflowId):"",(v=n.data)!=null&&v.escalationId?` esc:${String(n.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${u} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Fm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(dC,{data:n.data})})})]})}function yC({open:n,onToggle:e,configOpen:s,onToggleConfig:i}){const[o,c]=E.useState([]),[m,p]=E.useState(!1),[g,u]=E.useState(""),d=E.useRef(null),b=E.useRef(new Map),{subscribe:x}=E.useContext(aa),{connected:v}=Lx(),{patterns:w,pagePattern:S,userPatterns:C,addPattern:P,removePattern:q}=eC(),re=E.useCallback(U=>{const ae=String(U.type||"unknown");if(ae.startsWith("mesh."))return;const z=`${ae}:${U.timestamp||""}:${U.escalationId||U.workflowId||U.taskId||""}`,I=Date.now(),D=b.current.get(z);if(!(D&&I-D<X1)){if(b.current.set(z,I),b.current.size>200)for(const[X,W]of b.current)I-W>X1*2&&b.current.delete(X);c(X=>[{id:++pC,type:ae,timestamp:U.timestamp||new Date().toISOString(),data:U},...X].slice(0,mC))}},[]),se=E.useRef(re);se.current=re;const M=n||m||s;return E.useEffect(()=>{if(!M)return;const U=w.map(ae=>x(ae,z=>se.current(z)));return()=>U.forEach(ae=>ae())},[x,w.join(","),M]),E.useEffect(()=>{n&&d.current&&(d.current.scrollTop=0)},[o.length,n]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:e,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[n?h.jsx(im,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(mx,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[o.length," events"]}),o.length>0&&!n&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Vv[Yv(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.jsx("span",{className:`p-0.5 ${v?"text-status-success":"text-status-warning hover:text-text-primary cursor-pointer"}`,title:v?"Live events connected":"Events disconnected — click to reconnect",onClick:U=>{U.stopPropagation(),v||window.location.reload()},children:h.jsx(cx,{className:"w-3 h-3"})}),h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:U=>{U.stopPropagation(),i()},children:h.jsx(PS,{className:"w-3 h-3"})}),o.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:U=>{U.stopPropagation(),p(!0)},children:h.jsx(hx,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:U=>{U.stopPropagation(),c([])},children:h.jsx(BS,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:S.replace("lt.events.","")}),C.map(U=>h.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:[U.replace("lt.events.",""),h.jsx("button",{onClick:()=>q(U),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Zt,{className:"w-2 h-2"})})]},U))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:U=>u(U.target.value),onKeyDown:U=>{U.key==="Enter"&&g.trim()&&(P(g.trim()),u(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(P(g.trim()),u(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(ux,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Fm,{open:n,children:h.jsx("div",{ref:d,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(U=>h.jsx(W1,{event:U},U.id))})}),h.jsxs(Gv,{open:m,onClose:()=>p(!1),sourceRef:d,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>p(!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:h.jsx(dx,{className:"w-5 h-5"})})}),o.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(U=>h.jsx(W1,{event:U,forceExpanded:!0},U.id))]})]})}function gC(){return qe({queryKey:["docs"],queryFn:()=>ue("/docs"),staleTime:5*6e4})}function bC(n){return qe({queryKey:["docs",n],queryFn:()=>ue(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function xC(){const[n,e]=E.useState([]),[s,i]=E.useState([]),[o,c]=E.useState(null),m=E.useRef(o),p=E.useRef(n),g=E.useRef(s);m.current=o,p.current=n,g.current=s;const u=E.useCallback((w,S)=>{var P;const C=m.current;if(C){const q=((P=S==null?void 0:S.current)==null?void 0:P.scrollTop)??0;e([...p.current,{...C,scrollTop:q}])}i([]),c({path:w,scrollTop:0})},[]),d=E.useCallback(w=>{var q;const S=p.current;if(S.length===0)return;const C=S[S.length-1],P=m.current;if(P){const re=((q=w==null?void 0:w.current)==null?void 0:q.scrollTop)??0;i([...g.current,{...P,scrollTop:re}])}e(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=C.scrollTop)})},[]),b=E.useCallback(w=>{var q;const S=g.current;if(S.length===0)return;const C=S[S.length-1],P=m.current;if(P){const re=((q=w==null?void 0:w.current)==null?void 0:q.scrollTop)??0;e([...p.current,{...P,scrollTop:re}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=C.scrollTop)})},[]),x=E.useCallback(w=>{var P,q;const S=m.current;if(!S)return;const C=((P=w==null?void 0:w.current)==null?void 0:P.scrollTop)??0;e([...p.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((q=w==null?void 0:w.current)==null?void 0:q.scrollTop)??0})},[]),v=E.useCallback(()=>{e([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:u,goBack:d,goForward:b,pushScrollPosition:x,reset:v}}function vC(n,e){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const m=((e?e.replace(/[^/]+$/,""):"")+o).split("/"),p=[];for(const g of m)g===".."?p.pop():g&&g!=="."&&p.push(g);o=p.join("/")}return{path:o,anchor:i}}function _C(n){if(!n.startsWith("#docs"))return null;const e=n.slice(1).split(":"),s=e[1]||"README.md",i=e[2]||void 0;return{path:s,anchor:i}}function wC(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function SC({content:n,currentPath:e,onNavigate:s,onAnchorClick:i}){const o=c=>{var u;const m=c.target,p=m.closest("[data-anchor]");if(p){c.preventDefault(),i();const d=p.dataset.anchor,b=(u=p.closest(".docs-content"))==null?void 0:u.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}=vC(g.dataset.docLink,e);s(d,b);return}};return h.jsx(Pu,{content:n,className:"docs-content",onClick:o})}function EC(n){const e=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){e.push(i);continue}let c=s;for(let m=0;m<o.length-1;m++){const p=o[m];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);m===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:e,dirs:s}}function OC({docs:n,selected:e,onSelect:s}){const{topLevel:i,dirs:o}=EC(n),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${e===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function m(p,g){return h.jsxs("details",{open:!0,children:[h.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:[h.jsx(US,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(u=>m(u)),p.children.map(u=>h.jsx("button",{className:c(u.path),onClick:()=>s(u.path),children:u.title},u.path))]})]},p.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(p=>h.jsx("button",{className:c(p.path),onClick:()=>s(p.path),children:p.title},p.path)),[...o.values()].map(p=>m(p))]})}function AC({open:n,onClose:e}){var ae,z,I;const[s,i]=E.useState(!1),{data:o}=gC(),c=xC(),{data:m,isLoading:p}=bC(((ae=c.current)==null?void 0:ae.path)??null),g=E.useRef(null),[u,d]=E.useState(null);E.useEffect(()=>{u&&(m!=null&&m.content)&&g.current&&requestAnimationFrame(()=>{var X;const D=(X=g.current)==null?void 0:X.querySelector(`#${CSS.escape(u)}`);D==null||D.scrollIntoView({behavior:"smooth",block:"start"}),d(null)})},[u,m]);const b=E.useCallback(()=>{var W;const D=_C(window.location.hash),X=(D==null?void 0:D.path)??"README.md";((W=c.current)==null?void 0:W.path)!==X&&c.navigate(X,g),D!=null&&D.anchor&&d(D.anchor)},[c]),x=E.useRef(!0);E.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const D=wC(c.current.path);window.location.hash!==D&&window.history.replaceState(null,"",window.location.pathname+window.location.search+D)},[n,(z=c.current)==null?void 0:z.path]),E.useEffect(()=>{if(!n)return;const D=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[n,b]);const v=E.useCallback((D,X)=>{X&&d(X),c.navigate(D,g)},[c]),w=E.useCallback(D=>{c.navigate(D,g)},[c]),S=E.useCallback(()=>{c.goBack(g)},[c]),C=E.useCallback(()=>{c.goForward(g)},[c]),P=E.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(E.useEffect(()=>{if(n){x.current=!0,b();const D=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(D)}},[n]),!(n||s))return null;const re=()=>{i(!1),setTimeout(()=>{e(),c.reset()},200)},se=((I=c.current)==null?void 0:I.path)??null,M=c.backStack.length>0,U=c.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&n?"opacity-100":"opacity-0"}`,onClick:re}),h.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&&n?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:S,disabled:!M,className:`p-0.5 transition-colors ${M?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(lx,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!U,className:`p-0.5 transition-colors ${U?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(gd,{className:"w-4 h-4"})}),h.jsx(zS,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:re,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Zt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?h.jsx(OC,{docs:o.docs,selected:se,onSelect:w}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:se?p?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):m!=null&&m.content?h.jsx(SC,{content:m.content,currentPath:se,onNavigate:v,onAnchorClick:P}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(gd,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function jC(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const Z1=2e3;function kC(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
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,u)=>`<h4 id="${Zc(u)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${u}</h4>`).replace(/^### (.+)$/gm,(g,u)=>`<h3 id="${Zc(u)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${u}</h3>`).replace(/^## (.+)$/gm,(g,u)=>`<h2 id="${Zc(u)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${u}</h2>`).replace(/^# (.+)$/gm,(g,u)=>`<h1 id="${Zc(u)}" class="text-lg font-bold text-text-primary mb-3">${u}</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 u=g.replace(/^> /gm,"").trim(),d=/⚠️|warning|caution/i.test(u),b=/note:|ℹ️|info/i.test(u);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">${u}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${o(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,u)=>e[parseInt(u,10)]);const m="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const u=g.trim();if(!u)return"";const d=[];let b=u,x;for(;(x=p.exec(b))!==null;){const v=x.index+x[0].length;d.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),p.lastIndex=0}return b&&d.push(b),d.map(v=>{const _=v.trim();return _?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(_)?_:`<p class="${m}">${_}</p>`:""}).join("")}).join(""),s}const hC=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function dC(n){return hC.test(n)}function Pu({content:n,className:e,onClick:s}){const i=E.useMemo(()=>fC(n),[n]);return h.jsx("div",{className:e,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function Su({data:n,depth:e=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:e>0,[c,m]=E.useState(o),[p,g]=E.useState(s);if(s!==void 0&&s!==p&&(g(s),m(s%2===0&&e>0)),n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',n,'"']});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?h.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["[",n.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:n.map((u,d)=>h.jsxs("div",{children:[h.jsx(Su,{data:u,depth:e+1,generation:s}),d<n.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof n=="object"){const u=Object.entries(n);return u.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?h.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:u.map(([d,b],x)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:d}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(Su,{data:b,depth:e+1,generation:s}),x<u.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(n)})}function Eo({data:n,depth:e=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&dC(n)?h.jsx(Pu,{content:n}):h.jsx("span",{className:"text-text-primary",children:n});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:n.map((s,i)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(Eo,{data:s,depth:e+1})})]},i))});if(typeof n=="object"){const s=Object.entries(n);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:e>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,o])=>{const c=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Eo,{data:o,depth:e+1})}):h.jsx(Eo,{data:o,depth:e+1})]},i)})})}return h.jsx("span",{children:String(n)})}function X1({mode:n,setMode:e,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:m,onClose:p,large:g}){const u=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 h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[n==="json"&&h.jsx("button",{onClick:i,className:d,title:s?"Expand all":"Collapse all",children:s?h.jsx(cC,{className:u}):h.jsx(lC,{className:u})}),h.jsx("button",{onClick:()=>e(n==="json"?"tree":"json"),className:d,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(sC,{className:u}):h.jsx(iC,{className:u})}),h.jsx("button",{onClick:o,className:d,title:"Copy to clipboard",children:c?h.jsx(oC,{className:`${u} text-status-success`}):h.jsx(aC,{className:u})}),m&&h.jsx("button",{onClick:m,className:d,title:"Fullscreen",children:h.jsx(dx,{className:u})}),p&&h.jsx("button",{onClick:p,className:d,title:"Close (Esc)",children:h.jsx(mx,{className:u})})]})}function mC({data:n,label:e,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=E.useRef(null),[m,p]=E.useState(o??"json"),[g,u]=E.useState(!1),[d,b]=E.useState(!1),[x,v]=E.useState(i?0:1),[_,S]=E.useState(1),C=x%2===0,P=_%2===0,q=E.useCallback(()=>v(D=>D+1),[]),ne=E.useCallback(()=>S(D=>D+1),[]);let te=n;if(typeof n=="string")try{te=JSON.parse(n)}catch{}const M=async()=>{const D=typeof n=="string"?n:JSON.stringify(te,null,2);await navigator.clipboard.writeText(D),u(!0),setTimeout(()=>u(!1),2e3)},U=E.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",z=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",I=ae?"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 h.jsxs("div",{className:z,children:[e&&h.jsx(nC,{children:e}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(X1,{mode:m,setMode:p,isCollapsed:C,onToggleCollapse:q,onCopy:M,copied:g,onFullscreen:U})}),h.jsx("div",{className:I,children:m==="json"?h.jsx(Su,{data:te,generation:x}):h.jsx(Eo,{data:te})})]}),h.jsxs(Vv,{open:d,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(X1,{mode:m,setMode:p,isCollapsed:P,onToggleCollapse:ne,onCopy:M,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:m==="json"?h.jsx(Su,{data:te,generation:_}):h.jsx(Eo,{data:te})})]})]})}const pC=100,W1=500;let yC=0;const Yv={"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 Kv(n){const e=n.split(".");return e[0]==="system"&&e.length>=3?`${e[1]}.${e[e.length-1]}`:n}function Z1({event:n,forceExpanded:e=!1}){var x,v;const[s,i]=E.useState(e),o=Yv[Kv(n.type)]||"text-text-tertiary";E.useEffect(()=>{i(e)},[e]);const c=e,m=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",u=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 h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>i(!s),className:`flex items-center gap-2 ${d} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${m} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(n.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${p} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:n.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(x=n.data)!=null&&x.workflowId?String(n.data.workflowId):"",(v=n.data)!=null&&v.escalationId?` esc:${String(n.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${u} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Gm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(mC,{data:n.data})})})]})}function gC({open:n,onToggle:e,configOpen:s,onToggleConfig:i}){const[o,c]=E.useState([]),[m,p]=E.useState(!1),[g,u]=E.useState(""),d=E.useRef(null),b=E.useRef(new Map),{subscribe:x}=E.useContext(aa),{connected:v}=qx(),{patterns:_,pagePattern:S,userPatterns:C,addPattern:P,removePattern:q}=tC(),ne=E.useCallback(U=>{const ae=String(U.type||"unknown");if(ae.startsWith("mesh."))return;const z=`${ae}:${U.timestamp||""}:${U.escalationId||U.workflowId||U.taskId||""}`,I=Date.now(),D=b.current.get(z);if(!(D&&I-D<W1)){if(b.current.set(z,I),b.current.size>200)for(const[X,W]of b.current)I-W>W1*2&&b.current.delete(X);c(X=>[{id:++yC,type:ae,timestamp:U.timestamp||new Date().toISOString(),data:U},...X].slice(0,pC))}},[]),te=E.useRef(ne);te.current=ne;const M=n||m||s;return E.useEffect(()=>{if(!M)return;const U=_.map(ae=>x(ae,z=>te.current(z)));return()=>U.forEach(ae=>ae())},[x,_.join(","),M]),E.useEffect(()=>{n&&d.current&&(d.current.scrollTop=0)},[o.length,n]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:e,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[n?h.jsx(im,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(px,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[o.length," events"]}),o.length>0&&!n&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Yv[Kv(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.jsx("span",{className:`p-0.5 ${v?"text-status-success":"text-status-warning hover:text-text-primary cursor-pointer"}`,title:v?"Live events connected":"Events disconnected — click to reconnect",onClick:U=>{U.stopPropagation(),v||window.location.reload()},children:h.jsx(ux,{className:"w-3 h-3"})}),h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:U=>{U.stopPropagation(),i()},children:h.jsx(BS,{className:"w-3 h-3"})}),o.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:U=>{U.stopPropagation(),p(!0)},children:h.jsx(dx,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:U=>{U.stopPropagation(),c([])},children:h.jsx(US,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:S.replace("lt.events.","")}),C.map(U=>h.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:[U.replace("lt.events.",""),h.jsx("button",{onClick:()=>q(U),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Zt,{className:"w-2 h-2"})})]},U))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:U=>u(U.target.value),onKeyDown:U=>{U.key==="Enter"&&g.trim()&&(P(g.trim()),u(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(P(g.trim()),u(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(fx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Gm,{open:n,children:h.jsx("div",{ref:d,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(U=>h.jsx(Z1,{event:U},U.id))})}),h.jsxs(Vv,{open:m,onClose:()=>p(!1),sourceRef:d,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>p(!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:h.jsx(mx,{className:"w-5 h-5"})})}),o.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(U=>h.jsx(Z1,{event:U,forceExpanded:!0},U.id))]})]})}function bC(){return qe({queryKey:["docs"],queryFn:()=>ue("/docs"),staleTime:5*6e4})}function xC(n){return qe({queryKey:["docs",n],queryFn:()=>ue(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function vC(){const[n,e]=E.useState([]),[s,i]=E.useState([]),[o,c]=E.useState(null),m=E.useRef(o),p=E.useRef(n),g=E.useRef(s);m.current=o,p.current=n,g.current=s;const u=E.useCallback((_,S)=>{var P;const C=m.current;if(C){const q=((P=S==null?void 0:S.current)==null?void 0:P.scrollTop)??0;e([...p.current,{...C,scrollTop:q}])}i([]),c({path:_,scrollTop:0})},[]),d=E.useCallback(_=>{var q;const S=p.current;if(S.length===0)return;const C=S[S.length-1],P=m.current;if(P){const ne=((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0;i([...g.current,{...P,scrollTop:ne}])}e(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),b=E.useCallback(_=>{var q;const S=g.current;if(S.length===0)return;const C=S[S.length-1],P=m.current;if(P){const ne=((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0;e([...p.current,{...P,scrollTop:ne}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),x=E.useCallback(_=>{var P,q;const S=m.current;if(!S)return;const C=((P=_==null?void 0:_.current)==null?void 0:P.scrollTop)??0;e([...p.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0})},[]),v=E.useCallback(()=>{e([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:u,goBack:d,goForward:b,pushScrollPosition:x,reset:v}}function _C(n,e){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const m=((e?e.replace(/[^/]+$/,""):"")+o).split("/"),p=[];for(const g of m)g===".."?p.pop():g&&g!=="."&&p.push(g);o=p.join("/")}return{path:o,anchor:i}}function wC(n){if(!n.startsWith("#docs"))return null;const e=n.slice(1).split(":"),s=e[1]||"README.md",i=e[2]||void 0;return{path:s,anchor:i}}function SC(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function EC({content:n,currentPath:e,onNavigate:s,onAnchorClick:i}){const o=c=>{var u;const m=c.target,p=m.closest("[data-anchor]");if(p){c.preventDefault(),i();const d=p.dataset.anchor,b=(u=p.closest(".docs-content"))==null?void 0:u.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}=_C(g.dataset.docLink,e);s(d,b);return}};return h.jsx(Pu,{content:n,className:"docs-content",onClick:o})}function OC(n){const e=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){e.push(i);continue}let c=s;for(let m=0;m<o.length-1;m++){const p=o[m];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);m===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:e,dirs:s}}function AC({docs:n,selected:e,onSelect:s}){const{topLevel:i,dirs:o}=OC(n),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${e===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function m(p,g){return h.jsxs("details",{open:!0,children:[h.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:[h.jsx(zS,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(u=>m(u)),p.children.map(u=>h.jsx("button",{className:c(u.path),onClick:()=>s(u.path),children:u.title},u.path))]})]},p.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(p=>h.jsx("button",{className:c(p.path),onClick:()=>s(p.path),children:p.title},p.path)),[...o.values()].map(p=>m(p))]})}function jC({open:n,onClose:e}){var ae,z,I;const[s,i]=E.useState(!1),{data:o}=bC(),c=vC(),{data:m,isLoading:p}=xC(((ae=c.current)==null?void 0:ae.path)??null),g=E.useRef(null),[u,d]=E.useState(null);E.useEffect(()=>{u&&(m!=null&&m.content)&&g.current&&requestAnimationFrame(()=>{var X;const D=(X=g.current)==null?void 0:X.querySelector(`#${CSS.escape(u)}`);D==null||D.scrollIntoView({behavior:"smooth",block:"start"}),d(null)})},[u,m]);const b=E.useCallback(()=>{var W;const D=wC(window.location.hash),X=(D==null?void 0:D.path)??"README.md";((W=c.current)==null?void 0:W.path)!==X&&c.navigate(X,g),D!=null&&D.anchor&&d(D.anchor)},[c]),x=E.useRef(!0);E.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const D=SC(c.current.path);window.location.hash!==D&&window.history.replaceState(null,"",window.location.pathname+window.location.search+D)},[n,(z=c.current)==null?void 0:z.path]),E.useEffect(()=>{if(!n)return;const D=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[n,b]);const v=E.useCallback((D,X)=>{X&&d(X),c.navigate(D,g)},[c]),_=E.useCallback(D=>{c.navigate(D,g)},[c]),S=E.useCallback(()=>{c.goBack(g)},[c]),C=E.useCallback(()=>{c.goForward(g)},[c]),P=E.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(E.useEffect(()=>{if(n){x.current=!0,b();const D=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(D)}},[n]),!(n||s))return null;const ne=()=>{i(!1),setTimeout(()=>{e(),c.reset()},200)},te=((I=c.current)==null?void 0:I.path)??null,M=c.backStack.length>0,U=c.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&n?"opacity-100":"opacity-0"}`,onClick:ne}),h.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&&n?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:S,disabled:!M,className:`p-0.5 transition-colors ${M?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(cx,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!U,className:`p-0.5 transition-colors ${U?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(gd,{className:"w-4 h-4"})}),h.jsx(IS,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:ne,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Zt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?h.jsx(AC,{docs:o.docs,selected:te,onSelect:_}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:te?p?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):m!=null&&m.content?h.jsx(EC,{content:m.content,currentPath:te,onNavigate:v,onAnchorClick:P}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(gd,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function kC(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const ex=2e3;function NC(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
60
60
  ${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
61
61
  `)}
62
62
  [End prior conversation]
63
63
 
64
- `}function NC(n){const e=n.summary,s=n.title;if(e){const i=e.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?e.slice(0,i).trim():e}return s||(typeof n=="string"?n:"Query completed.")}const Kv=E.createContext(null);function TC({children:n}){const e=en(),[s,i]=E.useState(!1),[o,c]=E.useState([]),[m,p]=E.useState(null),[g,u]=E.useState({}),d=E.useRef(null),b={page:e.pathname.split("/").filter(Boolean).join("-")||"home",route:e.pathname,params:{},...g,suggestedTags:g.suggestedTags??jC(e.pathname)};E.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const x=E.useCallback(()=>i(P=>!P),[]),v=E.useCallback(P=>{u(P)},[]),w=E.useCallback(()=>{c([]),p(null)},[]),S=E.useCallback(async P=>{var z;const q=new Date().toISOString(),re={id:`user-${Date.now()}`,role:"user",content:P,timestamp:q},se={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:q,pending:!0};c(I=>[...I,re,se]);const M={...b};(z=M.entities)!=null&&z.yamlContent&&M.entities.yamlContent.length>Z1&&(M.entities={...M.entities,yamlContent:M.entities.yamlContent.slice(0,Z1)+`
65
- ... (truncated)`});const ae=`${kC(o.concat(re))}${P}`;try{const D=(await ue("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:M.suggestedTags,context:M,wait:!1,direct:!0})})).workflow_id;p(D),c(X=>X.map(W=>W.id===se.id?{...W,workflowId:D}:W)),d.current&&clearInterval(d.current),d.current=setInterval(async()=>{var X;try{const W=await ue(`/workflows/${D}/result`),he=(X=W==null?void 0:W.result)==null?void 0:X.data;if(he){d.current&&clearInterval(d.current),d.current=null,p(null);const we=NC(he);let Oe;try{Oe=(await ue(`/workflow-states/${D}/execution`)).duration_ms}catch{}c(F=>F.map(J=>J.id===se.id?{...J,content:we,timestamp:new Date().toISOString(),pending:!1,durationMs:Oe}:J))}}catch{}},3e3)}catch{c(I=>I.map(D=>D.id===se.id?{...D,content:"Failed to submit query. Please try again.",pending:!1}:D))}},[o,b]),C=E.useCallback(async P=>{const q=o.find(M=>M.id===P);if(!(q!=null&&q.workflowId)||q.compilationStatus==="compiling"||q.compilationStatus==="done")return;const re=o.indexOf(q),se=o.slice(0,re).reverse().find(M=>M.role==="user");if(se){c(M=>M.map(U=>U.id===P?{...U,compilationStatus:"compiling"}:U));try{const M=await ue("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:se.content,summary:q.content})}),U=await ue("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:q.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:M.tool_name,description:M.description,tags:M.tags,app_id:""})});await ue(`/yaml-workflows/${U.id}/deploy`,{method:"POST"}),c(ae=>ae.map(z=>z.id===P?{...z,compilationStatus:"done"}:z))}catch(M){const U=M instanceof Error?M.message:"Compilation failed";c(ae=>ae.map(z=>z.id===P?{...z,compilationStatus:"error",compilationError:U}:z))}}},[o]);return h.jsx(Kv.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:m,clearMessages:w,compileMessage:C},children:n})}function Jv(){const n=E.useContext(Kv);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function CC(){const{helpOpen:n,toggleHelp:e}=Jv();return h.jsx("button",{onClick:e,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":n?"Close help":"Ask for help",children:n?h.jsx(Zt,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Vt}/logo512.png)`}})})}function MC({ms:n,className:e=""}){const s=pk(n),i=E.useMemo(()=>n==null?[]:[{label:"ms",value:String(n)},{label:"sec",value:`${(n/1e3).toFixed(3)}s`},{label:"text",value:s}],[n,s]);return n==null?h.jsx("span",{className:`text-xs text-text-tertiary ${e}`,children:"--"}):h.jsx(gv,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${e}`,children:s})})}const RC=["sm","md","lg","full"],ex={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"},tx={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function DC({which:n}){const e="stroke-current";switch(n){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:e,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:e,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:e,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:e,strokeWidth:"1.5"})})}}function LC({msg:n}){const[e,s]=E.useState(0);E.useEffect(()=>{const m=new Date(n.timestamp).getTime(),p=()=>s(Math.floor((Date.now()-m)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(e/60),o=e%60,c=i>0?`${i}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),n.workflowId&&h.jsxs(ar,{to:`/workflows/executions/${n.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(am,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function qC({msg:n,compileMessage:e}){const s=n.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(bv,{date:n.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),n.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(MC,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(ar,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(am,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>e(n.id),disabled:n.compilationStatus==="compiling"||n.compilationStatus==="done",className:"transition-colors",title:n.compilationStatus==="done"?"Compiled — future queries will match this pipeline":n.compilationStatus==="error"?n.compilationError??"Compilation failed":n.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(IS,{className:`w-2.5 h-2.5 ${n.compilationStatus==="done"?"text-status-success":n.compilationStatus==="error"?"text-status-error":n.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function PC(){const{helpOpen:n,setHelpOpen:e,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:m,compileMessage:p}=Jv(),[g,u]=E.useState(""),[d,b]=E.useState("md"),[x,v]=E.useState(!0),w=E.useRef(null),S=E.useRef(null);if(E.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[s]),E.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),E.useEffect(()=>{if(!n)return;const M=U=>{U.key==="Escape"&&(d==="full"?b("lg"):d==="lg"?b("md"):d==="md"?b("sm"):e(!1))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[n,d,e]),!n)return null;const C=()=>{const M=g.trim();!M||c||(i(M),u(""),S.current&&(S.current.style.height="auto"))},P=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),C())},q=d==="full",re=o.page.replace(/-/g," "),se=q?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${q?ex.full:`right-6 ${ex[d]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:se,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:re})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:RC.map(M=>h.jsx("button",{onClick:()=>b(M),className:`p-1 rounded transition-colors ${M===d?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":M===d,"aria-label":tx[M],title:tx[M],children:h.jsx(DC,{which:M})},M))}),s.length>0&&h.jsx("button",{onClick:m,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx($S,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>e(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(M=>h.jsxs("div",{className:`text-xs leading-relaxed ${M.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${M.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:M.pending?h.jsx(LC,{msg:M}):M.role==="assistant"?h.jsx(Pu,{content:M.content}):M.content}),!M.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(qC,{msg:M,compileMessage:p})})]},M.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:S,value:g,onChange:M=>{u(M.target.value);const U=M.target;U.style.height="auto",U.style.height=`${Math.min(U.scrollHeight,120)}px`},onKeyDown:P,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}),h.jsx("button",{onClick:C,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:h.jsx(HS,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const BC=6e3,UC="scan";function zC(){const{lastResult:n}=Im(),{open:e,ownerKey:s}=Dm(),[i,o]=E.useState(null);return E.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),BC);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||e&&s===UC||n.source===To.TOOLBAR?null:h.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:h.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[h.jsx(Mo,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx($m,{result:n})}),h.jsx("button",{type:"button",onClick:()=>o(n.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:h.jsx(Zt,{className:"w-3.5 h-3.5"})})]})})}const Qv="lt-announcement-dismissed:",IC="Live updates unavailable. Reconnecting… Refresh if this persists.";function $C(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HC(n){try{return localStorage.getItem(`${Qv}${n}`)==="1"}catch{return!1}}function FC(){const{isAuthenticated:n,userRoleNames:e}=qt(),{data:s}=yv(n),i=Be(),[o,c]=E.useState(null),[m,p]=E.useState(0),{unavailable:g}=hO();An(fk,()=>{i.invalidateQueries({queryKey:["announcements"]})});const u=Date.now(),d=((s==null?void 0:s.announcements)??[]).filter(x=>!HC(x.id)&&new Date(x.expires_at).getTime()>u&&(x.roles.length===0||x.roles.some(v=>e.includes(v))));if(E.useEffect(()=>{const x=((s==null?void 0:s.announcements)??[]).map(w=>new Date(w.expires_at).getTime()-Date.now()).filter(w=>w>0);if(x.length===0)return;const v=setTimeout(()=>p(w=>w+1),Math.min(...x)+250);return()=>clearTimeout(v)},[s,m]),d.length===0&&!g)return null;const b=x=>{try{localStorage.setItem(`${Qv}${x}`,"1")}catch{}p(v=>v+1)};return h.jsxs("div",{"data-testid":"announcement-banner",className:"relative z-40",children:[g&&h.jsx("div",{"data-testid":"live-updates-notice",role:"status",className:"border-b border-status-warning/25 bg-status-warning/10",children:h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-status-warning",children:"Notice"}),h.jsx("span",{className:"truncate text-xs text-text-primary",children:IC})]})}),d.map(x=>{const v=o===x.id,w=x.title??x.body.split(`
66
- `)[0];return h.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),h.jsxs("button",{type:"button",onClick:()=>c(v?null:x.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[h.jsx("span",{className:"truncate",children:w}),v?h.jsx(mx,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(im,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>b(x.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${w}`,children:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(Pu,{content:$C(x.body)})})]},x.id)})]})}function GC(){var U,ae;const{isBuilder:n,isOps:e,viewAs:s}=ev(),{canSeePaceBoard:i}=tv();_A();const{data:o}=er();Mj((U=o==null?void 0:o.display)==null?void 0:U.timeZone);const c=Qx(),m=c!==null?c:!!((ae=o==null?void 0:o.ai)!=null&&ae.enabled),{collapsed:p,toggle:g}=Mm(),[u,d]=E.useState(!1),[b,x]=E.useState(!1),[v,w]=E.useState(!1),[S,C]=E.useState(()=>window.location.hash.startsWith("#docs")),P=en(),q=E.useRef(null),{kiosk:re,homePath:se}=Tm(),M=re||Vj(P.pathname);return E.useEffect(()=>{const z=q.current;z&&(z.classList.remove("animate-page-in"),z.offsetWidth,z.classList.add("animate-page-in"))},[P.pathname]),E.useEffect(()=>{const z=()=>{window.location.hash.startsWith("#docs")&&C(!0)};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]),re&&se&&!Qj(P.pathname,P.search)?h.jsx(Sn,{to:se,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(ET,{onToggleEventFeed:()=>d(z=>!z),onToggleDocs:()=>C(z=>!z),onToggleNav:M?void 0:()=>x(z=>!z)}),h.jsx(FC,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!M&&h.jsxs("aside",{className:`${p?"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:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Hv,{aiEnabled:m,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${p?"flex justify-center":"flex items-center px-7"}`,"aria-label":p?"Expand sidebar":"Collapse sidebar",children:p?h.jsx(FS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(GS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!p&&(o==null?void 0:o.environment)&&h.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${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:q,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(ei,{})})}),h.jsx(VC,{})]}),!M&&h.jsx(XT,{open:b,onClose:()=>x(!1),aiEnabled:m,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i}),h.jsx(yC,{open:u,onToggle:()=>d(z=>!z),configOpen:v,onToggleConfig:()=>w(z=>!z)}),h.jsx(AC,{open:S,onClose:()=>{C(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),m&&h.jsx(CC,{}),m&&h.jsx(PC,{}),h.jsx(zC,{})]})}function VC(){const{node:n,width:e,open:s}=Dm();return h.jsx(tk,{open:s,width:e,className:"border-l border-surface-border bg-surface-raised",children:n})}function YC(){const{isAuthenticated:n}=qt(),e=en();return n?h.jsx(Wj,{children:h.jsx(ek,{children:h.jsx(TC,{children:h.jsx(bA,{children:h.jsx(Jk,{children:h.jsx(GC,{})})})})})}):h.jsx(Sn,{to:"/login",state:{from:e.pathname},replace:!0})}function Xv({provider:n,className:e="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:[h.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"}),h.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"}),h.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"}),h.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 h.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:h.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 h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:h.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 h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function KC(){return ue("/auth/oauth/providers")}async function JC(n,e){const s=e?`?label=${encodeURIComponent(e)}`:"";return ue(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function GM(){return qe({queryKey:["oauth-connections"],queryFn:()=>ue("/auth/oauth/connections")})}function VM(){const n=Be();return Fe({mutationFn:({provider:e,label:s})=>JC(e,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function QC(){var ae;const{login:n,isAuthenticated:e}=qt(),s=ni(),i=en(),o=new URLSearchParams(i.search),c=o.get("token"),m=o.get("error"),p=((ae=i.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=E.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[u,d]=E.useState(""),[b,x]=E.useState(""),[v,w]=E.useState(m||""),[S,C]=E.useState(!1),[P,q]=E.useState(!!c),[re,se]=E.useState([]),M=E.useRef(!1);if(E.useEffect(()=>{c||M.current||(M.current=!0,(async()=>{var z,I,D,X;try{const W=await lm().catch(()=>null);if(!((z=W==null?void 0:W.auth)!=null&&z.sso))return;const he=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!he.ok){w("Host authentication required — please log in to your organization first");return}const we=await he.json();we.token&&((I=W.auth)!=null&&I.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",W.auth.ssoLogoutUrl),q(!0),n(we.token,void 0,{displayName:(D=we.user)==null?void 0:D.display_name,username:(X=we.user)==null?void 0:X.external_id}))}catch{}})())},[]),E.useEffect(()=>{c||KC().then(se).catch(()=>{})},[]),E.useEffect(()=>{if(!P)return;const z=setTimeout(()=>s(p,{replace:!0}),1500);return()=>clearTimeout(z)},[P]),e&&!P)return h.jsx(Sn,{to:p,replace:!0});const U=async z=>{var I,D;if(z.preventDefault(),w(""),!u.trim()||!b){w("Username and password are required");return}C(!0);try{const X=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.trim(),password:b})}),W=await X.json();if(!X.ok){w(W.error||"Login failed");return}q(!0),n(W.token,{username:u.trim(),password:b},{displayName:(I=W.user)==null?void 0:I.display_name,username:(D=W.user)==null?void 0:D.external_id})}catch{w("Unable to connect to server")}finally{C(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${P?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Ru,{size:"lg",hideLabel:P})}),h.jsxs("form",{onSubmit:U,className:`space-y-5 transition-opacity duration-300 ${P?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:u,onChange:z=>d(z.target.value),className:"input",placeholder:"Enter your username",autoFocus:!P,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:b,onChange:z=>x(z.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),v&&h.jsx("p",{className:"text-sm text-status-error",children:v}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||P,children:S?"Signing in...":"Sign In"}),re.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:re.filter(z=>z.provider!=="anthropic").map(z=>h.jsxs("a",{href:`${Vt}/api/auth/oauth/${z.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(Xv,{provider:z.provider}),"Sign in with ",z.name]},z.provider))})]})]})]})})}function nx(){const{isAuthenticated:n}=qt(),e=ni(),s=en(),i=new URLSearchParams(s.search),o=i.get("state")||"";E.useEffect(()=>{n||e(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,m]=E.useState(""),[p,g]=E.useState(i.get("label")||"default"),[u,d]=E.useState(""),[b,x]=E.useState(!1),v=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const P=c.trim();if(!P){d("A token or API key is required");return}if(!P.startsWith("sk-ant-")){d('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}x(!0),d("");const q=`${Vt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(P)}&state=${encodeURIComponent(o)}`;window.location.href=q};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Ru,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(Xv,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),h.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."}),h.jsxs("form",{onSubmit:S,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:c,onChange:C=>m(C.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),v&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:p,onChange:C=>g(C.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.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").'})]}),u&&h.jsx("p",{className:"text-sm text-status-error",children:u}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.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."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.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 XC({items:n,columns:e=1}){if(n.length===0)return null;const s=e>=2&&n.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return h.jsx("div",{className:"@container",children:h.jsx("dl",{className:`grid ${s} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:n.map(({key:i,label:o,value:c})=>h.jsxs(E.Fragment,{children:[h.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:o}),h.jsx("dd",{className:"text-sm text-text-primary break-words whitespace-pre-wrap min-w-0","data-field-key":i,children:WC(c)})]},i))})})}function WC(n){return n==null||n===""?"—":typeof n=="boolean"?n?"Yes":"No":typeof n=="object"?JSON.stringify(n):String(n)}function ZC(n){return qe({queryKey:["oauth-client",n],queryFn:()=>ue(`/oauth/clients/${encodeURIComponent(n)}`),enabled:!!n,retry:!1})}function e3(n){return qe({queryKey:["oauth-presets"],queryFn:()=>ue("/oauth/presets"),enabled:n})}function t3(){return Fe({mutationFn:n=>ue(n.preset?"/oauth/authorize":"/oauth/deny",{method:"POST",body:JSON.stringify(n.preset?{...n.request,preset:n.preset}:n.request)})})}function YM(){return qe({queryKey:["oauth-grants"],queryFn:()=>ue("/oauth/grants")})}function KM(){const n=Be();return Fe({mutationFn:e=>ue(`/oauth/grants/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["oauth-grants"]})})}const n3=["client_id","redirect_uri","code_challenge","code_challenge_method","response_type","state","scope","resource"],yd={read_only:{action:"Allow read-only",effect:"Reads what you can read and runs workflows marked read-safe."},just_me:{action:"Allow as me",effect:"Acts with your full rights: claims, resolves, invokes, and administers wherever you may."}};function r3(n){const e=new URLSearchParams(n),s=n3.map(o=>[o,e.get(o)??void 0]),i=Object.fromEntries(s);return!i.client_id||!i.redirect_uri||!i.code_challenge?null:i}function s3(n){try{return new URL(n).host}catch{return n}}function i3(){var b,x,v;const{isAuthenticated:n,user:e}=qt(),s=ni(),i=en(),o=E.useMemo(()=>r3(i.search),[i.search]);E.useEffect(()=>{n||s(`/login?returnTo=${encodeURIComponent(i.pathname+i.search)}`,{replace:!0})},[n]);const c=ZC(n&&o?o.client_id:null),m=e3(n&&!!o),p=t3(),g=w=>{o&&p.mutate({request:o,preset:w},{onSuccess:({redirect:S})=>window.location.assign(S)})};if(!n)return null;const u=!o||c.isError,d=((b=c.data)==null?void 0:b.client_name)||"An app";return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-lg p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Ru,{size:"lg"})}),u?h.jsxs("div",{role:"alert",children:[h.jsx("h2",{className:"heading-3 mb-3",children:"Sign-in link not valid"}),h.jsx("p",{className:"text-sm text-text-secondary",children:"Start the connection again from the app."})]}):h.jsxs(h.Fragment,{children:[h.jsxs("h2",{className:"heading-2 mb-2",children:["Connect ",d]}),h.jsxs("p",{className:"text-sm text-text-secondary mb-6",children:["Pick how much ",d," may do as you. Disconnect it any time under Connected apps."]}),h.jsx("div",{className:"mb-8",children:h.jsx(XC,{items:[{key:"app",label:"App",value:d},{key:"account",label:"Account",value:(e==null?void 0:e.displayName)||(e==null?void 0:e.username)||(e==null?void 0:e.userId)||null},{key:"returns-to",label:"Returns to",value:s3(o.redirect_uri)},{key:"deployment",label:"Deployment",value:window.location.host}]})}),h.jsx("dl",{className:"space-y-3 mb-8",children:(((x=m.data)==null?void 0:x.presets)??[]).map(w=>h.jsxs("div",{children:[h.jsx("dt",{className:"text-sm font-medium text-text-primary",children:yd[w].action}),h.jsx("dd",{className:"text-sm text-text-secondary",children:yd[w].effect})]},w))}),p.isError&&h.jsx("p",{className:"text-sm text-status-error mb-4",role:"alert",children:p.error.message}),h.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[(((v=m.data)==null?void 0:v.presets)??[]).map(w=>h.jsx("button",{type:"button",className:w==="read_only"?"btn-primary":"btn-secondary",disabled:p.isPending||c.isLoading,onClick:()=>g(w),children:yd[w].action},w)),h.jsx("button",{type:"button",className:"btn-ghost",disabled:p.isPending,onClick:()=>g(null),children:"Deny"})]})]})]})})}function po({roleTypes:n,roleNames:e,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=qt();return i?h.jsx(ei,{}):n&&n.some(m=>c(m))?h.jsx(ei,{}):e&&e.some(m=>o(m))?h.jsx(ei,{}):h.jsx(Sn,{to:s,replace:!0})}function a3(){const{data:n,isSuccess:e}=$v();return e&&n.length===0?h.jsx(Sn,{to:"/",replace:!0}):h.jsx(ei,{})}function o3({redirectTo:n="/"}){var i;const{data:e,isLoading:s}=er();return s||!e?null:(i=e.ai)!=null&&i.enabled?h.jsx(ei,{}):h.jsx(Sn,{to:n,replace:!0})}function l3({flag:n,redirectTo:e="/"}){var o;const{data:s,isLoading:i}=er();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(Sn,{to:e,replace:!0}):h.jsx(ei,{})}const c3=E.lazy(()=>ke(()=>import("./ProcessesListPage-DrvjzgWT.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(n=>({default:n.ProcessesListPage}))),u3=E.lazy(()=>ke(()=>import("./ProcessDetailPage-B30RatjD.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,4,20,21]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),f3=E.lazy(()=>ke(()=>import("./McpOverview-B2bbKKu2.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,4]),import.meta.url).then(n=>({default:n.McpOverview}))),h3=E.lazy(()=>ke(()=>import("./McpRunsPage-twxFdTtJ.js"),__vite__mapDeps([28,1,24,25,3,4,29,26,6,7,8,9,16,13,30,14,12,11,15,31]),import.meta.url).then(n=>({default:n.McpRunsPage}))),d3=E.lazy(()=>ke(()=>import("./McpRunDetailPage-CrUsDPRD.js"),__vite__mapDeps([32,1,24,14,13,33,34,12,35,19,4,36,15,37]),import.meta.url).then(n=>({default:n.McpRunDetailPage}))),m3=E.lazy(()=>ke(()=>import("./McpQueryPage-CSkczeJP.js"),__vite__mapDeps([38,1,14,13,7,8,9,12,11,15,6,10,30,16,31,3,4,39]),import.meta.url).then(n=>({default:n.McpQueryPage}))),p3=E.lazy(()=>ke(()=>import("./McpQueryDetailPage-DgLxwwJy.js"),__vite__mapDeps([40,1,14,13,19,39,4,25,41,42,24,2,43,44,45,46,47,48,37,49,35,36]),import.meta.url).then(n=>({default:n.McpQueryDetailPage}))),y3=E.lazy(()=>ke(()=>import("./EscalationsOverview-B7O4ttP4.js"),__vite__mapDeps([50,1,14,13,27,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),g3=E.lazy(()=>ke(()=>import("./AvailableEscalationsPage-D1mCqj8Z.js"),__vite__mapDeps([51,1,4,52,13,53,54,5,55,56,57,19,7,8,9,58,59,21,11,60,12,61,20,16,62,3,31]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),b3=E.lazy(()=>ke(()=>import("./OperatorDashboard-BoeZIyup.js"),__vite__mapDeps([63,1,3,4,5,6,52,7,8,9,11,31,58,57,19,13,59,21,60,12,61,20,16,62,55,15]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),x3=E.lazy(()=>ke(()=>import("./index-CED9cLE2.js"),__vite__mapDeps([64,1,65,13,57,19,4,54,16,53,5,14,15,20,62,37,21,66]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),v3=E.lazy(()=>ke(()=>import("./WorkflowsOverview-Cg4LSfck.js"),__vite__mapDeps([67,1,14,13,27,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),_3=E.lazy(()=>ke(()=>import("./index-BvH8T-jb.js"),__vite__mapDeps([68,1,14,13,12,16,65,57,19,4,54,69,46,47]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),w3=E.lazy(()=>ke(()=>import("./index-BvH8T-jb.js"),__vite__mapDeps([68,1,14,13,12,16,65,57,19,4,54,69,46,47]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),S3=E.lazy(()=>ke(()=>import("./WorkflowsDashboard-DtxYdQbQ.js"),__vite__mapDeps([70,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"durable"})}))),E3=E.lazy(()=>ke(()=>import("./WorkflowsDashboard-DtxYdQbQ.js"),__vite__mapDeps([70,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"all"})}))),O3=E.lazy(()=>ke(()=>import("./YamlWorkflowsPage-BF6Jtx24.js"),__vite__mapDeps([71,1,25,3,4,14,13,12,8,48,69,19]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),A3=E.lazy(()=>ke(()=>import("./GraphInvokePage-CR0MtYv8.js"),__vite__mapDeps([72,1,25,14,13,43,45,46,47,44,4,48,69]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),j3=E.lazy(()=>ke(()=>import("./YamlWorkflowDetailPage-Del-RCgi.js"),__vite__mapDeps([73,1,25,19,69,13,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),k3=E.lazy(()=>ke(()=>import("./TasksListPage-CkMmOYOE.js"),__vite__mapDeps([74,1,2,3,4,7,8,9,19,61,49,11,12,13,14,16]),import.meta.url).then(n=>({default:n.TasksListPage}))),N3=E.lazy(()=>ke(()=>import("./TaskDetailPage-CoV3WcTA.js"),__vite__mapDeps([75,1,2,19,61,14,13,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),rx=E.lazy(()=>ke(()=>import("./WorkflowExecutionPage-46UV5pJd.js"),__vite__mapDeps([76,1,34,12,13,35,19,4,36,2,14,33,15,37]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),T3=E.lazy(()=>ke(()=>import("./AdminDashboard-DWVRAu63.js"),__vite__mapDeps([77,1,2,23,18,13,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),C3=E.lazy(()=>ke(()=>import("./index-Cu0xdX2t.js"),__vite__mapDeps([78,1,7,8,9,12,13,31,3,4,14,79,16]),import.meta.url).then(n=>({default:n.WorkersPage}))),M3=E.lazy(()=>ke(()=>import("./index-D1lfq5iZ.js"),__vite__mapDeps([80,1,12,13,81,20,16,14,4,46,47,69,65,57,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),sx=E.lazy(()=>ke(()=>import("./index-D1lfq5iZ.js"),__vite__mapDeps([80,1,12,13,81,20,16,14,4,46,47,69,65,57,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),R3=E.lazy(()=>ke(()=>import("./index-h1Useskt.js"),__vite__mapDeps([82,1,23,8,81,14,13,12,11,3,4,83,45,46,47,48,44,31,19]),import.meta.url).then(n=>({default:n.McpServersPage}))),ix=E.lazy(()=>ke(()=>import("./index-Btm8FtTQ.js"),__vite__mapDeps([84,1,23,14,13,41,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),D3=E.lazy(()=>ke(()=>import("./index-C-QQ5rKF.js"),__vite__mapDeps([85,1,3,4,7,8,9,11,12,13,81,31,14,20,47,49,86,87,33]),import.meta.url).then(n=>({default:n.UsersPage}))),L3=E.lazy(()=>ke(()=>import("./RolesPage-B_3qWsvQ.js"),__vite__mapDeps([88,1,12,13,14,20,4]),import.meta.url).then(n=>({default:n.RolesPage}))),q3=E.lazy(()=>ke(()=>import("./RoleDetailPage-ClYgn-3d.js"),__vite__mapDeps([89,1,90,81,13,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),P3=E.lazy(()=>ke(()=>import("./PersonasPage-Bs097x07.js"),__vite__mapDeps([91,1,86,12,13,14,20,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),B3=E.lazy(()=>ke(()=>import("./PersonaDetailPage-CDktk1mi.js"),__vite__mapDeps([92,1,86,20,13,87,90,81,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),U3=E.lazy(()=>ke(()=>import("./EscalationSchemaPage-D8YVQNph.js"),__vite__mapDeps([93,1,65,13,57,19,4,54,16]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),z3=E.lazy(()=>ke(()=>import("./PortalPage-DjfjerpF.js"),__vite__mapDeps([94,1,9,56,13,57,19,4,7,8,58,59,21,11,60,12,61,20,16,62]),import.meta.url).then(n=>({default:n.PortalPage}))),I3=E.lazy(()=>ke(()=>import("./EscalationListSchemaPage-CqCd-y6B.js"),__vite__mapDeps([95,1,13,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),$3=E.lazy(()=>ke(()=>import("./ScanCodesPage-CIIDuh8w.js"),__vite__mapDeps([96,1,97,14,13,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),H3=E.lazy(()=>ke(()=>import("./ScanSchemeDetailPage-Bd3P3eyh.js"),__vite__mapDeps([98,1,81,14,13,97,4]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),F3=E.lazy(()=>ke(()=>import("./ScanStationPage-BiO34nov.js"),__vite__mapDeps([99,1,13,66,59,21,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),G3=E.lazy(()=>ke(()=>import("./index-czgLyfSo.js"),__vite__mapDeps([100,1,14,13,54,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),ax=E.lazy(()=>ke(()=>import("./OperationsPage-gOVMrL_a.js").then(n=>n.O),__vite__mapDeps([101,1,60,13,4,14,9]),import.meta.url).then(n=>({default:n.OperationsPage}))),V3=E.lazy(()=>ke(()=>import("./index-ujGmmwl6.js"),__vite__mapDeps([102,1,18,13,12,3,4,29,26,42,79,7,8,9,31]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),Y3=E.lazy(()=>ke(()=>import("./index-C1iuZ4Q5.js"),__vite__mapDeps([103,1,36,13,3,4,29,26,6,7,8,9,11,12,14,15]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),K3=E.lazy(()=>ke(()=>import("./CredentialsPage-CPVbYQow.js"),__vite__mapDeps([104,1,14,13,49,81,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),J3=E.lazy(()=>ke(()=>import("./ConnectedAppsPage-DG2YZGN3.js"),__vite__mapDeps([105,1,14,13,49,81,4]),import.meta.url).then(n=>({default:n.ConnectedAppsPage}))),Q3=E.lazy(()=>ke(()=>import("./index-CDxOQ84B.js"),__vite__mapDeps([106,1,4,14,13,12,15,6,8,107,49]),import.meta.url).then(n=>({default:n.FilesPage}))),X3=E.lazy(()=>ke(()=>import("./index-CptTEhWp.js"),__vite__mapDeps([108,1,14,13,12,15,11,8,107,49,109,41,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),W3=E.lazy(()=>ke(()=>import("./HomePage-HVw7T5ER.js"),__vite__mapDeps([110,1,24,26,20,13,16,15,101,60,4,14,9,52]),import.meta.url).then(n=>({default:n.HomePage}))),Z3=E.lazy(()=>ke(()=>import("./AgentsPage-Dsk9iHps.js"),__vite__mapDeps([111,1,112,3,4,6,7,8,9,11,12,13,14,15]),import.meta.url).then(n=>({default:n.AgentsPage}))),e5=E.lazy(()=>ke(()=>import("./AgentDetailPage-nDbZo6RB.js"),__vite__mapDeps([113,1,112,114,13,16,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),ox=E.lazy(()=>ke(()=>import("./AgentConfigPage-Exjtjbvp.js"),__vite__mapDeps([115,1,112,114,13,14,109,45,46,47,25,116,117,16,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),t5=E.lazy(()=>ke(()=>import("./CapabilitiesPage-BKIlrQfU.js"),__vite__mapDeps([118,1,116,83,23,45,46,47,13,48,4,44,14,12]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),n5=E.lazy(()=>ke(()=>import("./TopicsPage-CJZnv50y.js"),__vite__mapDeps([119,1,117,14,13,12,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),r5=E.lazy(()=>ke(()=>import("./TopicDetailPage-CjkAAyy8.js"),__vite__mapDeps([120,1,117,15,13,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function s5(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function Ee({children:n}){return h.jsx(E.Suspense,{fallback:h.jsx(s5,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const Wv=new fS({defaultOptions:{queries:{staleTime:1e4,retry:(n,e)=>e instanceof Error&&e.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{Wv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",e=`${n}/login`;if(window.location.pathname!==e){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${e}?returnTo=${encodeURIComponent(i)}`}});const i5=mS([{path:"/login",element:h.jsx(QC,{})},{path:"/connect/anthropic",element:h.jsx(nx,{})},{path:"/connect/:provider",element:h.jsx(nx,{})},{path:"/oauth/consent",element:h.jsx(i3,{})},{path:"/",element:h.jsx(YC,{}),children:[{index:!0,element:h.jsx(Ee,{children:h.jsx(W3,{})})},{path:"processes/all",element:h.jsx(Ee,{children:h.jsx(c3,{})})},{path:"processes/detail/:originId",element:h.jsx(Ee,{children:h.jsx(u3,{})})},{path:"credentials",element:h.jsx(Ee,{children:h.jsx(K3,{})})},{path:"connected-apps",element:h.jsx(Ee,{children:h.jsx(J3,{})})},{path:"connections",element:h.jsx(Sn,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(Ee,{children:h.jsx(y3,{})})},{path:"escalations/available",element:h.jsx(Ee,{children:h.jsx(g3,{})})},{path:"escalations/queue",element:h.jsx(Ee,{children:h.jsx(b3,{})})},{path:"escalations/detail/:id",element:h.jsx(Ee,{children:h.jsx(x3,{})})},{path:"portal/:role/:portal?",element:h.jsx(Ee,{children:h.jsx(z3,{})})},{path:"scan/station",element:h.jsx(Ee,{children:h.jsx(F3,{})})},{path:"capabilities",element:h.jsx(Ee,{children:h.jsx(t5,{})})},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"agents",element:h.jsx(Ee,{children:h.jsx(Z3,{})})},{path:"agents/new",element:h.jsx(Ee,{children:h.jsx(ox,{})})},{path:"agents/:id",element:h.jsx(Ee,{children:h.jsx(e5,{})})},{path:"agents/:id/edit",element:h.jsx(Ee,{children:h.jsx(ox,{})})},{path:"topics",element:h.jsx(Ee,{children:h.jsx(n5,{})})},{path:"topics/:topic",element:h.jsx(Ee,{children:h.jsx(r5,{})})}]},{element:h.jsx(a3,{}),children:[{path:"workflows/start",element:h.jsx(Ee,{children:h.jsx(_3,{})})},{path:"workflows/durable/invoke",element:h.jsx(Ee,{children:h.jsx(w3,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(Ee,{children:h.jsx(v3,{})})},{path:"workflows/executions",element:h.jsx(Ee,{children:h.jsx(E3,{})})},{path:"workflows/durable/executions",element:h.jsx(Ee,{children:h.jsx(S3,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(Ee,{children:h.jsx(rx,{})})},{path:"workflows/tasks",element:h.jsx(Ee,{children:h.jsx(k3,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(Ee,{children:h.jsx(N3,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(Ee,{children:h.jsx(rx,{})})},{path:"workflows/cron",element:h.jsx(Sn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(Ee,{children:h.jsx(C3,{})})},{path:"workflows/registry",element:h.jsx(Ee,{children:h.jsx(M3,{})})},{path:"workflows/registry/new",element:h.jsx(Ee,{children:h.jsx(sx,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(Ee,{children:h.jsx(sx,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(Ee,{children:h.jsx(O3,{})})},{path:"mcp/workflows/invoke",element:h.jsx(Ee,{children:h.jsx(A3,{})})},{path:"mcp/workflows/:id",element:h.jsx(Ee,{children:h.jsx(j3,{})})},{path:"mcp/executions",element:h.jsx(Ee,{children:h.jsx(h3,{})})},{path:"mcp/executions/:jobId",element:h.jsx(Ee,{children:h.jsx(d3,{})})},{path:"files",element:h.jsx(Ee,{children:h.jsx(Q3,{})})},{path:"knowledge",element:h.jsx(Ee,{children:h.jsx(X3,{})})},{element:h.jsx(o3,{}),children:[{path:"mcp",element:h.jsx(Ee,{children:h.jsx(f3,{})})},{path:"mcp/queries",element:h.jsx(Ee,{children:h.jsx(m3,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(Ee,{children:h.jsx(p3,{})})},{path:"mcp/tools",element:h.jsx(Sn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(Ee,{children:h.jsx(R3,{})})},{path:"mcp/servers/new",element:h.jsx(Ee,{children:h.jsx(ix,{})})},{path:"mcp/servers/:serverId",element:h.jsx(Ee,{children:h.jsx(ix,{})})}]}]},{path:"pace",element:h.jsx(Ee,{children:h.jsx(ax,{})})},{path:"trends",element:h.jsx(Ee,{children:h.jsx(ax,{})})},{path:"operations",element:h.jsx(Sn,{to:"/pace",replace:!0})},{element:h.jsx(po,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(Ee,{children:h.jsx(T3,{})})},{path:"admin/users",element:h.jsx(Ee,{children:h.jsx(D3,{})})},{path:"admin/escalation-chains",element:h.jsx(Sn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(Ee,{children:h.jsx(L3,{})})},{path:"admin/roles/:role",element:h.jsx(Ee,{children:h.jsx(q3,{})})},{path:"admin/roles/:role/schema",element:h.jsx(Ee,{children:h.jsx(U3,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(Ee,{children:h.jsx(I3,{})})},{path:"admin/scan-codes",element:h.jsx(Ee,{children:h.jsx($3,{})})},{path:"admin/scan-codes/:version",element:h.jsx(Ee,{children:h.jsx(H3,{})})},{path:"admin/personas",element:h.jsx(Ee,{children:h.jsx(P3,{})})},{path:"admin/personas/:key",element:h.jsx(Ee,{children:h.jsx(B3,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(Sn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(l3,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(Ee,{children:h.jsx(G3,{})})}]},{path:"admin/controlplane",element:h.jsx(Ee,{children:h.jsx(V3,{})})},{path:"admin/streams",element:h.jsx(Ee,{children:h.jsx(Y3,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function a5(){return h.jsx(hS,{client:Wv,children:h.jsx(aE,{children:h.jsx(uA,{children:h.jsx(pS,{router:i5})})})})}Sv(wv());const Gm=document.createElement("link");Gm.rel="stylesheet";Gm.href=`${Vt}/api/settings/custom.css`;document.head.appendChild(Gm);QS.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(a5,{})}));export{qt as $,Gk as A,AM as B,Fm as C,MC as D,q5 as E,Gv as F,jM as G,Dm as H,TT as I,dC as J,CT as K,zT as L,XN as M,Xt as N,ev as O,C5 as P,Tm as Q,V5 as R,tC as S,Y5 as T,K5 as U,J5 as V,Q5 as W,W5 as X,zj as Y,Mu as Z,L5 as _,LM as a,pM as a$,nm as a0,qT as a1,w5 as a2,MM as a3,Pm as a4,ta as a5,xs as a6,I5 as a7,E5 as a8,mv as a9,qM as aA,$v as aB,BM as aC,DM as aD,gv as aE,tM as aF,IM as aG,RM as aH,HM as aI,$M as aJ,m5 as aK,p5 as aL,x5 as aM,v5 as aN,y5 as aO,g5 as aP,b5 as aQ,A5 as aR,k5 as aS,j5 as aT,NM as aU,_5 as aV,Nm as aW,N5 as aX,PT as aY,T5 as aZ,S5 as a_,wT as aa,Nk as ab,xM as ac,Yk as ad,dc as ae,H5 as af,F5 as ag,Pu as ah,Vk as ai,zN as aj,kM as ak,Av as al,Cu as am,Um as an,Uj as ao,xA as ap,B5 as aq,uM as ar,U5 as as,G5 as at,X5 as au,Lj as av,Ug as aw,h5 as ax,zM as ay,PM as az,sM as b,js as b0,Eo as b1,FM as b2,Lx as b3,sk as b4,XC as b5,dM as b6,Vt as b7,wd as b8,d5 as b9,Kk as bA,je as bB,vM as bC,R5 as bD,aM as bE,WN as bF,GM as bG,VM as bH,Xv as bI,YM as bJ,KM as bK,Am as bL,tv as bM,fM as bN,RT as ba,CM as bb,pv as bc,Y1 as bd,jv as be,cM as bf,jm as bg,oM as bh,gM as bi,kj as bj,yM as bk,fr as bl,rv as bm,mM as bn,ea as bo,O5 as bp,Uk as bq,wM as br,bk as bs,EM as bt,OM as bu,_M as bv,SM as bw,xT as bx,Im as by,mk as bz,er as c,bM as d,Z5 as e,pk as f,bv as g,tk as h,M5 as i,tn as j,An as k,eM as l,ue as m,UM as n,nM as o,rM as p,P5 as q,z5 as r,$5 as s,iM as t,hM as u,D5 as v,Hm as w,TM as x,Qx as y,lM as z};
67
- //# sourceMappingURL=index-BaCDL5fh.js.map
64
+ `}function TC(n){const e=n.summary,s=n.title;if(e){const i=e.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?e.slice(0,i).trim():e}return s||(typeof n=="string"?n:"Query completed.")}const Jv=E.createContext(null);function CC({children:n}){const e=en(),[s,i]=E.useState(!1),[o,c]=E.useState([]),[m,p]=E.useState(null),[g,u]=E.useState({}),d=E.useRef(null),b={page:e.pathname.split("/").filter(Boolean).join("-")||"home",route:e.pathname,params:{},...g,suggestedTags:g.suggestedTags??kC(e.pathname)};E.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const x=E.useCallback(()=>i(P=>!P),[]),v=E.useCallback(P=>{u(P)},[]),_=E.useCallback(()=>{c([]),p(null)},[]),S=E.useCallback(async P=>{var z;const q=new Date().toISOString(),ne={id:`user-${Date.now()}`,role:"user",content:P,timestamp:q},te={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:q,pending:!0};c(I=>[...I,ne,te]);const M={...b};(z=M.entities)!=null&&z.yamlContent&&M.entities.yamlContent.length>ex&&(M.entities={...M.entities,yamlContent:M.entities.yamlContent.slice(0,ex)+`
65
+ ... (truncated)`});const ae=`${NC(o.concat(ne))}${P}`;try{const D=(await ue("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:M.suggestedTags,context:M,wait:!1,direct:!0})})).workflow_id;p(D),c(X=>X.map(W=>W.id===te.id?{...W,workflowId:D}:W)),d.current&&clearInterval(d.current),d.current=setInterval(async()=>{var X;try{const W=await ue(`/workflows/${D}/result`),he=(X=W==null?void 0:W.result)==null?void 0:X.data;if(he){d.current&&clearInterval(d.current),d.current=null,p(null);const we=TC(he);let Oe;try{Oe=(await ue(`/workflow-states/${D}/execution`)).duration_ms}catch{}c(F=>F.map(J=>J.id===te.id?{...J,content:we,timestamp:new Date().toISOString(),pending:!1,durationMs:Oe}:J))}}catch{}},3e3)}catch{c(I=>I.map(D=>D.id===te.id?{...D,content:"Failed to submit query. Please try again.",pending:!1}:D))}},[o,b]),C=E.useCallback(async P=>{const q=o.find(M=>M.id===P);if(!(q!=null&&q.workflowId)||q.compilationStatus==="compiling"||q.compilationStatus==="done")return;const ne=o.indexOf(q),te=o.slice(0,ne).reverse().find(M=>M.role==="user");if(te){c(M=>M.map(U=>U.id===P?{...U,compilationStatus:"compiling"}:U));try{const M=await ue("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:te.content,summary:q.content})}),U=await ue("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:q.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:M.tool_name,description:M.description,tags:M.tags,app_id:""})});await ue(`/yaml-workflows/${U.id}/deploy`,{method:"POST"}),c(ae=>ae.map(z=>z.id===P?{...z,compilationStatus:"done"}:z))}catch(M){const U=M instanceof Error?M.message:"Compilation failed";c(ae=>ae.map(z=>z.id===P?{...z,compilationStatus:"error",compilationError:U}:z))}}},[o]);return h.jsx(Jv.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:m,clearMessages:_,compileMessage:C},children:n})}function Qv(){const n=E.useContext(Jv);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function MC(){const{helpOpen:n,toggleHelp:e}=Qv();return h.jsx("button",{onClick:e,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":n?"Close help":"Ask for help",children:n?h.jsx(Zt,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Vt}/logo512.png)`}})})}function RC({ms:n,className:e=""}){const s=yk(n),i=E.useMemo(()=>n==null?[]:[{label:"ms",value:String(n)},{label:"sec",value:`${(n/1e3).toFixed(3)}s`},{label:"text",value:s}],[n,s]);return n==null?h.jsx("span",{className:`text-xs text-text-tertiary ${e}`,children:"--"}):h.jsx(bv,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${e}`,children:s})})}const DC=["sm","md","lg","full"],tx={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"},nx={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function LC({which:n}){const e="stroke-current";switch(n){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:e,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:e,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:e,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:e,strokeWidth:"1.5"})})}}function qC({msg:n}){const[e,s]=E.useState(0);E.useEffect(()=>{const m=new Date(n.timestamp).getTime(),p=()=>s(Math.floor((Date.now()-m)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(e/60),o=e%60,c=i>0?`${i}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),n.workflowId&&h.jsxs(ar,{to:`/workflows/executions/${n.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(am,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function PC({msg:n,compileMessage:e}){const s=n.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(xv,{date:n.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),n.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(RC,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(ar,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(am,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>e(n.id),disabled:n.compilationStatus==="compiling"||n.compilationStatus==="done",className:"transition-colors",title:n.compilationStatus==="done"?"Compiled — future queries will match this pipeline":n.compilationStatus==="error"?n.compilationError??"Compilation failed":n.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx($S,{className:`w-2.5 h-2.5 ${n.compilationStatus==="done"?"text-status-success":n.compilationStatus==="error"?"text-status-error":n.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function BC(){const{helpOpen:n,setHelpOpen:e,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:m,compileMessage:p}=Qv(),[g,u]=E.useState(""),[d,b]=E.useState("md"),[x,v]=E.useState(!0),_=E.useRef(null),S=E.useRef(null);if(E.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[s]),E.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),E.useEffect(()=>{if(!n)return;const M=U=>{U.key==="Escape"&&(d==="full"?b("lg"):d==="lg"?b("md"):d==="md"?b("sm"):e(!1))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[n,d,e]),!n)return null;const C=()=>{const M=g.trim();!M||c||(i(M),u(""),S.current&&(S.current.style.height="auto"))},P=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),C())},q=d==="full",ne=o.page.replace(/-/g," "),te=q?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${q?tx.full:`right-6 ${tx[d]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:te,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ne})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:DC.map(M=>h.jsx("button",{onClick:()=>b(M),className:`p-1 rounded transition-colors ${M===d?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":M===d,"aria-label":nx[M],title:nx[M],children:h.jsx(LC,{which:M})},M))}),s.length>0&&h.jsx("button",{onClick:m,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(HS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>e(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:_,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(M=>h.jsxs("div",{className:`text-xs leading-relaxed ${M.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${M.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:M.pending?h.jsx(qC,{msg:M}):M.role==="assistant"?h.jsx(Pu,{content:M.content}):M.content}),!M.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(PC,{msg:M,compileMessage:p})})]},M.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:S,value:g,onChange:M=>{u(M.target.value);const U=M.target;U.style.height="auto",U.style.height=`${Math.min(U.scrollHeight,120)}px`},onKeyDown:P,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}),h.jsx("button",{onClick:C,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:h.jsx(FS,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const UC=6e3,zC="scan";function IC(){const{lastResult:n}=$m(),{open:e,ownerKey:s}=Lm(),[i,o]=E.useState(null);return E.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),UC);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||e&&s===zC||n.source===To.TOOLBAR?null:h.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:h.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[h.jsx(Mo,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx(Hm,{result:n})}),h.jsx("button",{type:"button",onClick:()=>o(n.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:h.jsx(Zt,{className:"w-3.5 h-3.5"})})]})})}const Xv="lt-announcement-dismissed:",$C="Live updates unavailable. Reconnecting… Refresh if this persists.";function HC(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FC(n){try{return localStorage.getItem(`${Xv}${n}`)==="1"}catch{return!1}}function GC(){const{isAuthenticated:n,userRoleNames:e}=qt(),{data:s}=gv(n),i=Be(),[o,c]=E.useState(null),[m,p]=E.useState(0),{unavailable:g}=dO();An(hk,()=>{i.invalidateQueries({queryKey:["announcements"]})});const u=Date.now(),d=((s==null?void 0:s.announcements)??[]).filter(x=>!FC(x.id)&&new Date(x.expires_at).getTime()>u&&(x.roles.length===0||x.roles.some(v=>e.includes(v))));if(E.useEffect(()=>{const x=((s==null?void 0:s.announcements)??[]).map(_=>new Date(_.expires_at).getTime()-Date.now()).filter(_=>_>0);if(x.length===0)return;const v=setTimeout(()=>p(_=>_+1),Math.min(...x)+250);return()=>clearTimeout(v)},[s,m]),d.length===0&&!g)return null;const b=x=>{try{localStorage.setItem(`${Xv}${x}`,"1")}catch{}p(v=>v+1)};return h.jsxs("div",{"data-testid":"announcement-banner",className:"relative z-40",children:[g&&h.jsx("div",{"data-testid":"live-updates-notice",role:"status",className:"border-b border-status-warning/25 bg-status-warning/10",children:h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-status-warning",children:"Notice"}),h.jsx("span",{className:"truncate text-xs text-text-primary",children:$C})]})}),d.map(x=>{const v=o===x.id,_=x.title??x.body.split(`
66
+ `)[0];return h.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),h.jsxs("button",{type:"button",onClick:()=>c(v?null:x.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[h.jsx("span",{className:"truncate",children:_}),v?h.jsx(px,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(im,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>b(x.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${_}`,children:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(Pu,{content:HC(x.body)})})]},x.id)})]})}function VC(){var U,ae;const{isBuilder:n,isOps:e,viewAs:s}=tv(),{canSeePaceBoard:i}=nv();SA();const{data:o}=er();Dj((U=o==null?void 0:o.display)==null?void 0:U.timeZone);const c=Xx(),m=c!==null?c:!!((ae=o==null?void 0:o.ai)!=null&&ae.enabled),{collapsed:p,toggle:g}=Rm(),[u,d]=E.useState(!1),[b,x]=E.useState(!1),[v,_]=E.useState(!1),[S,C]=E.useState(()=>window.location.hash.startsWith("#docs")),P=en(),q=E.useRef(null),{kiosk:ne,homePath:te}=Cm(),M=ne||Yj(P.pathname);return E.useEffect(()=>{const z=q.current;z&&(z.classList.remove("animate-page-in"),z.offsetWidth,z.classList.add("animate-page-in"))},[P.pathname]),E.useEffect(()=>{const z=()=>{window.location.hash.startsWith("#docs")&&C(!0)};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]),ne&&te&&!Xj(P.pathname,P.search)?h.jsx(Sn,{to:te,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(OT,{onToggleEventFeed:()=>d(z=>!z),onToggleDocs:()=>C(z=>!z),onToggleNav:M?void 0:()=>x(z=>!z)}),h.jsx(GC,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!M&&h.jsxs("aside",{className:`${p?"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:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Fv,{aiEnabled:m,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${p?"flex justify-center":"flex items-center px-7"}`,"aria-label":p?"Expand sidebar":"Collapse sidebar",children:p?h.jsx(GS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(VS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!p&&(o==null?void 0:o.environment)&&h.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${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:q,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(ei,{})})}),h.jsx(YC,{})]}),!M&&h.jsx(WT,{open:b,onClose:()=>x(!1),aiEnabled:m,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i}),h.jsx(gC,{open:u,onToggle:()=>d(z=>!z),configOpen:v,onToggleConfig:()=>_(z=>!z)}),h.jsx(jC,{open:S,onClose:()=>{C(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),m&&h.jsx(MC,{}),m&&h.jsx(BC,{}),h.jsx(IC,{})]})}function YC(){const{node:n,width:e,open:s}=Lm();return h.jsx(nk,{open:s,width:e,className:"border-l border-surface-border bg-surface-raised",children:n})}function KC(){const{isAuthenticated:n}=qt(),e=en();return n?h.jsx(Zj,{children:h.jsx(tk,{children:h.jsx(CC,{children:h.jsx(vA,{children:h.jsx(Qk,{children:h.jsx(VC,{})})})})})}):h.jsx(Sn,{to:"/login",state:{from:e.pathname},replace:!0})}function Wv({provider:n,className:e="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:[h.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"}),h.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"}),h.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"}),h.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 h.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:h.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 h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:h.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 h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function JC(){return ue("/auth/oauth/providers")}async function QC(n,e){const s=e?`?label=${encodeURIComponent(e)}`:"";return ue(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function YM(){return qe({queryKey:["oauth-connections"],queryFn:()=>ue("/auth/oauth/connections")})}function KM(){const n=Be();return Fe({mutationFn:({provider:e,label:s})=>QC(e,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function XC(){var ae;const{login:n,isAuthenticated:e}=qt(),s=ni(),i=en(),o=new URLSearchParams(i.search),c=o.get("token"),m=o.get("error"),p=((ae=i.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=E.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[u,d]=E.useState(""),[b,x]=E.useState(""),[v,_]=E.useState(m||""),[S,C]=E.useState(!1),[P,q]=E.useState(!!c),[ne,te]=E.useState([]),M=E.useRef(!1);if(E.useEffect(()=>{c||M.current||(M.current=!0,(async()=>{var z,I,D,X;try{const W=await lm().catch(()=>null);if(!((z=W==null?void 0:W.auth)!=null&&z.sso))return;const he=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!he.ok){_("Host authentication required — please log in to your organization first");return}const we=await he.json();we.token&&((I=W.auth)!=null&&I.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",W.auth.ssoLogoutUrl),q(!0),n(we.token,void 0,{displayName:(D=we.user)==null?void 0:D.display_name,username:(X=we.user)==null?void 0:X.external_id}))}catch{}})())},[]),E.useEffect(()=>{c||JC().then(te).catch(()=>{})},[]),E.useEffect(()=>{if(!P)return;const z=setTimeout(()=>s(p,{replace:!0}),1500);return()=>clearTimeout(z)},[P]),e&&!P)return h.jsx(Sn,{to:p,replace:!0});const U=async z=>{var I,D;if(z.preventDefault(),_(""),!u.trim()||!b){_("Username and password are required");return}C(!0);try{const X=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.trim(),password:b})}),W=await X.json();if(!X.ok){_(W.error||"Login failed");return}q(!0),n(W.token,{username:u.trim(),password:b},{displayName:(I=W.user)==null?void 0:I.display_name,username:(D=W.user)==null?void 0:D.external_id})}catch{_("Unable to connect to server")}finally{C(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${P?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Ru,{size:"lg",hideLabel:P})}),h.jsxs("form",{onSubmit:U,className:`space-y-5 transition-opacity duration-300 ${P?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:u,onChange:z=>d(z.target.value),className:"input",placeholder:"Enter your username",autoFocus:!P,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:b,onChange:z=>x(z.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),v&&h.jsx("p",{className:"text-sm text-status-error",children:v}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||P,children:S?"Signing in...":"Sign In"}),ne.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:ne.filter(z=>z.provider!=="anthropic").map(z=>h.jsxs("a",{href:`${Vt}/api/auth/oauth/${z.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(Wv,{provider:z.provider}),"Sign in with ",z.name]},z.provider))})]})]})]})})}function rx(){const{isAuthenticated:n}=qt(),e=ni(),s=en(),i=new URLSearchParams(s.search),o=i.get("state")||"";E.useEffect(()=>{n||e(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,m]=E.useState(""),[p,g]=E.useState(i.get("label")||"default"),[u,d]=E.useState(""),[b,x]=E.useState(!1),v=c.trim().startsWith("sk-ant-oat"),_=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const P=c.trim();if(!P){d("A token or API key is required");return}if(!P.startsWith("sk-ant-")){d('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}x(!0),d("");const q=`${Vt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(P)}&state=${encodeURIComponent(o)}`;window.location.href=q};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Ru,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(Wv,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),h.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."}),h.jsxs("form",{onSubmit:S,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:c,onChange:C=>m(C.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),v&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),_&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:p,onChange:C=>g(C.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.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").'})]}),u&&h.jsx("p",{className:"text-sm text-status-error",children:u}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.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."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.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 WC({items:n,columns:e=1}){if(n.length===0)return null;const s=e>=2&&n.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return h.jsx("div",{className:"@container",children:h.jsx("dl",{className:`grid ${s} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:n.map(({key:i,label:o,value:c})=>h.jsxs(E.Fragment,{children:[h.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:o}),h.jsx("dd",{className:"text-sm text-text-primary break-words whitespace-pre-wrap min-w-0","data-field-key":i,children:ZC(c)})]},i))})})}function ZC(n){return n==null||n===""?"—":typeof n=="boolean"?n?"Yes":"No":typeof n=="object"?JSON.stringify(n):String(n)}function e3(n){return qe({queryKey:["oauth-client",n],queryFn:()=>ue(`/oauth/clients/${encodeURIComponent(n)}`),enabled:!!n,retry:!1})}function t3(n){return qe({queryKey:["oauth-presets"],queryFn:()=>ue("/oauth/presets"),enabled:n})}function n3(){return Fe({mutationFn:n=>ue(n.preset?"/oauth/authorize":"/oauth/deny",{method:"POST",body:JSON.stringify(n.preset?{...n.request,preset:n.preset}:n.request)})})}function JM(){return qe({queryKey:["oauth-grants"],queryFn:()=>ue("/oauth/grants")})}function QM(){const n=Be();return Fe({mutationFn:e=>ue(`/oauth/grants/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["oauth-grants"]})})}const r3=["client_id","redirect_uri","code_challenge","code_challenge_method","response_type","state","scope","resource"],yd={read_only:{action:"Allow read-only",effect:"Reads what you can read and runs workflows marked read-safe."},just_me:{action:"Allow as me",effect:"Acts with your full rights: claims, resolves, invokes, and administers wherever you may."}};function s3(n){const e=new URLSearchParams(n),s=r3.map(o=>[o,e.get(o)??void 0]),i=Object.fromEntries(s);return!i.client_id||!i.redirect_uri||!i.code_challenge?null:i}function i3(n){try{return new URL(n).host}catch{return n}}function a3(){var b,x,v;const{isAuthenticated:n,user:e}=qt(),s=ni(),i=en(),o=E.useMemo(()=>s3(i.search),[i.search]);E.useEffect(()=>{n||s(`/login?returnTo=${encodeURIComponent(i.pathname+i.search)}`,{replace:!0})},[n]);const c=e3(n&&o?o.client_id:null),m=t3(n&&!!o),p=n3(),g=_=>{o&&p.mutate({request:o,preset:_},{onSuccess:({redirect:S})=>window.location.assign(S)})};if(!n)return null;const u=!o||c.isError,d=((b=c.data)==null?void 0:b.client_name)||"An app";return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-lg p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Ru,{size:"lg"})}),u?h.jsxs("div",{role:"alert",children:[h.jsx("h2",{className:"heading-3 mb-3",children:"Sign-in link not valid"}),h.jsx("p",{className:"text-sm text-text-secondary",children:"Start the connection again from the app."})]}):h.jsxs(h.Fragment,{children:[h.jsxs("h2",{className:"heading-2 mb-2",children:["Connect ",d]}),h.jsxs("p",{className:"text-sm text-text-secondary mb-6",children:["Pick how much ",d," may do as you. Disconnect it any time under Connected apps."]}),h.jsx("div",{className:"mb-8",children:h.jsx(WC,{items:[{key:"app",label:"App",value:d},{key:"account",label:"Account",value:(e==null?void 0:e.displayName)||(e==null?void 0:e.username)||(e==null?void 0:e.userId)||null},{key:"returns-to",label:"Returns to",value:i3(o.redirect_uri)},{key:"deployment",label:"Deployment",value:window.location.host}]})}),h.jsx("dl",{className:"space-y-3 mb-8",children:(((x=m.data)==null?void 0:x.presets)??[]).map(_=>h.jsxs("div",{children:[h.jsx("dt",{className:"text-sm font-medium text-text-primary",children:yd[_].action}),h.jsx("dd",{className:"text-sm text-text-secondary",children:yd[_].effect})]},_))}),p.isError&&h.jsx("p",{className:"text-sm text-status-error mb-4",role:"alert",children:p.error.message}),h.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[(((v=m.data)==null?void 0:v.presets)??[]).map(_=>h.jsx("button",{type:"button",className:_==="read_only"?"btn-primary":"btn-secondary",disabled:p.isPending||c.isLoading,onClick:()=>g(_),children:yd[_].action},_)),h.jsx("button",{type:"button",className:"btn-ghost",disabled:p.isPending,onClick:()=>g(null),children:"Deny"})]})]})]})})}function po({roleTypes:n,roleNames:e,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=qt();return i?h.jsx(ei,{}):n&&n.some(m=>c(m))?h.jsx(ei,{}):e&&e.some(m=>o(m))?h.jsx(ei,{}):h.jsx(Sn,{to:s,replace:!0})}function o3(){const{data:n,isSuccess:e}=Hv();return e&&n.length===0?h.jsx(Sn,{to:"/",replace:!0}):h.jsx(ei,{})}function l3({redirectTo:n="/"}){var i;const{data:e,isLoading:s}=er();return s||!e?null:(i=e.ai)!=null&&i.enabled?h.jsx(ei,{}):h.jsx(Sn,{to:n,replace:!0})}function c3({flag:n,redirectTo:e="/"}){var o;const{data:s,isLoading:i}=er();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(Sn,{to:e,replace:!0}):h.jsx(ei,{})}const u3=E.lazy(()=>ke(()=>import("./ProcessesListPage-assXQe-x.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(n=>({default:n.ProcessesListPage}))),f3=E.lazy(()=>ke(()=>import("./ProcessDetailPage-Cp5-969g.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,4,20,21]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),h3=E.lazy(()=>ke(()=>import("./McpOverview-DmH-qtX9.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,4]),import.meta.url).then(n=>({default:n.McpOverview}))),d3=E.lazy(()=>ke(()=>import("./McpRunsPage-DVXVB4AJ.js"),__vite__mapDeps([28,1,24,25,3,4,29,26,6,7,8,9,16,13,30,14,12,11,15,31]),import.meta.url).then(n=>({default:n.McpRunsPage}))),m3=E.lazy(()=>ke(()=>import("./McpRunDetailPage-DNdl10nB.js"),__vite__mapDeps([32,1,24,14,13,33,34,12,35,19,4,36,15,37]),import.meta.url).then(n=>({default:n.McpRunDetailPage}))),p3=E.lazy(()=>ke(()=>import("./McpQueryPage-DX1T-Ugq.js"),__vite__mapDeps([38,1,14,13,7,8,9,12,11,15,6,10,30,16,31,3,4,39]),import.meta.url).then(n=>({default:n.McpQueryPage}))),y3=E.lazy(()=>ke(()=>import("./McpQueryDetailPage-B-qtmwLd.js"),__vite__mapDeps([40,1,14,13,19,39,4,25,41,42,24,2,43,44,45,46,47,48,37,49,35,36]),import.meta.url).then(n=>({default:n.McpQueryDetailPage}))),g3=E.lazy(()=>ke(()=>import("./EscalationsOverview-Bl8g53x-.js"),__vite__mapDeps([50,1,14,13,27,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),b3=E.lazy(()=>ke(()=>import("./AvailableEscalationsPage-DU84iaBN.js"),__vite__mapDeps([51,1,4,52,13,53,54,5,55,56,57,19,7,8,9,58,59,21,11,60,12,61,20,16,62,3,31]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),x3=E.lazy(()=>ke(()=>import("./OperatorDashboard-Cw86vOPg.js"),__vite__mapDeps([63,1,3,4,5,6,52,7,8,9,11,31,58,57,19,13,59,21,60,12,61,20,16,62,55,15]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),v3=E.lazy(()=>ke(()=>import("./index-kGSUZCOb.js"),__vite__mapDeps([64,1,65,13,57,19,4,54,16,53,5,14,15,20,62,37,21,66]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),_3=E.lazy(()=>ke(()=>import("./WorkflowsOverview-DwVMLe1y.js"),__vite__mapDeps([67,1,14,13,27,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),w3=E.lazy(()=>ke(()=>import("./index-AJNPDsTI.js"),__vite__mapDeps([68,1,14,13,12,16,65,57,19,4,54,69,46,47]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),S3=E.lazy(()=>ke(()=>import("./index-AJNPDsTI.js"),__vite__mapDeps([68,1,14,13,12,16,65,57,19,4,54,69,46,47]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),E3=E.lazy(()=>ke(()=>import("./WorkflowsDashboard-CMJPiR6G.js"),__vite__mapDeps([70,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"durable"})}))),O3=E.lazy(()=>ke(()=>import("./WorkflowsDashboard-CMJPiR6G.js"),__vite__mapDeps([70,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"all"})}))),A3=E.lazy(()=>ke(()=>import("./YamlWorkflowsPage-8Sr6rZMZ.js"),__vite__mapDeps([71,1,25,3,4,14,13,12,8,48,69,19]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),j3=E.lazy(()=>ke(()=>import("./GraphInvokePage-HQEvbHTd.js"),__vite__mapDeps([72,1,25,14,13,43,45,46,47,44,4,48,69]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),k3=E.lazy(()=>ke(()=>import("./YamlWorkflowDetailPage-Do6s_wmW.js"),__vite__mapDeps([73,1,25,19,69,13,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),N3=E.lazy(()=>ke(()=>import("./TasksListPage-DyLaZvTT.js"),__vite__mapDeps([74,1,2,3,4,7,8,9,19,61,49,11,12,13,14,16]),import.meta.url).then(n=>({default:n.TasksListPage}))),T3=E.lazy(()=>ke(()=>import("./TaskDetailPage-BJGKEnIo.js"),__vite__mapDeps([75,1,2,19,61,14,13,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),sx=E.lazy(()=>ke(()=>import("./WorkflowExecutionPage-DQITqX-6.js"),__vite__mapDeps([76,1,34,12,13,35,19,4,36,2,14,33,15,37]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),C3=E.lazy(()=>ke(()=>import("./AdminDashboard-C_0ShYrm.js"),__vite__mapDeps([77,1,2,23,18,13,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),M3=E.lazy(()=>ke(()=>import("./index-B4SNhwgt.js"),__vite__mapDeps([78,1,7,8,9,12,13,31,3,4,14,79,16]),import.meta.url).then(n=>({default:n.WorkersPage}))),R3=E.lazy(()=>ke(()=>import("./index-qY2KDGkM.js"),__vite__mapDeps([80,1,12,13,81,20,16,14,4,46,47,69,65,57,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),ix=E.lazy(()=>ke(()=>import("./index-qY2KDGkM.js"),__vite__mapDeps([80,1,12,13,81,20,16,14,4,46,47,69,65,57,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),D3=E.lazy(()=>ke(()=>import("./index-WA8py2Yc.js"),__vite__mapDeps([82,1,23,8,81,14,13,12,11,3,4,83,45,46,47,48,44,31,19]),import.meta.url).then(n=>({default:n.McpServersPage}))),ax=E.lazy(()=>ke(()=>import("./index-BkVarz6E.js"),__vite__mapDeps([84,1,23,14,13,41,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),L3=E.lazy(()=>ke(()=>import("./index-D5JQweUm.js"),__vite__mapDeps([85,1,3,4,7,8,9,11,12,13,81,31,14,20,47,49,86,87,33]),import.meta.url).then(n=>({default:n.UsersPage}))),q3=E.lazy(()=>ke(()=>import("./RolesPage-D4oaYgTg.js"),__vite__mapDeps([88,1,12,13,14,20,4]),import.meta.url).then(n=>({default:n.RolesPage}))),P3=E.lazy(()=>ke(()=>import("./RoleDetailPage-c_Qij0Tf.js"),__vite__mapDeps([89,1,90,81,13,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),B3=E.lazy(()=>ke(()=>import("./PersonasPage-D11PokPb.js"),__vite__mapDeps([91,1,86,12,13,14,20,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),U3=E.lazy(()=>ke(()=>import("./PersonaDetailPage-BTIJ4A6p.js"),__vite__mapDeps([92,1,86,20,13,87,90,81,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),z3=E.lazy(()=>ke(()=>import("./EscalationSchemaPage-BHSC46Ow.js"),__vite__mapDeps([93,1,65,13,57,19,4,54,16]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),I3=E.lazy(()=>ke(()=>import("./PortalPage-1rXm0cNK.js"),__vite__mapDeps([94,1,9,56,13,57,19,4,7,8,58,59,21,11,60,12,61,20,16,62]),import.meta.url).then(n=>({default:n.PortalPage}))),$3=E.lazy(()=>ke(()=>import("./EscalationListSchemaPage-EEBsNpTe.js"),__vite__mapDeps([95,1,13,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),H3=E.lazy(()=>ke(()=>import("./ScanCodesPage-BeZA_YJW.js"),__vite__mapDeps([96,1,97,14,13,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),F3=E.lazy(()=>ke(()=>import("./ScanSchemeDetailPage-Bxi15xNr.js"),__vite__mapDeps([98,1,81,14,13,97,4]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),G3=E.lazy(()=>ke(()=>import("./ScanStationPage-t5Bz957t.js"),__vite__mapDeps([99,1,13,66,59,21,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),V3=E.lazy(()=>ke(()=>import("./index-BpWutGxS.js"),__vite__mapDeps([100,1,14,13,54,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),ox=E.lazy(()=>ke(()=>import("./OperationsPage-BxgWQq8v.js").then(n=>n.O),__vite__mapDeps([101,1,60,13,4,14,9]),import.meta.url).then(n=>({default:n.OperationsPage}))),Y3=E.lazy(()=>ke(()=>import("./index-BG7OpNg7.js"),__vite__mapDeps([102,1,18,13,12,3,4,29,26,42,79,7,8,9,31]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),K3=E.lazy(()=>ke(()=>import("./index-BLlg1aVG.js"),__vite__mapDeps([103,1,36,13,3,4,29,26,6,7,8,9,11,12,14,15]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),J3=E.lazy(()=>ke(()=>import("./CredentialsPage-BR7s6eVu.js"),__vite__mapDeps([104,1,14,13,49,81,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),Q3=E.lazy(()=>ke(()=>import("./ConnectedAppsPage-DZgbCC0G.js"),__vite__mapDeps([105,1,14,13,49,81,4]),import.meta.url).then(n=>({default:n.ConnectedAppsPage}))),X3=E.lazy(()=>ke(()=>import("./index-_yHsJJTS.js"),__vite__mapDeps([106,1,4,14,13,12,15,6,8,107,49]),import.meta.url).then(n=>({default:n.FilesPage}))),W3=E.lazy(()=>ke(()=>import("./index-BvI2_dSt.js"),__vite__mapDeps([108,1,14,13,12,15,11,8,107,49,109,41,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),Z3=E.lazy(()=>ke(()=>import("./HomePage-DizTklVg.js"),__vite__mapDeps([110,1,24,26,20,13,16,15,101,60,4,14,9,52]),import.meta.url).then(n=>({default:n.HomePage}))),e5=E.lazy(()=>ke(()=>import("./AgentsPage-BuzXc1mg.js"),__vite__mapDeps([111,1,112,3,4,6,7,8,9,11,12,13,14,15]),import.meta.url).then(n=>({default:n.AgentsPage}))),t5=E.lazy(()=>ke(()=>import("./AgentDetailPage-Sdmt5j-k.js"),__vite__mapDeps([113,1,112,114,13,16,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),lx=E.lazy(()=>ke(()=>import("./AgentConfigPage-Cc9dI8lO.js"),__vite__mapDeps([115,1,112,114,13,14,109,45,46,47,25,116,117,16,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),n5=E.lazy(()=>ke(()=>import("./CapabilitiesPage-DuSfgr6i.js"),__vite__mapDeps([118,1,116,83,23,45,46,47,13,48,4,44,14,12]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),r5=E.lazy(()=>ke(()=>import("./TopicsPage-0Z2lAE0d.js"),__vite__mapDeps([119,1,117,14,13,12,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),s5=E.lazy(()=>ke(()=>import("./TopicDetailPage-DPMAWKTN.js"),__vite__mapDeps([120,1,117,15,13,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function i5(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function Ee({children:n}){return h.jsx(E.Suspense,{fallback:h.jsx(i5,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const Zv=new hS({defaultOptions:{queries:{staleTime:1e4,retry:(n,e)=>e instanceof Error&&e.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{Zv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",e=`${n}/login`;if(window.location.pathname!==e){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${e}?returnTo=${encodeURIComponent(i)}`}});const a5=pS([{path:"/login",element:h.jsx(XC,{})},{path:"/connect/anthropic",element:h.jsx(rx,{})},{path:"/connect/:provider",element:h.jsx(rx,{})},{path:"/oauth/consent",element:h.jsx(a3,{})},{path:"/",element:h.jsx(KC,{}),children:[{index:!0,element:h.jsx(Ee,{children:h.jsx(Z3,{})})},{path:"processes/all",element:h.jsx(Ee,{children:h.jsx(u3,{})})},{path:"processes/detail/:originId",element:h.jsx(Ee,{children:h.jsx(f3,{})})},{path:"credentials",element:h.jsx(Ee,{children:h.jsx(J3,{})})},{path:"connected-apps",element:h.jsx(Ee,{children:h.jsx(Q3,{})})},{path:"connections",element:h.jsx(Sn,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(Ee,{children:h.jsx(g3,{})})},{path:"escalations/available",element:h.jsx(Ee,{children:h.jsx(b3,{})})},{path:"escalations/queue",element:h.jsx(Ee,{children:h.jsx(x3,{})})},{path:"escalations/detail/:id",element:h.jsx(Ee,{children:h.jsx(v3,{})})},{path:"portal/:role/:portal?",element:h.jsx(Ee,{children:h.jsx(I3,{})})},{path:"scan/station",element:h.jsx(Ee,{children:h.jsx(G3,{})})},{path:"capabilities",element:h.jsx(Ee,{children:h.jsx(n5,{})})},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"agents",element:h.jsx(Ee,{children:h.jsx(e5,{})})},{path:"agents/new",element:h.jsx(Ee,{children:h.jsx(lx,{})})},{path:"agents/:id",element:h.jsx(Ee,{children:h.jsx(t5,{})})},{path:"agents/:id/edit",element:h.jsx(Ee,{children:h.jsx(lx,{})})},{path:"topics",element:h.jsx(Ee,{children:h.jsx(r5,{})})},{path:"topics/:topic",element:h.jsx(Ee,{children:h.jsx(s5,{})})}]},{element:h.jsx(o3,{}),children:[{path:"workflows/start",element:h.jsx(Ee,{children:h.jsx(w3,{})})},{path:"workflows/durable/invoke",element:h.jsx(Ee,{children:h.jsx(S3,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(Ee,{children:h.jsx(_3,{})})},{path:"workflows/executions",element:h.jsx(Ee,{children:h.jsx(O3,{})})},{path:"workflows/durable/executions",element:h.jsx(Ee,{children:h.jsx(E3,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(Ee,{children:h.jsx(sx,{})})},{path:"workflows/tasks",element:h.jsx(Ee,{children:h.jsx(N3,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(Ee,{children:h.jsx(T3,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(Ee,{children:h.jsx(sx,{})})},{path:"workflows/cron",element:h.jsx(Sn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(Ee,{children:h.jsx(M3,{})})},{path:"workflows/registry",element:h.jsx(Ee,{children:h.jsx(R3,{})})},{path:"workflows/registry/new",element:h.jsx(Ee,{children:h.jsx(ix,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(Ee,{children:h.jsx(ix,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(Ee,{children:h.jsx(A3,{})})},{path:"mcp/workflows/invoke",element:h.jsx(Ee,{children:h.jsx(j3,{})})},{path:"mcp/workflows/:id",element:h.jsx(Ee,{children:h.jsx(k3,{})})},{path:"mcp/executions",element:h.jsx(Ee,{children:h.jsx(d3,{})})},{path:"mcp/executions/:jobId",element:h.jsx(Ee,{children:h.jsx(m3,{})})},{path:"files",element:h.jsx(Ee,{children:h.jsx(X3,{})})},{path:"knowledge",element:h.jsx(Ee,{children:h.jsx(W3,{})})},{element:h.jsx(l3,{}),children:[{path:"mcp",element:h.jsx(Ee,{children:h.jsx(h3,{})})},{path:"mcp/queries",element:h.jsx(Ee,{children:h.jsx(p3,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(Ee,{children:h.jsx(y3,{})})},{path:"mcp/tools",element:h.jsx(Sn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(Ee,{children:h.jsx(D3,{})})},{path:"mcp/servers/new",element:h.jsx(Ee,{children:h.jsx(ax,{})})},{path:"mcp/servers/:serverId",element:h.jsx(Ee,{children:h.jsx(ax,{})})}]}]},{path:"pace",element:h.jsx(Ee,{children:h.jsx(ox,{})})},{path:"trends",element:h.jsx(Ee,{children:h.jsx(ox,{})})},{path:"operations",element:h.jsx(Sn,{to:"/pace",replace:!0})},{element:h.jsx(po,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(Ee,{children:h.jsx(C3,{})})},{path:"admin/users",element:h.jsx(Ee,{children:h.jsx(L3,{})})},{path:"admin/escalation-chains",element:h.jsx(Sn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(Ee,{children:h.jsx(q3,{})})},{path:"admin/roles/:role",element:h.jsx(Ee,{children:h.jsx(P3,{})})},{path:"admin/roles/:role/schema",element:h.jsx(Ee,{children:h.jsx(z3,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(Ee,{children:h.jsx($3,{})})},{path:"admin/scan-codes",element:h.jsx(Ee,{children:h.jsx(H3,{})})},{path:"admin/scan-codes/:version",element:h.jsx(Ee,{children:h.jsx(F3,{})})},{path:"admin/personas",element:h.jsx(Ee,{children:h.jsx(B3,{})})},{path:"admin/personas/:key",element:h.jsx(Ee,{children:h.jsx(U3,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(Sn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(c3,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(Ee,{children:h.jsx(V3,{})})}]},{path:"admin/controlplane",element:h.jsx(Ee,{children:h.jsx(Y3,{})})},{path:"admin/streams",element:h.jsx(Ee,{children:h.jsx(K3,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function o5(){return h.jsx(dS,{client:Zv,children:h.jsx(oE,{children:h.jsx(fA,{children:h.jsx(yS,{router:a5})})})})}Ev(Sv());const Vm=document.createElement("link");Vm.rel="stylesheet";Vm.href=`${Vt}/api/settings/custom.css`;document.head.appendChild(Vm);XS.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(o5,{})}));export{qt as $,Vk as A,kM as B,Gm as C,RC as D,B5 as E,Vv as F,NM as G,Lm as H,CT as I,mC as J,MT as K,IT as L,WN as M,Xt as N,tv as O,R5 as P,Cm as Q,K5 as R,nC as S,J5 as T,Q5 as U,X5 as V,W5 as W,eM as X,Ij as Y,Mu as Z,P5 as _,PM as a,O5 as a$,nm as a0,PT as a1,E5 as a2,DM as a3,Bm as a4,ta as a5,xs as a6,H5 as a7,A5 as a8,pv as a9,UM as aA,BM as aB,Hv as aC,zM as aD,qM as aE,bv as aF,rM as aG,HM as aH,LM as aI,GM as aJ,FM as aK,y5 as aL,g5 as aM,_5 as aN,w5 as aO,b5 as aP,x5 as aQ,v5 as aR,k5 as aS,T5 as aT,N5 as aU,CM as aV,S5 as aW,Tm as aX,C5 as aY,BT as aZ,M5 as a_,ST as aa,Tk as ab,_M as ac,Kk as ad,dc as ae,G5 as af,V5 as ag,Pu as ah,Yk as ai,IN as aj,TM as ak,jv as al,Cu as am,zm as an,zj as ao,_A as ap,z5 as aq,hM as ar,I5 as as,Y5 as at,Z5 as au,uv as av,d5 as aw,zg as ax,m5 as ay,$M as az,aM as b,gM as b0,js as b1,Eo as b2,VM as b3,qx as b4,ik as b5,WC as b6,pM as b7,Vt as b8,wd as b9,pk as bA,Jk as bB,je as bC,wM as bD,L5 as bE,lM as bF,ZN as bG,YM as bH,KM as bI,Wv as bJ,JM as bK,QM as bL,jm as bM,nv as bN,dM as bO,p5 as ba,DT as bb,RM as bc,yv as bd,K1 as be,kv as bf,fM as bg,km as bh,cM as bi,xM as bj,Tj as bk,bM as bl,fr as bm,rv as bn,yM as bo,ea as bp,j5 as bq,zk as br,EM as bs,xk as bt,AM as bu,jM as bv,SM as bw,OM as bx,vT as by,$m as bz,er as c,vM as d,tM as e,yk as f,xv as g,nk as h,D5 as i,tn as j,An as k,nM as l,ue as m,IM as n,sM as o,iM as p,U5 as q,$5 as r,F5 as s,oM as t,mM as u,q5 as v,Fm as w,MM as x,Xx as y,uM as z};
67
+ //# sourceMappingURL=index-BLbZsMRG.js.map