@hotmeshio/long-tail 0.9.3 → 0.9.4
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.
- package/dashboard/dist/assets/{AdminDashboard-BONGlQva.js → AdminDashboard-DmQG0fUK.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-BONGlQva.js.map → AdminDashboard-DmQG0fUK.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-C_NJ4-pr.js → AgentConfigPage-BZ8g7Ml8.js} +5 -5
- package/dashboard/dist/assets/{AgentConfigPage-C_NJ4-pr.js.map → AgentConfigPage-BZ8g7Ml8.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-MSCS6bFD.js → AgentDetailPage-Cdinl7bx.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-MSCS6bFD.js.map → AgentDetailPage-Cdinl7bx.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-PfSvedS-.js → AgentsPage-GEYMgmez.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-PfSvedS-.js.map → AgentsPage-GEYMgmez.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-qRf3tBYi.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-qRf3tBYi.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-DmCdoim8.js → BotPicker-Bpglj7RE.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-DmCdoim8.js.map → BotPicker-Bpglj7RE.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-DVf4zIMZ.js → CapabilitiesPage-ARIQzRiq.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-DVf4zIMZ.js.map → CapabilitiesPage-ARIQzRiq.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-7ACdYUZy.js → CollapsibleSection-BuZl37uS.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-7ACdYUZy.js.map → CollapsibleSection-BuZl37uS.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-Gbp6RHav.js → CountdownTimer-CRK-E2UF.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-Gbp6RHav.js.map → CountdownTimer-CRK-E2UF.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-JWCUgQMi.js → CredentialsPage-CjBiPahB.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-JWCUgQMi.js.map → CredentialsPage-CjBiPahB.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-9GtrGEDe.js → CronLabel-DTXl2Rgj.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-9GtrGEDe.js.map → CronLabel-DTXl2Rgj.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-xNJMIvjL.js → CustomDurationPicker-qhb23E3p.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-xNJMIvjL.js.map → CustomDurationPicker-qhb23E3p.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-wJqP4zA4.js → DropZone-C1TpkVQG.js} +2 -2
- package/dashboard/dist/assets/{DropZone-wJqP4zA4.js.map → DropZone-C1TpkVQG.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-rRiChKDm.js → ElapsedCell-BMhamzj3.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-rRiChKDm.js.map → ElapsedCell-BMhamzj3.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-B7PHz5CB.js → EscalationListSchemaPage-BEi89A7y.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-B7PHz5CB.js.map → EscalationListSchemaPage-BEi89A7y.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-_CbayTDk.js → EscalationSchemaPage-9NY4Q4ku.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-_CbayTDk.js.map → EscalationSchemaPage-9NY4Q4ku.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-C5bVdGf2.js → EscalationsOverview-2VRjFxPV.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-C5bVdGf2.js.map → EscalationsOverview-2VRjFxPV.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-DGaRYVnB.js → EventTable-hHPNI3Yq.js} +2 -2
- package/dashboard/dist/assets/{EventTable-DGaRYVnB.js.map → EventTable-hHPNI3Yq.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-R6_p2Sy7.js → GraphInvokePage-B6qAC8zt.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-R6_p2Sy7.js.map → GraphInvokePage-B6qAC8zt.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-DHxtqRkD.js → HomePage-DDyQOu57.js} +2 -2
- package/dashboard/dist/assets/{HomePage-DHxtqRkD.js.map → HomePage-DDyQOu57.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-BhXp7clK.js → ListToolbar-BUgEY8Oc.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-BhXp7clK.js.map → ListToolbar-BUgEY8Oc.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-COgIIWkK.js → McpOverview-DIenRt0e.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-COgIIWkK.js.map → McpOverview-DIenRt0e.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-4LEqQZax.js → McpQueryDetailPage-CxAR4Bpw.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-4LEqQZax.js.map → McpQueryDetailPage-CxAR4Bpw.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-DWAcSqF-.js → McpQueryPage-CkT4A2c5.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-DWAcSqF-.js.map → McpQueryPage-CkT4A2c5.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-BNjhOPLp.js → McpRunDetailPage-DDiOtG5r.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-BNjhOPLp.js.map → McpRunDetailPage-DDiOtG5r.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-DAjYKqqt.js → McpRunsPage-BWe6WVzw.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-DAjYKqqt.js.map → McpRunsPage-BWe6WVzw.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-BlhSWa5S.js → NamespacePill--ikKtMvx.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-BlhSWa5S.js.map → NamespacePill--ikKtMvx.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-5RkfIbtT.js → OperationsPage-CzJx-zxj.js} +2 -2
- package/dashboard/dist/assets/{OperationsPage-5RkfIbtT.js.map → OperationsPage-CzJx-zxj.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-B-2dIbj4.js → OperatorDashboard-CVq7V7hE.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-B-2dIbj4.js.map → OperatorDashboard-CVq7V7hE.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-Ji1AtA4f.js → PageHeader-CiFhzGc0.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-Ji1AtA4f.js.map → PageHeader-CiFhzGc0.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-B2qrFAaG.js → PageHeaderWithStats-_zOnWAhq.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-B2qrFAaG.js.map → PageHeaderWithStats-_zOnWAhq.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-Bx7sF-vV.js → ProcessDetailPage-BWVFB-nL.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-Bx7sF-vV.js.map → ProcessDetailPage-BWVFB-nL.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-Dsfc-DX_.js → ProcessesListPage-kyRO3E9d.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-Dsfc-DX_.js.map → ProcessesListPage-kyRO3E9d.js.map} +1 -1
- package/dashboard/dist/assets/{RoleDetailPage-DF-ov9E9.js → RoleDetailPage-DrSlAQUQ.js} +3 -3
- package/dashboard/dist/assets/{RoleDetailPage-DF-ov9E9.js.map → RoleDetailPage-DrSlAQUQ.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-ColM_ynA.js → RolePill-CUIJSgRq.js} +2 -2
- package/dashboard/dist/assets/{RolePill-ColM_ynA.js.map → RolePill-CUIJSgRq.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-DIlde9bw.js → RolesPage-tT21PIEb.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-DIlde9bw.js.map → RolesPage-tT21PIEb.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-DOYUYXcD.js → RunAsSelector-BqhOzi2p.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-DOYUYXcD.js.map → RunAsSelector-BqhOzi2p.js.map} +1 -1
- package/dashboard/dist/assets/{SlidePanel-BzeKveus.js → SlidePanel-BcWKelpn.js} +2 -2
- package/dashboard/dist/assets/{SlidePanel-BzeKveus.js.map → SlidePanel-BcWKelpn.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-BwXLmDc-.js → StickyPagination-BTDj99Vb.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-BwXLmDc-.js.map → StickyPagination-BTDj99Vb.js.map} +1 -1
- package/dashboard/dist/assets/StreamMessageDetail-DjjnJ31Q.js +2 -0
- package/dashboard/dist/assets/{StreamMessageDetail-CCez20kE.js.map → StreamMessageDetail-DjjnJ31Q.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-hcWBunXb.js → SwimlaneTimeline-Db7ATobq.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-hcWBunXb.js.map → SwimlaneTimeline-Db7ATobq.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-By0E_Jym.js → TagInput-BaFJCq9A.js} +2 -2
- package/dashboard/dist/assets/{TagInput-By0E_Jym.js.map → TagInput-BaFJCq9A.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-CIarmoAk.js → TaskDetailPage-BVlCa-PR.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-CIarmoAk.js.map → TaskDetailPage-BVlCa-PR.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-CY1ZSwWu.js → TaskQueuePill-D9e16qkU.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-CY1ZSwWu.js.map → TaskQueuePill-D9e16qkU.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-CFqMwhLE.js → TasksListPage-PKscNTJs.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-CFqMwhLE.js.map → TasksListPage-PKscNTJs.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-CuI-66Kw.js → TimeAgo-CGx_Ffwq.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-CuI-66Kw.js.map → TimeAgo-CGx_Ffwq.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BI3Uptj8.js → TimestampCell-CdD5hp9o.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BI3Uptj8.js.map → TimestampCell-CdD5hp9o.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-D0IzqLEe.js → ToolPill-Enc3nyic.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-D0IzqLEe.js.map → ToolPill-Enc3nyic.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-QwGyWRfG.js → ToolTestPanel-DWs0DNGB.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-QwGyWRfG.js.map → ToolTestPanel-DWs0DNGB.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-CGCiqQGf.js → TopicDetailPage-BaL3m3yb.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-CGCiqQGf.js.map → TopicDetailPage-BaL3m3yb.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-Bk8-inSO.js → TopicsPage-bFjJUYmO.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-Bk8-inSO.js.map → TopicsPage-bFjJUYmO.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-BOaihCFP.js → UserName-IdFyeFle.js} +2 -2
- package/dashboard/dist/assets/{UserName-BOaihCFP.js.map → UserName-IdFyeFle.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-CE0QzhIt.js → WorkflowExecutionPage-DtC-71vO.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-CE0QzhIt.js.map → WorkflowExecutionPage-DtC-71vO.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-BXmmLR0t.js → WorkflowPill-S6VV2Eax.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-BXmmLR0t.js.map → WorkflowPill-S6VV2Eax.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-wgWRZOnB.js → WorkflowsDashboard-DGtMG5vL.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-wgWRZOnB.js.map → WorkflowsDashboard-DGtMG5vL.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-CLyitES7.js → WorkflowsOverview-BFs-ZSTn.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-CLyitES7.js.map → WorkflowsOverview-BFs-ZSTn.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-pP2i1ptj.js → YamlWorkflowDetailPage-6FTLoVfO.js} +25 -25
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-pP2i1ptj.js.map → YamlWorkflowDetailPage-6FTLoVfO.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-BwQSMfYw.js → YamlWorkflowsPage-0Moxrj_c.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-BwQSMfYw.js.map → YamlWorkflowsPage-0Moxrj_c.js.map} +1 -1
- package/dashboard/dist/assets/{agents-CRtBacrZ.js → agents-Dpg829fG.js} +2 -2
- package/dashboard/dist/assets/{agents-CRtBacrZ.js.map → agents-Dpg829fG.js.map} +1 -1
- package/dashboard/dist/assets/{bots-FjzeqLzA.js → bots-BiS_mYcH.js} +2 -2
- package/dashboard/dist/assets/{bots-FjzeqLzA.js.map → bots-BiS_mYcH.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-CB0y1ZCx.js → capabilities-Cpe3amV5.js} +2 -2
- package/dashboard/dist/assets/{capabilities-CB0y1ZCx.js.map → capabilities-Cpe3amV5.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-ZJtfQopv.js → controlplane-CjK2cXaD.js} +2 -2
- package/dashboard/dist/assets/{controlplane-ZJtfQopv.js.map → controlplane-CjK2cXaD.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-_KrFogWG.js +2 -0
- package/dashboard/dist/assets/escalation-columns-_KrFogWG.js.map +1 -0
- package/dashboard/dist/assets/{index-DzIB5CaR.js → index-3ewF-RsR.js} +2 -2
- package/dashboard/dist/assets/{index-DzIB5CaR.js.map → index-3ewF-RsR.js.map} +1 -1
- package/dashboard/dist/assets/{index-Bho1kYrO.js → index-BFh7zbQF.js} +2 -2
- package/dashboard/dist/assets/{index-Bho1kYrO.js.map → index-BFh7zbQF.js.map} +1 -1
- package/dashboard/dist/assets/{index-DlrsXckY.js → index-BYpOpKoM.js} +2 -2
- package/dashboard/dist/assets/{index-DlrsXckY.js.map → index-BYpOpKoM.js.map} +1 -1
- package/dashboard/dist/assets/{index-B_pZXTTp.js → index-Be9bw5cd.js} +2 -2
- package/dashboard/dist/assets/{index-B_pZXTTp.js.map → index-Be9bw5cd.js.map} +1 -1
- package/dashboard/dist/assets/{index-iEn58vjL.js → index-C42kzl9D.js} +2 -2
- package/dashboard/dist/assets/{index-iEn58vjL.js.map → index-C42kzl9D.js.map} +1 -1
- package/dashboard/dist/assets/{index-GRckVBX1.js → index-CTTxpoEl.js} +2 -2
- package/dashboard/dist/assets/{index-GRckVBX1.js.map → index-CTTxpoEl.js.map} +1 -1
- package/dashboard/dist/assets/index-DWXhbO4b.js +5 -0
- package/dashboard/dist/assets/index-DWXhbO4b.js.map +1 -0
- package/dashboard/dist/assets/index-DYcP4jyl.js +63 -0
- package/dashboard/dist/assets/index-DYcP4jyl.js.map +1 -0
- package/dashboard/dist/assets/{index-BH0BQHF-.js → index-Dq5RU7sm.js} +2 -2
- package/dashboard/dist/assets/{index-BH0BQHF-.js.map → index-Dq5RU7sm.js.map} +1 -1
- package/dashboard/dist/assets/{index-DiCp9bmR.js → index-Fc1qNrqI.js} +2 -2
- package/dashboard/dist/assets/{index-DiCp9bmR.js.map → index-Fc1qNrqI.js.map} +1 -1
- package/dashboard/dist/assets/{index-D4z4fzW5.js → index-IHOuIqlt.js} +2 -2
- package/dashboard/dist/assets/{index-D4z4fzW5.js.map → index-IHOuIqlt.js.map} +1 -1
- package/dashboard/dist/assets/{index-CzYOxahh.js → index-JQCy1mnu.js} +2 -2
- package/dashboard/dist/assets/{index-CzYOxahh.js.map → index-JQCy1mnu.js.map} +1 -1
- package/dashboard/dist/assets/{index-AUrwksY_.js → index-p85Oqfqc.js} +2 -2
- package/dashboard/dist/assets/{index-AUrwksY_.js.map → index-p85Oqfqc.js.map} +1 -1
- package/dashboard/dist/assets/index-waKF7bKZ.css +1 -0
- package/dashboard/dist/assets/{knowledge-Bw51BCX9.js → knowledge-Bed_1toa.js} +2 -2
- package/dashboard/dist/assets/{knowledge-Bw51BCX9.js.map → knowledge-Bed_1toa.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-D4KRVy2a.js → mcp-LRVvEX8W.js} +2 -2
- package/dashboard/dist/assets/{mcp-D4KRVy2a.js.map → mcp-LRVvEX8W.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-0Zo3GwTv.js → mcp-query-k2J65UbP.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-0Zo3GwTv.js.map → mcp-query-k2J65UbP.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-B8sOpeCD.js → pipelines-C9fpHxJR.js} +2 -2
- package/dashboard/dist/assets/{pipelines-B8sOpeCD.js.map → pipelines-C9fpHxJR.js.map} +1 -1
- package/dashboard/dist/assets/{roles-Bs6hUrQJ.js → roles-BO-4Ieun.js} +2 -2
- package/dashboard/dist/assets/{roles-Bs6hUrQJ.js.map → roles-BO-4Ieun.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-KDV3bflF.js → tasks-BiyBXdk7.js} +2 -2
- package/dashboard/dist/assets/{tasks-KDV3bflF.js.map → tasks-BiyBXdk7.js.map} +1 -1
- package/dashboard/dist/assets/{topics-BS_n738l.js → topics-m_BXjCFf.js} +2 -2
- package/dashboard/dist/assets/{topics-BS_n738l.js.map → topics-m_BXjCFf.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-RbAigCWV.js → useEventHooks-CtkD_tnd.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-RbAigCWV.js.map → useEventHooks-CtkD_tnd.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-ChDZWKAd.js → useNamespace-Dt2COnsG.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-ChDZWKAd.js.map → useNamespace-Dt2COnsG.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-6xNaRNAc.js → useYamlActivityEvents--i7p1Ta9.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-6xNaRNAc.js.map → useYamlActivityEvents--i7p1Ta9.js.map} +1 -1
- package/dashboard/dist/assets/{users-BPt2YERY.js → users-BsRZkm9v.js} +2 -2
- package/dashboard/dist/assets/{users-BPt2YERY.js.map → users-BsRZkm9v.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-BX2Vih4L.js → vendor-icons-DPmIjhZB.js} +129 -124
- package/dashboard/dist/assets/vendor-icons-DPmIjhZB.js.map +1 -0
- package/dashboard/dist/assets/{workflows-BaSjfNsd.js → workflows-B0djSSvg.js} +2 -2
- package/dashboard/dist/assets/{workflows-BaSjfNsd.js.map → workflows-B0djSSvg.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-Be3rM5i2.js → yaml-workflows-CupO7vvi.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-Be3rM5i2.js.map → yaml-workflows-CupO7vvi.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/hitl-guide.md +125 -1
- package/package.json +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-DBeBLNWW.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-DBeBLNWW.js.map +0 -1
- package/dashboard/dist/assets/StreamMessageDetail-CCez20kE.js +0 -2
- package/dashboard/dist/assets/escalation-columns-735GLlEN.js +0 -2
- package/dashboard/dist/assets/escalation-columns-735GLlEN.js.map +0 -1
- package/dashboard/dist/assets/index-BTrN5iqE.js +0 -5
- package/dashboard/dist/assets/index-BTrN5iqE.js.map +0 -1
- package/dashboard/dist/assets/index-CsMAT5cs.css +0 -1
- package/dashboard/dist/assets/index-DpGeD89g.js +0 -63
- package/dashboard/dist/assets/index-DpGeD89g.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-BX2Vih4L.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-kyRO3E9d.js","./vendor-query-B2UbickB.js","./tasks-BiyBXdk7.js","./workflows-B0djSSvg.js","./useEventHooks-CtkD_tnd.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./useDebouncedValue-BA5S7V54.js","./api-path-u2Jf9QXS.js","./DataTable-Byn3oyT9.js","./EmptyState-BcsfPq9T.js","./TimestampCell-CdD5hp9o.js","./StickyPagination-BTDj99Vb.js","./FilterBar-DDIn8TOs.js","./PageHeader-CiFhzGc0.js","./vendor-icons-DPmIjhZB.js","./ListToolbar-BUgEY8Oc.js","./WorkflowPill-S6VV2Eax.js","./ProcessDetailPage-BWVFB-nL.js","./PageHeaderWithStats-_zOnWAhq.js","./StatusBadge-CEQMRmSQ.js","./RolePill-CUIJSgRq.js","./UserName-IdFyeFle.js","./users-BsRZkm9v.js","./McpOverview-DIenRt0e.js","./mcp-LRVvEX8W.js","./pipelines-C9fpHxJR.js","./yaml-workflows-CupO7vvi.js","./controlplane-CjK2cXaD.js","./StatCard-DrdlUeQz.js","./McpRunsPage-BWe6WVzw.js","./useNamespace-Dt2COnsG.js","./ElapsedCell-BMhamzj3.js","./RowActions-BA9L9djf.js","./McpRunDetailPage-DDiOtG5r.js","./CopyableId-uot2mE_g.js","./CollapsibleSection-BuZl37uS.js","./EventTable-hHPNI3Yq.js","./SwimlaneTimeline-Db7ATobq.js","./StreamMessageDetail-DjjnJ31Q.js","./McpQueryPage-CkT4A2c5.js","./mcp-query-k2J65UbP.js","./McpQueryDetailPage-CxAR4Bpw.js","./TagInput-BaFJCq9A.js","./useYamlActivityEvents--i7p1Ta9.js","./helpers-DzO-OGPe.js","./RunAsSelector-BqhOzi2p.js","./BotPicker-Bpglj7RE.js","./bots-BiS_mYcH.js","./ToolPill-Enc3nyic.js","./TimeAgo-CGx_Ffwq.js","./EscalationsOverview-2VRjFxPV.js","./AvailableEscalationsPage-qRf3tBYi.js","./CustomDurationPicker-qhb23E3p.js","./Modal-CSrxpXeM.js","./constants-BHkpVaqx.js","./roles-BO-4Ieun.js","./CountdownTimer-CRK-E2UF.js","./escalation-columns-_KrFogWG.js","./PriorityBadge-B4ykBH7f.js","./OperatorDashboard-CVq7V7hE.js","./index-DWXhbO4b.js","./SlidePanel-BcWKelpn.js","./WorkflowsOverview-BFs-ZSTn.js","./index-BFh7zbQF.js","./NamespacePill--ikKtMvx.js","./WorkflowsDashboard-DGtMG5vL.js","./YamlWorkflowsPage-0Moxrj_c.js","./GraphInvokePage-B6qAC8zt.js","./YamlWorkflowDetailPage-6FTLoVfO.js","./TasksListPage-PKscNTJs.js","./TaskDetailPage-BVlCa-PR.js","./WorkflowExecutionPage-DtC-71vO.js","./AdminDashboard-DmQG0fUK.js","./index-CTTxpoEl.js","./TaskQueuePill-D9e16qkU.js","./index-3ewF-RsR.js","./ConfirmDeleteModal-D9_1b4MW.js","./index-BYpOpKoM.js","./ToolTestPanel-DWs0DNGB.js","./index-Fc1qNrqI.js","./index-JQCy1mnu.js","./RolesPage-tT21PIEb.js","./RoleDetailPage-DrSlAQUQ.js","./EscalationSchemaPage-9NY4Q4ku.js","./EscalationListSchemaPage-BEi89A7y.js","./index-p85Oqfqc.js","./OperationsPage-CzJx-zxj.js","./index-Dq5RU7sm.js","./index-Be9bw5cd.js","./CredentialsPage-CjBiPahB.js","./index-IHOuIqlt.js","./DropZone-C1TpkVQG.js","./index-C42kzl9D.js","./knowledge-Bed_1toa.js","./HomePage-DDyQOu57.js","./AgentsPage-GEYMgmez.js","./agents-Dpg829fG.js","./AgentDetailPage-Cdinl7bx.js","./CronLabel-DTXl2Rgj.js","./AgentConfigPage-BZ8g7Ml8.js","./capabilities-Cpe3amV5.js","./topics-m_BXjCFf.js","./CapabilitiesPage-ARIQzRiq.js","./TopicsPage-bFjJUYmO.js","./TopicDetailPage-BaL3m3yb.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Kx=Object.defineProperty;var Zx=(i,n,s)=>n in i?Kx(i,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[n]=s;var v=(i,n,s)=>Zx(i,typeof n!="symbol"?n+"":n,s);import{r as Wx,a as O,j as h,u as Sn,b as on,c as En,Q as ev,d as tv}from"./vendor-query-B2UbickB.js";import{r as nv,u as xs,L as Ni,N as $o,a as Tg,b as $n,O as jr,c as kg,d as sv,R as iv}from"./vendor-react-CXumBFUA.js";import{X as Mi,I as Df,R as Ng,B as Cg,U as rv,a as av,L as zf,b as m0,c as lv,Z as ov,S as p0,P as g0,C as cv,W as rh,d as uv,e as fv,F as hv,f as dv,g as mv,T as pv,N as gv,h as yv,D as bv,M as Mg,i as Rg,j as xv,k as vv,l as _v,E as wv,m as Sv,n as Ev,o as Av,p as y0,G as jv,q as Ov,r as Tv,s as kv,t as Nv}from"./vendor-icons-DPmIjhZB.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var yf={exports:{}},Ma={},bf={exports:{}},xf={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* scheduler.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var b0;function Cv(){return b0||(b0=1,(function(i){function n($,re){var he=$.length;$.push(re);e:for(;0<he;){var je=he-1>>>1,ve=$[je];if(0<o(ve,re))$[je]=re,$[he]=ve,he=je;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var re=$[0],he=$.pop();if(he!==re){$[0]=he;e:for(var je=0,ve=$.length,G=ve>>>1;je<G;){var ge=2*(je+1)-1,xe=$[ge],Pe=ge+1,tt=$[Pe];if(0>o(xe,he))Pe<ve&&0>o(tt,xe)?($[je]=tt,$[Pe]=he,je=Pe):($[je]=xe,$[ge]=he,je=ge);else if(Pe<ve&&0>o(tt,he))$[je]=tt,$[Pe]=he,je=Pe;else break e}}return re}function o($,re){var he=$.sortIndex-re.sortIndex;return he!==0?he:$.id-re.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var d=Date,m=d.now();i.unstable_now=function(){return d.now()-m}}var g=[],y=[],E=1,w=null,T=3,z=!1,M=!1,q=!1,Q=!1,ee=typeof setTimeout=="function"?setTimeout:null,ne=typeof clearTimeout=="function"?clearTimeout:null,fe=typeof setImmediate<"u"?setImmediate:null;function ae($){for(var re=s(y);re!==null;){if(re.callback===null)a(y);else if(re.startTime<=$)a(y),re.sortIndex=re.expirationTime,n(g,re);else break;re=s(y)}}function k($){if(q=!1,ae($),!M)if(s(g)!==null)M=!0,X||(X=!0,ie());else{var re=s(y);re!==null&&Oe(k,re.startTime-$)}}var X=!1,le=-1,P=5,V=-1;function I(){return Q?!0:!(i.unstable_now()-V<P)}function Z(){if(Q=!1,X){var $=i.unstable_now();V=$;var re=!0;try{e:{M=!1,q&&(q=!1,ne(le),le=-1),z=!0;var he=T;try{t:{for(ae($),w=s(g);w!==null&&!(w.expirationTime>$&&I());){var je=w.callback;if(typeof je=="function"){w.callback=null,T=w.priorityLevel;var ve=je(w.expirationTime<=$);if($=i.unstable_now(),typeof ve=="function"){w.callback=ve,ae($),re=!0;break t}w===s(g)&&a(g),ae($)}else a(g);w=s(g)}if(w!==null)re=!0;else{var G=s(y);G!==null&&Oe(k,G.startTime-$),re=!1}}break e}finally{w=null,T=he,z=!1}re=void 0}}finally{re?ie():X=!1}}}var ie;if(typeof fe=="function")ie=function(){fe(Z)};else if(typeof MessageChannel<"u"){var Ae=new MessageChannel,Re=Ae.port2;Ae.port1.onmessage=Z,ie=function(){Re.postMessage(null)}}else ie=function(){ee(Z,0)};function Oe($,re){le=ee(function(){$(i.unstable_now())},re)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function($){$.callback=null},i.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<$?Math.floor(1e3/$):5},i.unstable_getCurrentPriorityLevel=function(){return T},i.unstable_next=function($){switch(T){case 1:case 2:case 3:var re=3;break;default:re=T}var he=T;T=re;try{return $()}finally{T=he}},i.unstable_requestPaint=function(){Q=!0},i.unstable_runWithPriority=function($,re){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var he=T;T=$;try{return re()}finally{T=he}},i.unstable_scheduleCallback=function($,re,he){var je=i.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?je+he:je):he=je,$){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=he+ve,$={id:E++,callback:re,priorityLevel:$,startTime:he,expirationTime:ve,sortIndex:-1},he>je?($.sortIndex=he,n(y,$),s(g)===null&&$===s(y)&&(q?(ne(le),le=-1):q=!0,Oe(k,he-je))):($.sortIndex=ve,n(g,$),M||z||(M=!0,X||(X=!0,ie()))),$},i.unstable_shouldYield=I,i.unstable_wrapCallback=function($){var re=T;return function(){var he=T;T=re;try{return $.apply(this,arguments)}finally{T=he}}}})(xf)),xf}var x0;function Mv(){return x0||(x0=1,bf.exports=Cv()),bf.exports}/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-dom-client.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var v0;function Rv(){if(v0)return Ma;v0=1;var i=Mv(),n=Wx(),s=nv();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var r=e,l=t;;){var c=r.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){r=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===r)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(r.return!==l.return)r=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===r){p=!0,r=c,l=u;break}if(b===l){p=!0,l=c,r=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===r){p=!0,r=u,l=c;break}if(b===l){p=!0,l=u,r=c;break}b=b.sibling}if(!p)throw Error(a(189))}}if(r.alternate!==l)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?e:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,T=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),ee=Symbol.for("react.profiler"),ne=Symbol.for("react.consumer"),fe=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=Z&&e[Z]||e["@@iterator"],typeof e=="function"?e:null)}var Ae=Symbol.for("react.client.reference");function Re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case ee:return"Profiler";case Q:return"StrictMode";case k:return"Suspense";case X:return"SuspenseList";case V:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case fe:return e.displayName||"Context";case ne:return(e._context.displayName||"Context")+".Consumer";case ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case le:return t=e.displayName||null,t!==null?t:Re(e.type)||"Memo";case P:t=e._payload,e=e._init;try{return Re(e(t))}catch{}}return null}var Oe=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},je=[],ve=-1;function G(e){return{current:e}}function ge(e){0>ve||(e.current=je[ve],je[ve]=null,ve--)}function xe(e,t){ve++,je[ve]=e.current,e.current=t}var Pe=G(null),tt=G(null),St=G(null),at=G(null);function lt(e,t){switch(xe(St,t),xe(tt,e),xe(Pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Bp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Bp(t),e=Up(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ge(Pe),xe(Pe,e)}function Se(){ge(Pe),ge(tt),ge(St)}function vt(e){e.memoizedState!==null&&xe(at,e);var t=Pe.current,r=Up(t,e.type);t!==r&&(xe(tt,e),xe(Pe,r))}function qn(e){tt.current===e&&(ge(Pe),ge(tt)),at.current===e&&(ge(at),Ta._currentValue=he)}var In,Rt;function cn(e){if(In===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);In=t&&t[1]||"",Rt=-1<r.stack.indexOf(`
|
|
19
|
+
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
+
`+In+e+Rt}var Di=!1;function vs(e,t){if(!e||Di)return"";Di=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(Y){var L=Y}Reflect.construct(e,[],te)}else{try{te.call()}catch(Y){L=Y}e.call(te.prototype)}}else{try{throw Error()}catch(Y){L=Y}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(Y){if(Y&&L&&typeof Y.stack=="string")return[Y.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var j=p.split(`
|
|
21
|
+
`),U=b.split(`
|
|
22
|
+
`);for(c=l=0;l<j.length&&!j[l].includes("DetermineComponentFrameRoot");)l++;for(;c<U.length&&!U[c].includes("DetermineComponentFrameRoot");)c++;if(l===j.length||c===U.length)for(l=j.length-1,c=U.length-1;1<=l&&0<=c&&j[l]!==U[c];)c--;for(;1<=l&&0<=c;l--,c--)if(j[l]!==U[c]){if(l!==1||c!==1)do if(l--,c--,0>c||j[l]!==U[c]){var F=`
|
|
23
|
+
`+j[l].replace(" at new "," at ");return e.displayName&&F.includes("<anonymous>")&&(F=F.replace("<anonymous>",e.displayName)),F}while(1<=l&&0<=c);break}}}finally{Di=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?cn(r):""}function sl(e,t){switch(e.tag){case 26:case 27:case 5:return cn(e.type);case 16:return cn("Lazy");case 13:return e.child!==t&&t!==null?cn("Suspense Fallback"):cn("Suspense");case 19:return cn("SuspenseList");case 0:case 15:return vs(e.type,!1);case 11:return vs(e.type.render,!1);case 1:return vs(e.type,!0);case 31:return cn("Activity");default:return""}}function il(e){try{var t="",r=null;do t+=sl(e,r),r=e,e=e.return;while(e);return t}catch(l){return`
|
|
24
|
+
Error generating stack: `+l.message+`
|
|
25
|
+
`+l.stack}}var Ur=Object.prototype.hasOwnProperty,Lr=i.unstable_scheduleCallback,Jn=i.unstable_cancelCallback,rl=i.unstable_shouldYield,zi=i.unstable_requestPaint,nt=i.unstable_now,ac=i.unstable_getCurrentPriorityLevel,al=i.unstable_ImmediatePriority,ll=i.unstable_UserBlockingPriority,qi=i.unstable_NormalPriority,lc=i.unstable_LowPriority,ol=i.unstable_IdlePriority,oc=i.log,cl=i.unstable_setDisableYieldValue,li=null,ft=null;function Ft(e){if(typeof oc=="function"&&cl(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(li,e)}catch{}}var Ct=Math.clz32?Math.clz32:Bi,Hr=Math.log,Pr=Math.LN2;function Bi(e){return e>>>=0,e===0?32:31-(Hr(e)/Pr|0)|0}var _s=256,Qn=262144,ws=4194304;function An(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function oi(e,t,r){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=An(l):(p&=b,p!==0?c=An(p):r||(r=b&~e,r!==0&&(c=An(r))))):(b=l&~u,b!==0?c=An(b):p!==0?c=An(p):r||(r=l&~e,r!==0&&(c=An(r)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,r=t&-t,u>=r||u===32&&(r&4194048)!==0)?t:c}function ci(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $r(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ui(){var e=ws;return ws<<=1,(ws&62914560)===0&&(ws=4194304),e}function Ss(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function jn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Es(e,t,r,l,c,u){var p=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var b=e.entanglements,j=e.expirationTimes,U=e.hiddenUpdates;for(r=p&~r;0<r;){var F=31-Ct(r),te=1<<F;b[F]=0,j[F]=-1;var L=U[F];if(L!==null)for(U[F]=null,F=0;F<L.length;F++){var Y=L[F];Y!==null&&(Y.lane&=-536870913)}r&=~te}l!==0&&As(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function As(e,t,r){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Ct(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|r&261930}function ui(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var l=31-Ct(r),c=1<<l;c&t|e[l]&t&&(e[l]|=t),r&=~c}}function js(e,t){var r=t&-t;return r=(r&42)!==0?1:Xn(r),(r&(e.suspendedLanes|t))!==0?0:r}function Xn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function fi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Yr(){var e=re.p;return e!==0?e:(e=window.event,e===void 0?32:l0(e.type))}function ul(e,t){var r=re.p;try{return re.p=e,t()}finally{re.p=r}}var Bn=Math.random().toString(36).slice(2),Xe="__reactFiber$"+Bn,ot="__reactProps$"+Bn,It="__reactContainer$"+Bn,hi="__reactEvents$"+Bn,Gr="__reactListeners$"+Bn,fl="__reactHandles$"+Bn,hl="__reactResources$"+Bn,_t="__reactMarker$"+Bn;function Li(e){delete e[Xe],delete e[ot],delete e[hi],delete e[Gr],delete e[fl]}function x(e){var t=e[Xe];if(t)return t;for(var r=e.parentNode;r;){if(t=r[It]||r[Xe]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Vp(e);e!==null;){if(r=e[Xe])return r;e=Vp(e)}return t}e=r,r=e.parentNode}return null}function S(e){if(e=e[Xe]||e[It]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[hl];return t||(t=e[hl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[_t]=!0}var D=new Set,W={};function se(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(W[e]=t,e=0;e<t.length;e++)D.add(t[e])}var K=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]*$"),me={},Ne={};function Ze(e){return Ur.call(Ne,e)?!0:Ur.call(me,e)?!1:K.test(e)?Ne[e]=!0:(me[e]=!0,!1)}function Mt(e,t,r){if(Ze(t))if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+r)}}function On(e,t,r){if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+r)}}function Kn(e,t,r,l){if(l===null)e.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(t,r,""+l)}}function un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function kh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Gy(e,t,r){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){r=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(p){r=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function cc(e){if(!e._valueTracker){var t=kh(e)?"checked":"value";e._valueTracker=Gy(e,t,""+e[t])}}function Nh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),l="";return e&&(l=kh(e)?e.checked?"true":"false":e.value),e=l,e!==r?(t.setValue(e),!0):!1}function dl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Vy=/[\n"\\]/g;function fn(e){return e.replace(Vy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function uc(e,t,r,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+un(t)):e.value!==""+un(t)&&(e.value=""+un(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?fc(e,p,un(t)):r!=null?fc(e,p,un(r)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+un(b):e.removeAttribute("name")}function Ch(e,t,r,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||r!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){cc(e);return}r=r!=null?""+un(r):"",t=t!=null?""+un(t):r,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),cc(e)}function fc(e,t,r){t==="number"&&dl(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function Hi(e,t,r,l){if(e=e.options,t){t={};for(var c=0;c<r.length;c++)t["$"+r[c]]=!0;for(r=0;r<e.length;r++)c=t.hasOwnProperty("$"+e[r].value),e[r].selected!==c&&(e[r].selected=c),c&&l&&(e[r].defaultSelected=!0)}else{for(r=""+un(r),t=null,c=0;c<e.length;c++){if(e[c].value===r){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function Mh(e,t,r){if(t!=null&&(t=""+un(t),t!==e.value&&(e.value=t),r==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=r!=null?""+un(r):""}function Rh(e,t,r,l){if(t==null){if(l!=null){if(r!=null)throw Error(a(92));if(Oe(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),t=r}r=un(t),e.defaultValue=r,l=e.textContent,l===r&&l!==""&&l!==null&&(e.value=l),cc(e)}function Pi(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Fy=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 Dh(e,t,r){var l=t.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,r):typeof r!="number"||r===0||Fy.has(t)?t==="float"?e.cssFloat=r:e[t]=(""+r).trim():e[t]=r+"px"}function zh(e,t,r){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&r[c]!==l&&Dh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&Dh(e,u,t[u])}function hc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Iy=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"]]),Jy=/^[\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 ml(e){return Jy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Zn(){}var dc=null;function mc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var $i=null,Yi=null;function qh(e){var t=S(e);if(t&&(e=t.stateNode)){var r=e[ot]||null;e:switch(e=t.stateNode,t.type){case"input":if(uc(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+fn(""+t)+'"][type="radio"]'),t=0;t<r.length;t++){var l=r[t];if(l!==e&&l.form===e.form){var c=l[ot]||null;if(!c)throw Error(a(90));uc(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<r.length;t++)l=r[t],l.form===e.form&&Nh(l)}break e;case"textarea":Mh(e,r.value,r.defaultValue);break e;case"select":t=r.value,t!=null&&Hi(e,!!r.multiple,t,!1)}}}var pc=!1;function Bh(e,t,r){if(pc)return e(t,r);pc=!0;try{var l=e(t);return l}finally{if(pc=!1,($i!==null||Yi!==null)&&(to(),$i&&(t=$i,e=Yi,Yi=$i=null,qh(t),e)))for(t=0;t<e.length;t++)qh(e[t])}}function Vr(e,t){var r=e.stateNode;if(r===null)return null;var l=r[ot]||null;if(l===null)return null;r=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(a(231,t,typeof r));return r}var Wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gc=!1;if(Wn)try{var Fr={};Object.defineProperty(Fr,"passive",{get:function(){gc=!0}}),window.addEventListener("test",Fr,Fr),window.removeEventListener("test",Fr,Fr)}catch{gc=!1}var Os=null,yc=null,pl=null;function Uh(){if(pl)return pl;var e,t=yc,r=t.length,l,c="value"in Os?Os.value:Os.textContent,u=c.length;for(e=0;e<r&&t[e]===c[e];e++);var p=r-e;for(l=1;l<=p&&t[r-l]===c[u-l];l++);return pl=c.slice(e,1<l?1-l:void 0)}function gl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function yl(){return!0}function Lh(){return!1}function Ut(e){function t(r,l,c,u,p){this._reactName=r,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(r=e[b],this[b]=r?r(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?yl:Lh,this.isPropagationStopped=Lh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=yl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=yl)},persist:function(){},isPersistent:yl}),t}var di={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bl=Ut(di),Ir=w({},di,{view:0,detail:0}),Qy=Ut(Ir),bc,xc,Jr,xl=w({},Ir,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_c,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Jr&&(Jr&&e.type==="mousemove"?(bc=e.screenX-Jr.screenX,xc=e.screenY-Jr.screenY):xc=bc=0,Jr=e),bc)},movementY:function(e){return"movementY"in e?e.movementY:xc}}),Hh=Ut(xl),Xy=w({},xl,{dataTransfer:0}),Ky=Ut(Xy),Zy=w({},Ir,{relatedTarget:0}),vc=Ut(Zy),Wy=w({},di,{animationName:0,elapsedTime:0,pseudoElement:0}),eb=Ut(Wy),tb=w({},di,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),nb=Ut(tb),sb=w({},di,{data:0}),Ph=Ut(sb),ib={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rb={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"},ab={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ab[e])?!!t[e]:!1}function _c(){return lb}var ob=w({},Ir,{key:function(e){if(e.key){var t=ib[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?rb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_c,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),cb=Ut(ob),ub=w({},xl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$h=Ut(ub),fb=w({},Ir,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_c}),hb=Ut(fb),db=w({},di,{propertyName:0,elapsedTime:0,pseudoElement:0}),mb=Ut(db),pb=w({},xl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),gb=Ut(pb),yb=w({},di,{newState:0,oldState:0}),bb=Ut(yb),xb=[9,13,27,32],wc=Wn&&"CompositionEvent"in window,Qr=null;Wn&&"documentMode"in document&&(Qr=document.documentMode);var vb=Wn&&"TextEvent"in window&&!Qr,Yh=Wn&&(!wc||Qr&&8<Qr&&11>=Qr),Gh=" ",Vh=!1;function Fh(e,t){switch(e){case"keyup":return xb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ih(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gi=!1;function _b(e,t){switch(e){case"compositionend":return Ih(t);case"keypress":return t.which!==32?null:(Vh=!0,Gh);case"textInput":return e=t.data,e===Gh&&Vh?null:e;default:return null}}function wb(e,t){if(Gi)return e==="compositionend"||!wc&&Fh(e,t)?(e=Uh(),pl=yc=Os=null,Gi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Yh&&t.locale!=="ko"?null:t.data;default:return null}}var Sb={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 Jh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Sb[e.type]:t==="textarea"}function Qh(e,t,r,l){$i?Yi?Yi.push(l):Yi=[l]:$i=l,t=oo(t,"onChange"),0<t.length&&(r=new bl("onChange","change",null,r,l),e.push({event:r,listeners:t}))}var Xr=null,Kr=null;function Eb(e){Cp(e,0)}function vl(e){var t=_(e);if(Nh(t))return e}function Xh(e,t){if(e==="change")return t}var Kh=!1;if(Wn){var Sc;if(Wn){var Ec="oninput"in document;if(!Ec){var Zh=document.createElement("div");Zh.setAttribute("oninput","return;"),Ec=typeof Zh.oninput=="function"}Sc=Ec}else Sc=!1;Kh=Sc&&(!document.documentMode||9<document.documentMode)}function Wh(){Xr&&(Xr.detachEvent("onpropertychange",ed),Kr=Xr=null)}function ed(e){if(e.propertyName==="value"&&vl(Kr)){var t=[];Qh(t,Kr,e,mc(e)),Bh(Eb,t)}}function Ab(e,t,r){e==="focusin"?(Wh(),Xr=t,Kr=r,Xr.attachEvent("onpropertychange",ed)):e==="focusout"&&Wh()}function jb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vl(Kr)}function Ob(e,t){if(e==="click")return vl(t)}function Tb(e,t){if(e==="input"||e==="change")return vl(t)}function kb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jt=typeof Object.is=="function"?Object.is:kb;function Zr(e,t){if(Jt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),l=Object.keys(t);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var c=r[l];if(!Ur.call(t,c)||!Jt(e[c],t[c]))return!1}return!0}function td(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function nd(e,t){var r=td(e);e=0;for(var l;r;){if(r.nodeType===3){if(l=e+r.textContent.length,e<=t&&l>=t)return{node:r,offset:t-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=td(r)}}function sd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?sd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function id(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=dl(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=dl(e.document)}return t}function Ac(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Nb=Wn&&"documentMode"in document&&11>=document.documentMode,Vi=null,jc=null,Wr=null,Oc=!1;function rd(e,t,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Oc||Vi==null||Vi!==dl(l)||(l=Vi,"selectionStart"in l&&Ac(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}),Wr&&Zr(Wr,l)||(Wr=l,l=oo(jc,"onSelect"),0<l.length&&(t=new bl("onSelect","select",null,t,r),e.push({event:t,listeners:l}),t.target=Vi)))}function mi(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Fi={animationend:mi("Animation","AnimationEnd"),animationiteration:mi("Animation","AnimationIteration"),animationstart:mi("Animation","AnimationStart"),transitionrun:mi("Transition","TransitionRun"),transitionstart:mi("Transition","TransitionStart"),transitioncancel:mi("Transition","TransitionCancel"),transitionend:mi("Transition","TransitionEnd")},Tc={},ad={};Wn&&(ad=document.createElement("div").style,"AnimationEvent"in window||(delete Fi.animationend.animation,delete Fi.animationiteration.animation,delete Fi.animationstart.animation),"TransitionEvent"in window||delete Fi.transitionend.transition);function pi(e){if(Tc[e])return Tc[e];if(!Fi[e])return e;var t=Fi[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in ad)return Tc[e]=t[r];return e}var ld=pi("animationend"),od=pi("animationiteration"),cd=pi("animationstart"),Cb=pi("transitionrun"),Mb=pi("transitionstart"),Rb=pi("transitioncancel"),ud=pi("transitionend"),fd=new Map,kc="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(" ");kc.push("scrollEnd");function Tn(e,t){fd.set(e,t),se(t,[e])}var _l=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},hn=[],Ii=0,Nc=0;function wl(){for(var e=Ii,t=Nc=Ii=0;t<e;){var r=hn[t];hn[t++]=null;var l=hn[t];hn[t++]=null;var c=hn[t];hn[t++]=null;var u=hn[t];if(hn[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&hd(r,c,u)}}function Sl(e,t,r,l){hn[Ii++]=e,hn[Ii++]=t,hn[Ii++]=r,hn[Ii++]=l,Nc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Cc(e,t,r,l){return Sl(e,t,r,l),El(e)}function gi(e,t){return Sl(e,null,null,t),El(e)}function hd(e,t,r){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r);for(var c=!1,u=e.return;u!==null;)u.childLanes|=r,l=u.alternate,l!==null&&(l.childLanes|=r),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Ct(r),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=r|536870912),u):null}function El(e){if(50<_a)throw _a=0,Hu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ji={};function Db(e,t,r,l){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qt(e,t,r,l){return new Db(e,t,r,l)}function Mc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function es(e,t){var r=e.alternate;return r===null?(r=Qt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function dd(e,t){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,t=r.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Al(e,t,r,l,c,u){var p=0;if(l=e,typeof e=="function")Mc(e)&&(p=1);else if(typeof e=="string")p=Lx(e,r,Pe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case V:return e=Qt(31,r,t,c),e.elementType=V,e.lanes=u,e;case q:return yi(r.children,c,u,t);case Q:p=8,c|=24;break;case ee:return e=Qt(12,r,t,c|2),e.elementType=ee,e.lanes=u,e;case k:return e=Qt(13,r,t,c),e.elementType=k,e.lanes=u,e;case X:return e=Qt(19,r,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fe:p=10;break e;case ne:p=9;break e;case ae:p=11;break e;case le:p=14;break e;case P:p=16,l=null;break e}p=29,r=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Qt(p,r,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function yi(e,t,r,l){return e=Qt(7,e,l,t),e.lanes=r,e}function Rc(e,t,r){return e=Qt(6,e,null,t),e.lanes=r,e}function md(e){var t=Qt(18,null,null,0);return t.stateNode=e,t}function Dc(e,t,r){return t=Qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var pd=new WeakMap;function dn(e,t){if(typeof e=="object"&&e!==null){var r=pd.get(e);return r!==void 0?r:(t={value:e,source:t,stack:il(t)},pd.set(e,t),t)}return{value:e,source:t,stack:il(t)}}var Qi=[],Xi=0,jl=null,ea=0,mn=[],pn=0,Ts=null,Un=1,Ln="";function ts(e,t){Qi[Xi++]=ea,Qi[Xi++]=jl,jl=e,ea=t}function gd(e,t,r){mn[pn++]=Un,mn[pn++]=Ln,mn[pn++]=Ts,Ts=e;var l=Un;e=Ln;var c=32-Ct(l)-1;l&=~(1<<c),r+=1;var u=32-Ct(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Un=1<<32-Ct(t)+c|r<<c|l,Ln=u+e}else Un=1<<u|r<<c|l,Ln=e}function zc(e){e.return!==null&&(ts(e,1),gd(e,1,0))}function qc(e){for(;e===jl;)jl=Qi[--Xi],Qi[Xi]=null,ea=Qi[--Xi],Qi[Xi]=null;for(;e===Ts;)Ts=mn[--pn],mn[pn]=null,Ln=mn[--pn],mn[pn]=null,Un=mn[--pn],mn[pn]=null}function yd(e,t){mn[pn++]=Un,mn[pn++]=Ln,mn[pn++]=Ts,Un=t.id,Ln=t.overflow,Ts=e}var Ot=null,We=null,qe=!1,ks=null,gn=!1,Bc=Error(a(519));function Ns(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ta(dn(t,e)),Bc}function bd(e){var t=e.stateNode,r=e.type,l=e.memoizedProps;switch(t[Xe]=e,t[ot]=l,r){case"dialog":Me("cancel",t),Me("close",t);break;case"iframe":case"object":case"embed":Me("load",t);break;case"video":case"audio":for(r=0;r<Sa.length;r++)Me(Sa[r],t);break;case"source":Me("error",t);break;case"img":case"image":case"link":Me("error",t),Me("load",t);break;case"details":Me("toggle",t);break;case"input":Me("invalid",t),Ch(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Me("invalid",t);break;case"textarea":Me("invalid",t),Rh(t,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||t.textContent===""+r||l.suppressHydrationWarning===!0||zp(t.textContent,r)?(l.popover!=null&&(Me("beforetoggle",t),Me("toggle",t)),l.onScroll!=null&&Me("scroll",t),l.onScrollEnd!=null&&Me("scrollend",t),l.onClick!=null&&(t.onclick=Zn),t=!0):t=!1,t||Ns(e,!0)}function xd(e){for(Ot=e.return;Ot;)switch(Ot.tag){case 5:case 31:case 13:gn=!1;return;case 27:case 3:gn=!0;return;default:Ot=Ot.return}}function Ki(e){if(e!==Ot)return!1;if(!qe)return xd(e),qe=!0,!1;var t=e.tag,r;if((r=t!==3&&t!==27)&&((r=t===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||tf(e.type,e.memoizedProps)),r=!r),r&&We&&Ns(e),xd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));We=Gp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));We=Gp(e)}else t===27?(t=We,Gs(e.type)?(e=lf,lf=null,We=e):We=t):We=Ot?bn(e.stateNode.nextSibling):null;return!0}function bi(){We=Ot=null,qe=!1}function Uc(){var e=ks;return e!==null&&($t===null?$t=e:$t.push.apply($t,e),ks=null),e}function ta(e){ks===null?ks=[e]:ks.push(e)}var Lc=G(null),xi=null,ns=null;function Cs(e,t,r){xe(Lc,t._currentValue),t._currentValue=r}function ss(e){e._currentValue=Lc.current,ge(Lc)}function Hc(e,t,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===r)break;e=e.return}}function Pc(e,t,r,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var j=0;j<t.length;j++)if(b.context===t[j]){u.lanes|=r,b=u.alternate,b!==null&&(b.lanes|=r),Hc(u.return,r,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=r,u=p.alternate,u!==null&&(u.lanes|=r),Hc(p,r,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Zi(e,t,r,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Jt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===at.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Ta):e=[Ta])}c=c.return}e!==null&&Pc(t,e,r,l),t.flags|=262144}function Ol(e){for(e=e.firstContext;e!==null;){if(!Jt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function vi(e){xi=e,ns=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return vd(xi,e)}function Tl(e,t){return xi===null&&vi(e),vd(e,t)}function vd(e,t){var r=t._currentValue;if(t={context:t,memoizedValue:r,next:null},ns===null){if(e===null)throw Error(a(308));ns=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ns=ns.next=t;return r}var zb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(r,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(r){return r()})}},qb=i.unstable_scheduleCallback,Bb=i.unstable_NormalPriority,pt={$$typeof:fe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $c(){return{controller:new zb,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&qb(Bb,function(){e.controller.abort()})}var sa=null,Yc=0,Wi=0,er=null;function Ub(e,t){if(sa===null){var r=sa=[];Yc=0,Wi=Fu(),er={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Yc++,t.then(_d,_d),t}function _d(){if(--Yc===0&&sa!==null){er!==null&&(er.status="fulfilled");var e=sa;sa=null,Wi=0,er=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Lb(e,t){var r=[],l={status:"pending",value:null,reason:null,then:function(c){r.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<r.length;c++)(0,r[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<r.length;c++)(0,r[c])(void 0)}),l}var wd=$.S;$.S=function(e,t){rp=nt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Ub(e,t),wd!==null&&wd(e,t)};var _i=G(null);function Gc(){var e=_i.current;return e!==null?e:Ke.pooledCache}function kl(e,t){t===null?xe(_i,_i.current):xe(_i,t.pool)}function Sd(){var e=Gc();return e===null?null:{parent:pt._currentValue,pool:e}}var tr=Error(a(460)),Vc=Error(a(474)),Nl=Error(a(542)),Cl={then:function(){}};function Ed(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ad(e,t,r){switch(r=e[r],r===void 0?e.push(t):r!==t&&(t.then(Zn,Zn),t=r),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Od(e),e;default:if(typeof t.status=="string")t.then(Zn,Zn);else{if(e=Ke,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Od(e),e}throw Si=t,tr}}function wi(e){try{var t=e._init;return t(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Si=r,tr):r}}var Si=null;function jd(){if(Si===null)throw Error(a(459));var e=Si;return Si=null,e}function Od(e){if(e===tr||e===Nl)throw Error(a(483))}var nr=null,ia=0;function Ml(e){var t=ia;return ia+=1,nr===null&&(nr=[]),Ad(nr,e,t)}function ra(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Rl(e,t){throw t.$$typeof===T?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Td(e){function t(R,C){if(e){var B=R.deletions;B===null?(R.deletions=[C],R.flags|=16):B.push(C)}}function r(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function l(R){for(var C=new Map;R!==null;)R.key!==null?C.set(R.key,R):C.set(R.index,R),R=R.sibling;return C}function c(R,C){return R=es(R,C),R.index=0,R.sibling=null,R}function u(R,C,B){return R.index=B,e?(B=R.alternate,B!==null?(B=B.index,B<C?(R.flags|=67108866,C):B):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,C,B,J){return C===null||C.tag!==6?(C=Rc(B,R.mode,J),C.return=R,C):(C=c(C,B),C.return=R,C)}function j(R,C,B,J){var be=B.type;return be===q?F(R,C,B.props.children,J,B.key):C!==null&&(C.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===P&&wi(be)===C.type)?(C=c(C,B.props),ra(C,B),C.return=R,C):(C=Al(B.type,B.key,B.props,null,R.mode,J),ra(C,B),C.return=R,C)}function U(R,C,B,J){return C===null||C.tag!==4||C.stateNode.containerInfo!==B.containerInfo||C.stateNode.implementation!==B.implementation?(C=Dc(B,R.mode,J),C.return=R,C):(C=c(C,B.children||[]),C.return=R,C)}function F(R,C,B,J,be){return C===null||C.tag!==7?(C=yi(B,R.mode,J,be),C.return=R,C):(C=c(C,B),C.return=R,C)}function te(R,C,B){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=Rc(""+C,R.mode,B),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case z:return B=Al(C.type,C.key,C.props,null,R.mode,B),ra(B,C),B.return=R,B;case M:return C=Dc(C,R.mode,B),C.return=R,C;case P:return C=wi(C),te(R,C,B)}if(Oe(C)||ie(C))return C=yi(C,R.mode,B,null),C.return=R,C;if(typeof C.then=="function")return te(R,Ml(C),B);if(C.$$typeof===fe)return te(R,Tl(R,C),B);Rl(R,C)}return null}function L(R,C,B,J){var be=C!==null?C.key:null;if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return be!==null?null:b(R,C,""+B,J);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case z:return B.key===be?j(R,C,B,J):null;case M:return B.key===be?U(R,C,B,J):null;case P:return B=wi(B),L(R,C,B,J)}if(Oe(B)||ie(B))return be!==null?null:F(R,C,B,J,null);if(typeof B.then=="function")return L(R,C,Ml(B),J);if(B.$$typeof===fe)return L(R,C,Tl(R,B),J);Rl(R,B)}return null}function Y(R,C,B,J,be){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return R=R.get(B)||null,b(C,R,""+J,be);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case z:return R=R.get(J.key===null?B:J.key)||null,j(C,R,J,be);case M:return R=R.get(J.key===null?B:J.key)||null,U(C,R,J,be);case P:return J=wi(J),Y(R,C,B,J,be)}if(Oe(J)||ie(J))return R=R.get(B)||null,F(C,R,J,be,null);if(typeof J.then=="function")return Y(R,C,B,Ml(J),be);if(J.$$typeof===fe)return Y(R,C,B,Tl(C,J),be);Rl(C,J)}return null}function pe(R,C,B,J){for(var be=null,Le=null,ye=C,ke=C=0,ze=null;ye!==null&&ke<B.length;ke++){ye.index>ke?(ze=ye,ye=null):ze=ye.sibling;var He=L(R,ye,B[ke],J);if(He===null){ye===null&&(ye=ze);break}e&&ye&&He.alternate===null&&t(R,ye),C=u(He,C,ke),Le===null?be=He:Le.sibling=He,Le=He,ye=ze}if(ke===B.length)return r(R,ye),qe&&ts(R,ke),be;if(ye===null){for(;ke<B.length;ke++)ye=te(R,B[ke],J),ye!==null&&(C=u(ye,C,ke),Le===null?be=ye:Le.sibling=ye,Le=ye);return qe&&ts(R,ke),be}for(ye=l(ye);ke<B.length;ke++)ze=Y(ye,R,ke,B[ke],J),ze!==null&&(e&&ze.alternate!==null&&ye.delete(ze.key===null?ke:ze.key),C=u(ze,C,ke),Le===null?be=ze:Le.sibling=ze,Le=ze);return e&&ye.forEach(function(Qs){return t(R,Qs)}),qe&&ts(R,ke),be}function _e(R,C,B,J){if(B==null)throw Error(a(151));for(var be=null,Le=null,ye=C,ke=C=0,ze=null,He=B.next();ye!==null&&!He.done;ke++,He=B.next()){ye.index>ke?(ze=ye,ye=null):ze=ye.sibling;var Qs=L(R,ye,He.value,J);if(Qs===null){ye===null&&(ye=ze);break}e&&ye&&Qs.alternate===null&&t(R,ye),C=u(Qs,C,ke),Le===null?be=Qs:Le.sibling=Qs,Le=Qs,ye=ze}if(He.done)return r(R,ye),qe&&ts(R,ke),be;if(ye===null){for(;!He.done;ke++,He=B.next())He=te(R,He.value,J),He!==null&&(C=u(He,C,ke),Le===null?be=He:Le.sibling=He,Le=He);return qe&&ts(R,ke),be}for(ye=l(ye);!He.done;ke++,He=B.next())He=Y(ye,R,ke,He.value,J),He!==null&&(e&&He.alternate!==null&&ye.delete(He.key===null?ke:He.key),C=u(He,C,ke),Le===null?be=He:Le.sibling=He,Le=He);return e&&ye.forEach(function(Xx){return t(R,Xx)}),qe&&ts(R,ke),be}function Qe(R,C,B,J){if(typeof B=="object"&&B!==null&&B.type===q&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case z:e:{for(var be=B.key;C!==null;){if(C.key===be){if(be=B.type,be===q){if(C.tag===7){r(R,C.sibling),J=c(C,B.props.children),J.return=R,R=J;break e}}else if(C.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===P&&wi(be)===C.type){r(R,C.sibling),J=c(C,B.props),ra(J,B),J.return=R,R=J;break e}r(R,C);break}else t(R,C);C=C.sibling}B.type===q?(J=yi(B.props.children,R.mode,J,B.key),J.return=R,R=J):(J=Al(B.type,B.key,B.props,null,R.mode,J),ra(J,B),J.return=R,R=J)}return p(R);case M:e:{for(be=B.key;C!==null;){if(C.key===be)if(C.tag===4&&C.stateNode.containerInfo===B.containerInfo&&C.stateNode.implementation===B.implementation){r(R,C.sibling),J=c(C,B.children||[]),J.return=R,R=J;break e}else{r(R,C);break}else t(R,C);C=C.sibling}J=Dc(B,R.mode,J),J.return=R,R=J}return p(R);case P:return B=wi(B),Qe(R,C,B,J)}if(Oe(B))return pe(R,C,B,J);if(ie(B)){if(be=ie(B),typeof be!="function")throw Error(a(150));return B=be.call(B),_e(R,C,B,J)}if(typeof B.then=="function")return Qe(R,C,Ml(B),J);if(B.$$typeof===fe)return Qe(R,C,Tl(R,B),J);Rl(R,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,C!==null&&C.tag===6?(r(R,C.sibling),J=c(C,B),J.return=R,R=J):(r(R,C),J=Rc(B,R.mode,J),J.return=R,R=J),p(R)):r(R,C)}return function(R,C,B,J){try{ia=0;var be=Qe(R,C,B,J);return nr=null,be}catch(ye){if(ye===tr||ye===Nl)throw ye;var Le=Qt(29,ye,null,R.mode);return Le.lanes=J,Le.return=R,Le}finally{}}}var Ei=Td(!0),kd=Td(!1),Ms=!1;function Fc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ic(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Rs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ds(e,t,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,($e&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=El(e),hd(e,null,r),t}return Sl(e,l,t,r),El(e)}function aa(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,ui(e,r)}}function Jc(e,t){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var c=null,u=null;if(r=r.firstBaseUpdate,r!==null){do{var p={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,r=r.next}while(r!==null);u===null?c=u=t:u=u.next=t}else c=u=t;r={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var Qc=!1;function la(){if(Qc){var e=er;if(e!==null)throw e}}function oa(e,t,r,l){Qc=!1;var c=e.updateQueue;Ms=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var j=b,U=j.next;j.next=null,p===null?u=U:p.next=U,p=j;var F=e.alternate;F!==null&&(F=F.updateQueue,b=F.lastBaseUpdate,b!==p&&(b===null?F.firstBaseUpdate=U:b.next=U,F.lastBaseUpdate=j))}if(u!==null){var te=c.baseState;p=0,F=U=j=null,b=u;do{var L=b.lane&-536870913,Y=L!==b.lane;if(Y?(De&L)===L:(l&L)===L){L!==0&&L===Wi&&(Qc=!0),F!==null&&(F=F.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var pe=e,_e=b;L=t;var Qe=r;switch(_e.tag){case 1:if(pe=_e.payload,typeof pe=="function"){te=pe.call(Qe,te,L);break e}te=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=_e.payload,L=typeof pe=="function"?pe.call(Qe,te,L):pe,L==null)break e;te=w({},te,L);break e;case 2:Ms=!0}}L=b.callback,L!==null&&(e.flags|=64,Y&&(e.flags|=8192),Y=c.callbacks,Y===null?c.callbacks=[L]:Y.push(L))}else Y={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},F===null?(U=F=Y,j=te):F=F.next=Y,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;Y=b,b=Y.next,Y.next=null,c.lastBaseUpdate=Y,c.shared.pending=null}}while(!0);F===null&&(j=te),c.baseState=j,c.firstBaseUpdate=U,c.lastBaseUpdate=F,u===null&&(c.shared.lanes=0),Ls|=p,e.lanes=p,e.memoizedState=te}}function Nd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function Cd(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Nd(r[e],t)}var sr=G(null),Dl=G(0);function Md(e,t){e=hs,xe(Dl,e),xe(sr,t),hs=e|t.baseLanes}function Xc(){xe(Dl,hs),xe(sr,sr.current)}function Kc(){hs=Dl.current,ge(sr),ge(Dl)}var Xt=G(null),yn=null;function zs(e){var t=e.alternate;xe(ht,ht.current&1),xe(Xt,e),yn===null&&(t===null||sr.current!==null||t.memoizedState!==null)&&(yn=e)}function Zc(e){xe(ht,ht.current),xe(Xt,e),yn===null&&(yn=e)}function Rd(e){e.tag===22?(xe(ht,ht.current),xe(Xt,e),yn===null&&(yn=e)):qs()}function qs(){xe(ht,ht.current),xe(Xt,Xt.current)}function Kt(e){ge(Xt),yn===e&&(yn=null),ge(ht)}var ht=G(0);function zl(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||rf(r)||af(r)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var is=0,Te=null,Ie=null,gt=null,ql=!1,ir=!1,Ai=!1,Bl=0,ca=0,rr=null,Hb=0;function ct(){throw Error(a(321))}function Wc(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Jt(e[r],t[r]))return!1;return!0}function eu(e,t,r,l,c,u){return is=u,Te=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?gm:pu,Ai=!1,u=r(l,c),Ai=!1,ir&&(u=zd(t,r,l,c)),Dd(e),u}function Dd(e){$.H=ha;var t=Ie!==null&&Ie.next!==null;if(is=0,gt=Ie=Te=null,ql=!1,ca=0,rr=null,t)throw Error(a(300));e===null||yt||(e=e.dependencies,e!==null&&Ol(e)&&(yt=!0))}function zd(e,t,r,l){Te=e;var c=0;do{if(ir&&(rr=null),ca=0,ir=!1,25<=c)throw Error(a(301));if(c+=1,gt=Ie=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=ym,u=t(r,l)}while(ir);return u}function Pb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ua(t):t,e=e.useState()[0],(Ie!==null?Ie.memoizedState:null)!==e&&(Te.flags|=1024),t}function tu(){var e=Bl!==0;return Bl=0,e}function nu(e,t,r){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r}function su(e){if(ql){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ql=!1}is=0,gt=Ie=Te=null,ir=!1,ca=Bl=0,rr=null}function Dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?Te.memoizedState=gt=e:gt=gt.next=e,gt}function dt(){if(Ie===null){var e=Te.alternate;e=e!==null?e.memoizedState:null}else e=Ie.next;var t=gt===null?Te.memoizedState:gt.next;if(t!==null)gt=t,Ie=e;else{if(e===null)throw Te.alternate===null?Error(a(467)):Error(a(310));Ie=e,e={memoizedState:Ie.memoizedState,baseState:Ie.baseState,baseQueue:Ie.baseQueue,queue:Ie.queue,next:null},gt===null?Te.memoizedState=gt=e:gt=gt.next=e}return gt}function Ul(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ua(e){var t=ca;return ca+=1,rr===null&&(rr=[]),e=Ad(rr,e,t),t=Te,(gt===null?t.memoizedState:gt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?gm:pu),e}function Ll(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ua(e);if(e.$$typeof===fe)return Tt(e)}throw Error(a(438,String(e)))}function iu(e){var t=null,r=Te.updateQueue;if(r!==null&&(t=r.memoCache),t==null){var l=Te.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),r===null&&(r=Ul(),Te.updateQueue=r),r.memoCache=t,r=t.data[t.index],r===void 0)for(r=t.data[t.index]=Array(e),l=0;l<e;l++)r[l]=I;return t.index++,r}function rs(e,t){return typeof t=="function"?t(e):t}function Hl(e){var t=dt();return ru(t,Ie,e)}function ru(e,t,r){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,j=null,U=t,F=!1;do{var te=U.lane&-536870913;if(te!==U.lane?(De&te)===te:(is&te)===te){var L=U.revertLane;if(L===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),te===Wi&&(F=!0);else if((is&L)===L){U=U.next,L===Wi&&(F=!0);continue}else te={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},j===null?(b=j=te,p=u):j=j.next=te,Te.lanes|=L,Ls|=L;te=U.action,Ai&&r(u,te),u=U.hasEagerState?U.eagerState:r(u,te)}else L={lane:te,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},j===null?(b=j=L,p=u):j=j.next=L,Te.lanes|=te,Ls|=te;U=U.next}while(U!==null&&U!==t);if(j===null?p=u:j.next=b,!Jt(u,e.memoizedState)&&(yt=!0,F&&(r=er,r!==null)))throw r;e.memoizedState=u,e.baseState=p,e.baseQueue=j,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function au(e){var t=dt(),r=t.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=e;var l=r.dispatch,c=r.pending,u=t.memoizedState;if(c!==null){r.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Jt(u,t.memoizedState)||(yt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),r.lastRenderedState=u}return[u,l]}function qd(e,t,r){var l=Te,c=dt(),u=qe;if(u){if(r===void 0)throw Error(a(407));r=r()}else r=t();var p=!Jt((Ie||c).memoizedState,r);if(p&&(c.memoizedState=r,yt=!0),c=c.queue,cu(Ld.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||gt!==null&>.memoizedState.tag&1){if(l.flags|=2048,ar(9,{destroy:void 0},Ud.bind(null,l,c,r,t),null),Ke===null)throw Error(a(349));u||(is&127)!==0||Bd(l,t,r)}return r}function Bd(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Te.updateQueue,t===null?(t=Ul(),Te.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Ud(e,t,r,l){t.value=r,t.getSnapshot=l,Hd(t)&&Pd(e)}function Ld(e,t,r){return r(function(){Hd(t)&&Pd(e)})}function Hd(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Jt(e,r)}catch{return!0}}function Pd(e){var t=gi(e,2);t!==null&&Yt(t,e,2)}function lu(e){var t=Dt();if(typeof e=="function"){var r=e;if(e=r(),Ai){Ft(!0);try{r()}finally{Ft(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:e},t}function $d(e,t,r,l){return e.baseState=r,ru(e,Ie,typeof l=="function"?l:rs)}function $b(e,t,r,l,c){if(Yl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?r(!0):u.isTransition=!1,l(u),r=t.pending,r===null?(u.next=t.pending=u,Yd(t,u)):(u.next=r.next,t.pending=r.next=u)}}function Yd(e,t){var r=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=r(c,l),j=$.S;j!==null&&j(p,b),Gd(e,t,b)}catch(U){ou(e,t,U)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=r(c,l),Gd(e,t,u)}catch(U){ou(e,t,U)}}function Gd(e,t,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){Vd(e,t,l)},function(l){return ou(e,t,l)}):Vd(e,t,r)}function Vd(e,t,r){t.status="fulfilled",t.value=r,Fd(t),e.state=r,t=e.pending,t!==null&&(r=t.next,r===t?e.pending=null:(r=r.next,t.next=r,Yd(e,r)))}function ou(e,t,r){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=r,Fd(t),t=t.next;while(t!==l)}e.action=null}function Fd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Id(e,t){return t}function Jd(e,t){if(qe){var r=Ke.formState;if(r!==null){e:{var l=Te;if(qe){if(We){t:{for(var c=We,u=gn;c.nodeType!==8;){if(!u){c=null;break t}if(c=bn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){We=bn(c.nextSibling),l=c.data==="F!";break e}}Ns(l)}l=!1}l&&(t=r[0])}}return r=Dt(),r.memoizedState=r.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Id,lastRenderedState:t},r.queue=l,r=dm.bind(null,Te,l),l.dispatch=r,l=lu(!1),u=mu.bind(null,Te,!1,l.queue),l=Dt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,r=$b.bind(null,Te,c,u,r),c.dispatch=r,l.memoizedState=e,[t,r,!1]}function Qd(e){var t=dt();return Xd(t,Ie,e)}function Xd(e,t,r){if(t=ru(e,t,Id)[0],e=Hl(rs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ua(t)}catch(p){throw p===tr?Nl:p}else l=t;t=dt();var c=t.queue,u=c.dispatch;return r!==t.memoizedState&&(Te.flags|=2048,ar(9,{destroy:void 0},Yb.bind(null,c,r),null)),[l,u,e]}function Yb(e,t){e.action=t}function Kd(e){var t=dt(),r=Ie;if(r!==null)return Xd(t,r,e);dt(),t=t.memoizedState,r=dt();var l=r.queue.dispatch;return r.memoizedState=e,[t,l,!1]}function ar(e,t,r,l){return e={tag:e,create:r,deps:l,inst:t,next:null},t=Te.updateQueue,t===null&&(t=Ul(),Te.updateQueue=t),r=t.lastEffect,r===null?t.lastEffect=e.next=e:(l=r.next,r.next=e,e.next=l,t.lastEffect=e),e}function Zd(){return dt().memoizedState}function Pl(e,t,r,l){var c=Dt();Te.flags|=e,c.memoizedState=ar(1|t,{destroy:void 0},r,l===void 0?null:l)}function $l(e,t,r,l){var c=dt();l=l===void 0?null:l;var u=c.memoizedState.inst;Ie!==null&&l!==null&&Wc(l,Ie.memoizedState.deps)?c.memoizedState=ar(t,u,r,l):(Te.flags|=e,c.memoizedState=ar(1|t,u,r,l))}function Wd(e,t){Pl(8390656,8,e,t)}function cu(e,t){$l(2048,8,e,t)}function Gb(e){Te.flags|=4;var t=Te.updateQueue;if(t===null)t=Ul(),Te.updateQueue=t,t.events=[e];else{var r=t.events;r===null?t.events=[e]:r.push(e)}}function em(e){var t=dt().memoizedState;return Gb({ref:t,nextImpl:e}),function(){if(($e&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function tm(e,t){return $l(4,2,e,t)}function nm(e,t){return $l(4,4,e,t)}function sm(e,t){if(typeof t=="function"){e=e();var r=t(e);return function(){typeof r=="function"?r():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function im(e,t,r){r=r!=null?r.concat([e]):null,$l(4,4,sm.bind(null,t,e),r)}function uu(){}function rm(e,t){var r=dt();t=t===void 0?null:t;var l=r.memoizedState;return t!==null&&Wc(t,l[1])?l[0]:(r.memoizedState=[e,t],e)}function am(e,t){var r=dt();t=t===void 0?null:t;var l=r.memoizedState;if(t!==null&&Wc(t,l[1]))return l[0];if(l=e(),Ai){Ft(!0);try{e()}finally{Ft(!1)}}return r.memoizedState=[l,t],l}function fu(e,t,r){return r===void 0||(is&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=r,e=lp(),Te.lanes|=e,Ls|=e,r)}function lm(e,t,r,l){return Jt(r,t)?r:sr.current!==null?(e=fu(e,r,l),Jt(e,t)||(yt=!0),e):(is&42)===0||(is&1073741824)!==0&&(De&261930)===0?(yt=!0,e.memoizedState=r):(e=lp(),Te.lanes|=e,Ls|=e,t)}function om(e,t,r,l,c){var u=re.p;re.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,mu(e,!1,t,r);try{var j=c(),U=$.S;if(U!==null&&U(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var F=Lb(j,l);fa(e,t,F,en(e))}else fa(e,t,l,en(e))}catch(te){fa(e,t,{then:function(){},status:"rejected",reason:te},en())}finally{re.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function Vb(){}function hu(e,t,r,l){if(e.tag!==5)throw Error(a(476));var c=cm(e).queue;om(e,c,t,he,r===null?Vb:function(){return um(e),r(l)})}function cm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:he},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function um(e){var t=cm(e);t.next===null&&(t=e.alternate.memoizedState),fa(e,t.next.queue,{},en())}function du(){return Tt(Ta)}function fm(){return dt().memoizedState}function hm(){return dt().memoizedState}function Fb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=en();e=Rs(r);var l=Ds(t,e,r);l!==null&&(Yt(l,t,r),aa(l,t,r)),t={cache:$c()},e.payload=t;return}t=t.return}}function Ib(e,t,r){var l=en();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Yl(e)?mm(t,r):(r=Cc(e,t,r,l),r!==null&&(Yt(r,e,l),pm(r,t,l)))}function dm(e,t,r){var l=en();fa(e,t,r,l)}function fa(e,t,r,l){var c={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Yl(e))mm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,r);if(c.hasEagerState=!0,c.eagerState=b,Jt(b,p))return Sl(e,t,c,0),Ke===null&&wl(),!1}catch{}finally{}if(r=Cc(e,t,c,l),r!==null)return Yt(r,e,l),pm(r,t,l),!0}return!1}function mu(e,t,r,l){if(l={lane:2,revertLane:Fu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Yl(e)){if(t)throw Error(a(479))}else t=Cc(e,r,l,2),t!==null&&Yt(t,e,2)}function Yl(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function mm(e,t){ir=ql=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function pm(e,t,r){if((r&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,ui(e,r)}}var ha={readContext:Tt,use:Ll,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useLayoutEffect:ct,useInsertionEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useSyncExternalStore:ct,useId:ct,useHostTransitionStatus:ct,useFormState:ct,useActionState:ct,useOptimistic:ct,useMemoCache:ct,useCacheRefresh:ct};ha.useEffectEvent=ct;var gm={readContext:Tt,use:Ll,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:Wd,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,Pl(4194308,4,sm.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Pl(4194308,4,e,t)},useInsertionEffect:function(e,t){Pl(4,2,e,t)},useMemo:function(e,t){var r=Dt();t=t===void 0?null:t;var l=e();if(Ai){Ft(!0);try{e()}finally{Ft(!1)}}return r.memoizedState=[l,t],l},useReducer:function(e,t,r){var l=Dt();if(r!==void 0){var c=r(t);if(Ai){Ft(!0);try{r(t)}finally{Ft(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=Ib.bind(null,Te,e),[l.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:function(e){e=lu(e);var t=e.queue,r=dm.bind(null,Te,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:uu,useDeferredValue:function(e,t){var r=Dt();return fu(r,e,t)},useTransition:function(){var e=lu(!1);return e=om.bind(null,Te,e.queue,!0,!1),Dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var l=Te,c=Dt();if(qe){if(r===void 0)throw Error(a(407));r=r()}else{if(r=t(),Ke===null)throw Error(a(349));(De&127)!==0||Bd(l,t,r)}c.memoizedState=r;var u={value:r,getSnapshot:t};return c.queue=u,Wd(Ld.bind(null,l,u,e),[e]),l.flags|=2048,ar(9,{destroy:void 0},Ud.bind(null,l,u,r,t),null),r},useId:function(){var e=Dt(),t=Ke.identifierPrefix;if(qe){var r=Ln,l=Un;r=(l&~(1<<32-Ct(l)-1)).toString(32)+r,t="_"+t+"R_"+r,r=Bl++,0<r&&(t+="H"+r.toString(32)),t+="_"}else r=Hb++,t="_"+t+"r_"+r.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:du,useFormState:Jd,useActionState:Jd,useOptimistic:function(e){var t=Dt();t.memoizedState=t.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=r,t=mu.bind(null,Te,!0,r),r.dispatch=t,[e,t]},useMemoCache:iu,useCacheRefresh:function(){return Dt().memoizedState=Fb.bind(null,Te)},useEffectEvent:function(e){var t=Dt(),r={impl:e};return t.memoizedState=r,function(){if(($e&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},pu={readContext:Tt,use:Ll,useCallback:rm,useContext:Tt,useEffect:cu,useImperativeHandle:im,useInsertionEffect:tm,useLayoutEffect:nm,useMemo:am,useReducer:Hl,useRef:Zd,useState:function(){return Hl(rs)},useDebugValue:uu,useDeferredValue:function(e,t){var r=dt();return lm(r,Ie.memoizedState,e,t)},useTransition:function(){var e=Hl(rs)[0],t=dt().memoizedState;return[typeof e=="boolean"?e:ua(e),t]},useSyncExternalStore:qd,useId:fm,useHostTransitionStatus:du,useFormState:Qd,useActionState:Qd,useOptimistic:function(e,t){var r=dt();return $d(r,Ie,e,t)},useMemoCache:iu,useCacheRefresh:hm};pu.useEffectEvent=em;var ym={readContext:Tt,use:Ll,useCallback:rm,useContext:Tt,useEffect:cu,useImperativeHandle:im,useInsertionEffect:tm,useLayoutEffect:nm,useMemo:am,useReducer:au,useRef:Zd,useState:function(){return au(rs)},useDebugValue:uu,useDeferredValue:function(e,t){var r=dt();return Ie===null?fu(r,e,t):lm(r,Ie.memoizedState,e,t)},useTransition:function(){var e=au(rs)[0],t=dt().memoizedState;return[typeof e=="boolean"?e:ua(e),t]},useSyncExternalStore:qd,useId:fm,useHostTransitionStatus:du,useFormState:Kd,useActionState:Kd,useOptimistic:function(e,t){var r=dt();return Ie!==null?$d(r,Ie,e,t):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:iu,useCacheRefresh:hm};ym.useEffectEvent=em;function gu(e,t,r,l){t=e.memoizedState,r=r(l,t),r=r==null?t:w({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var yu={enqueueSetState:function(e,t,r){e=e._reactInternals;var l=en(),c=Rs(l);c.payload=t,r!=null&&(c.callback=r),t=Ds(e,c,l),t!==null&&(Yt(t,e,l),aa(t,e,l))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var l=en(),c=Rs(l);c.tag=1,c.payload=t,r!=null&&(c.callback=r),t=Ds(e,c,l),t!==null&&(Yt(t,e,l),aa(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=en(),l=Rs(r);l.tag=2,t!=null&&(l.callback=t),t=Ds(e,l,r),t!==null&&(Yt(t,e,r),aa(t,e,r))}};function bm(e,t,r,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Zr(r,l)||!Zr(c,u):!0}function xm(e,t,r,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,l),t.state!==e&&yu.enqueueReplaceState(t,t.state,null)}function ji(e,t){var r=t;if("ref"in t){r={};for(var l in t)l!=="ref"&&(r[l]=t[l])}if(e=e.defaultProps){r===t&&(r=w({},r));for(var c in e)r[c]===void 0&&(r[c]=e[c])}return r}function vm(e){_l(e)}function _m(e){console.error(e)}function wm(e){_l(e)}function Gl(e,t){try{var r=e.onUncaughtError;r(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Sm(e,t,r){try{var l=e.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function bu(e,t,r){return r=Rs(r),r.tag=3,r.payload={element:null},r.callback=function(){Gl(e,t)},r}function Em(e){return e=Rs(e),e.tag=3,e}function Am(e,t,r,l){var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){Sm(t,r,l)}}var p=r.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Sm(t,r,l),typeof c!="function"&&(Hs===null?Hs=new Set([this]):Hs.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function Jb(e,t,r,l,c){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=r.alternate,t!==null&&Zi(t,r,c,!0),r=Xt.current,r!==null){switch(r.tag){case 31:case 13:return yn===null?no():r.alternate===null&&ut===0&&(ut=3),r.flags&=-257,r.flags|=65536,r.lanes=c,l===Cl?r.flags|=16384:(t=r.updateQueue,t===null?r.updateQueue=new Set([l]):t.add(l),Yu(e,l,c)),!1;case 22:return r.flags|=65536,l===Cl?r.flags|=16384:(t=r.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=t):(r=t.retryQueue,r===null?t.retryQueue=new Set([l]):r.add(l)),Yu(e,l,c)),!1}throw Error(a(435,r.tag))}return Yu(e,l,c),no(),!1}if(qe)return t=Xt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Bc&&(e=Error(a(422),{cause:l}),ta(dn(e,r)))):(l!==Bc&&(t=Error(a(423),{cause:l}),ta(dn(t,r))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=dn(l,r),c=bu(e.stateNode,l,c),Jc(e,c),ut!==4&&(ut=2)),!1;var u=Error(a(520),{cause:l});if(u=dn(u,r),va===null?va=[u]:va.push(u),ut!==4&&(ut=2),t===null)return!0;l=dn(l,r),r=t;do{switch(r.tag){case 3:return r.flags|=65536,e=c&-c,r.lanes|=e,e=bu(r.stateNode,l,e),Jc(r,e),!1;case 1:if(t=r.type,u=r.stateNode,(r.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Hs===null||!Hs.has(u))))return r.flags|=65536,c&=-c,r.lanes|=c,c=Em(c),Am(c,e,r,l),Jc(r,c),!1}r=r.return}while(r!==null);return!1}var xu=Error(a(461)),yt=!1;function kt(e,t,r,l){t.child=e===null?kd(t,null,r,l):Ei(t,e.child,r,l)}function jm(e,t,r,l,c){r=r.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return vi(t),l=eu(e,t,r,p,u,c),b=tu(),e!==null&&!yt?(nu(e,t,c),as(e,t,c)):(qe&&b&&zc(t),t.flags|=1,kt(e,t,l,c),t.child)}function Om(e,t,r,l,c){if(e===null){var u=r.type;return typeof u=="function"&&!Mc(u)&&u.defaultProps===void 0&&r.compare===null?(t.tag=15,t.type=u,Tm(e,t,u,l,c)):(e=Al(r.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Ou(e,c)){var p=u.memoizedProps;if(r=r.compare,r=r!==null?r:Zr,r(p,l)&&e.ref===t.ref)return as(e,t,c)}return t.flags|=1,e=es(u,l),e.ref=t.ref,e.return=t,t.child=e}function Tm(e,t,r,l,c){if(e!==null){var u=e.memoizedProps;if(Zr(u,l)&&e.ref===t.ref)if(yt=!1,t.pendingProps=l=u,Ou(e,c))(e.flags&131072)!==0&&(yt=!0);else return t.lanes=e.lanes,as(e,t,c)}return vu(e,t,r,l,c)}function km(e,t,r,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|r:r,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return Nm(e,t,u,r,l)}if((r&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&kl(t,u!==null?u.cachePool:null),u!==null?Md(t,u):Xc(),Rd(t);else return l=t.lanes=536870912,Nm(e,t,u!==null?u.baseLanes|r:r,r,l)}else u!==null?(kl(t,u.cachePool),Md(t,u),qs(),t.memoizedState=null):(e!==null&&kl(t,null),Xc(),qs());return kt(e,t,c,r),t.child}function da(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Nm(e,t,r,l,c){var u=Gc();return u=u===null?null:{parent:pt._currentValue,pool:u},t.memoizedState={baseLanes:r,cachePool:u},e!==null&&kl(t,null),Xc(),Rd(t),e!==null&&Zi(e,t,l,!0),t.childLanes=c,null}function Vl(e,t){return t=Il({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Cm(e,t,r){return Ei(t,e.child,null,r),e=Vl(t,t.pendingProps),e.flags|=2,Kt(t),t.memoizedState=null,e}function Qb(e,t,r){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(qe){if(l.mode==="hidden")return e=Vl(t,l),t.lanes=536870912,da(null,e);if(Zc(t),(e=We)?(e=Yp(e,gn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ts!==null?{id:Un,overflow:Ln}:null,retryLane:536870912,hydrationErrors:null},r=md(e),r.return=t,t.child=r,Ot=t,We=null)):e=null,e===null)throw Ns(t);return t.lanes=536870912,null}return Vl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Zc(t),c)if(t.flags&256)t.flags&=-257,t=Cm(e,t,r);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(yt||Zi(e,t,r,!1),c=(r&e.childLanes)!==0,yt||c){if(l=Ke,l!==null&&(p=js(l,r),p!==0&&p!==u.retryLane))throw u.retryLane=p,gi(e,p),Yt(l,e,p),xu;no(),t=Cm(e,t,r)}else e=u.treeContext,We=bn(p.nextSibling),Ot=t,qe=!0,ks=null,gn=!1,e!==null&&yd(t,e),t=Vl(t,l),t.flags|=4096;return t}return e=es(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Fl(e,t){var r=t.ref;if(r===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(e===null||e.ref!==r)&&(t.flags|=4194816)}}function vu(e,t,r,l,c){return vi(t),r=eu(e,t,r,l,void 0,c),l=tu(),e!==null&&!yt?(nu(e,t,c),as(e,t,c)):(qe&&l&&zc(t),t.flags|=1,kt(e,t,r,c),t.child)}function Mm(e,t,r,l,c,u){return vi(t),t.updateQueue=null,r=zd(t,l,r,c),Dd(e),l=tu(),e!==null&&!yt?(nu(e,t,u),as(e,t,u)):(qe&&l&&zc(t),t.flags|=1,kt(e,t,r,u),t.child)}function Rm(e,t,r,l,c){if(vi(t),t.stateNode===null){var u=Ji,p=r.contextType;typeof p=="object"&&p!==null&&(u=Tt(p)),u=new r(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=yu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Fc(t),p=r.contextType,u.context=typeof p=="object"&&p!==null?Tt(p):Ji,u.state=t.memoizedState,p=r.getDerivedStateFromProps,typeof p=="function"&&(gu(t,r,p,l),u.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&yu.enqueueReplaceState(u,u.state,null),oa(t,l,u,c),la(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,j=ji(r,b);u.props=j;var U=u.context,F=r.contextType;p=Ji,typeof F=="object"&&F!==null&&(p=Tt(F));var te=r.getDerivedStateFromProps;F=typeof te=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,F||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||U!==p)&&xm(t,u,l,p),Ms=!1;var L=t.memoizedState;u.state=L,oa(t,l,u,c),la(),U=t.memoizedState,b||L!==U||Ms?(typeof te=="function"&&(gu(t,r,te,l),U=t.memoizedState),(j=Ms||bm(t,r,j,l,L,U,p))?(F||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=U),u.props=l,u.state=U,u.context=p,l=j):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Ic(e,t),p=t.memoizedProps,F=ji(r,p),u.props=F,te=t.pendingProps,L=u.context,U=r.contextType,j=Ji,typeof U=="object"&&U!==null&&(j=Tt(U)),b=r.getDerivedStateFromProps,(U=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==te||L!==j)&&xm(t,u,l,j),Ms=!1,L=t.memoizedState,u.state=L,oa(t,l,u,c),la();var Y=t.memoizedState;p!==te||L!==Y||Ms||e!==null&&e.dependencies!==null&&Ol(e.dependencies)?(typeof b=="function"&&(gu(t,r,b,l),Y=t.memoizedState),(F=Ms||bm(t,r,F,l,L,Y,j)||e!==null&&e.dependencies!==null&&Ol(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,Y,j),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,Y,j)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=Y),u.props=l,u.state=Y,u.context=j,l=F):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Fl(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=Ei(t,e.child,null,c),t.child=Ei(t,null,r,c)):kt(e,t,r,c),t.memoizedState=u.state,e=t.child):e=as(e,t,c),e}function Dm(e,t,r,l){return bi(),t.flags|=256,kt(e,t,r,l),t.child}var _u={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function wu(e){return{baseLanes:e,cachePool:Sd()}}function Su(e,t,r){return e=e!==null?e.childLanes&~r:0,t&&(e|=Wt),e}function zm(e,t,r){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ht.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(qe){if(c?zs(t):qs(),(e=We)?(e=Yp(e,gn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ts!==null?{id:Un,overflow:Ln}:null,retryLane:536870912,hydrationErrors:null},r=md(e),r.return=t,t.child=r,Ot=t,We=null)):e=null,e===null)throw Ns(t);return af(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(qs(),c=t.mode,b=Il({mode:"hidden",children:b},c),l=yi(l,c,r,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=wu(r),l.childLanes=Su(e,p,r),t.memoizedState=_u,da(null,l)):(zs(t),Eu(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(u)t.flags&256?(zs(t),t.flags&=-257,t=Au(e,t,r)):t.memoizedState!==null?(qs(),t.child=e.child,t.flags|=128,t=null):(qs(),b=l.fallback,c=t.mode,l=Il({mode:"visible",children:l.children},c),b=yi(b,c,r,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,Ei(t,e.child,null,r),l=t.child,l.memoizedState=wu(r),l.childLanes=Su(e,p,r),t.memoizedState=_u,t=da(null,l));else if(zs(t),af(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var U=p.dgst;p=U,l=Error(a(419)),l.stack="",l.digest=p,ta({value:l,source:null,stack:null}),t=Au(e,t,r)}else if(yt||Zi(e,t,r,!1),p=(r&e.childLanes)!==0,yt||p){if(p=Ke,p!==null&&(l=js(p,r),l!==0&&l!==j.retryLane))throw j.retryLane=l,gi(e,l),Yt(p,e,l),xu;rf(b)||no(),t=Au(e,t,r)}else rf(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,We=bn(b.nextSibling),Ot=t,qe=!0,ks=null,gn=!1,e!==null&&yd(t,e),t=Eu(t,l.children),t.flags|=4096);return t}return c?(qs(),b=l.fallback,c=t.mode,j=e.child,U=j.sibling,l=es(j,{mode:"hidden",children:l.children}),l.subtreeFlags=j.subtreeFlags&65011712,U!==null?b=es(U,b):(b=yi(b,c,r,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,da(null,l),l=t.child,b=e.child.memoizedState,b===null?b=wu(r):(c=b.cachePool,c!==null?(j=pt._currentValue,c=c.parent!==j?{parent:j,pool:j}:c):c=Sd(),b={baseLanes:b.baseLanes|r,cachePool:c}),l.memoizedState=b,l.childLanes=Su(e,p,r),t.memoizedState=_u,da(e.child,l)):(zs(t),r=e.child,e=r.sibling,r=es(r,{mode:"visible",children:l.children}),r.return=t,r.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=r,t.memoizedState=null,r)}function Eu(e,t){return t=Il({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Il(e,t){return e=Qt(22,e,null,t),e.lanes=0,e}function Au(e,t,r){return Ei(t,e.child,null,r),e=Eu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qm(e,t,r){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Hc(e.return,t,r)}function ju(e,t,r,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=r,p.tailMode=c,p.treeForkCount=u)}function Bm(e,t,r){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ht.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,xe(ht,p),kt(e,t,l,r),l=qe?ea:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&qm(e,r,t);else if(e.tag===19)qm(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(r=t.child,c=null;r!==null;)e=r.alternate,e!==null&&zl(e)===null&&(c=r),r=r.sibling;r=c,r===null?(c=t.child,t.child=null):(c=r.sibling,r.sibling=null),ju(t,!1,c,r,u,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&zl(e)===null){t.child=c;break}e=c.sibling,c.sibling=r,r=c,c=e}ju(t,!0,r,null,u,l);break;case"together":ju(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function as(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Ls|=t.lanes,(r&t.childLanes)===0)if(e!==null){if(Zi(e,t,r,!1),(r&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,r=es(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=es(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Ou(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ol(e)))}function Xb(e,t,r){switch(t.tag){case 3:lt(t,t.stateNode.containerInfo),Cs(t,pt,e.memoizedState.cache),bi();break;case 27:case 5:vt(t);break;case 4:lt(t,t.stateNode.containerInfo);break;case 10:Cs(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Zc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(zs(t),t.flags|=128,null):(r&t.child.childLanes)!==0?zm(e,t,r):(zs(t),e=as(e,t,r),e!==null?e.sibling:null);zs(t);break;case 19:var c=(e.flags&128)!==0;if(l=(r&t.childLanes)!==0,l||(Zi(e,t,r,!1),l=(r&t.childLanes)!==0),c){if(l)return Bm(e,t,r);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),xe(ht,ht.current),l)break;return null;case 22:return t.lanes=0,km(e,t,r,t.pendingProps);case 24:Cs(t,pt,e.memoizedState.cache)}return as(e,t,r)}function Um(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps)yt=!0;else{if(!Ou(e,r)&&(t.flags&128)===0)return yt=!1,Xb(e,t,r);yt=(e.flags&131072)!==0}else yt=!1,qe&&(t.flags&1048576)!==0&&gd(t,ea,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=wi(t.elementType),t.type=e,typeof e=="function")Mc(e)?(l=ji(e,l),t.tag=1,t=Rm(null,t,e,l,r)):(t.tag=0,t=vu(null,t,e,l,r));else{if(e!=null){var c=e.$$typeof;if(c===ae){t.tag=11,t=jm(null,t,e,l,r);break e}else if(c===le){t.tag=14,t=Om(null,t,e,l,r);break e}}throw t=Re(e)||e,Error(a(306,t,""))}}return t;case 0:return vu(e,t,t.type,t.pendingProps,r);case 1:return l=t.type,c=ji(l,t.pendingProps),Rm(e,t,l,c,r);case 3:e:{if(lt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,Ic(e,t),oa(t,l,null,r);var p=t.memoizedState;if(l=p.cache,Cs(t,pt,l),l!==u.cache&&Pc(t,[pt],r,!0),la(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Dm(e,t,l,r);break e}else if(l!==c){c=dn(Error(a(424)),t),ta(c),t=Dm(e,t,l,r);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(We=bn(e.firstChild),Ot=t,qe=!0,ks=null,gn=!0,r=kd(t,null,l,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(bi(),l===c){t=as(e,t,r);break e}kt(e,t,l,r)}t=t.child}return t;case 26:return Fl(e,t),e===null?(r=Qp(t.type,null,t.pendingProps,null))?t.memoizedState=r:qe||(r=t.type,e=t.pendingProps,l=co(St.current).createElement(r),l[Xe]=t,l[ot]=e,Nt(l,r,e),N(l),t.stateNode=l):t.memoizedState=Qp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return vt(t),e===null&&qe&&(l=t.stateNode=Fp(t.type,t.pendingProps,St.current),Ot=t,gn=!0,c=We,Gs(t.type)?(lf=c,We=bn(l.firstChild)):We=c),kt(e,t,t.pendingProps.children,r),Fl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&qe&&((c=l=We)&&(l=jx(l,t.type,t.pendingProps,gn),l!==null?(t.stateNode=l,Ot=t,We=bn(l.firstChild),gn=!1,c=!0):c=!1),c||Ns(t)),vt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,tf(c,u)?l=null:p!==null&&tf(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=eu(e,t,Pb,null,null,r),Ta._currentValue=c),Fl(e,t),kt(e,t,l,r),t.child;case 6:return e===null&&qe&&((e=r=We)&&(r=Ox(r,t.pendingProps,gn),r!==null?(t.stateNode=r,Ot=t,We=null,e=!0):e=!1),e||Ns(t)),null;case 13:return zm(e,t,r);case 4:return lt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ei(t,null,l,r):kt(e,t,l,r),t.child;case 11:return jm(e,t,t.type,t.pendingProps,r);case 7:return kt(e,t,t.pendingProps,r),t.child;case 8:return kt(e,t,t.pendingProps.children,r),t.child;case 12:return kt(e,t,t.pendingProps.children,r),t.child;case 10:return l=t.pendingProps,Cs(t,t.type,l.value),kt(e,t,l.children,r),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,vi(t),c=Tt(c),l=l(c),t.flags|=1,kt(e,t,l,r),t.child;case 14:return Om(e,t,t.type,t.pendingProps,r);case 15:return Tm(e,t,t.type,t.pendingProps,r);case 19:return Bm(e,t,r);case 31:return Qb(e,t,r);case 22:return km(e,t,r,t.pendingProps);case 24:return vi(t),l=Tt(pt),e===null?(c=Gc(),c===null&&(c=Ke,u=$c(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=r),c=u),t.memoizedState={parent:l,cache:c},Fc(t),Cs(t,pt,c)):((e.lanes&r)!==0&&(Ic(e,t),oa(t,null,null,r),la()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Cs(t,pt,l)):(l=u.cache,Cs(t,pt,l),l!==c.cache&&Pc(t,[pt],r,!0))),kt(e,t,t.pendingProps.children,r),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ls(e){e.flags|=4}function Tu(e,t,r,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(fp())e.flags|=8192;else throw Si=Cl,Vc}else e.flags&=-16777217}function Lm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!e0(t))if(fp())e.flags|=8192;else throw Si=Cl,Vc}function Jl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ui():536870912,e.lanes|=t,ur|=t)}function ma(e,t){if(!qe)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function et(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,l=0;if(t)for(var c=e.child;c!==null;)r|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)r|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=r,t}function Kb(e,t,r){var l=t.pendingProps;switch(qc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(t),null;case 1:return et(t),null;case 3:return r=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ss(pt),Se(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ki(t)?ls(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Uc())),et(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ls(t),u!==null?(et(t),Lm(t,u)):(et(t),Tu(t,c,null,l,r))):u?u!==e.memoizedState?(ls(t),et(t),Lm(t,u)):(et(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ls(t),et(t),Tu(t,c,e,l,r)),null;case 27:if(qn(t),r=St.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return et(t),null}e=Pe.current,Ki(t)?bd(t):(e=Fp(c,l,r),t.stateNode=e,ls(t))}return et(t),null;case 5:if(qn(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return et(t),null}if(u=Pe.current,Ki(t))bd(t);else{var p=co(St.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Xe]=t,u[ot]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(Nt(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ls(t)}}return et(t),Tu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=St.current,Ki(t)){if(e=t.stateNode,r=t.memoizedProps,l=null,c=Ot,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Xe]=t,e=!!(e.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||zp(e.nodeValue,r)),e||Ns(t,!0)}else e=co(e).createTextNode(l),e[Xe]=t,t.stateNode=e}return et(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(l=Ki(t),r!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Xe]=t}else bi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),e=!1}else r=Uc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(Kt(t),t):(Kt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return et(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Ki(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Xe]=t}else bi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),c=!1}else c=Uc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Kt(t),t):(Kt(t),null)}return Kt(t),(t.flags&128)!==0?(t.lanes=r,t):(r=l!==null,e=e!==null&&e.memoizedState!==null,r&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),Jl(t,t.updateQueue),et(t),null);case 4:return Se(),e===null&&Xu(t.stateNode.containerInfo),et(t),null;case 10:return ss(t.type),et(t),null;case 19:if(ge(ht),l=t.memoizedState,l===null)return et(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ma(l,!1);else{if(ut!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=zl(e),u!==null){for(t.flags|=128,ma(l,!1),e=u.updateQueue,t.updateQueue=e,Jl(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)dd(r,e),r=r.sibling;return xe(ht,ht.current&1|2),qe&&ts(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&nt()>Wl&&(t.flags|=128,c=!0,ma(l,!1),t.lanes=4194304)}else{if(!c)if(e=zl(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Jl(t,e),ma(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!qe)return et(t),null}else 2*nt()-l.renderingStartTime>Wl&&r!==536870912&&(t.flags|=128,c=!0,ma(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=nt(),e.sibling=null,r=ht.current,xe(ht,c?r&1|2:r&1),qe&&ts(t,l.treeForkCount),e):(et(t),null);case 22:case 23:return Kt(t),Kc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(r&536870912)!==0&&(t.flags&128)===0&&(et(t),t.subtreeFlags&6&&(t.flags|=8192)):et(t),r=t.updateQueue,r!==null&&Jl(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==r&&(t.flags|=2048),e!==null&&ge(_i),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ss(pt),et(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Zb(e,t){switch(qc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ss(pt),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return qn(t),null;case 31:if(t.memoizedState!==null){if(Kt(t),t.alternate===null)throw Error(a(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Kt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ge(ht),null;case 4:return Se(),null;case 10:return ss(t.type),null;case 22:case 23:return Kt(t),Kc(),e!==null&&ge(_i),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ss(pt),null;case 25:return null;default:return null}}function Hm(e,t){switch(qc(t),t.tag){case 3:ss(pt),Se();break;case 26:case 27:case 5:qn(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&Kt(t);break;case 13:Kt(t);break;case 19:ge(ht);break;case 10:ss(t.type);break;case 22:case 23:Kt(t),Kc(),e!==null&&ge(_i);break;case 24:ss(pt)}}function pa(e,t){try{var r=t.updateQueue,l=r!==null?r.lastEffect:null;if(l!==null){var c=l.next;r=c;do{if((r.tag&e)===e){l=void 0;var u=r.create,p=r.inst;l=u(),p.destroy=l}r=r.next}while(r!==c)}}catch(b){Ve(t,t.return,b)}}function Bs(e,t,r){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var j=r,U=b;try{U()}catch(F){Ve(c,j,F)}}}l=l.next}while(l!==u)}}catch(F){Ve(t,t.return,F)}}function Pm(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Cd(t,r)}catch(l){Ve(e,e.return,l)}}}function $m(e,t,r){r.props=ji(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(l){Ve(e,t,l)}}function ga(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof r=="function"?e.refCleanup=r(l):r.current=l}}catch(c){Ve(e,t,c)}}function Hn(e,t){var r=e.ref,l=e.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(c){Ve(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(c){Ve(e,t,c)}else r.current=null}function Ym(e){var t=e.type,r=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":r.autoFocus&&l.focus();break e;case"img":r.src?l.src=r.src:r.srcSet&&(l.srcset=r.srcSet)}}catch(c){Ve(e,e.return,c)}}function ku(e,t,r){try{var l=e.stateNode;vx(l,e.type,r,t),l[ot]=t}catch(c){Ve(e,e.return,c)}}function Gm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Gs(e.type)||e.tag===4}function Nu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Gs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cu(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,t):(t=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,t.appendChild(e),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Zn));else if(l!==4&&(l===27&&Gs(e.type)&&(r=e.stateNode,t=null),e=e.child,e!==null))for(Cu(e,t,r),e=e.sibling;e!==null;)Cu(e,t,r),e=e.sibling}function Ql(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(l!==4&&(l===27&&Gs(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Ql(e,t,r),e=e.sibling;e!==null;)Ql(e,t,r),e=e.sibling}function Vm(e){var t=e.stateNode,r=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Nt(t,l,r),t[Xe]=e,t[ot]=r}catch(u){Ve(e,e.return,u)}}var os=!1,bt=!1,Mu=!1,Fm=typeof WeakSet=="function"?WeakSet:Set,Et=null;function Wb(e,t){if(e=e.containerInfo,Wu=yo,e=id(e),Ac(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{r.nodeType,u.nodeType}catch{r=null;break e}var p=0,b=-1,j=-1,U=0,F=0,te=e,L=null;t:for(;;){for(var Y;te!==r||c!==0&&te.nodeType!==3||(b=p+c),te!==u||l!==0&&te.nodeType!==3||(j=p+l),te.nodeType===3&&(p+=te.nodeValue.length),(Y=te.firstChild)!==null;)L=te,te=Y;for(;;){if(te===e)break t;if(L===r&&++U===c&&(b=p),L===u&&++F===l&&(j=p),(Y=te.nextSibling)!==null)break;te=L,L=te.parentNode}te=Y}r=b===-1||j===-1?null:{start:b,end:j}}else r=null}r=r||{start:0,end:0}}else r=null;for(ef={focusedElem:e,selectionRange:r},yo=!1,Et=t;Et!==null;)if(t=Et,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Et=e;else for(;Et!==null;){switch(t=Et,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)c=e[r],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,r=t,c=u.memoizedProps,u=u.memoizedState,l=r.stateNode;try{var pe=ji(r.type,c);e=l.getSnapshotBeforeUpdate(pe,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(_e){Ve(r,r.return,_e)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,r=e.nodeType,r===9)sf(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":sf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,Et=e;break}Et=t.return}}function Im(e,t,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:us(e,r),l&4&&pa(5,r);break;case 1:if(us(e,r),l&4)if(e=r.stateNode,t===null)try{e.componentDidMount()}catch(p){Ve(r,r.return,p)}else{var c=ji(r.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ve(r,r.return,p)}}l&64&&Pm(r),l&512&&ga(r,r.return);break;case 3:if(us(e,r),l&64&&(e=r.updateQueue,e!==null)){if(t=null,r.child!==null)switch(r.child.tag){case 27:case 5:t=r.child.stateNode;break;case 1:t=r.child.stateNode}try{Cd(e,t)}catch(p){Ve(r,r.return,p)}}break;case 27:t===null&&l&4&&Vm(r);case 26:case 5:us(e,r),t===null&&l&4&&Ym(r),l&512&&ga(r,r.return);break;case 12:us(e,r);break;case 31:us(e,r),l&4&&Xm(e,r);break;case 13:us(e,r),l&4&&Km(e,r),l&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=ox.bind(null,r),Tx(e,r))));break;case 22:if(l=r.memoizedState!==null||os,!l){t=t!==null&&t.memoizedState!==null||bt,c=os;var u=bt;os=l,(bt=t)&&!u?fs(e,r,(r.subtreeFlags&8772)!==0):us(e,r),os=c,bt=u}break;case 30:break;default:us(e,r)}}function Jm(e){var t=e.alternate;t!==null&&(e.alternate=null,Jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Li(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var st=null,Lt=!1;function cs(e,t,r){for(r=r.child;r!==null;)Qm(e,t,r),r=r.sibling}function Qm(e,t,r){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(li,r)}catch{}switch(r.tag){case 26:bt||Hn(r,t),cs(e,t,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:bt||Hn(r,t);var l=st,c=Lt;Gs(r.type)&&(st=r.stateNode,Lt=!1),cs(e,t,r),Aa(r.stateNode),st=l,Lt=c;break;case 5:bt||Hn(r,t);case 6:if(l=st,c=Lt,st=null,cs(e,t,r),st=l,Lt=c,st!==null)if(Lt)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(r.stateNode)}catch(u){Ve(r,t,u)}else try{st.removeChild(r.stateNode)}catch(u){Ve(r,t,u)}break;case 18:st!==null&&(Lt?(e=st,Pp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),br(e)):Pp(st,r.stateNode));break;case 4:l=st,c=Lt,st=r.stateNode.containerInfo,Lt=!0,cs(e,t,r),st=l,Lt=c;break;case 0:case 11:case 14:case 15:Bs(2,r,t),bt||Bs(4,r,t),cs(e,t,r);break;case 1:bt||(Hn(r,t),l=r.stateNode,typeof l.componentWillUnmount=="function"&&$m(r,t,l)),cs(e,t,r);break;case 21:cs(e,t,r);break;case 22:bt=(l=bt)||r.memoizedState!==null,cs(e,t,r),bt=l;break;default:cs(e,t,r)}}function Xm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{br(e)}catch(r){Ve(t,t.return,r)}}}function Km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{br(e)}catch(r){Ve(t,t.return,r)}}function ex(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Fm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Fm),t;default:throw Error(a(435,e.tag))}}function Xl(e,t){var r=ex(e);t.forEach(function(l){if(!r.has(l)){r.add(l);var c=cx.bind(null,e,l);l.then(c,c)}})}function Ht(e,t){var r=t.deletions;if(r!==null)for(var l=0;l<r.length;l++){var c=r[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Gs(b.type)){st=b.stateNode,Lt=!1;break e}break;case 5:st=b.stateNode,Lt=!1;break e;case 3:case 4:st=b.stateNode.containerInfo,Lt=!0;break e}b=b.return}if(st===null)throw Error(a(160));Qm(u,p,c),st=null,Lt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Zm(t,e),t=t.sibling}var kn=null;function Zm(e,t){var r=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ht(t,e),Pt(e),l&4&&(Bs(3,e,e.return),pa(3,e),Bs(5,e,e.return));break;case 1:Ht(t,e),Pt(e),l&512&&(bt||r===null||Hn(r,r.return)),l&64&&os&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?l:r.concat(l))));break;case 26:var c=kn;if(Ht(t,e),Pt(e),l&512&&(bt||r===null||Hn(r,r.return)),l&4){var u=r!==null?r.memoizedState:null;if(l=e.memoizedState,r===null)if(l===null)if(e.stateNode===null){e:{l=e.type,r=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[_t]||u[Xe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),Nt(u,l,r),u[Xe]=e,N(u),l=u;break e;case"link":var p=Zp("link","href",c).get(l+(r.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&u.getAttribute("rel")===(r.rel==null?null:r.rel)&&u.getAttribute("title")===(r.title==null?null:r.title)&&u.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),Nt(u,l,r),c.head.appendChild(u);break;case"meta":if(p=Zp("meta","content",c).get(l+(r.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(r.content==null?null:""+r.content)&&u.getAttribute("name")===(r.name==null?null:r.name)&&u.getAttribute("property")===(r.property==null?null:r.property)&&u.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&u.getAttribute("charset")===(r.charSet==null?null:r.charSet)){p.splice(b,1);break t}}u=c.createElement(l),Nt(u,l,r),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Xe]=e,N(u),l=u}e.stateNode=l}else Wp(c,e.type,e.stateNode);else e.stateNode=Kp(c,l,e.memoizedProps);else u!==l?(u===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):u.count--,l===null?Wp(c,e.type,e.stateNode):Kp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&ku(e,e.memoizedProps,r.memoizedProps)}break;case 27:Ht(t,e),Pt(e),l&512&&(bt||r===null||Hn(r,r.return)),r!==null&&l&4&&ku(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Ht(t,e),Pt(e),l&512&&(bt||r===null||Hn(r,r.return)),e.flags&32){c=e.stateNode;try{Pi(c,"")}catch(pe){Ve(e,e.return,pe)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,ku(e,c,r!==null?r.memoizedProps:c)),l&1024&&(Mu=!0);break;case 6:if(Ht(t,e),Pt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,r=e.stateNode;try{r.nodeValue=l}catch(pe){Ve(e,e.return,pe)}}break;case 3:if(ho=null,c=kn,kn=uo(t.containerInfo),Ht(t,e),kn=c,Pt(e),l&4&&r!==null&&r.memoizedState.isDehydrated)try{br(t.containerInfo)}catch(pe){Ve(e,e.return,pe)}Mu&&(Mu=!1,Wm(e));break;case 4:l=kn,kn=uo(e.stateNode.containerInfo),Ht(t,e),Pt(e),kn=l;break;case 12:Ht(t,e),Pt(e);break;case 31:Ht(t,e),Pt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 13:Ht(t,e),Pt(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Zl=nt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 22:c=e.memoizedState!==null;var j=r!==null&&r.memoizedState!==null,U=os,F=bt;if(os=U||c,bt=F||j,Ht(t,e),bt=F,os=U,Pt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(r===null||j||os||bt||Oi(e)),r=null,t=e;;){if(t.tag===5||t.tag===26){if(r===null){j=r=t;try{if(u=j.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=j.stateNode;var te=j.memoizedProps.style,L=te!=null&&te.hasOwnProperty("display")?te.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(pe){Ve(j,j.return,pe)}}}else if(t.tag===6){if(r===null){j=t;try{j.stateNode.nodeValue=c?"":j.memoizedProps}catch(pe){Ve(j,j.return,pe)}}}else if(t.tag===18){if(r===null){j=t;try{var Y=j.stateNode;c?$p(Y,!0):$p(j.stateNode,!1)}catch(pe){Ve(j,j.return,pe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,Xl(e,r))));break;case 19:Ht(t,e),Pt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 30:break;case 21:break;default:Ht(t,e),Pt(e)}}function Pt(e){var t=e.flags;if(t&2){try{for(var r,l=e.return;l!==null;){if(Gm(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var c=r.stateNode,u=Nu(e);Ql(e,u,c);break;case 5:var p=r.stateNode;r.flags&32&&(Pi(p,""),r.flags&=-33);var b=Nu(e);Ql(e,b,p);break;case 3:case 4:var j=r.stateNode.containerInfo,U=Nu(e);Cu(e,U,j);break;default:throw Error(a(161))}}catch(F){Ve(e,e.return,F)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Wm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Wm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function us(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Im(e,t.alternate,t),t=t.sibling}function Oi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Bs(4,t,t.return),Oi(t);break;case 1:Hn(t,t.return);var r=t.stateNode;typeof r.componentWillUnmount=="function"&&$m(t,t.return,r),Oi(t);break;case 27:Aa(t.stateNode);case 26:case 5:Hn(t,t.return),Oi(t);break;case 22:t.memoizedState===null&&Oi(t);break;case 30:Oi(t);break;default:Oi(t)}e=e.sibling}}function fs(e,t,r){for(r=r&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:fs(c,u,r),pa(4,u);break;case 1:if(fs(c,u,r),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(U){Ve(l,l.return,U)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var j=c.shared.hiddenCallbacks;if(j!==null)for(c.shared.hiddenCallbacks=null,c=0;c<j.length;c++)Nd(j[c],b)}catch(U){Ve(l,l.return,U)}}r&&p&64&&Pm(u),ga(u,u.return);break;case 27:Vm(u);case 26:case 5:fs(c,u,r),r&&l===null&&p&4&&Ym(u),ga(u,u.return);break;case 12:fs(c,u,r);break;case 31:fs(c,u,r),r&&p&4&&Xm(c,u);break;case 13:fs(c,u,r),r&&p&4&&Km(c,u);break;case 22:u.memoizedState===null&&fs(c,u,r),ga(u,u.return);break;case 30:break;default:fs(c,u,r)}t=t.sibling}}function Ru(e,t){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&na(r))}function Du(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function Nn(e,t,r,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ep(e,t,r,l),t=t.sibling}function ep(e,t,r,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Nn(e,t,r,l),c&2048&&pa(9,t);break;case 1:Nn(e,t,r,l);break;case 3:Nn(e,t,r,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e)));break;case 12:if(c&2048){Nn(e,t,r,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(j){Ve(t,t.return,j)}}else Nn(e,t,r,l);break;case 31:Nn(e,t,r,l);break;case 13:Nn(e,t,r,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?Nn(e,t,r,l):ya(e,t):u._visibility&2?Nn(e,t,r,l):(u._visibility|=2,lr(e,t,r,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Ru(p,t);break;case 24:Nn(e,t,r,l),c&2048&&Du(t.alternate,t);break;default:Nn(e,t,r,l)}}function lr(e,t,r,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=r,j=l,U=p.flags;switch(p.tag){case 0:case 11:case 15:lr(u,p,b,j,c),pa(8,p);break;case 23:break;case 22:var F=p.stateNode;p.memoizedState!==null?F._visibility&2?lr(u,p,b,j,c):ya(u,p):(F._visibility|=2,lr(u,p,b,j,c)),c&&U&2048&&Ru(p.alternate,p);break;case 24:lr(u,p,b,j,c),c&&U&2048&&Du(p.alternate,p);break;default:lr(u,p,b,j,c)}t=t.sibling}}function ya(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var r=e,l=t,c=l.flags;switch(l.tag){case 22:ya(r,l),c&2048&&Ru(l.alternate,l);break;case 24:ya(r,l),c&2048&&Du(l.alternate,l);break;default:ya(r,l)}t=t.sibling}}var ba=8192;function or(e,t,r){if(e.subtreeFlags&ba)for(e=e.child;e!==null;)tp(e,t,r),e=e.sibling}function tp(e,t,r){switch(e.tag){case 26:or(e,t,r),e.flags&ba&&e.memoizedState!==null&&Hx(r,kn,e.memoizedState,e.memoizedProps);break;case 5:or(e,t,r);break;case 3:case 4:var l=kn;kn=uo(e.stateNode.containerInfo),or(e,t,r),kn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ba,ba=16777216,or(e,t,r),ba=l):or(e,t,r));break;default:or(e,t,r)}}function np(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function xa(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var l=t[r];Et=l,ip(l,e)}np(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sp(e),e=e.sibling}function sp(e){switch(e.tag){case 0:case 11:case 15:xa(e),e.flags&2048&&Bs(9,e,e.return);break;case 3:xa(e);break;case 12:xa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kl(e)):xa(e);break;default:xa(e)}}function Kl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var l=t[r];Et=l,ip(l,e)}np(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Bs(8,t,t.return),Kl(t);break;case 22:r=t.stateNode,r._visibility&2&&(r._visibility&=-3,Kl(t));break;default:Kl(t)}e=e.sibling}}function ip(e,t){for(;Et!==null;){var r=Et;switch(r.tag){case 0:case 11:case 15:Bs(8,r,t);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var l=r.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:na(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,Et=l;else e:for(r=e;Et!==null;){l=Et;var c=l.sibling,u=l.return;if(Jm(l),l===r){Et=null;break e}if(c!==null){c.return=u,Et=c;break e}Et=u}}}var tx={getCacheForType:function(e){var t=Tt(pt),r=t.data.get(e);return r===void 0&&(r=e(),t.data.set(e,r)),r},cacheSignal:function(){return Tt(pt).controller.signal}},nx=typeof WeakMap=="function"?WeakMap:Map,$e=0,Ke=null,Ce=null,De=0,Ge=0,Zt=null,Us=!1,cr=!1,zu=!1,hs=0,ut=0,Ls=0,Ti=0,qu=0,Wt=0,ur=0,va=null,$t=null,Bu=!1,Zl=0,rp=0,Wl=1/0,eo=null,Hs=null,wt=0,Ps=null,fr=null,ds=0,Uu=0,Lu=null,ap=null,_a=0,Hu=null;function en(){return($e&2)!==0&&De!==0?De&-De:$.T!==null?Fu():Yr()}function lp(){if(Wt===0)if((De&536870912)===0||qe){var e=Qn;Qn<<=1,(Qn&3932160)===0&&(Qn=262144),Wt=e}else Wt=536870912;return e=Xt.current,e!==null&&(e.flags|=32),Wt}function Yt(e,t,r){(e===Ke&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)&&(hr(e,0),$s(e,De,Wt,!1)),jn(e,r),(($e&2)===0||e!==Ke)&&(e===Ke&&(($e&2)===0&&(Ti|=r),ut===4&&$s(e,De,Wt,!1)),Pn(e))}function op(e,t,r){if(($e&6)!==0)throw Error(a(327));var l=!r&&(t&127)===0&&(t&e.expiredLanes)===0||ci(e,t),c=l?rx(e,t):$u(e,t,!0),u=l;do{if(c===0){cr&&!l&&$s(e,t,0,!1);break}else{if(r=e.current.alternate,u&&!sx(r)){c=$u(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=va;var j=b.current.memoizedState.isDehydrated;if(j&&(hr(b,p).flags|=256),p=$u(b,p,!1),p!==2){if(zu&&!j){b.errorRecoveryDisabledLanes|=u,Ti|=u,c=4;break e}u=$t,$t=c,u!==null&&($t===null?$t=u:$t.push.apply($t,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){hr(e,0),$s(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:$s(l,t,Wt,!Us);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Zl+300-nt(),10<c)){if($s(l,t,Wt,!Us),oi(l,0,!0)!==0)break e;ds=t,l.timeoutHandle=Lp(cp.bind(null,l,r,$t,eo,Bu,t,Wt,Ti,ur,Us,u,"Throttled",-0,0),c);break e}cp(l,r,$t,eo,Bu,t,Wt,Ti,ur,Us,u,null,-0,0)}}break}while(!0);Pn(e)}function cp(e,t,r,l,c,u,p,b,j,U,F,te,L,Y){if(e.timeoutHandle=-1,te=t.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zn},tp(t,u,te);var pe=(u&62914560)===u?Zl-nt():(u&4194048)===u?rp-nt():0;if(pe=Px(te,pe),pe!==null){ds=u,e.cancelPendingCommit=pe(yp.bind(null,e,t,u,r,l,c,p,b,j,F,te,null,L,Y)),$s(e,u,p,!U);return}}yp(e,t,u,r,l,c,p,b,j)}function sx(e){for(var t=e;;){var r=t.tag;if((r===0||r===11||r===15)&&t.flags&16384&&(r=t.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var c=r[l],u=c.getSnapshot;c=c.value;try{if(!Jt(u(),c))return!1}catch{return!1}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function $s(e,t,r,l){t&=~qu,t&=~Ti,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Ct(c),p=1<<u;l[u]=-1,c&=~p}r!==0&&As(e,r,t)}function to(){return($e&6)===0?(wa(0),!1):!0}function Pu(){if(Ce!==null){if(Ge===0)var e=Ce.return;else e=Ce,ns=xi=null,su(e),nr=null,ia=0,e=Ce;for(;e!==null;)Hm(e.alternate,e),e=e.return;Ce=null}}function hr(e,t){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,Sx(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),ds=0,Pu(),Ke=e,Ce=r=es(e.current,null),De=t,Ge=0,Zt=null,Us=!1,cr=ci(e,t),zu=!1,ur=Wt=qu=Ti=Ls=ut=0,$t=va=null,Bu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Ct(l),u=1<<c;t|=e[c],l&=~u}return hs=t,wl(),r}function up(e,t){Te=null,$.H=ha,t===tr||t===Nl?(t=jd(),Ge=3):t===Vc?(t=jd(),Ge=4):Ge=t===xu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Zt=t,Ce===null&&(ut=1,Gl(e,dn(t,e.current)))}function fp(){var e=Xt.current;return e===null?!0:(De&4194048)===De?yn===null:(De&62914560)===De||(De&536870912)!==0?e===yn:!1}function hp(){var e=$.H;return $.H=ha,e===null?ha:e}function dp(){var e=$.A;return $.A=tx,e}function no(){ut=4,Us||(De&4194048)!==De&&Xt.current!==null||(cr=!0),(Ls&134217727)===0&&(Ti&134217727)===0||Ke===null||$s(Ke,De,Wt,!1)}function $u(e,t,r){var l=$e;$e|=2;var c=hp(),u=dp();(Ke!==e||De!==t)&&(eo=null,hr(e,t)),t=!1;var p=ut;e:do try{if(Ge!==0&&Ce!==null){var b=Ce,j=Zt;switch(Ge){case 8:Pu(),p=6;break e;case 3:case 2:case 9:case 6:Xt.current===null&&(t=!0);var U=Ge;if(Ge=0,Zt=null,dr(e,b,j,U),r&&cr){p=0;break e}break;default:U=Ge,Ge=0,Zt=null,dr(e,b,j,U)}}ix(),p=ut;break}catch(F){up(e,F)}while(!0);return t&&e.shellSuspendCounter++,ns=xi=null,$e=l,$.H=c,$.A=u,Ce===null&&(Ke=null,De=0,wl()),p}function ix(){for(;Ce!==null;)mp(Ce)}function rx(e,t){var r=$e;$e|=2;var l=hp(),c=dp();Ke!==e||De!==t?(eo=null,Wl=nt()+500,hr(e,t)):cr=ci(e,t);e:do try{if(Ge!==0&&Ce!==null){t=Ce;var u=Zt;t:switch(Ge){case 1:Ge=0,Zt=null,dr(e,t,u,1);break;case 2:case 9:if(Ed(u)){Ge=0,Zt=null,pp(t);break}t=function(){Ge!==2&&Ge!==9||Ke!==e||(Ge=7),Pn(e)},u.then(t,t);break e;case 3:Ge=7;break e;case 4:Ge=5;break e;case 7:Ed(u)?(Ge=0,Zt=null,pp(t)):(Ge=0,Zt=null,dr(e,t,u,7));break;case 5:var p=null;switch(Ce.tag){case 26:p=Ce.memoizedState;case 5:case 27:var b=Ce;if(p?e0(p):b.stateNode.complete){Ge=0,Zt=null;var j=b.sibling;if(j!==null)Ce=j;else{var U=b.return;U!==null?(Ce=U,so(U)):Ce=null}break t}}Ge=0,Zt=null,dr(e,t,u,5);break;case 6:Ge=0,Zt=null,dr(e,t,u,6);break;case 8:Pu(),ut=6;break e;default:throw Error(a(462))}}ax();break}catch(F){up(e,F)}while(!0);return ns=xi=null,$.H=l,$.A=c,$e=r,Ce!==null?0:(Ke=null,De=0,wl(),ut)}function ax(){for(;Ce!==null&&!rl();)mp(Ce)}function mp(e){var t=Um(e.alternate,e,hs);e.memoizedProps=e.pendingProps,t===null?so(e):Ce=t}function pp(e){var t=e,r=t.alternate;switch(t.tag){case 15:case 0:t=Mm(r,t,t.pendingProps,t.type,void 0,De);break;case 11:t=Mm(r,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:su(t);default:Hm(r,t),t=Ce=dd(t,hs),t=Um(r,t,hs)}e.memoizedProps=e.pendingProps,t===null?so(e):Ce=t}function dr(e,t,r,l){ns=xi=null,su(t),nr=null,ia=0;var c=t.return;try{if(Jb(e,c,t,r,De)){ut=1,Gl(e,dn(r,e.current)),Ce=null;return}}catch(u){if(c!==null)throw Ce=c,u;ut=1,Gl(e,dn(r,e.current)),Ce=null;return}t.flags&32768?(qe||l===1?e=!0:cr||(De&536870912)!==0?e=!1:(Us=e=!0,(l===2||l===9||l===3||l===6)&&(l=Xt.current,l!==null&&l.tag===13&&(l.flags|=16384))),gp(t,e)):so(t)}function so(e){var t=e;do{if((t.flags&32768)!==0){gp(t,Us);return}e=t.return;var r=Kb(t.alternate,t,hs);if(r!==null){Ce=r;return}if(t=t.sibling,t!==null){Ce=t;return}Ce=t=e}while(t!==null);ut===0&&(ut=5)}function gp(e,t){do{var r=Zb(e.alternate,e);if(r!==null){r.flags&=32767,Ce=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!t&&(e=e.sibling,e!==null)){Ce=e;return}Ce=e=r}while(e!==null);ut=6,Ce=null}function yp(e,t,r,l,c,u,p,b,j){e.cancelPendingCommit=null;do io();while(wt!==0);if(($e&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=Nc,Es(e,r,u,p,b,j),e===Ke&&(Ce=Ke=null,De=0),fr=t,Ps=e,ds=r,Uu=u,Lu=c,ap=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,ux(qi,function(){return wp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=re.p,re.p=2,p=$e,$e|=4;try{Wb(e,t,r)}finally{$e=p,re.p=c,$.T=l}}wt=1,bp(),xp(),vp()}}function bp(){if(wt===1){wt=0;var e=Ps,t=fr,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=$.T,$.T=null;var l=re.p;re.p=2;var c=$e;$e|=4;try{Zm(t,e);var u=ef,p=id(e.containerInfo),b=u.focusedElem,j=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&sd(b.ownerDocument.documentElement,b)){if(j!==null&&Ac(b)){var U=j.start,F=j.end;if(F===void 0&&(F=U),"selectionStart"in b)b.selectionStart=U,b.selectionEnd=Math.min(F,b.value.length);else{var te=b.ownerDocument||document,L=te&&te.defaultView||window;if(L.getSelection){var Y=L.getSelection(),pe=b.textContent.length,_e=Math.min(j.start,pe),Qe=j.end===void 0?_e:Math.min(j.end,pe);!Y.extend&&_e>Qe&&(p=Qe,Qe=_e,_e=p);var R=nd(b,_e),C=nd(b,Qe);if(R&&C&&(Y.rangeCount!==1||Y.anchorNode!==R.node||Y.anchorOffset!==R.offset||Y.focusNode!==C.node||Y.focusOffset!==C.offset)){var B=te.createRange();B.setStart(R.node,R.offset),Y.removeAllRanges(),_e>Qe?(Y.addRange(B),Y.extend(C.node,C.offset)):(B.setEnd(C.node,C.offset),Y.addRange(B))}}}}for(te=[],Y=b;Y=Y.parentNode;)Y.nodeType===1&&te.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<te.length;b++){var J=te[b];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}yo=!!Wu,ef=Wu=null}finally{$e=c,re.p=l,$.T=r}}e.current=t,wt=2}}function xp(){if(wt===2){wt=0;var e=Ps,t=fr,r=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||r){r=$.T,$.T=null;var l=re.p;re.p=2;var c=$e;$e|=4;try{Im(e,t.alternate,t)}finally{$e=c,re.p=l,$.T=r}}wt=3}}function vp(){if(wt===4||wt===3){wt=0,zi();var e=Ps,t=fr,r=ds,l=ap;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?wt=5:(wt=0,fr=Ps=null,_p(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Hs=null),fi(r),t=t.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(li,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=re.p,re.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,re.p=c}}(ds&3)!==0&&io(),Pn(e),c=e.pendingLanes,(r&261930)!==0&&(c&42)!==0?e===Hu?_a++:(_a=0,Hu=e):_a=0,wa(0)}}function _p(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function io(){return bp(),xp(),vp(),wp()}function wp(){if(wt!==5)return!1;var e=Ps,t=Uu;Uu=0;var r=fi(ds),l=$.T,c=re.p;try{re.p=32>r?32:r,$.T=null,r=Lu,Lu=null;var u=Ps,p=ds;if(wt=0,fr=Ps=null,ds=0,($e&6)!==0)throw Error(a(331));var b=$e;if($e|=4,sp(u.current),ep(u,u.current,p,r),$e=b,wa(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(li,u)}catch{}return!0}finally{re.p=c,$.T=l,_p(e,t)}}function Sp(e,t,r){t=dn(r,t),t=bu(e.stateNode,t,2),e=Ds(e,t,2),e!==null&&(jn(e,2),Pn(e))}function Ve(e,t,r){if(e.tag===3)Sp(e,e,r);else for(;t!==null;){if(t.tag===3){Sp(t,e,r);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Hs===null||!Hs.has(l))){e=dn(r,e),r=Em(2),l=Ds(t,r,2),l!==null&&(Am(r,l,t,e),jn(l,2),Pn(l));break}}t=t.return}}function Yu(e,t,r){var l=e.pingCache;if(l===null){l=e.pingCache=new nx;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(r)||(zu=!0,c.add(r),e=lx.bind(null,e,t,r),t.then(e,e))}function lx(e,t,r){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Ke===e&&(De&r)===r&&(ut===4||ut===3&&(De&62914560)===De&&300>nt()-Zl?($e&2)===0&&hr(e,0):qu|=r,ur===De&&(ur=0)),Pn(e)}function Ep(e,t){t===0&&(t=Ui()),e=gi(e,t),e!==null&&(jn(e,t),Pn(e))}function ox(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Ep(e,r)}function cx(e,t){var r=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(r=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),Ep(e,r)}function ux(e,t){return Lr(e,t)}var ro=null,mr=null,Gu=!1,ao=!1,Vu=!1,Ys=0;function Pn(e){e!==mr&&e.next===null&&(mr===null?ro=mr=e:mr=mr.next=e),ao=!0,Gu||(Gu=!0,hx())}function wa(e,t){if(!Vu&&ao){Vu=!0;do for(var r=!1,l=ro;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Ct(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(r=!0,Tp(l,u))}else u=De,u=oi(l,l===Ke?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ci(l,u)||(r=!0,Tp(l,u));l=l.next}while(r);Vu=!1}}function fx(){Ap()}function Ap(){ao=Gu=!1;var e=0;Ys!==0&&wx()&&(e=Ys);for(var t=nt(),r=null,l=ro;l!==null;){var c=l.next,u=jp(l,t);u===0?(l.next=null,r===null?ro=c:r.next=c,c===null&&(mr=r)):(r=l,(e!==0||(u&3)!==0)&&(ao=!0)),l=c}wt!==0&&wt!==5||wa(e),Ys!==0&&(Ys=0)}function jp(e,t){for(var r=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Ct(u),b=1<<p,j=c[p];j===-1?((b&r)===0||(b&l)!==0)&&(c[p]=$r(b,t)):j<=t&&(e.expiredLanes|=b),u&=~b}if(t=Ke,r=De,r=oi(e,e===t?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,r===0||e===t&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Jn(l),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||ci(e,r)){if(t=r&-r,t===e.callbackPriority)return t;switch(l!==null&&Jn(l),fi(r)){case 2:case 8:r=ll;break;case 32:r=qi;break;case 268435456:r=ol;break;default:r=qi}return l=Op.bind(null,e),r=Lr(r,l),e.callbackPriority=t,e.callbackNode=r,t}return l!==null&&l!==null&&Jn(l),e.callbackPriority=2,e.callbackNode=null,2}function Op(e,t){if(wt!==0&&wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(io()&&e.callbackNode!==r)return null;var l=De;return l=oi(e,e===Ke?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(op(e,l,t),jp(e,nt()),e.callbackNode!=null&&e.callbackNode===r?Op.bind(null,e):null)}function Tp(e,t){if(io())return null;op(e,t,!0)}function hx(){Ex(function(){($e&6)!==0?Lr(al,fx):Ap()})}function Fu(){if(Ys===0){var e=Wi;e===0&&(e=_s,_s<<=1,(_s&261888)===0&&(_s=256)),Ys=e}return Ys}function kp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ml(""+e)}function Np(e,t){var r=t.ownerDocument.createElement("input");return r.name=t.name,r.value=t.value,e.id&&r.setAttribute("form",e.id),t.parentNode.insertBefore(r,t),e=new FormData(e),r.parentNode.removeChild(r),e}function dx(e,t,r,l,c){if(t==="submit"&&r&&r.stateNode===c){var u=kp((c[ot]||null).action),p=l.submitter;p&&(t=(t=p[ot]||null)?kp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new bl("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ys!==0){var j=p?Np(c,p):new FormData(c);hu(r,{pending:!0,data:j,method:c.method,action:u},null,j)}}else typeof u=="function"&&(b.preventDefault(),j=p?Np(c,p):new FormData(c),hu(r,{pending:!0,data:j,method:c.method,action:u},u,j))},currentTarget:c}]})}}for(var Iu=0;Iu<kc.length;Iu++){var Ju=kc[Iu],mx=Ju.toLowerCase(),px=Ju[0].toUpperCase()+Ju.slice(1);Tn(mx,"on"+px)}Tn(ld,"onAnimationEnd"),Tn(od,"onAnimationIteration"),Tn(cd,"onAnimationStart"),Tn("dblclick","onDoubleClick"),Tn("focusin","onFocus"),Tn("focusout","onBlur"),Tn(Cb,"onTransitionRun"),Tn(Mb,"onTransitionStart"),Tn(Rb,"onTransitionCancel"),Tn(ud,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),se("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),se("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),se("onBeforeInput",["compositionend","keypress","textInput","paste"]),se("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sa="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(" "),gx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Sa));function Cp(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var l=e[r],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],j=b.instance,U=b.currentTarget;if(b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=U;try{u(c)}catch(F){_l(F)}c.currentTarget=null,u=j}else for(p=0;p<l.length;p++){if(b=l[p],j=b.instance,U=b.currentTarget,b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=U;try{u(c)}catch(F){_l(F)}c.currentTarget=null,u=j}}}}function Me(e,t){var r=t[hi];r===void 0&&(r=t[hi]=new Set);var l=e+"__bubble";r.has(l)||(Mp(t,e,2,!1),r.add(l))}function Qu(e,t,r){var l=0;t&&(l|=4),Mp(r,e,l,t)}var lo="_reactListening"+Math.random().toString(36).slice(2);function Xu(e){if(!e[lo]){e[lo]=!0,D.forEach(function(r){r!=="selectionchange"&&(gx.has(r)||Qu(r,!1,e),Qu(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[lo]||(t[lo]=!0,Qu("selectionchange",!1,t))}}function Mp(e,t,r,l){switch(l0(t)){case 2:var c=Gx;break;case 8:c=Vx;break;default:c=hf}r=c.bind(null,t,r,e),c=void 0,!gc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,r,{capture:!0,passive:c}):e.addEventListener(t,r,!0):c!==void 0?e.addEventListener(t,r,{passive:c}):e.addEventListener(t,r,!1)}function Ku(e,t,r,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var j=p.tag;if((j===3||j===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(j=p.tag,j===5||j===6||j===26||j===27){l=u=p;continue e}b=b.parentNode}}l=l.return}Bh(function(){var U=u,F=mc(r),te=[];e:{var L=fd.get(e);if(L!==void 0){var Y=bl,pe=e;switch(e){case"keypress":if(gl(r)===0)break e;case"keydown":case"keyup":Y=cb;break;case"focusin":pe="focus",Y=vc;break;case"focusout":pe="blur",Y=vc;break;case"beforeblur":case"afterblur":Y=vc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Y=Hh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=Ky;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=hb;break;case ld:case od:case cd:Y=eb;break;case ud:Y=mb;break;case"scroll":case"scrollend":Y=Qy;break;case"wheel":Y=gb;break;case"copy":case"cut":case"paste":Y=nb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=$h;break;case"toggle":case"beforetoggle":Y=bb}var _e=(t&4)!==0,Qe=!_e&&(e==="scroll"||e==="scrollend"),R=_e?L!==null?L+"Capture":null:L;_e=[];for(var C=U,B;C!==null;){var J=C;if(B=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||B===null||R===null||(J=Vr(C,R),J!=null&&_e.push(Ea(C,J,B))),Qe)break;C=C.return}0<_e.length&&(L=new Y(L,pe,null,r,F),te.push({event:L,listeners:_e}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",Y=e==="mouseout"||e==="pointerout",L&&r!==dc&&(pe=r.relatedTarget||r.fromElement)&&(x(pe)||pe[It]))break e;if((Y||L)&&(L=F.window===F?F:(L=F.ownerDocument)?L.defaultView||L.parentWindow:window,Y?(pe=r.relatedTarget||r.toElement,Y=U,pe=pe?x(pe):null,pe!==null&&(Qe=f(pe),_e=pe.tag,pe!==Qe||_e!==5&&_e!==27&&_e!==6)&&(pe=null)):(Y=null,pe=U),Y!==pe)){if(_e=Hh,J="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(_e=$h,J="onPointerLeave",R="onPointerEnter",C="pointer"),Qe=Y==null?L:_(Y),B=pe==null?L:_(pe),L=new _e(J,C+"leave",Y,r,F),L.target=Qe,L.relatedTarget=B,J=null,x(F)===U&&(_e=new _e(R,C+"enter",pe,r,F),_e.target=B,_e.relatedTarget=Qe,J=_e),Qe=J,Y&&pe)t:{for(_e=yx,R=Y,C=pe,B=0,J=R;J;J=_e(J))B++;J=0;for(var be=C;be;be=_e(be))J++;for(;0<B-J;)R=_e(R),B--;for(;0<J-B;)C=_e(C),J--;for(;B--;){if(R===C||C!==null&&R===C.alternate){_e=R;break t}R=_e(R),C=_e(C)}_e=null}else _e=null;Y!==null&&Rp(te,L,Y,_e,!1),pe!==null&&Qe!==null&&Rp(te,Qe,pe,_e,!0)}}e:{if(L=U?_(U):window,Y=L.nodeName&&L.nodeName.toLowerCase(),Y==="select"||Y==="input"&&L.type==="file")var Le=Xh;else if(Jh(L))if(Kh)Le=Tb;else{Le=jb;var ye=Ab}else Y=L.nodeName,!Y||Y.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?U&&hc(U.elementType)&&(Le=Xh):Le=Ob;if(Le&&(Le=Le(e,U))){Qh(te,Le,r,F);break e}ye&&ye(e,L,U),e==="focusout"&&U&&L.type==="number"&&U.memoizedProps.value!=null&&fc(L,"number",L.value)}switch(ye=U?_(U):window,e){case"focusin":(Jh(ye)||ye.contentEditable==="true")&&(Vi=ye,jc=U,Wr=null);break;case"focusout":Wr=jc=Vi=null;break;case"mousedown":Oc=!0;break;case"contextmenu":case"mouseup":case"dragend":Oc=!1,rd(te,r,F);break;case"selectionchange":if(Nb)break;case"keydown":case"keyup":rd(te,r,F)}var ke;if(wc)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Gi?Fh(e,r)&&(ze="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(ze="onCompositionStart");ze&&(Yh&&r.locale!=="ko"&&(Gi||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Gi&&(ke=Uh()):(Os=F,yc="value"in Os?Os.value:Os.textContent,Gi=!0)),ye=oo(U,ze),0<ye.length&&(ze=new Ph(ze,e,null,r,F),te.push({event:ze,listeners:ye}),ke?ze.data=ke:(ke=Ih(r),ke!==null&&(ze.data=ke)))),(ke=vb?_b(e,r):wb(e,r))&&(ze=oo(U,"onBeforeInput"),0<ze.length&&(ye=new Ph("onBeforeInput","beforeinput",null,r,F),te.push({event:ye,listeners:ze}),ye.data=ke)),dx(te,e,U,r,F)}Cp(te,t)})}function Ea(e,t,r){return{instance:e,listener:t,currentTarget:r}}function oo(e,t){for(var r=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Vr(e,r),c!=null&&l.unshift(Ea(e,c,u)),c=Vr(e,t),c!=null&&l.push(Ea(e,c,u))),e.tag===3)return l;e=e.return}return[]}function yx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Rp(e,t,r,l,c){for(var u=t._reactName,p=[];r!==null&&r!==l;){var b=r,j=b.alternate,U=b.stateNode;if(b=b.tag,j!==null&&j===l)break;b!==5&&b!==26&&b!==27||U===null||(j=U,c?(U=Vr(r,u),U!=null&&p.unshift(Ea(r,U,j))):c||(U=Vr(r,u),U!=null&&p.push(Ea(r,U,j)))),r=r.return}p.length!==0&&e.push({event:t,listeners:p})}var bx=/\r\n?/g,xx=/\u0000|\uFFFD/g;function Dp(e){return(typeof e=="string"?e:""+e).replace(bx,`
|
|
26
|
+
`).replace(xx,"")}function zp(e,t){return t=Dp(t),Dp(e)===t}function Je(e,t,r,l,c,u){switch(r){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Pi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Pi(e,""+l);break;case"className":On(e,"class",l);break;case"tabIndex":On(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":On(e,r,l);break;case"style":zh(e,l,u);break;case"data":if(t!=="object"){On(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||r!=="href")){e.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=ml(""+l),e.setAttribute(r,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(r==="formAction"?(t!=="input"&&Je(e,t,"name",c.name,c,null),Je(e,t,"formEncType",c.formEncType,c,null),Je(e,t,"formMethod",c.formMethod,c,null),Je(e,t,"formTarget",c.formTarget,c,null)):(Je(e,t,"encType",c.encType,c,null),Je(e,t,"method",c.method,c,null),Je(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=ml(""+l),e.setAttribute(r,l);break;case"onClick":l!=null&&(e.onclick=Zn);break;case"onScroll":l!=null&&Me("scroll",e);break;case"onScrollEnd":l!=null&&Me("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}r=ml(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,""+l):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":l===!0?e.setAttribute(r,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,l):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(r,l):e.removeAttribute(r);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(r):e.setAttribute(r,l);break;case"popover":Me("beforetoggle",e),Me("toggle",e),Mt(e,"popover",l);break;case"xlinkActuate":Kn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Kn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Kn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Kn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Kn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Kn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Mt(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Iy.get(r)||r,Mt(e,r,l))}}function Zu(e,t,r,l,c,u){switch(r){case"style":zh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"children":typeof l=="string"?Pi(e,l):(typeof l=="number"||typeof l=="bigint")&&Pi(e,""+l);break;case"onScroll":l!=null&&Me("scroll",e);break;case"onScrollEnd":l!=null&&Me("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Zn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!W.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(c=r.endsWith("Capture"),t=r.slice(2,c?r.length-7:void 0),u=e[ot]||null,u=u!=null?u[r]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(t,l,c);break e}r in e?e[r]=l:l===!0?e.setAttribute(r,""):Mt(e,r,l)}}}function Nt(e,t,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Me("error",e),Me("load",e);var l=!1,c=!1,u;for(u in r)if(r.hasOwnProperty(u)){var p=r[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,u,p,r,null)}}c&&Je(e,t,"srcSet",r.srcSet,r,null),l&&Je(e,t,"src",r.src,r,null);return;case"input":Me("invalid",e);var b=u=p=c=null,j=null,U=null;for(l in r)if(r.hasOwnProperty(l)){var F=r[l];if(F!=null)switch(l){case"name":c=F;break;case"type":p=F;break;case"checked":j=F;break;case"defaultChecked":U=F;break;case"value":u=F;break;case"defaultValue":b=F;break;case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(a(137,t));break;default:Je(e,t,l,F,r,null)}}Ch(e,u,b,j,U,p,c,!1);return;case"select":Me("invalid",e),l=p=u=null;for(c in r)if(r.hasOwnProperty(c)&&(b=r[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Je(e,t,c,b,r,null)}t=u,r=p,e.multiple=!!l,t!=null?Hi(e,!!l,t,!1):r!=null&&Hi(e,!!l,r,!0);return;case"textarea":Me("invalid",e),u=c=l=null;for(p in r)if(r.hasOwnProperty(p)&&(b=r[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Je(e,t,p,b,r,null)}Rh(e,l,c,u);return;case"option":for(j in r)if(r.hasOwnProperty(j)&&(l=r[j],l!=null))switch(j){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Je(e,t,j,l,r,null)}return;case"dialog":Me("beforetoggle",e),Me("toggle",e),Me("cancel",e),Me("close",e);break;case"iframe":case"object":Me("load",e);break;case"video":case"audio":for(l=0;l<Sa.length;l++)Me(Sa[l],e);break;case"image":Me("error",e),Me("load",e);break;case"details":Me("toggle",e);break;case"embed":case"source":case"link":Me("error",e),Me("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in r)if(r.hasOwnProperty(U)&&(l=r[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,U,l,r,null)}return;default:if(hc(t)){for(F in r)r.hasOwnProperty(F)&&(l=r[F],l!==void 0&&Zu(e,t,F,l,r,void 0));return}}for(b in r)r.hasOwnProperty(b)&&(l=r[b],l!=null&&Je(e,t,b,l,r,null))}function vx(e,t,r,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,j=null,U=null,F=null;for(Y in r){var te=r[Y];if(r.hasOwnProperty(Y)&&te!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":j=te;default:l.hasOwnProperty(Y)||Je(e,t,Y,null,l,te)}}for(var L in l){var Y=l[L];if(te=r[L],l.hasOwnProperty(L)&&(Y!=null||te!=null))switch(L){case"type":u=Y;break;case"name":c=Y;break;case"checked":U=Y;break;case"defaultChecked":F=Y;break;case"value":p=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Y!==te&&Je(e,t,L,Y,l,te)}}uc(e,p,b,j,U,F,u,c);return;case"select":Y=p=b=L=null;for(u in r)if(j=r[u],r.hasOwnProperty(u)&&j!=null)switch(u){case"value":break;case"multiple":Y=j;default:l.hasOwnProperty(u)||Je(e,t,u,null,l,j)}for(c in l)if(u=l[c],j=r[c],l.hasOwnProperty(c)&&(u!=null||j!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==j&&Je(e,t,c,u,l,j)}t=b,r=p,l=Y,L!=null?Hi(e,!!r,L,!1):!!l!=!!r&&(t!=null?Hi(e,!!r,t,!0):Hi(e,!!r,r?[]:"",!1));return;case"textarea":Y=L=null;for(b in r)if(c=r[b],r.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Je(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=r[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":Y=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Je(e,t,p,c,l,u)}Mh(e,L,Y);return;case"option":for(var pe in r)if(L=r[pe],r.hasOwnProperty(pe)&&L!=null&&!l.hasOwnProperty(pe))switch(pe){case"selected":e.selected=!1;break;default:Je(e,t,pe,null,l,L)}for(j in l)if(L=l[j],Y=r[j],l.hasOwnProperty(j)&&L!==Y&&(L!=null||Y!=null))switch(j){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Je(e,t,j,L,l,Y)}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 _e in r)L=r[_e],r.hasOwnProperty(_e)&&L!=null&&!l.hasOwnProperty(_e)&&Je(e,t,_e,null,l,L);for(U in l)if(L=l[U],Y=r[U],l.hasOwnProperty(U)&&L!==Y&&(L!=null||Y!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Je(e,t,U,L,l,Y)}return;default:if(hc(t)){for(var Qe in r)L=r[Qe],r.hasOwnProperty(Qe)&&L!==void 0&&!l.hasOwnProperty(Qe)&&Zu(e,t,Qe,void 0,l,L);for(F in l)L=l[F],Y=r[F],!l.hasOwnProperty(F)||L===Y||L===void 0&&Y===void 0||Zu(e,t,F,L,l,Y);return}}for(var R in r)L=r[R],r.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Je(e,t,R,null,l,L);for(te in l)L=l[te],Y=r[te],!l.hasOwnProperty(te)||L===Y||L==null&&Y==null||Je(e,t,te,L,l,Y)}function qp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _x(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var c=r[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&qp(p)){for(p=0,b=c.responseEnd,l+=1;l<r.length;l++){var j=r[l],U=j.startTime;if(U>b)break;var F=j.transferSize,te=j.initiatorType;F&&qp(te)&&(j=j.responseEnd,p+=F*(j<b?1:(b-U)/(j-U)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Wu=null,ef=null;function co(e){return e.nodeType===9?e:e.ownerDocument}function Bp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Up(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function tf(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var nf=null;function wx(){var e=window.event;return e&&e.type==="popstate"?e===nf?!1:(nf=e,!0):(nf=null,!1)}var Lp=typeof setTimeout=="function"?setTimeout:void 0,Sx=typeof clearTimeout=="function"?clearTimeout:void 0,Hp=typeof Promise=="function"?Promise:void 0,Ex=typeof queueMicrotask=="function"?queueMicrotask:typeof Hp<"u"?function(e){return Hp.resolve(null).then(e).catch(Ax)}:Lp;function Ax(e){setTimeout(function(){throw e})}function Gs(e){return e==="head"}function Pp(e,t){var r=t,l=0;do{var c=r.nextSibling;if(e.removeChild(r),c&&c.nodeType===8)if(r=c.data,r==="/$"||r==="/&"){if(l===0){e.removeChild(c),br(t);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Aa(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Aa(r);for(var u=r.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[_t]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||r.removeChild(u),u=p}}else r==="body"&&Aa(e.ownerDocument.body);r=c}while(r);br(t)}function $p(e,t){var r=e;e=0;do{var l=r.nextSibling;if(r.nodeType===1?t?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(t?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),l&&l.nodeType===8)if(r=l.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=l}while(r)}function sf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var r=t;switch(t=t.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":sf(r),Li(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function jx(e,t,r,l){for(;e.nodeType===1;){var c=r;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[_t])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=bn(e.nextSibling),e===null)break}return null}function Ox(e,t,r){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=bn(e.nextSibling),e===null))return null;return e}function Yp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=bn(e.nextSibling),e===null))return null;return e}function rf(e){return e.data==="$?"||e.data==="$~"}function af(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Tx(e,t){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||r.readyState!=="loading")t();else{var l=function(){t(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function bn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var lf=null;function Gp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(t===0)return bn(e.nextSibling);t--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||t++}e=e.nextSibling}return null}function Vp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(t===0)return e;t--}else r!=="/$"&&r!=="/&"||t++}e=e.previousSibling}return null}function Fp(e,t,r){switch(t=co(r),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function Aa(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Li(e)}var xn=new Map,Ip=new Set;function uo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ms=re.d;re.d={f:kx,r:Nx,D:Cx,C:Mx,L:Rx,m:Dx,X:qx,S:zx,M:Bx};function kx(){var e=ms.f(),t=to();return e||t}function Nx(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?um(t):ms.r(e)}var pr=typeof document>"u"?null:document;function Jp(e,t,r){var l=pr;if(l&&typeof t=="string"&&t){var c=fn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof r=="string"&&(c+='[crossorigin="'+r+'"]'),Ip.has(c)||(Ip.add(c),e={rel:e,crossOrigin:r,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),Nt(t,"link",e),N(t),l.head.appendChild(t)))}}function Cx(e){ms.D(e),Jp("dns-prefetch",e,null)}function Mx(e,t){ms.C(e,t),Jp("preconnect",e,t)}function Rx(e,t,r){ms.L(e,t,r);var l=pr;if(l&&e&&t){var c='link[rel="preload"][as="'+fn(t)+'"]';t==="image"&&r&&r.imageSrcSet?(c+='[imagesrcset="'+fn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(c+='[imagesizes="'+fn(r.imageSizes)+'"]')):c+='[href="'+fn(e)+'"]';var u=c;switch(t){case"style":u=gr(e);break;case"script":u=yr(e)}xn.has(u)||(e=w({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),xn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ja(u))||t==="script"&&l.querySelector(Oa(u))||(t=l.createElement("link"),Nt(t,"link",e),N(t),l.head.appendChild(t)))}}function Dx(e,t){ms.m(e,t);var r=pr;if(r&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+fn(l)+'"][href="'+fn(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=yr(e)}if(!xn.has(u)&&(e=w({rel:"modulepreload",href:e},t),xn.set(u,e),r.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Oa(u)))return}l=r.createElement("link"),Nt(l,"link",e),N(l),r.head.appendChild(l)}}}function zx(e,t,r){ms.S(e,t,r);var l=pr;if(l&&e){var c=A(l).hoistableStyles,u=gr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ja(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},r),(r=xn.get(u))&&of(e,r);var j=p=l.createElement("link");N(j),Nt(j,"link",e),j._p=new Promise(function(U,F){j.onload=U,j.onerror=F}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,fo(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function qx(e,t){ms.X(e,t);var r=pr;if(r&&e){var l=A(r).hoistableScripts,c=yr(e),u=l.get(c);u||(u=r.querySelector(Oa(c)),u||(e=w({src:e,async:!0},t),(t=xn.get(c))&&cf(e,t),u=r.createElement("script"),N(u),Nt(u,"link",e),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Bx(e,t){ms.M(e,t);var r=pr;if(r&&e){var l=A(r).hoistableScripts,c=yr(e),u=l.get(c);u||(u=r.querySelector(Oa(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=xn.get(c))&&cf(e,t),u=r.createElement("script"),N(u),Nt(u,"link",e),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Qp(e,t,r,l){var c=(c=St.current)?uo(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(t=gr(r.href),r=A(c).hoistableStyles,l=r.get(t),l||(l={type:"style",instance:null,count:0,state:null},r.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=gr(r.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ja(e)))&&!u._p&&(p.instance=u,p.state.loading=5),xn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},xn.set(e,r),u||Ux(c,e,r,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=yr(r),r=A(c).hoistableScripts,l=r.get(t),l||(l={type:"script",instance:null,count:0,state:null},r.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function gr(e){return'href="'+fn(e)+'"'}function ja(e){return'link[rel="stylesheet"]['+e+"]"}function Xp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Ux(e,t,r,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Nt(t,"link",r),N(t),e.head.appendChild(t))}function yr(e){return'[src="'+fn(e)+'"]'}function Oa(e){return"script[async]"+e}function Kp(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+fn(r.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),Nt(l,"style",c),fo(l,r.precedence,e),t.instance=l;case"stylesheet":c=gr(r.href);var u=e.querySelector(ja(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Xp(r),(c=xn.get(c))&&of(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),Nt(u,"link",l),t.state.loading|=4,fo(u,r.precedence,e),t.instance=u;case"script":return u=yr(r.src),(c=e.querySelector(Oa(u)))?(t.instance=c,N(c),c):(l=r,(c=xn.get(u))&&(l=w({},r),cf(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),Nt(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,fo(l,r.precedence,e));return t.instance}function fo(e,t,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=r.nodeType===9?r.head:r,t.insertBefore(e,t.firstChild))}function of(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function cf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ho=null;function Zp(e,t,r){if(ho===null){var l=new Map,c=ho=new Map;c.set(r,l)}else c=ho,l=c.get(r),l||(l=new Map,c.set(r,l));if(l.has(e))return l;for(l.set(e,null),r=r.getElementsByTagName(e),c=0;c<r.length;c++){var u=r[c];if(!(u[_t]||u[Xe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function Wp(e,t,r){e=e.ownerDocument||e,e.head.insertBefore(r,t==="title"?e.querySelector("head > title"):null)}function Lx(e,t,r){if(r===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function e0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Hx(e,t,r,l){if(r.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var c=gr(l.href),u=t.querySelector(ja(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=mo.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=u,N(u);return}u=t.ownerDocument||t,l=Xp(l),(c=xn.get(c))&&of(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),Nt(u,"link",l),r.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=mo.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var uf=0;function Px(e,t){return e.stylesheets&&e.count===0&&go(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var l=setTimeout(function(){if(e.stylesheets&&go(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&uf===0&&(uf=62500*_x());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&go(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>uf?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function mo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var po=null;function go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,po=new Map,t.forEach($x,e),po=null,mo.call(e))}function $x(e,t){if(!(t.state.loading&4)){var r=po.get(e);if(r)var l=r.get(null);else{r=new Map,po.set(e,r);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(r.set(p.dataset.precedence,p),l=p)}l&&r.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=r.get(p)||l,u===l&&r.set(null,c),r.set(p,c),this.count++,l=mo.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Ta={$$typeof:fe,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function Yx(e,t,r,l,c,u,p,b,j){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ss(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ss(0),this.hiddenUpdates=Ss(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function t0(e,t,r,l,c,u,p,b,j,U,F,te){return e=new Yx(e,t,r,p,j,U,F,te,b),t=1,u===!0&&(t|=24),u=Qt(3,null,null,t),e.current=u,u.stateNode=e,t=$c(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:r,cache:t},Fc(u),e}function n0(e){return e?(e=Ji,e):Ji}function s0(e,t,r,l,c,u){c=n0(c),l.context===null?l.context=c:l.pendingContext=c,l=Rs(t),l.payload={element:r},u=u===void 0?null:u,u!==null&&(l.callback=u),r=Ds(e,l,t),r!==null&&(Yt(r,e,t),aa(r,e,t))}function i0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function ff(e,t){i0(e,t),(e=e.alternate)&&i0(e,t)}function r0(e){if(e.tag===13||e.tag===31){var t=gi(e,67108864);t!==null&&Yt(t,e,67108864),ff(e,67108864)}}function a0(e){if(e.tag===13||e.tag===31){var t=en();t=Xn(t);var r=gi(e,t);r!==null&&Yt(r,e,t),ff(e,t)}}var yo=!0;function Gx(e,t,r,l){var c=$.T;$.T=null;var u=re.p;try{re.p=2,hf(e,t,r,l)}finally{re.p=u,$.T=c}}function Vx(e,t,r,l){var c=$.T;$.T=null;var u=re.p;try{re.p=8,hf(e,t,r,l)}finally{re.p=u,$.T=c}}function hf(e,t,r,l){if(yo){var c=df(l);if(c===null)Ku(e,t,l,bo,r),o0(e,l);else if(Ix(c,e,t,r,l))l.stopPropagation();else if(o0(e,l),t&4&&-1<Fx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=An(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var j=1<<31-Ct(p);b.entanglements[1]|=j,p&=~j}Pn(u),($e&6)===0&&(Wl=nt()+500,wa(0))}}break;case 31:case 13:b=gi(u,2),b!==null&&Yt(b,u,2),to(),ff(u,2)}if(u=df(l),u===null&&Ku(e,t,l,bo,r),u===c)break;c=u}c!==null&&l.stopPropagation()}else Ku(e,t,l,null,r)}}function df(e){return e=mc(e),mf(e)}var bo=null;function mf(e){if(bo=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var r=t.tag;if(r===13){if(e=d(t),e!==null)return e;e=null}else if(r===31){if(e=m(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return bo=e,null}function l0(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ac()){case al:return 2;case ll:return 8;case qi:case lc:return 32;case ol:return 268435456;default:return 32}default:return 32}}var pf=!1,Vs=null,Fs=null,Is=null,ka=new Map,Na=new Map,Js=[],Fx="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 o0(e,t){switch(e){case"focusin":case"focusout":Vs=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":Is=null;break;case"pointerover":case"pointerout":ka.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Na.delete(t.pointerId)}}function Ca(e,t,r,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:r,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&r0(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Ix(e,t,r,l,c){switch(t){case"focusin":return Vs=Ca(Vs,e,t,r,l,c),!0;case"dragenter":return Fs=Ca(Fs,e,t,r,l,c),!0;case"mouseover":return Is=Ca(Is,e,t,r,l,c),!0;case"pointerover":var u=c.pointerId;return ka.set(u,Ca(ka.get(u)||null,e,t,r,l,c)),!0;case"gotpointercapture":return u=c.pointerId,Na.set(u,Ca(Na.get(u)||null,e,t,r,l,c)),!0}return!1}function c0(e){var t=x(e.target);if(t!==null){var r=f(t);if(r!==null){if(t=r.tag,t===13){if(t=d(r),t!==null){e.blockedOn=t,ul(e.priority,function(){a0(r)});return}}else if(t===31){if(t=m(r),t!==null){e.blockedOn=t,ul(e.priority,function(){a0(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function xo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=df(e.nativeEvent);if(r===null){r=e.nativeEvent;var l=new r.constructor(r.type,r);dc=l,r.target.dispatchEvent(l),dc=null}else return t=S(r),t!==null&&r0(t),e.blockedOn=r,!1;t.shift()}return!0}function u0(e,t,r){xo(e)&&r.delete(t)}function Jx(){pf=!1,Vs!==null&&xo(Vs)&&(Vs=null),Fs!==null&&xo(Fs)&&(Fs=null),Is!==null&&xo(Is)&&(Is=null),ka.forEach(u0),Na.forEach(u0)}function vo(e,t){e.blockedOn===t&&(e.blockedOn=null,pf||(pf=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Jx)))}var _o=null;function f0(e){_o!==e&&(_o=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){_o===e&&(_o=null);for(var t=0;t<e.length;t+=3){var r=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(mf(l||r)===null)continue;break}var u=S(r);u!==null&&(e.splice(t,3),t-=3,hu(u,{pending:!0,data:c,method:r.method,action:l},l,c))}}))}function br(e){function t(j){return vo(j,e)}Vs!==null&&vo(Vs,e),Fs!==null&&vo(Fs,e),Is!==null&&vo(Is,e),ka.forEach(t),Na.forEach(t);for(var r=0;r<Js.length;r++){var l=Js[r];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Js.length&&(r=Js[0],r.blockedOn===null);)c0(r),r.blockedOn===null&&Js.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var c=r[l],u=r[l+1],p=c[ot]||null;if(typeof u=="function")p||f0(r);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[ot]||null)b=p.formAction;else if(mf(c)!==null)continue}else b=p.action;typeof b=="function"?r[l+1]=b:(r.splice(l,3),l-=3),f0(r)}}}function h0(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function gf(e){this._internalRoot=e}wo.prototype.render=gf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var r=t.current,l=en();s0(r,l,e,t,null,null)},wo.prototype.unmount=gf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;s0(e.current,2,null,e,null,null),to(),t[It]=null}};function wo(e){this._internalRoot=e}wo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Yr();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Js.length&&t!==0&&t<Js[r].priority;r++);Js.splice(r,0,e),r===0&&c0(e)}};var d0=n.version;if(d0!=="19.2.4")throw Error(a(527,d0,"19.2.4"));re.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var Qx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var So=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!So.isDisabled&&So.supportsFiber)try{li=So.inject(Qx),ft=So}catch{}}return Ma.createRoot=function(e,t){if(!o(e))throw Error(a(299));var r=!1,l="",c=vm,u=_m,p=wm;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=t0(e,1,!1,null,null,r,l,null,c,u,p,h0),e[It]=t.current,Xu(e),new gf(t)},Ma.hydrateRoot=function(e,t,r){if(!o(e))throw Error(a(299));var l=!1,c="",u=vm,p=_m,b=wm,j=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(u=r.onUncaughtError),r.onCaughtError!==void 0&&(p=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError),r.formState!==void 0&&(j=r.formState)),t=t0(e,1,!0,t,r??null,l,c,j,u,p,b,h0),t.context=n0(null),r=t.current,l=en(),l=Xn(l),c=Rs(l),c.callback=null,Ds(r,c,l),r=l,t.current.lanes=r,jn(t,r),Pn(t),e[It]=t.current,Xu(e),new wo(t)},Ma.version="19.2.4",Ma}var _0;function Dv(){if(_0)return yf.exports;_0=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),yf.exports=Rv(),yf.exports}var zv=Dv();const qv="modulepreload",Bv=function(i,n){return new URL(i,n).href},w0={},Ee=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let d=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(T=>({status:"fulfilled",value:T}),T=>({status:"rejected",reason:T}))))};const m=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=d(s.map(E=>{if(E=Bv(E,a),E in w0)return;w0[E]=!0;const w=E.endsWith(".css"),T=w?'[rel="stylesheet"]':"";if(!!a)for(let q=m.length-1;q>=0;q--){const Q=m[q];if(Q.href===E&&(!w||Q.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${T}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":qv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((q,Q)=>{M.addEventListener("load",q),M.addEventListener("error",()=>Q(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return o.then(d=>{for(const m of d||[])m.status==="rejected"&&f(m.reason);return n().catch(f)})};function ah(i){try{const n=i.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function Dg(i){const n=ah(i);return!n||typeof n.exp!="number"?null:n.exp}function lh(i,n=0){const s=Dg(i);return s===null?!0:Date.now()/1e3>=s-n}const Vt=window.__LT_BASE__??"",qf=`${Vt}/api`;let Zs=null;function Eo(i){Zs=i}function zg(){return Zs}async function S0(){const i=sessionStorage.getItem("lt_credentials");if(!i)return null;try{const{username:n,password:s}=JSON.parse(i),a=await fetch(`${qf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Xs=null;async function Ye(i,n={}){const s={"Content-Type":"application/json",...n.headers};if(Zs){if(lh(Zs)){Xs||(Xs=S0().finally(()=>{Xs=null}));const o=await Xs;if(o)Zs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Zs}`}let a=await fetch(`${qf}${i}`,{...n,headers:s});if(a.status===401&&Zs){Xs||(Xs=S0().finally(()=>{Xs=null}));const o=await Xs;if(o&&(Zs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${qf}${i}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const qg=O.createContext(null),Uv=300;function vf(i,n){if(lh(i))return null;const s=ah(i);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function Lv({children:i}){const[n,s]=O.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?lh(w)?(sessionStorage.removeItem("lt_token"),null):(Eo(w),vf(w)):null}),a=O.useRef(void 0),o=O.useCallback(w=>{clearTimeout(a.current);const T=Dg(w);if(!T)return;const z=(T-Uv)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{try{const M=ah(w);if(M!=null&&M.sso){const ae=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!ae.ok)return;const k=await ae.json();k.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:k.token}}));return}const q=sessionStorage.getItem("lt_credentials");if(!q)return;const{username:Q,password:ee}=JSON.parse(q),ne=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:Q,password:ee})});if(!ne.ok)return;const fe=await ne.json();fe.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:fe.token}}))}catch{}},z))},[]),f=O.useCallback((w,T,z)=>{const M={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(T==null?void 0:T.username)??null},q=vf(w,M);q&&(Eo(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),T&&sessionStorage.setItem("lt_credentials",JSON.stringify(T)),s(q),o(w))},[o]),d=O.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");Eo(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),w&&(window.location.href=w)},[]);O.useEffect(()=>{const w=()=>d(),T=z=>{var Q;const M=(Q=z.detail)==null?void 0:Q.token;if(!M)return;const q=vf(M);q&&(Eo(M),sessionStorage.setItem("lt_token",M),s(q),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",T),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",T)}},[d,o]),O.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const m=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=O.useCallback(w=>(n==null?void 0:n.roles.some(T=>T.role===w))??!1,[n]),y=O.useCallback(w=>(n==null?void 0:n.roles.some(T=>T.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return h.jsx(qg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:m,login:f,logout:d,hasRole:g,hasRoleType:y,userRoleNames:E},children:i})}function ai(){const i=O.useContext(qg);if(!i)throw new Error("useAuth must be used within AuthProvider");return i}const an=new Uint8Array(0),Ri=new TextEncoder,sn=new TextDecoder;function Hv(...i){let n=0;for(let o=0;o<i.length;o++)n+=i[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<i.length;o++)s.set(i[o],a),a+=i[o].length;return s}function Ya(...i){const n=[];for(let s=0;s<i.length;s++)n.push(Ri.encode(i[s]));return n.length===0?an:n.length===1?n[0]:Hv(...n)}function E0(i){return!i||i.length===0?"":sn.decode(i)}const A0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",j0=36,Pv=0xcfd41b9100000,O0=33,$v=333,T0=22;function Yv(i){for(let n=0;n<i.length;n++)i[n]=Math.floor(Math.random()*255)}function Gv(i){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(i):Yv(i)}class Vv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(T0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Pv),this.inc=Math.floor(Math.random()*($v-O0)+O0)}setPre(){const n=new Uint8Array(12);Gv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=A0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=T0-1;s>=12;s--)this.buf[s]=A0.charCodeAt(n%j0),n=Math.floor(n/j0)}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 ii=new Vv;var ps;(function(i){i.Disconnect="disconnect",i.Reconnect="reconnect",i.Update="update",i.LDM="ldm",i.Error="error"})(ps||(ps={}));var Or;(function(i){i.Reconnecting="reconnecting",i.PingTimer="pingTimer",i.StaleConnection="staleConnection",i.ClientInitiatedReconnect="client initiated reconnect"})(Or||(Or={}));var oe;(function(i){i.ApiError="BAD API",i.BadAuthentication="BAD_AUTHENTICATION",i.BadCreds="BAD_CREDS",i.BadHeader="BAD_HEADER",i.BadJson="BAD_JSON",i.BadPayload="BAD_PAYLOAD",i.BadSubject="BAD_SUBJECT",i.Cancelled="CANCELLED",i.ConnectionClosed="CONNECTION_CLOSED",i.ConnectionDraining="CONNECTION_DRAINING",i.ConnectionRefused="CONNECTION_REFUSED",i.ConnectionTimeout="CONNECTION_TIMEOUT",i.Disconnect="DISCONNECT",i.InvalidOption="INVALID_OPTION",i.InvalidPayload="INVALID_PAYLOAD",i.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",i.NoResponders="503",i.NotFunction="NOT_FUNC",i.RequestError="REQUEST_ERROR",i.ServerOptionNotAvailable="SERVER_OPT_NA",i.SubClosed="SUB_CLOSED",i.SubDraining="SUB_DRAINING",i.Timeout="TIMEOUT",i.Tls="TLS",i.Unknown="UNKNOWN_ERROR",i.WssRequired="WSS_REQUIRED",i.JetStreamInvalidAck="JESTREAM_INVALID_ACK",i.JetStream404NoMessages="404",i.JetStream408RequestTimeout="408",i.JetStream409MaxAckPendingExceeded="409",i.JetStream409="409",i.JetStreamNotEnabled="503",i.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",i.AuthorizationViolation="AUTHORIZATION_VIOLATION",i.AuthenticationExpired="AUTHENTICATION_EXPIRED",i.ProtocolError="NATS_PROTOCOL_ERR",i.PermissionsViolation="PERMISSIONS_VIOLATION",i.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",i.AccountExpired="ACCOUNT_EXPIRED"})(oe||(oe={}));function Fv(i){return typeof i.code=="string"}class Bg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(oe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(oe.BadJson,"Bad JSON"),this.messages.set(oe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return Iv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const Iv=new Bg;class de extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=Bg.getMessage(s);return new de(o,s,a)}isAuthError(){return this.code===oe.AuthenticationExpired||this.code===oe.AuthorizationViolation||this.code===oe.AccountExpired}isAuthTimeout(){return this.code===oe.AuthenticationTimeout}isPermissionError(){return this.code===oe.PermissionsViolation}isProtocolError(){return this.code===oe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var tn;(function(i){i[i.Exact=0]="Exact",i[i.CanonicalMIME=1]="CanonicalMIME",i[i.IgnoreCase=2]="IgnoreCase"})(tn||(tn={}));var Dn;(function(i){i.Timer="timer",i.Count="count",i.JitterTimer="jitterTimer",i.SentinelMsg="sentinelMsg"})(Dn||(Dn={}));var Ga;(function(i){i.STATS="io.nats.micro.v1.stats_response",i.INFO="io.nats.micro.v1.info_response",i.PING="io.nats.micro.v1.ping_response"})(Ga||(Ga={}));const Yo="Nats-Service-Error",Go="Nats-Service-Error-Code";class Vo extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Vo.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Go))||"";if(a!==""){const d=parseInt(a)||400,m=((f=s==null?void 0:s.headers)==null?void 0:f.get(Yo))||"";return new Vo(d,m.length?m:a)}return null}}function gs(i=""){if(i=i||"_INBOX",typeof i!="string")throw new Error("prefix must be a string");return i.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${i}'`)}),`${i}.${ii.next()}`}const Bf="127.0.0.1";var Ws;(function(i){i.PING="PING",i.STATS="STATS",i.INFO="INFO"})(Ws||(Ws={}));function ec(i,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){i[o]=a[o]})}return i}function Ao(i){return sn.decode(i).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Mr(i,n=!0){const s=n?de.errorForCode(oe.Timeout):null;let a,o;const f=new Promise((d,m)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{m(s===null?de.errorForCode(oe.Timeout):s)},i)});return Object.assign(f,a)}function zr(i=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},i);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function rt(){let i={};const n=new Promise((s,a)=>{i={resolve:s,reject:a}});return Object.assign(n,i)}function Ug(i){for(let n=i.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[i[n],i[s]]=[i[s],i[n]]}return i}function Jv(i){return i===0?0:Math.floor(i/2+Math.random()*i)}function oh(i=[0,250,250,500,500,3e3,5e3]){Array.isArray(i)||(i=[0,250,250,500,500,3e3,5e3]);const n=i.length-1;return{backoff(s){return Jv(s>n?i[n]:i[s])}}}function it(i){return i*1e6}function ch(i){return Math.floor(i/1e6)}function k0(i){let a=!0;const o=new Array(i.length);for(let f=0;f<i.length;f++){let d=i.charCodeAt(f);if(d===58||d<33||d>126)throw new de(`'${i[f]}' is not a valid character for a header key`,oe.BadHeader);a&&97<=d&&d<=122?d-=32:!a&&65<=d&&d<=90&&(d+=32),o[f]=d,a=d==45}return String.fromCharCode(...o)}function ys(i=0,n=""){if(i===0&&n!==""||i>0&&n==="")throw new Error("setting status requires both code and description");return new ei(i,n)}const _f="NATS/1.0";class ei{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),d=[...o].sort();for(let m=0;m<f.length;m++)if(f[m]!==d[m])return!1}return!0}return!1}static decode(n){const s=new ei,o=sn.decode(n).split(`\r
|
|
27
|
+
`),f=o[0];if(f!==_f){let d=f.replace(_f,"").trim();if(d.length>0){s._code=parseInt(d,10),isNaN(s._code)&&(s._code=0);const m=s._code.toString();d=d.replace(m,""),s._description=d.trim()}}return o.length>=1&&o.slice(1).map(d=>{if(d){const m=d.indexOf(":");if(m>-1){const g=d.slice(0,m),y=d.slice(m+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=_f;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)n=`${n}\r
|
|
28
|
+
${s}: ${a[o]}`;return`${n}\r
|
|
29
|
+
\r
|
|
30
|
+
`}encode(){return Ri.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new de("invalid header value - \\r and \\n are not allowed.",oe.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=tn.Exact){const a=this.keys();switch(s){case tn.Exact:return a.filter(o=>o===n);case tn.CanonicalMIME:return n=k0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=tn.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=tn.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,s=tn.Exact){return this.findKeys(n,s).length>0}set(n,s,a=tn.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=tn.Exact){const o=k0(n);a===tn.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const d=ei.validHeaderValue(s);let m=this.headers.get(n);m||(m=[],this.headers.set(n,m)),m.push(d)}values(n,s=tn.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const d=this.headers.get(f);d&&a.push(...d)}),a}delete(n,s=tn.Exact){this.findKeys(n,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new ei;for(const a in n)s.headers.set(a,n[a]);return s}}function Uf(){return{encode(i){return Ri.encode(i)},decode(i){return sn.decode(i)}}}function zn(i){return{encode(n){try{return n===void 0&&(n=null),Ri.encode(JSON.stringify(n))}catch(s){throw de.errorForCode(oe.BadJson,s)}},decode(n){try{return JSON.parse(sn.decode(n),i)}catch(s){throw de.errorForCode(oe.BadJson,s)}}}}function Lg(i){var n;return i&&i.data.length===0&&((n=i.headers)==null?void 0:n.code)===503?de.errorForCode(oe.NoResponders):null}class uh{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=sn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=sn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=ei.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=an,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return zn(n).decode(this.data)}string(){return sn.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(uh,"jc");function Tr(i){return tc("durable",i)}function zt(i){return tc("stream",i)}function tc(i,n=""){if(n==="")throw Error(`${i} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
|
+
`,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
|
|
32
|
+
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${i} name - ${i} name cannot contain '${a}'`)}}),""}function La(i,n=""){if(n==="")throw Error(`${i} name required`);const s=Qv(n);if(s.length)throw new Error(`invalid ${i} name - ${i} name ${s}`)}function Qv(i=""){if(i==="")throw Error("name required");const n=/^[-\w]+$/g;if(i.match(n)===null){for(const a of i.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Lf(i){if(i.data.length>0)return!1;const n=i.headers;return n?n.code>=100&&n.code<200:!1}function Hf(i){var n;return Lf(i)&&((n=i.headers)==null?void 0:n.description)==="Idle Heartbeat"}function Xv(i,n,s){const a=ys(i,n),o={hdr:1,sid:0,size:0},f=new uh(o,an,{});return f._headers=a,f._subject=s,f}function kr(i){if(i.data.length!==0)return null;const n=i.headers;return n?Hg(n.code,n.description):null}var _n;(function(i){i.MaxBatchExceeded="exceeded maxrequestbatch of",i.MaxExpiresExceeded="exceeded maxrequestexpires of",i.MaxBytesExceeded="exceeded maxrequestmaxbytes of",i.MaxMessageSizeExceeded="message size exceeds maxbytes",i.PushConsumer="consumer is push based",i.MaxWaitingExceeded="exceeded maxwaiting",i.IdleHeartbeatMissed="idle heartbeats missed",i.ConsumerDeleted="consumer deleted"})(_n||(_n={}));function Kv(i){return i.code!==oe.JetStream409?!1:[_n.MaxBatchExceeded,_n.MaxExpiresExceeded,_n.MaxBytesExceeded,_n.MaxMessageSizeExceeded,_n.PushConsumer,_n.IdleHeartbeatMissed,_n.ConsumerDeleted].find(s=>i.message.indexOf(s)!==-1)!==void 0}function Hg(i,n=""){if(i<300)return null;switch(n=n.toLowerCase(),i){case 404:return new de(n,oe.JetStream404NoMessages);case 408:return new de(n,oe.JetStream408RequestTimeout);case 409:{const s=n.startsWith(_n.IdleHeartbeatMissed)?oe.JetStreamIdleHeartBeat:oe.JetStream409;return new de(n,s)}case 503:return de.errorForCode(oe.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=oe.Unknown),new de(n,`${i}`)}}class jt{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=rt(),this.yields=[],this.iterClosed=rt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new de("unsupported iterator",oe.ApiError);if(this.yielding)throw new de("already yielding",oe.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=rt())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class fh{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Pf;(function(i){i.Limits="limits",i.Interest="interest",i.Workqueue="workqueue"})(Pf||(Pf={}));var Ja;(function(i){i.Old="old",i.New="new"})(Ja||(Ja={}));var $f;(function(i){i.File="file",i.Memory="memory"})($f||($f={}));var mt;(function(i){i.All="all",i.Last="last",i.New="new",i.StartSequence="by_start_sequence",i.StartTime="by_start_time",i.LastPerSubject="last_per_subject"})(mt||(mt={}));var At;(function(i){i.None="none",i.All="all",i.Explicit="explicit",i.NotSet=""})(At||(At={}));var Rr;(function(i){i.Instant="instant",i.Original="original"})(Rr||(Rr={}));var ri;(function(i){i.None="none",i.S2="s2"})(ri||(ri={}));var Fo;(function(i){i.CreateOrUpdate="",i.Update="update",i.Create="create"})(Fo||(Fo={}));function Zv(i,n={}){return Object.assign({name:i,deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Rr.Instant},n)}var N0;(function(i){i.API="api_audit",i.StreamAction="stream_action",i.ConsumerAction="consumer_action",i.SnapshotCreate="snapshot_create",i.SnapshotComplete="snapshot_complete",i.RestoreCreate="restore_create",i.RestoreComplete="restore_complete",i.MaxDeliver="max_deliver",i.Terminated="terminated",i.Ack="consumer_ack",i.StreamLeaderElected="stream_leader_elected",i.StreamQuorumLost="stream_quorum_lost",i.ConsumerLeaderElected="consumer_leader_elected",i.ConsumerQuorumLost="consumer_quorum_lost"})(N0||(N0={}));var Bt;(function(i){i.StreamSourceHdr="Nats-Stream-Source",i.LastConsumerSeqHdr="Nats-Last-Consumer",i.LastStreamSeqHdr="Nats-Last-Stream",i.ConsumerStalledHdr="Nats-Consumer-Stalled",i.MessageSizeHdr="Nats-Msg-Size",i.RollupHdr="Nats-Rollup",i.RollupValueSubject="sub",i.RollupValueAll="all",i.PendingMessagesHdr="Nats-Pending-Messages",i.PendingBytesHdr="Nats-Pending-Bytes"})(Bt||(Bt={}));var Mn;(function(i){i.LastValue="",i.AllHistory="history",i.UpdatesOnly="updates"})(Mn||(Mn={}));var Sr;(function(i){i.Stream="Nats-Stream",i.Sequence="Nats-Sequence",i.TimeStamp="Nats-Time-Stamp",i.Subject="Nats-Subject"})(Sr||(Sr={}));var C0;(function(i){i.Stream="Nats-Stream",i.Subject="Nats-Subject",i.Sequence="Nats-Sequence",i.LastSequence="Nats-Last-Sequence",i.Size="Nats-Msg-Size"})(C0||(C0={}));const nn="KV_";class Wv{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=Zv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?At.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return Tr(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=mt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=mt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=mt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=mt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=mt.Last,this}deliverNew(){return this.config.deliver_policy=mt.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=At.None,this}ackAll(){return this.config.ack_policy=At.All,this}ackExplicit(){return this.config.ack_policy=At.Explicit,this}ackWait(n){return this.config.ack_wait=it(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Rr.Instant,this}replayOriginal(){return this.config.replay_policy=Rr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=it(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=it(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=it(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function ti(i){return new Wv(i)}function M0(i){return typeof i.getOpts=="function"}class e1{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class Nr{static encode(n){return Nr.toB64URLEncoding(e1.encode(n))}static decode(n,s=!1){return Nr.decode(Nr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Dr{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),Ri.encode(n)}static toAscii(n){return sn.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function t1(i,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in i)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(i,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(i)}var n1=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Ra=n1.performance||{};Ra.now||Ra.mozNow||Ra.msNow||Ra.oNow||Ra.webkitNow;var R0={versions:{}},s1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function i1(i){if(i.__esModule)return i;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(s){var a=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return i[s]}})}),n}var wf,nc={exports:{}},D0={},z0=i1(t1({__proto__:null,default:D0},[D0]));wf=nc,(function(){var i="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&R0.versions&&R0.versions.node;o?s=s1:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&wf.exports,d=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",m="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],T=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var z=function(k,X){return function(le){return new ne(X,!0).update(le)[k]()}},M=function(k){var X=z("hex",k);o&&(X=q(X,k)),X.create=function(){return new ne(k)},X.update=function(V){return X.create().update(V)};for(var le=0;le<w.length;++le){var P=w[le];X[P]=z(P,k)}return X},q=function(k,X){var le,P=z0,V=z0.Buffer,I=X?"sha224":"sha256";return le=V.from&&!s.JS_SHA256_NO_BUFFER_FROM?V.from:function(Z){return new V(Z)},function(Z){if(typeof Z=="string")return P.createHash(I).update(Z,"utf8").digest("hex");if(Z==null)throw new Error(i);return Z.constructor===ArrayBuffer&&(Z=new Uint8Array(Z)),Array.isArray(Z)||ArrayBuffer.isView(Z)||Z.constructor===V?P.createHash(I).update(le(Z)).digest("hex"):k(Z)}},Q=function(k,X){return function(le,P){return new fe(le,X,!0).update(P)[k]()}},ee=function(k){var X=Q("hex",k);X.create=function(V){return new fe(V,k)},X.update=function(V,I){return X.create(V).update(I)};for(var le=0;le<w.length;++le){var P=w[le];X[P]=Q(P,k)}return X};function ne(k,X){X?(T[0]=T[16]=T[1]=T[2]=T[3]=T[4]=T[5]=T[6]=T[7]=T[8]=T[9]=T[10]=T[11]=T[12]=T[13]=T[14]=T[15]=0,this.blocks=T):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=k}function fe(k,X,le){var P,V=typeof k;if(V==="string"){var I,Z=[],ie=k.length,Ae=0;for(P=0;P<ie;++P)(I=k.charCodeAt(P))<128?Z[Ae++]=I:I<2048?(Z[Ae++]=192|I>>>6,Z[Ae++]=128|63&I):I<55296||I>=57344?(Z[Ae++]=224|I>>>12,Z[Ae++]=128|I>>>6&63,Z[Ae++]=128|63&I):(I=65536+((1023&I)<<10|1023&k.charCodeAt(++P)),Z[Ae++]=240|I>>>18,Z[Ae++]=128|I>>>12&63,Z[Ae++]=128|I>>>6&63,Z[Ae++]=128|63&I);k=Z}else{if(V!=="object")throw new Error(i);if(k===null)throw new Error(i);if(d&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||d&&ArrayBuffer.isView(k)))throw new Error(i)}k.length>64&&(k=new ne(X,!0).update(k).array());var Re=[],Oe=[];for(P=0;P<64;++P){var $=k[P]||0;Re[P]=92^$,Oe[P]=54^$}ne.call(this,X,le),this.update(Oe),this.oKeyPad=Re,this.inner=!0,this.sharedMemory=le}ne.prototype.update=function(k){if(!this.finalized){var X,le=typeof k;if(le!=="string"){if(le!=="object")throw new Error(i);if(k===null)throw new Error(i);if(d&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||d&&ArrayBuffer.isView(k)))throw new Error(i);X=!0}for(var P,V,I=0,Z=k.length,ie=this.blocks;I<Z;){if(this.hashed&&(this.hashed=!1,ie[0]=this.block,this.block=ie[16]=ie[1]=ie[2]=ie[3]=ie[4]=ie[5]=ie[6]=ie[7]=ie[8]=ie[9]=ie[10]=ie[11]=ie[12]=ie[13]=ie[14]=ie[15]=0),X)for(V=this.start;I<Z&&V<64;++I)ie[V>>>2]|=k[I]<<y[3&V++];else for(V=this.start;I<Z&&V<64;++I)(P=k.charCodeAt(I))<128?ie[V>>>2]|=P<<y[3&V++]:P<2048?(ie[V>>>2]|=(192|P>>>6)<<y[3&V++],ie[V>>>2]|=(128|63&P)<<y[3&V++]):P<55296||P>=57344?(ie[V>>>2]|=(224|P>>>12)<<y[3&V++],ie[V>>>2]|=(128|P>>>6&63)<<y[3&V++],ie[V>>>2]|=(128|63&P)<<y[3&V++]):(P=65536+((1023&P)<<10|1023&k.charCodeAt(++I)),ie[V>>>2]|=(240|P>>>18)<<y[3&V++],ie[V>>>2]|=(128|P>>>12&63)<<y[3&V++],ie[V>>>2]|=(128|P>>>6&63)<<y[3&V++],ie[V>>>2]|=(128|63&P)<<y[3&V++]);this.lastByteIndex=V,this.bytes+=V-this.start,V>=64?(this.block=ie[16],this.start=V-64,this.hash(),this.hashed=!0):this.start=V}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ne.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,X=this.lastByteIndex;k[16]=this.block,k[X>>>2]|=g[3&X],this.block=k[16],X>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},ne.prototype.hash=function(){var k,X,le,P,V,I,Z,ie,Ae,Re=this.h0,Oe=this.h1,$=this.h2,re=this.h3,he=this.h4,je=this.h5,ve=this.h6,G=this.h7,ge=this.blocks;for(k=16;k<64;++k)X=((V=ge[k-15])>>>7|V<<25)^(V>>>18|V<<14)^V>>>3,le=((V=ge[k-2])>>>17|V<<15)^(V>>>19|V<<13)^V>>>10,ge[k]=ge[k-16]+X+ge[k-7]+le|0;for(Ae=Oe&$,k=0;k<64;k+=4)this.first?(this.is224?(I=300032,G=(V=ge[0]-1413257819)-150054599|0,re=V+24177077|0):(I=704751109,G=(V=ge[0]-210244248)-1521486534|0,re=V+143694565|0),this.first=!1):(X=(Re>>>2|Re<<30)^(Re>>>13|Re<<19)^(Re>>>22|Re<<10),P=(I=Re&Oe)^Re&$^Ae,G=re+(V=G+(le=(he>>>6|he<<26)^(he>>>11|he<<21)^(he>>>25|he<<7))+(he&je^~he&ve)+E[k]+ge[k])|0,re=V+(X+P)|0),X=(re>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),P=(Z=re&Re)^re&Oe^I,ve=$+(V=ve+(le=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7))+(G&he^~G&je)+E[k+1]+ge[k+1])|0,X=(($=V+(X+P)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),P=(ie=$&re)^$&Re^Z,je=Oe+(V=je+(le=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&G^~ve&he)+E[k+2]+ge[k+2])|0,X=((Oe=V+(X+P)|0)>>>2|Oe<<30)^(Oe>>>13|Oe<<19)^(Oe>>>22|Oe<<10),P=(Ae=Oe&$)^Oe&re^ie,he=Re+(V=he+(le=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&ve^~je&G)+E[k+3]+ge[k+3])|0,Re=V+(X+P)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Re|0,this.h1=this.h1+Oe|0,this.h2=this.h2+$|0,this.h3=this.h3+re|0,this.h4=this.h4+he|0,this.h5=this.h5+je|0,this.h6=this.h6+ve|0,this.h7=this.h7+G|0},ne.prototype.hex=function(){this.finalize();var k=this.h0,X=this.h1,le=this.h2,P=this.h3,V=this.h4,I=this.h5,Z=this.h6,ie=this.h7,Ae=m[k>>>28&15]+m[k>>>24&15]+m[k>>>20&15]+m[k>>>16&15]+m[k>>>12&15]+m[k>>>8&15]+m[k>>>4&15]+m[15&k]+m[X>>>28&15]+m[X>>>24&15]+m[X>>>20&15]+m[X>>>16&15]+m[X>>>12&15]+m[X>>>8&15]+m[X>>>4&15]+m[15&X]+m[le>>>28&15]+m[le>>>24&15]+m[le>>>20&15]+m[le>>>16&15]+m[le>>>12&15]+m[le>>>8&15]+m[le>>>4&15]+m[15&le]+m[P>>>28&15]+m[P>>>24&15]+m[P>>>20&15]+m[P>>>16&15]+m[P>>>12&15]+m[P>>>8&15]+m[P>>>4&15]+m[15&P]+m[V>>>28&15]+m[V>>>24&15]+m[V>>>20&15]+m[V>>>16&15]+m[V>>>12&15]+m[V>>>8&15]+m[V>>>4&15]+m[15&V]+m[I>>>28&15]+m[I>>>24&15]+m[I>>>20&15]+m[I>>>16&15]+m[I>>>12&15]+m[I>>>8&15]+m[I>>>4&15]+m[15&I]+m[Z>>>28&15]+m[Z>>>24&15]+m[Z>>>20&15]+m[Z>>>16&15]+m[Z>>>12&15]+m[Z>>>8&15]+m[Z>>>4&15]+m[15&Z];return this.is224||(Ae+=m[ie>>>28&15]+m[ie>>>24&15]+m[ie>>>20&15]+m[ie>>>16&15]+m[ie>>>12&15]+m[ie>>>8&15]+m[ie>>>4&15]+m[15&ie]),Ae},ne.prototype.toString=ne.prototype.hex,ne.prototype.digest=function(){this.finalize();var k=this.h0,X=this.h1,le=this.h2,P=this.h3,V=this.h4,I=this.h5,Z=this.h6,ie=this.h7,Ae=[k>>>24&255,k>>>16&255,k>>>8&255,255&k,X>>>24&255,X>>>16&255,X>>>8&255,255&X,le>>>24&255,le>>>16&255,le>>>8&255,255&le,P>>>24&255,P>>>16&255,P>>>8&255,255&P,V>>>24&255,V>>>16&255,V>>>8&255,255&V,I>>>24&255,I>>>16&255,I>>>8&255,255&I,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z];return this.is224||Ae.push(ie>>>24&255,ie>>>16&255,ie>>>8&255,255&ie),Ae},ne.prototype.array=ne.prototype.digest,ne.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),X=new DataView(k);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),k},fe.prototype=new ne,fe.prototype.finalize=function(){if(ne.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();ne.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),ne.prototype.finalize.call(this)}};var ae=M();ae.sha256=ae,ae.sha224=M(!0),ae.sha256.hmac=ee(),ae.sha224.hmac=ee(!0),f?wf.exports=ae:(s.sha256=ae.sha256,s.sha224=ae.sha224)})();nc.exports;nc.exports.sha224;var q0=nc.exports.sha256;function Yf(i){return u1(i)}function r1(i){if(!/^[0-9A-Fa-f]+$/.test(i))return!1;const s=/^[0-9A-F]+$/.test(i),a=/^[0-9a-f]+$/.test(i);return s||a?i.length%2===0:!1}function a1(i){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(i)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(i)}function l1(i){return r1(i)?"hex":a1(i)?"b64":""}function o1(i){if(i.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(i.length/2);for(let s=0;s<i.length;s+=2)n[s/2]=parseInt(i.substring(s,s+2),16);return n}function c1(i){i=i.replace(/-/g,"+"),i=i.replace(/_/g,"/");const n=atob(i);return Uint8Array.from(n,s=>s.charCodeAt(0))}function u1(i){switch(l1(i)){case"hex":return o1(i);case"b64":return c1(i)}return null}function f1(i,n){const s=typeof i=="string"?Yf(i):i,a=typeof n=="string"?Yf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class Pg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=ii.next(),a&&(this.ctx=new Error)}}class h1 extends Pg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=rt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
|
|
33
|
+
|
|
34
|
+
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===Dn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Dn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Dn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class $g extends Pg{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=rt(),this.timer=Mr(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
|
+
|
|
36
|
+
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||de.errorForCode(oe.Cancelled))}}const d1="$JS.API";function m1(i){return i=i||{},i.domain&&(i.apiPrefix=`$JS.${i.domain}.API`,delete i.domain),ec({apiPrefix:d1,timeout:5e3},i)}class Wa{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=m1(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=zn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let o=an;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const d=oh();for(let m=0;m<f;m++)try{const g=await this.nc.request(n,o,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===oe.Timeout)&&m+1<f)await zr(d.backoff(m));else throw g}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=Hg(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Ha{constructor(n,s,a,o){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,o;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((o=n.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Ci(i=""){const n=i.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${i}' is not a semver value`)}function Gf(i,n){return i.major<n.major?-1:i.major>n.major?1:i.minor<n.minor?-1:i.minor>n.minor?1:i.micro<n.micro?-1:i.micro>n.micro?1:0}var Ue;(function(i){i.JS_KV="js_kv",i.JS_OBJECTSTORE="js_objectstore",i.JS_PULL_MAX_BYTES="js_pull_max_bytes",i.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",i.JS_ALLOW_DIRECT="js_allow_direct",i.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",i.JS_SIMPLIFICATION="js_simplification",i.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",i.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",i.JS_STREAM_FIRST_SEQ="js_stream_first_seq",i.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",i.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",i.JS_STREAM_COMPRESSION="js_stream_compression",i.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",i.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ue||(Ue={}));class p1{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Ci(n)),this.server=n,this.set(Ue.JS_KV,"2.6.2"),this.set(Ue.JS_OBJECTSTORE,"2.6.3"),this.set(Ue.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ue.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ue.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ue.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ue.JS_SIMPLIFICATION,"2.9.4"),this.set(Ue.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ue.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ue.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ue.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ue.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ue.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:Gf(this.server,Ci(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Ci(n)),Gf(this.server,n)>=0}}class Io extends Wa{constructor(n,s){super(n,s)}async add(n,s,a=Fo.Create){if(zt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&Tr(o.config.durable_name);const f=this.nc;let{min:d,ok:m}=f.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!m)throw new Error(`consumer 'name' requires server ${d}`);if(g)try{tc("name",g)}catch(T){const z=T.message,M=z.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${z.substring(M)}`):T}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:T,ok:z}=f.features.get(Ue.JS_MULTIPLE_CONSUMER_FILTER);if(!z)throw new Error(`consumer 'filter_subjects' requires server ${T}`);m=!1}if(s.metadata){const{min:T,ok:z}=f.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!z)throw new Error(`consumer 'metadata' requires server ${T}`)}if(m&&(E=s.name??s.durable_name??""),E!==""){let T=s.filter_subject??void 0;T===">"&&(T=void 0),y=T!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${E}.${T}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Fo.Update)}async info(n,s){return zt(n),Tr(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return zt(n),Tr(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){zt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Ha(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function xr(i,n,s=!1){if(s===!0&&!i)throw de.errorForCode(oe.ApiError,new Error(`${n} is not a function`));if(i&&typeof i!="function")throw de.errorForCode(oe.ApiError,new Error(`${n} is not a function`))}class g1 extends jt{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");xr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&xr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(xr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(xr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(xr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&xr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,T)=>{const[z,M]=this.adapter(w,T);if(z){E(z,null);return}const{ingest:q}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};q&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(z,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:d,queue:m,timeout:g}=o,y={queue:m,timeout:g,callback:f};d&&d>0&&(y.max=d),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=rt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async E=>{await E.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[o,f]=this.adapter(s,a);o&&this.stop(o),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let rn;function y1(i){rn=i}function Yg(){return rn!==void 0&&rn.defaultPort!==void 0?rn.defaultPort:4222}function Sf(){return rn!==void 0&&rn.urlParseFn?rn.urlParseFn:void 0}function b1(){if(!rn||typeof rn.factory!="function")throw new Error("transport fn is not set");return rn.factory()}function Vf(){return rn!==void 0&&rn.dnsResolveFn?rn.dnsResolveFn:void 0}const zo=`\r
|
|
37
|
+
`,Jo=Dr.fromAscii(zo),x1=new Uint8Array(Jo)[0],v1=new Uint8Array(Jo)[1];function _1(i){for(let n=0;n<i.length;n++){const s=n+1;if(i.byteLength>s&&i[n]===x1&&i[s]===v1)return s+1}return 0}function w1(i){const n=_1(i);if(n>0){const a=new Uint8Array(i).slice(0,n);return sn.decode(a)}return""}const S1=4,Gg=48,E1=65,A1=97;function j1(i,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,m)=>{o[m]=d}),o[12]=i,o[13]=n,o[14]=s,o[15]=a,o}function Ff(i){return O1(i)!==void 0}function O1(i){for(let n=0;n<i.length;n++)switch(i[n]){case".":return Vg(i);case":":return T1(i)}}function Vg(i){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(i.length===0)return;if(s>0){if(i[0]!==".")return;i=i.substring(1)}const{n:a,c:o,ok:f}=k1(i);if(!f||a>255)return;i=i.substring(o),n[s]=a}return j1(n[0],n[1],n[2],n[3])}function T1(i){const n=new Uint8Array(16);let s=-1;if(i.length>=2&&i[0]===":"&&i[1]===":"&&(s=0,i=i.substring(2),i.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:d}=N1(i);if(!d||o>65535)return;if(f<i.length&&i[f]==="."){if(s<0&&a!=12||a+4>16)return;const m=Vg(i);if(m===void 0)return;n[a]=m[12],n[a+1]=m[13],n[a+2]=m[14],n[a+3]=m[15],i="",a+=S1;break}if(n[a]=o>>8,n[a+1]=o,a+=2,i=i.substring(f),i.length===0)break;if(i[0]!==":"||i.length==1)return;if(i=i.substring(1),i[0]===":"){if(s>=0)return;if(s=a,i=i.substring(1),i.length===0)break}}if(i.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function k1(i){let n=0,s=0;for(n=0;n<i.length&&48<=i.charCodeAt(n)&&i.charCodeAt(n)<=57;n++)if(s=s*10+(i.charCodeAt(n)-Gg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function N1(i){let n=0,s=0;for(s=0;s<i.length;s++){if(48<=i.charCodeAt(s)&&i.charCodeAt(s)<=57)n*=16,n+=i.charCodeAt(s)-Gg;else if(97<=i.charCodeAt(s)&&i.charCodeAt(s)<=102)n*=16,n+=i.charCodeAt(s)-A1+10;else if(65<=i.charCodeAt(s)&&i.charCodeAt(s)<=70)n*=16,n+=i.charCodeAt(s)-E1+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function C1(i){return i.indexOf("[")!==-1||i.indexOf("::")!==-1?!1:i.indexOf(".")!==-1||i.split(":").length<=2}function If(i){return!C1(i)}function M1(i){const n="::FFFF:",s=i.toUpperCase().indexOf(n);if(s!==-1&&i.indexOf(".")!==-1){let a=i.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return i}function R1(i){i=i.trim(),i.match(/^(.*:\/\/)(.*)/m)&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2")),i=M1(i),If(i)&&i.indexOf("[")===-1&&(i=`[${i}]`);const n=If(i)?i.match(/(]:)(\d+)/):i.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${i}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class Va{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=R1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(Ff(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",d=new URL(`${f}://${If(o)?"["+o+"]":o}`);d.port=`${this.port}`;const m=new Va(d.host,!1);m.tlsName=this.hostname,s.push(m)}}return n.randomize&&Ug(s),this.resolves=s,s}}class D1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=Sf();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new Va(o))}),this.randomize&&(this.servers=Ug(this.servers))),this.servers.length===0&&this.addServer(`${Bf}:${Yg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Ff(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=Sf();n=a?a(n):n;const o=new Va(n,s);Ff(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let o=[];const f=Sf(),d=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Va(g,!0);d.set(g,y)});const m=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&d.get(E)===void 0&&m.push(y),d.delete(E)}),m.reverse(),m.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),d.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class z1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${gs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=Lg(s)),o.resolver(n,s))}}}close(){const n=de.errorForCode(oe.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class q1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Or.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=rt();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class B1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function U1(i,n="Assertion failed."){if(!i)throw new B1(n)}const B0=32*1024,Ef=2**32-2;function jo(i,n,s=0){const a=n.byteLength-s;return i.byteLength>a&&(i=i.subarray(0,a)),n.set(i,s),i.byteLength}class Af{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){U1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=jo(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Ri.encode(n))}write(n){const s=this._grow(n.byteLength);return jo(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)jo(this._buf.subarray(this._off),this._buf);else{if(o+n>Ef)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,Ef));jo(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,Ef)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(B0);for(;;){const o=this.capacity-this.length<B0,f=o?a:new Uint8Array(this._buf.buffer,this.length),d=n.read(f);if(d===null)return s;o?this.write(f.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var qt;(function(i){i[i.OK=0]="OK",i[i.ERR=1]="ERR",i[i.MSG=2]="MSG",i[i.INFO=3]="INFO",i[i.PING=4]="PING",i[i.PONG=5]="PONG"})(qt||(qt={}));function U0(){const i={};return i.sid=-1,i.hdr=-1,i.size=-1,i}const L1=48;class L0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=ce.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case ce.OP_START:switch(a){case ue.M:case ue.m:this.state=ce.OP_M,this.hdr=-1,this.ma=U0();break;case ue.H:case ue.h:this.state=ce.OP_H,this.hdr=0,this.ma=U0();break;case ue.P:case ue.p:this.state=ce.OP_P;break;case ue.PLUS:this.state=ce.OP_PLUS;break;case ue.MINUS:this.state=ce.OP_MINUS;break;case ue.I:case ue.i:this.state=ce.OP_I;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_H:switch(a){case ue.M:case ue.m:this.state=ce.OP_M;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_M:switch(a){case ue.S:case ue.s:this.state=ce.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MS:switch(a){case ue.G:case ue.g:this.state=ce.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MSG:switch(a){case ue.SPACE:case ue.TAB:this.state=ce.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MSG_SPC:switch(a){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.MSG_ARG,this.as=s}break;case ce.MSG_ARG:switch(a){case ue.CR:this.drop=1;break;case ue.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=ce.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case ce.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=ce.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:qt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ce.MSG_END);break;case ce.MSG_END:switch(a){case ue.NL:this.drop=0,this.as=s+1,this.state=ce.OP_START;break;default:continue}break;case ce.OP_PLUS:switch(a){case ue.O:case ue.o:this.state=ce.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PLUS_O:switch(a){case ue.K:case ue.k:this.state=ce.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PLUS_OK:switch(a){case ue.NL:this.dispatcher.push({kind:qt.OK}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_MINUS:switch(a){case ue.E:case ue.e:this.state=ce.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MINUS_E:switch(a){case ue.R:case ue.r:this.state=ce.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MINUS_ER:switch(a){case ue.R:case ue.r:this.state=ce.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MINUS_ERR:switch(a){case ue.SPACE:case ue.TAB:this.state=ce.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MINUS_ERR_SPC:switch(a){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.MINUS_ERR_ARG,this.as=s}break;case ce.MINUS_ERR_ARG:switch(a){case ue.CR:this.drop=1;break;case ue.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:qt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=ce.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case ce.OP_P:switch(a){case ue.I:case ue.i:this.state=ce.OP_PI;break;case ue.O:case ue.o:this.state=ce.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PO:switch(a){case ue.N:case ue.n:this.state=ce.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PON:switch(a){case ue.G:case ue.g:this.state=ce.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PONG:switch(a){case ue.NL:this.dispatcher.push({kind:qt.PONG}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_PI:switch(a){case ue.N:case ue.n:this.state=ce.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PIN:switch(a){case ue.G:case ue.g:this.state=ce.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PING:switch(a){case ue.NL:this.dispatcher.push({kind:qt.PING}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_I:switch(a){case ue.N:case ue.n:this.state=ce.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_IN:switch(a){case ue.F:case ue.f:this.state=ce.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_INF:switch(a){case ue.O:case ue.o:this.state=ce.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_INFO:switch(a){case ue.SPACE:case ue.TAB:this.state=ce.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_INFO_SPC:switch(a){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.INFO_ARG,this.as=s}break;case ce.INFO_ARG:switch(a){case ue.CR:this.drop=1;break;case ue.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:qt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=ce.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===ce.MSG_ARG||this.state===ce.MINUS_ERR_ARG||this.state===ce.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Af(n.subarray(this.as,s-this.drop))),this.state===ce.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Af(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new Af(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ue.SPACE:case ue.TAB:case ue.CR:case ue.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${sn.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ue.SPACE:case ue.TAB:case ue.CR:case ue.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-L1)}return s}}var ce;(function(i){i[i.OP_START=0]="OP_START",i[i.OP_PLUS=1]="OP_PLUS",i[i.OP_PLUS_O=2]="OP_PLUS_O",i[i.OP_PLUS_OK=3]="OP_PLUS_OK",i[i.OP_MINUS=4]="OP_MINUS",i[i.OP_MINUS_E=5]="OP_MINUS_E",i[i.OP_MINUS_ER=6]="OP_MINUS_ER",i[i.OP_MINUS_ERR=7]="OP_MINUS_ERR",i[i.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",i[i.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",i[i.OP_M=10]="OP_M",i[i.OP_MS=11]="OP_MS",i[i.OP_MSG=12]="OP_MSG",i[i.OP_MSG_SPC=13]="OP_MSG_SPC",i[i.MSG_ARG=14]="MSG_ARG",i[i.MSG_PAYLOAD=15]="MSG_PAYLOAD",i[i.MSG_END=16]="MSG_END",i[i.OP_H=17]="OP_H",i[i.OP_P=18]="OP_P",i[i.OP_PI=19]="OP_PI",i[i.OP_PIN=20]="OP_PIN",i[i.OP_PING=21]="OP_PING",i[i.OP_PO=22]="OP_PO",i[i.OP_PON=23]="OP_PON",i[i.OP_PONG=24]="OP_PONG",i[i.OP_I=25]="OP_I",i[i.OP_IN=26]="OP_IN",i[i.OP_INF=27]="OP_INF",i[i.OP_INFO=28]="OP_INFO",i[i.OP_INFO_SPC=29]="OP_INFO_SPC",i[i.INFO_ARG=30]="INFO_ARG"})(ce||(ce={}));var ue;(function(i){i[i.CR=13]="CR",i[i.E=69]="E",i[i.e=101]="e",i[i.F=70]="F",i[i.f=102]="f",i[i.G=71]="G",i[i.g=103]="g",i[i.H=72]="H",i[i.h=104]="h",i[i.I=73]="I",i[i.i=105]="i",i[i.K=75]="K",i[i.k=107]="k",i[i.M=77]="M",i[i.m=109]="m",i[i.MINUS=45]="MINUS",i[i.N=78]="N",i[i.n=110]="n",i[i.NL=10]="NL",i[i.O=79]="O",i[i.o=111]="o",i[i.P=80]="P",i[i.p=112]="p",i[i.PLUS=43]="PLUS",i[i.R=82]="R",i[i.r=114]="r",i[i.S=83]="S",i[i.s=115]="s",i[i.SPACE=32]="SPACE",i[i.TAB=9]="TAB"})(ue||(ue={}));(function(i){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var d=s(),m=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),T=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),z=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function q(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function Q(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function ee(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ne(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function fe(x,S,_,A,N){var D,W=0;for(D=0;D<N;D++)W|=x[S+D]^_[A+D];return(1&W-1>>>8)-1}function ae(x,S,_,A){return fe(x,S,_,A,16)}function k(x,S,_,A){return fe(x,S,_,A,32)}function X(x,S,_,A,N){var D=new Uint32Array(16),W=new Uint32Array(16),se=new Uint32Array(16),H=new Uint32Array(4),K,me,Ne;for(K=0;K<4;K++)W[5*K]=q(A,4*K),W[1+K]=q(_,4*K),W[6+K]=q(S,4*K),W[11+K]=q(_,16+4*K);for(K=0;K<16;K++)se[K]=W[K];for(K=0;K<20;K++){for(me=0;me<4;me++){for(Ne=0;Ne<4;Ne++)H[Ne]=W[(5*me+4*Ne)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),Ne=0;Ne<4;Ne++)D[4*me+(me+Ne)%4]=H[Ne]}for(Ne=0;Ne<16;Ne++)W[Ne]=D[Ne]}if(N){for(K=0;K<16;K++)W[K]=W[K]+se[K]|0;for(K=0;K<4;K++)W[5*K]=W[5*K]-q(A,4*K)|0,W[6+K]=W[6+K]-q(S,4*K)|0;for(K=0;K<4;K++)ee(x,4*K,W[5*K]),ee(x,16+4*K,W[6+K])}else for(K=0;K<16;K++)ee(x,4*K,W[K]+se[K]|0)}function le(x,S,_,A){return X(x,S,_,A,!1),0}function P(x,S,_,A){return X(x,S,_,A,!0),0}var V=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function I(x,S,_,A,N,D,W){var se=new Uint8Array(16),H=new Uint8Array(64),K,me;if(!N)return 0;for(me=0;me<16;me++)se[me]=0;for(me=0;me<8;me++)se[me]=D[me];for(;N>=64;){for(le(H,se,W,V),me=0;me<64;me++)x[S+me]=(_?_[A+me]:0)^H[me];for(K=1,me=8;me<16;me++)K=K+(se[me]&255)|0,se[me]=K&255,K>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(le(H,se,W,V),me=0;me<N;me++)x[S+me]=(_?_[A+me]:0)^H[me];return 0}function Z(x,S,_,A,N){return I(x,S,null,0,_,A,N)}function ie(x,S,_,A,N){var D=new Uint8Array(32);return P(D,A,N,V),Z(x,S,_,A.subarray(16),D)}function Ae(x,S,_,A,N,D,W){var se=new Uint8Array(32);return P(se,D,W,V),I(x,S,_,A,N,D.subarray(16),se)}function Re(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Oe=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,D){var W,se,H,K,me=new Uint32Array(17),Ne=new Uint32Array(17),Ze=new Uint32Array(17),Mt=new Uint32Array(17),On=new Uint32Array(17);for(H=0;H<17;H++)Ne[H]=Ze[H]=0;for(H=0;H<16;H++)Ne[H]=D[H];for(Ne[3]&=15,Ne[4]&=252,Ne[7]&=15,Ne[8]&=252,Ne[11]&=15,Ne[12]&=252,Ne[15]&=15;N>0;){for(H=0;H<17;H++)Mt[H]=0;for(H=0;H<16&&H<N;++H)Mt[H]=_[A+H];for(Mt[H]=1,A+=H,N-=H,Re(Ze,Mt),se=0;se<17;se++)for(me[se]=0,H=0;H<17;H++)me[se]=me[se]+Ze[H]*(H<=se?Ne[se-H]:320*Ne[se+17-H]|0)|0|0;for(se=0;se<17;se++)Ze[se]=me[se];for(K=0,H=0;H<16;H++)K=K+Ze[H]|0,Ze[H]=K&255,K>>>=8;for(K=K+Ze[16]|0,Ze[16]=K&3,K=5*(K>>>2)|0,H=0;H<16;H++)K=K+Ze[H]|0,Ze[H]=K&255,K>>>=8;K=K+Ze[16]|0,Ze[16]=K}for(H=0;H<17;H++)On[H]=Ze[H];for(Re(Ze,Oe),W=-(Ze[16]>>>7)|0,H=0;H<17;H++)Ze[H]^=W&(On[H]^Ze[H]);for(H=0;H<16;H++)Mt[H]=D[H+16];for(Mt[16]=0,Re(Ze,Mt),H=0;H<16;H++)x[S+H]=Ze[H];return 0}function re(x,S,_,A,N,D){var W=new Uint8Array(16);return $(W,0,_,A,N,D),ae(x,S,W,0)}function he(x,S,_,A,N){var D;if(_<32)return-1;for(Ae(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function je(x,S,_,A,N){var D,W=new Uint8Array(32);if(_<32||(ie(W,0,32,A,N),re(S,16,S,32,_-32,W)!==0))return-1;for(Ae(x,0,S,0,_,A,N),D=0;D<32;D++)x[D]=0;return 0}function ve(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function G(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function ge(x,S,_){for(var A,N=~(_-1),D=0;D<16;D++)A=N&(x[D]^S[D]),x[D]^=A,S[D]^=A}function xe(x,S){var _,A,N,D=s(),W=s();for(_=0;_<16;_++)W[_]=S[_];for(G(W),G(W),G(W),A=0;A<2;A++){for(D[0]=W[0]-65517,_=1;_<15;_++)D[_]=W[_]-65535-(D[_-1]>>16&1),D[_-1]&=65535;D[15]=W[15]-32767-(D[14]>>16&1),N=D[15]>>16&1,D[14]&=65535,ge(W,D,1-N)}for(_=0;_<16;_++)x[2*_]=W[_]&255,x[2*_+1]=W[_]>>8}function Pe(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return xe(_,x),xe(A,S),k(_,0,A,0)}function tt(x){var S=new Uint8Array(32);return xe(S,x),S[0]&1}function St(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function at(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function lt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function Se(x,S,_){var A,N,D=new Float64Array(31);for(A=0;A<31;A++)D[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)D[A+N]+=S[A]*_[N];for(A=0;A<15;A++)D[A]+=38*D[A+16];for(A=0;A<16;A++)x[A]=D[A];G(x),G(x)}function vt(x,S){Se(x,S,S)}function qn(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)vt(_,_),A!==2&&A!==4&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function In(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)vt(_,_),A!==1&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Rt(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),D,W,se=s(),H=s(),K=s(),me=s(),Ne=s(),Ze=s();for(W=0;W<31;W++)A[W]=S[W];for(A[31]=S[31]&127|64,A[0]&=248,St(N,_),W=0;W<16;W++)H[W]=N[W],me[W]=se[W]=K[W]=0;for(se[0]=me[0]=1,W=254;W>=0;--W)D=A[W>>>3]>>>(W&7)&1,ge(se,H,D),ge(K,me,D),at(Ne,se,K),lt(se,se,K),at(K,H,me),lt(H,H,me),vt(me,Ne),vt(Ze,se),Se(se,K,se),Se(K,H,Ne),at(Ne,se,K),lt(se,se,K),vt(H,se),lt(K,me,Ze),Se(se,K,g),at(se,se,me),Se(K,K,se),Se(se,me,Ze),Se(me,H,N),vt(H,Ne),ge(se,H,D),ge(K,me,D);for(W=0;W<16;W++)N[W+16]=se[W],N[W+32]=K[W],N[W+48]=H[W],N[W+64]=me[W];var Mt=N.subarray(32),On=N.subarray(16);return qn(Mt,Mt),Se(On,On,Mt),xe(x,On),0}function cn(x,S){return Rt(x,S,f)}function Di(x,S){return a(S,32),cn(x,S)}function vs(x,S,_){var A=new Uint8Array(32);return Rt(A,_,S),P(x,o,A,V)}var sl=he,il=je;function Ur(x,S,_,A,N,D){var W=new Uint8Array(32);return vs(W,N,D),sl(x,S,_,A,W)}function Lr(x,S,_,A,N,D){var W=new Uint8Array(32);return vs(W,N,D),il(x,S,_,A,W)}function Jn(){var x=0,S=0,_=0,A=0,N=65535,D,W,se;for(se=0;se<arguments.length;se++)D=arguments[se].lo,W=arguments[se].hi,x+=D&N,S+=D>>>16,_+=W&N,A+=W>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function rl(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function zi(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function nt(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function ac(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function al(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function ll(x){return zi(nt(x,28),nt(x,34),nt(x,39))}function qi(x){return zi(nt(x,14),nt(x,18),nt(x,41))}function lc(x){return zi(nt(x,1),nt(x,8),rl(x,7))}function ol(x){return zi(nt(x,19),nt(x,61),rl(x,6))}var oc=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function cl(x,S,_){var A=[],N=[],D=[],W=[],se,H,K;for(H=0;H<8;H++)A[H]=D[H]=Q(x,8*H);for(var me=0;_>=128;){for(H=0;H<16;H++)W[H]=Q(S,8*H+me);for(H=0;H<80;H++){for(K=0;K<8;K++)N[K]=D[K];for(se=Jn(D[7],qi(D[4]),ac(D[4],D[5],D[6]),oc[H],W[H%16]),N[7]=Jn(se,ll(D[0]),al(D[0],D[1],D[2])),N[3]=Jn(N[3],se),K=0;K<8;K++)D[(K+1)%8]=N[K];if(H%16===15)for(K=0;K<16;K++)W[K]=Jn(W[K],W[(K+9)%16],lc(W[(K+1)%16]),ol(W[(K+14)%16]))}for(H=0;H<8;H++)D[H]=Jn(D[H],A[H]),A[H]=D[H];me+=128,_-=128}for(H=0;H<8;H++)ne(x,8*H,A[H]);return _}var li=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 ft(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),D,W=_;for(D=0;D<64;D++)A[D]=li[D];for(cl(A,S,_),_%=128,D=0;D<256;D++)N[D]=0;for(D=0;D<_;D++)N[D]=S[W-_+D];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ne(N,_-8,new n(W/536870912|0,W<<3)),cl(A,N,_),D=0;D<64;D++)x[D]=A[D];return 0}function Ft(x,S){var _=s(),A=s(),N=s(),D=s(),W=s(),se=s(),H=s(),K=s(),me=s();lt(_,x[1],x[0]),lt(me,S[1],S[0]),Se(_,_,me),at(A,x[0],x[1]),at(me,S[0],S[1]),Se(A,A,me),Se(N,x[3],S[3]),Se(N,N,E),Se(D,x[2],S[2]),at(D,D,D),lt(W,A,_),lt(se,D,N),at(H,D,N),at(K,A,_),Se(x[0],W,se),Se(x[1],K,H),Se(x[2],H,se),Se(x[3],W,K)}function Ct(x,S,_){var A;for(A=0;A<4;A++)ge(x[A],S[A],_)}function Hr(x,S){var _=s(),A=s(),N=s();qn(N,S[2]),Se(_,S[0],N),Se(A,S[1],N),xe(x,A),x[31]^=tt(_)<<7}function Pr(x,S,_){var A,N;for(ve(x[0],d),ve(x[1],m),ve(x[2],m),ve(x[3],d),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Ct(x,S,A),Ft(S,x),Ft(x,x),Ct(x,S,A)}function Bi(x,S){var _=[s(),s(),s(),s()];ve(_[0],w),ve(_[1],T),ve(_[2],m),Se(_[3],w,T),Pr(x,_,S)}function _s(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],D;for(_||a(S,32),ft(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Bi(N,A),Hr(x,N),D=0;D<32;D++)S[D+32]=x[D];return 0}var Qn=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 ws(x,S){var _,A,N,D;for(A=63;A>=32;--A){for(_=0,N=A-32,D=A-12;N<D;++N)S[N]+=_-16*S[A]*Qn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Qn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Qn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function An(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;ws(x,S)}function oi(x,S,_,A){var N=new Uint8Array(64),D=new Uint8Array(64),W=new Uint8Array(64),se,H,K=new Float64Array(64),me=[s(),s(),s(),s()];ft(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var Ne=_+64;for(se=0;se<_;se++)x[64+se]=S[se];for(se=0;se<32;se++)x[32+se]=N[32+se];for(ft(W,x.subarray(32),_+32),An(W),Bi(me,W),Hr(x,me),se=32;se<64;se++)x[se]=A[se];for(ft(D,x,_+64),An(D),se=0;se<64;se++)K[se]=0;for(se=0;se<32;se++)K[se]=W[se];for(se=0;se<32;se++)for(H=0;H<32;H++)K[se+H]+=D[se]*N[H];return ws(x.subarray(32),K),Ne}function ci(x,S){var _=s(),A=s(),N=s(),D=s(),W=s(),se=s(),H=s();return ve(x[2],m),St(x[1],S),vt(N,x[1]),Se(D,N,y),lt(N,N,x[2]),at(D,x[2],D),vt(W,D),vt(se,W),Se(H,se,W),Se(_,H,N),Se(_,_,D),In(_,_),Se(_,_,N),Se(_,_,D),Se(_,_,D),Se(x[0],_,D),vt(A,x[0]),Se(A,A,D),Pe(A,N)&&Se(x[0],x[0],z),vt(A,x[0]),Se(A,A,D),Pe(A,N)?-1:(tt(x[0])===S[31]>>7&<(x[0],d,x[0]),Se(x[3],x[0],x[1]),0)}function $r(x,S,_,A){var N,D=new Uint8Array(32),W=new Uint8Array(64),se=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ci(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ft(W,x,_),An(W),Pr(se,H,W),Bi(H,S.subarray(32)),Ft(se,H),Hr(D,se),_-=64,k(S,0,D,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Ui=32,Ss=24,jn=32,Es=16,As=32,ui=32,js=32,Xn=32,fi=32,Yr=Ss,ul=jn,Bn=Es,Xe=64,ot=32,It=64,hi=32,Gr=64;i.lowlevel={crypto_core_hsalsa20:P,crypto_stream_xor:Ae,crypto_stream:ie,crypto_stream_salsa20_xor:I,crypto_stream_salsa20:Z,crypto_onetimeauth:$,crypto_onetimeauth_verify:re,crypto_verify_16:ae,crypto_verify_32:k,crypto_secretbox:he,crypto_secretbox_open:je,crypto_scalarmult:Rt,crypto_scalarmult_base:cn,crypto_box_beforenm:vs,crypto_box_afternm:sl,crypto_box:Ur,crypto_box_open:Lr,crypto_box_keypair:Di,crypto_hash:ft,crypto_sign:oi,crypto_sign_keypair:_s,crypto_sign_open:$r,crypto_secretbox_KEYBYTES:Ui,crypto_secretbox_NONCEBYTES:Ss,crypto_secretbox_ZEROBYTES:jn,crypto_secretbox_BOXZEROBYTES:Es,crypto_scalarmult_BYTES:As,crypto_scalarmult_SCALARBYTES:ui,crypto_box_PUBLICKEYBYTES:js,crypto_box_SECRETKEYBYTES:Xn,crypto_box_BEFORENMBYTES:fi,crypto_box_NONCEBYTES:Yr,crypto_box_ZEROBYTES:ul,crypto_box_BOXZEROBYTES:Bn,crypto_sign_BYTES:Xe,crypto_sign_PUBLICKEYBYTES:ot,crypto_sign_SECRETKEYBYTES:It,crypto_sign_SEEDBYTES:hi,crypto_hash_BYTES:Gr,gf:s,D:y,L:Qn,pack25519:xe,unpack25519:St,M:Se,A:at,S:vt,Z:lt,pow2523:In,add:Ft,set25519:ve,modL:ws,scalarmult:Pr,scalarbase:Bi};function fl(x,S){if(x.length!==Ui)throw new Error("bad key size");if(S.length!==Ss)throw new Error("bad nonce size")}function hl(x,S){if(x.length!==js)throw new Error("bad public key size");if(S.length!==Xn)throw new Error("bad secret key size")}function _t(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Li(x){for(var S=0;S<x.length;S++)x[S]=0}i.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},i.secretbox=function(x,S,_){_t(x,S,_),fl(_,S);for(var A=new Uint8Array(jn+x.length),N=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+jn]=x[D];return he(N,A,A.length,S,_),N.subarray(Es)},i.secretbox.open=function(x,S,_){_t(x,S,_),fl(_,S);for(var A=new Uint8Array(Es+x.length),N=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+Es]=x[D];return A.length<32||je(N,A,A.length,S,_)!==0?null:N.subarray(jn)},i.secretbox.keyLength=Ui,i.secretbox.nonceLength=Ss,i.secretbox.overheadLength=Es,i.scalarMult=function(x,S){if(_t(x,S),x.length!==ui)throw new Error("bad n size");if(S.length!==As)throw new Error("bad p size");var _=new Uint8Array(As);return Rt(_,x,S),_},i.scalarMult.base=function(x){if(_t(x),x.length!==ui)throw new Error("bad n size");var S=new Uint8Array(As);return cn(S,x),S},i.scalarMult.scalarLength=ui,i.scalarMult.groupElementLength=As,i.box=function(x,S,_,A){var N=i.box.before(_,A);return i.secretbox(x,S,N)},i.box.before=function(x,S){_t(x,S),hl(x,S);var _=new Uint8Array(fi);return vs(_,x,S),_},i.box.after=i.secretbox,i.box.open=function(x,S,_,A){var N=i.box.before(_,A);return i.secretbox.open(x,S,N)},i.box.open.after=i.secretbox.open,i.box.keyPair=function(){var x=new Uint8Array(js),S=new Uint8Array(Xn);return Di(x,S),{publicKey:x,secretKey:S}},i.box.keyPair.fromSecretKey=function(x){if(_t(x),x.length!==Xn)throw new Error("bad secret key size");var S=new Uint8Array(js);return cn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},i.box.publicKeyLength=js,i.box.secretKeyLength=Xn,i.box.sharedKeyLength=fi,i.box.nonceLength=Yr,i.box.overheadLength=i.secretbox.overheadLength,i.sign=function(x,S){if(_t(x,S),S.length!==It)throw new Error("bad secret key size");var _=new Uint8Array(Xe+x.length);return oi(_,x,x.length,S),_},i.sign.open=function(x,S){if(_t(x,S),S.length!==ot)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=$r(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),D=0;D<N.length;D++)N[D]=_[D];return N},i.sign.detached=function(x,S){for(var _=i.sign(x,S),A=new Uint8Array(Xe),N=0;N<A.length;N++)A[N]=_[N];return A},i.sign.detached.verify=function(x,S,_){if(_t(x,S,_),S.length!==Xe)throw new Error("bad signature size");if(_.length!==ot)throw new Error("bad public key size");var A=new Uint8Array(Xe+x.length),N=new Uint8Array(Xe+x.length),D;for(D=0;D<Xe;D++)A[D]=S[D];for(D=0;D<x.length;D++)A[D+Xe]=x[D];return $r(N,A,A.length,_)>=0},i.sign.keyPair=function(){var x=new Uint8Array(ot),S=new Uint8Array(It);return _s(x,S),{publicKey:x,secretKey:S}},i.sign.keyPair.fromSecretKey=function(x){if(_t(x),x.length!==It)throw new Error("bad secret key size");for(var S=new Uint8Array(ot),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},i.sign.keyPair.fromSeed=function(x){if(_t(x),x.length!==hi)throw new Error("bad seed size");for(var S=new Uint8Array(ot),_=new Uint8Array(It),A=0;A<32;A++)_[A]=x[A];return _s(S,_,!0),{publicKey:S,secretKey:_}},i.sign.publicKeyLength=ot,i.sign.secretKeyLength=It,i.sign.seedLength=hi,i.sign.signatureLength=Xe,i.hash=function(x){_t(x);var S=new Uint8Array(Gr);return ft(S,x,x.length),S},i.hash.hashLength=Gr,i.verify=function(x,S){return _t(x,S),x.length===0||S.length===0||x.length!==S.length?!1:fe(x,0,S,0,x.length)===0},i.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;i.setPRNG(function(_,A){var N,D=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(D.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=D[N];Li(D)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&i.setPRNG(function(_,A){var N,D=x.randomBytes(A);for(N=0;N<A;N++)_[N]=D[N];Li(D)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Oo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Oo.sign.keyPair.fromSeed,Oo.sign.detached,Oo.sign.detached.verify,Oo.randomBytes;var H0;(function(i){i.InvalidPrefixByte="nkeys: invalid prefix byte",i.InvalidKey="nkeys: invalid key",i.InvalidPublicKey="nkeys: invalid public key",i.InvalidSeedLen="nkeys: invalid seed length",i.InvalidSeed="nkeys: invalid seed",i.InvalidEncoding="nkeys: invalid encoded key",i.InvalidSignature="nkeys: signature verification failed",i.CannotSign="nkeys: cannot sign, no private key available",i.PublicKeyOnly="nkeys: no seed or private key available",i.InvalidChecksum="nkeys: invalid checksum",i.SerializationError="nkeys: serialization error",i.ApiError="nkeys: api error",i.ClearedPair="nkeys: pair is cleared"})(H0||(H0={}));var P0;(function(i){i[i.Seed=144]="Seed",i[i.Private=120]="Private",i[i.Operator=112]="Operator",i[i.Server=104]="Server",i[i.Cluster=16]="Cluster",i[i.Account=0]="Account",i[i.User=160]="User"})(P0||(P0={}));function H1(i){return n=>{let s={};return i.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function P1(){return()=>{}}function $1(i,n){return()=>{const s=typeof i=="function"?i():i,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function Y1(i){return()=>({auth_token:typeof i=="function"?i():i})}const Fg=120*1e3,G1=2,Ig=2*1e3;function V1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Fg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Ig,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function F1(i){const n=[];return typeof i.authenticator=="function"&&n.push(i.authenticator),Array.isArray(i.authenticator)&&n.push(...i.authenticator),i.token&&n.push(Y1(i.token)),i.user&&n.push($1(i.user,i.pass)),n.length===0?P1():H1(n)}function I1(i){const n=`${Bf}:${Yg()}`;if(i=i||{servers:[n]},i.servers=i.servers||[],typeof i.servers=="string"&&(i.servers=[i.servers]),i.servers.length>0&&i.port)throw new de("port and servers options are mutually exclusive",oe.InvalidOption);i.servers.length===0&&i.port&&(i.servers=[`${Bf}:${i.port}`]),i.servers&&i.servers.length===0&&(i.servers=[n]);const s=ec(V1(),i);if(s.authenticator=F1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new de(`${a} option should be a function`,oe.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{gs(s.inboxPrefix)}catch(a){throw new de(a.message,oe.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Vf()=="function"),s.resolve&&typeof Vf()!="function")throw new de("'resolve' is not supported on this client",oe.InvalidOption);return s}function J1(i,n){const{proto:s,tls_required:a,tls_available:o}=i;if((s===void 0||s<1)&&n.noEcho)throw new de("noEcho",oe.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new de("tls",oe.ServerOptionNotAvailable)}const Q1=1024*32,X1=/^INFO\s+([^\r\n]+)\r\n/i,K1=Ya(`PONG\r
|
|
38
|
+
`),$0=Ya(`PING\r
|
|
39
|
+
`);class Z1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};ec(this,o)}}class Jg extends jt{constructor(s,a,o={}){var d;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");ec(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=rt();const f=!((d=s.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=Mr(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(m=>{this.stop(m),this.noIterator&&this.callback(m,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,d=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(m,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(m,g),d(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(de.errorForCode(oe.ConnectionClosed)):this.isClosed()?Promise.reject(de.errorForCode(oe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(rt()).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 W1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Qo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=Q1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new W1,this.muxSubscriptions=new z1,this.outbound=new Dr,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new p1({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new D1(a,{randomize:!n.noRandomize}),this.closed=rt(),this.parser=new L0(this),this.heartbeats=new q1(this,this.options.pingInterval||Fg,this.options.maxPingOut||G1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=de.errorForCode(oe.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new L0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new jt;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=rt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=b1(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:Or.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Or.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:ps.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:ps.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===oe.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Mr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Vf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:Or.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(d){o=d}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Ig;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:de.errorForCode(oe.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(d){if(n=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const m=this.options.maxReconnectAttempts||0;m!==-1&&o.reconnects>=m&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await zr(a)}}static async connect(n,s){const a=new Qo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new de(n,oe.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new de(n,oe.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new de(n,oe.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new de(n,oe.AccountExpired):s.indexOf("authentication timeout")!==-1?new de(n,oe.AuthenticationTimeout):new de(n,oe.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new uh(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=E0(n),a=Qo.toError(s),o={type:ps.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const d=this.subscriptions.getMux();f=(d==null?void 0:d.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(K1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(E0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ci(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:d}=this.transport;try{const m=new Z1({version:f,lang:d},this.options,s.nonce);s.headers&&(m.headers=!0,m.no_responders=!0);const g=JSON.stringify(m);this.transport.send(Ya(`CONNECT ${g}${zo}`)),this.transport.send($0)}catch(m){this._close(m)}}a&&this.dispatchStatus({type:ps.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:ps.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case qt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case qt.OK:break;case qt.ERR:this.processError(n.data);break;case qt.PING:this.processPing();break;case qt.PONG:this.processPong();break;case qt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=Ya(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=an,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=Ri.encode(s);else throw de.errorForCode(oe.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let d=an,m=0;if(a.headers){if(this.info&&!this.info.headers)throw new de("headers",oe.ServerOptionNotAvailable);d=a.headers.encode(),m=d.length,f=o.length+m}if(this.info&&f>this.info.max_payload)throw de.errorForCode(oe.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${m} ${f}\r
|
|
40
|
+
`:g=`HPUB ${n} ${m} ${f}\r
|
|
41
|
+
`,this.sendCommand(g,d,o,Jo)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
|
|
42
|
+
`:g=`PUB ${n} ${f}\r
|
|
43
|
+
`,this.sendCommand(g,o,Jo))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
|
|
44
|
+
`):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
|
|
45
|
+
`)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
|
|
46
|
+
`):this.sendCommand(`UNSUB ${n.sid}\r
|
|
47
|
+
`),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=rt()),this.pongs.push(n),this.outbound.fill($0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${zo}`):n.push(`SUB ${a.subject} ${a.sid}${zo}`)}),n.length&&this.transport.send(Ya(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Jg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const e_="$SRV";class Y0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,d;return o=o||{},o.headers=o.headers||ys(),(f=o.headers)==null||f.set(Go,`${n}`),(d=o.headers)==null||d.set(Yo,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Qa{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&n_("service group",s);let o="";if(n instanceof el)this.srv=n,o="";else if(n instanceof Qa){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;La("endpoint",n);let{subject:o,handler:f,metadata:d,queue:m}=a;o=o||n,m=m||this.queue,t_("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:m,handler:f,metadata:d};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new Qa(this,n,s)}}function t_(i,n){if(n==="")throw new Error(`${i} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${i} cannot have internal '>': '${n}'`)})}function n_(i,n){if(n.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${i} name cannot contain internal '>': '${n}'`)})}class el{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),La("name",this.config.name),La("queue",this.config.queue),Ci(this.config.version),this._id=ii.next(),this.internal=[],this._done=rt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??e_;return s===""&&a===""?`${f}.${n}`:(La("control subject name",s),a!==""?(La("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=ys();if(n instanceof Vo){const a=n;s.set(Yo,a.message),s.set(Go,`${a.code}`)}else s.set(Yo,n.message),s.set(Go,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:d}=n,m=n;m.internal=s,s&&this.internal.push(m),m.stats=new s_(o,f,a),m.queue=a;const g=d?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{d(y,new Y0(E))}catch(T){m.stats.countError(T),E==null||E.respond(an,{headers:this.errorToHeader(T)})}finally{m.stats.countLatency(w)}}:void 0;return m.sub=this.nc.subscribe(f,{callback:g,queue:a}),m.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),m}info(){return{type:Ga.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Ga.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const d={};d.name=n,d.subject=el.controlSubject(s,o,f),d.handler=a,this.setupHandler(d,!0)}start(){const n=zn(),s=(d,m)=>d?(this.close(d),Promise.reject(d)):this.stats().then(g=>(m==null||m.respond(n.encode(g)),Promise.resolve())),a=(d,m)=>d?(this.close(d),Promise.reject(d)):(m==null||m.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(d,m)=>d?(this.close(d).then().catch(),Promise.reject(d)):(m.respond(o),Promise.resolve());return this.addInternalHandler(Ws.PING,f),this.addInternalHandler(Ws.STATS,s),this.addInternalHandler(Ws.INFO,a),this.handlers.forEach(d=>{const{subject:m}=d;typeof m=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Ga.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new Qa(this,n,s)}addEndpoint(n,s){return new Qa(this).addEndpoint(n,s)}_addEndpoint(n){const s=new jt;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new Y0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class s_{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=it(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:d,last_error:m,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:d,last_error:m,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=it(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 i_{constructor(n,s={strategy:Dn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Ws.PING,n,s)}stats(n="",s=""){return this.q(Ws.STATS,n,s)}info(n="",s=""){return this.q(Ws.INFO,n,s)}async q(n,s="",a=""){const o=new jt,f=zn(),d=el.controlSubject(n,s,a,this.prefix),m=await this.nc.requestMany(d,an,this.opts);return(async()=>{for await(const g of m)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Qg(){return{key:{encode(i){return i},decode(i){return i}},value:{encode(i){return i},decode(i){return i}}}}function r_(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Qg(),storage:$f.File}}const Xo="KV-Operation",G0="$KV",a_=/^[-/=.\w]+$/,l_=/^[-/=.>*\w]+$/,o_=/^[-\w]+$/;function c_(i){if(i.startsWith(".")||i.endsWith(".")||!a_.test(i))throw new Error(`invalid key: ${i}`)}function u_(i){if(i.startsWith(".")||i.endsWith(".")||!l_.test(i))throw new Error(`invalid key: ${i}`)}function f_(i){if(i.startsWith(".")||i.endsWith("."))throw new Error(`invalid key: ${i}`);const n=i.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${i}`);s=!0;break}return s}function qo(i){if(!o_.test(i))throw new Error(`invalid bucket name: ${i}`)}var Yn;(function(i){i.MsgIdHdr="Nats-Msg-Id",i.ExpectedStreamHdr="Nats-Expected-Stream",i.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",i.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",i.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Yn||(Yn={}));class Xa{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",c_);v(this,"validateSearchKey",u_);v(this,"hasWildcards",f_);qo(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=G0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){qo(s);const o=await n.jetstreamManager(),f=new Xa(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};qo(s);const d=new Xa(s,n,o);return f.config.name=a.streamName??d.bucketName(),Object.assign(d,f),d.stream=f.config.name,d.codec=a.codec||Qg(),d.direct=f.config.allow_direct??!1,d.initializePrefixes(f),d}async init(n={}){const s=Object.assign(r_(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Pf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(nn)||(w.name=`${nn}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(T=>{const z=Object.assign({},T),M=z.name.startsWith(nn)?z.name.substring(nn.length):z.name;return z.name.startsWith(nn)||(z.name=`${nn}${z.name}`),!T.external&&M!==this.bucket&&(z.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?ri.S2:ri.None);const f=this.js.nc,d=f.getServerVersion(),m=d?Gf(d,Ci("2.7.2"))>=0:!1;a.discard=m?Ja.New:Ja.Old;const{ok:g,min:y}=f.features.get(Ue.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=it(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(nn)&&(a=a.substring(nn.length)),s.external&&s.external.api!==""){const o=s.name.substring(nn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${nn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${G0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Bt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new j_(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new O_(this.bucket,s,n)}async create(n,s){var f;let a;try{const d=await this.put(n,s,{previousSeq:0});return Promise.resolve(d)}catch(d){if(a=d,((f=d==null?void 0:d.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(d)}let o=0;try{const d=await this.get(n);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(o=d!==null?d.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(d){return Promise.reject(d)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var d,m;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=ys();f.headers=g,g.set(Yn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(d=y.api_error)==null?void 0:d.description,y.code=`${(m=y.api_error)==null?void 0:m.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const d=this.smToEntry(f);return d.key!==a?null:d}catch(d){if(d.code===oe.JetStream404NoMessages)return null;throw d}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=rt(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,d=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),m=await Promise.all(d);return m.unshift({success:!0,purged:0}),m.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const d of o)f.push(this._doDeleteOrPurge(d,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=ys();f.set(Xo,s),s==="PURGE"&&f.set(Bt.RollupHdr,Bt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(Yn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),an,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),d=mt.LastPerSubject;s===Mn.AllHistory&&(d=mt.All),s===Mn.UpdatesOnly&&(d=mt.New);let m;return f.length===1&&(m=f[0],f=void 0),Object.assign({deliver_policy:d,ack_policy:At.None,filter_subjects:f,filter_subject:m,flow_control:!0,idle_heartbeat:it(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new jt,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let d=0;const m=this._buildCC(s,Mn.AllHistory,o),g=m.filter_subject,y=ti(m);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,T)=>{if(w){a.stop(w);return}if(T){const z=this.jmToEntry(T);a.push(z),a.received++,(f&&d>0&&a.received>=d||T.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,T=w.num_pending+w.delivered.consumer_seq;if(T===0||a.received>=T)try{f()}catch(z){a.stop(z)}finally{f=void 0}else d=T}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new jt,o={};o.headers_only=n.headers_only||!1;let f=Mn.LastValue;n.include===Mn.AllHistory?f=Mn.AllHistory:n.include===Mn.UpdatesOnly&&(f=Mn.UpdatesOnly);const d=n.ignoreDeletes===!0;let m=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=ti(y);this.canSetWatcherName()&&w.consumerName(ii.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((z,M)=>{if(z){a.stop(z);return}if(M){const q=this.jmToEntry(M);if(d&&q.operation==="DEL")return;a.push(q),a.received++,m&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(m),m=void 0)}});const T=await this.js.subscribe(E,w);if(m){const{info:{last:z}}=T,M=z.num_pending+z.delivered.consumer_seq;if(M===0||a.received>=M)try{m()}catch(q){a.stop(q)}finally{m=void 0}else g=M}return a._data=T,a.iterClosed.then(()=>{T.unsubscribe()}),T.closed.then(()=>{a.stop()}).catch(z=>{a.stop(z)}),a}async keys(n=">"){const s=new jt,a=this._buildCC(n,Mn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=ti(a);f.bindStream(this.stream),f.orderedConsumer();const d=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of d){const E=(g=y.headers)==null?void 0:g.get(Xo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&d.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),d.info.last.num_pending===0&&d.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Xg(o,s)}}class Xg{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(nn)?this.si.config.name.substring(nn.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 ch(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==ri.None:!1}}const hh="OBJ_",V0="SHA-256=";function h_(i){return qo(i),`${hh}${i}`}function d_(i){return i.startsWith(hh)?i.substring(4):i}class Jf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return d_(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!==ri.None:!1}}function To(i){if(i===void 0)return;const{domain:n}=i;if(n===void 0)return i;const s=Object.assign({},i);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var vn;(function(i){i[i.Unset=-1]="Unset",i[i.Consume=0]="Consume",i[i.Fetch=1]="Fetch"})(vn||(vn={}));var Gn;(function(i){i.HeartbeatsMissed="heartbeats_missed",i.ConsumerNotFound="consumer_not_found",i.StreamNotFound="stream_not_found",i.ConsumerDeleted="consumer_deleted",i.OrderedConsumerRecreated="ordered_consumer_recreated",i.NoResponders="no_responders"})(Gn||(Gn={}));var Cr;(function(i){i.DebugEvent="debug",i.Discard="discard",i.Reset="reset",i.Next="next"})(Cr||(Cr={}));const F0=Uint8Array.of(43,65,67,75),m_=Uint8Array.of(45,78,65,75),Da=Uint8Array.of(43,87,80,73),p_=Uint8Array.of(43,78,88,84),g_=Uint8Array.of(43,84,69,82,77),y_=Uint8Array.of(32);function Ka(i,n=5e3){return new D_(i,n)}class jf extends jt{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=gs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:d}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:m}=this;m&&m.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,T,z,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Hf(y))return;const q=(T=y.headers)==null?void 0:T.code,Q=((M=(z=y.headers)==null?void 0:z.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:ee,bytesLeft:ne}=this.parseDiscard(y.headers);if(ee>0||ne>0)this.pending.msgs-=ee,this.pending.bytes-=ne,this.pending.requests--,this.notify(Cr.Discard,{msgsLeft:ee,bytesLeft:ne});else if(q===400){this.stop(new de(Q,`${q}`));return}else if(q===409&&Q==="consumer deleted"){if(this.notify(Gn.ConsumerDeleted,`${q} ${Q}`),!this.refilling||this.abortOnMissingResource){const fe=new de(Q,`${q}`);this.stop(fe);return}}else if(q===503){if(this.notify(Gn.NoResponders,`${q} No Responders`),!this.refilling||this.abortOnMissingResource){const fe=new de("no responders",`${q}`);this.stop(fe);return}}else this.notify(Cr.DebugEvent,`${q} ${Q}`)}else this._push(Ka(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=d||a&&this.pending.bytes<=f){const q=this.pullOptions();this.pull(q)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new fh(o,g=>(this.notify(Gn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case ps.Disconnect:(y=this.monitor)==null||y.cancel();break;case ps.Reconnect:this.resetPending().then(w=>{var T;w&&((T=this.monitor)==null||T.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const o=oh([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(d){if(d.message==="stream not found"){if(a++,this.notify(Gn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(s++,this.notify(Gn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(d),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const m=o.backoff(f),g=zr(m);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(Cr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=it(this.opts.idle_heartbeat),f=it(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Bt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Bt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const d=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||d}return o}status(){const s=new jt;return this.listeners.push(s),Promise.resolve(s)}}class b_ extends jt{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new jt;return this.listeners.push(s),Promise.resolve(s)}}class Qf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new jf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new jf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Mr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=rt(),a=n;a.max_messages=1;const o=new jf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const m of await o.status())if(m.type===Gn.HeartbeatsMissed&&m.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const m of o){s.resolve(m);break}})().catch(()=>{});const d=Mr(f);return o.closed().then(m=>{m?s.reject(m):s.resolve(null)}).catch(m=>{s.reject(m)}).finally(()=>{d.cancel()}),d.catch(m=>{s.resolve(null),o.close().catch()}),o.trackTimeout(d),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class x_{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=ii.next(),typeof a.name_prefix=="string"&&(tc("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=vn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:mt.StartSequence,opt_start_seq:n,ack_policy:At.None,inactive_threshold:it(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||mt.StartSequence,(this.consumerOpts.deliver_policy===mt.LastPerSubject||this.consumerOpts.deliver_policy===mt.New||this.consumerOpts.deliver_policy===mt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===mt.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=mt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=it(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var d,m,g,y,E;ii.next();const s=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=oh([((m=this.opts)==null?void 0:m.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(Gn.OrderedConsumerRecreated,f.name);break}catch(T){if(T.message==="stream not found"&&((y=this.iter)==null||y.notify(Gn.StreamNotFound,w),this.type===vn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(T),Promise.reject(T);if(s&&w>=this.maxInitialReset)throw T;await zr(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===vn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new b_),this.consumer=new Qf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let d=null;this.type===vn.Fetch&&a?d=await this.consumer.fetch(n):this.type===vn.Consume&&(d=await this.consumer.consume(n));const m=d;m.forOrderedConsumer=!0,m.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(m)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(Cr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===vn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===vn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=vn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===vn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=vn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=rt();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Xf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(Ue.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Qf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Qf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new dh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new x_(this.api,n,s))).catch(f=>Promise.reject(f))}}class sc{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new sc(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Xf(new Io(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Xf(new Io(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class dh extends Wa{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Ue.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var m;if((((m=f==null?void 0:f.subject_transforms)==null?void 0:m.length)||0)>0){const{min:g,ok:y}=s.features.get(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),zt(n.name),n.mirror=To(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(To);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return zt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var m;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),zt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=To(o.mirror),o.sources=(m=o.sources)==null?void 0:m.map(To);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(d),d}async info(n,s){zt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:d,limit:m}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(d&&d>g){const y=[f],E=s||{};let w=0;for(;d>g;){w++,E.offset=m*w;const z=await this._request(a,E);d=z.total,y.push(z);const M=Object.getOwnPropertyNames(z.state.subjects).length;if(g+=M,M<m)break}let T={};for(let z=0;z<y.length;z++)f=y[z],f.state.subjects&&(T=Object.assign(T,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=T}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const d=f;return d.streams.forEach(m=>{this._fixInfo(m)}),d.streams},o=`${this.prefix}.STREAM.LIST`;return new Ha(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return zt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){zt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){zt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Kg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(nn));f.forEach(y=>{this._fixInfo(y)});let d="";return f.length&&(d=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Xg(y,d))},s=`${this.prefix}.STREAM.LIST`;return new Ha(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(m=>m.config.name.startsWith(hh));return f.forEach(m=>{this._fixInfo(m)}),f.map(m=>new Jf(m))},s=`${this.prefix}.STREAM.LIST`;return new Ha(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Ha(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new sc(this,s))}}class v_ extends Wa{constructor(n,s){super(n,s)}async getMessage(n,s){zt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):an,d=this.opts.apiPrefix||"$JS.API",m=o?`${d}.DIRECT.GET.${n}.${o}`:`${d}.DIRECT.GET.${n}`,g=await this.nc.request(m,f,{timeout:this.timeout}),y=kr(g);if(y)return Promise.reject(y);const E=new Kf(g);return Promise.resolve(E)}async getBatch(n,s){zt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),d=new jt,m=await this.nc.requestMany(o,f,{strategy:Dn.SentinelMsg});return(async()=>{var w,T,z;let g=!1,y=!1,E;for await(const M of m){if(!g){g=!0;const q=((w=M.headers)==null?void 0:w.code)||0;if(q!==0&&q<200||q>299){E=(T=M.headers)==null?void 0:T.description.toLowerCase();break}if(((z=M.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;d.push(new Kf(M))}d.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);d.stop()})})(),Promise.resolve(d)}}class Kf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(Sr.Subject)}get seq(){const n=this.header.last(Sr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Sr.TimeStamp)}get stream(){return this.header.last(Sr.Stream)}json(n){return zn(n).decode(this.data)}string(){return sn.decode(this.data)}}v(Kf,"jc");class __ extends Wa{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new dh(s,a),this.consumers=new Io(s,a),this.direct=new v_(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new jt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),d=f.type.split("."),m=d[d.length-1];s.push({kind:m,data:f})}catch(f){s.stop(f)}}}),s}}class Kg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):an}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=ei.decode(n)}else this._header=ys();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return zn(n).decode(this.data)}string(){return sn.decode(this.data)}}v(Kg,"jc");class w_{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new sc(this.api,s))}}class Of{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=ei.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function I0(i){const n={name:i.name,description:i.description??"",options:i.options,metadata:i.metadata};if(i.headers){const s=i.headers;n.headers=s.toRecord()}return n}function S_(){return new ReadableStream({pull(i){i.enqueue(new Uint8Array(0)),i.close()}})}class Fa{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new Of(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),m=zn().decode(f.data);return m.revision=f.seq,m}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new Jf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Jf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var ae;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:d}=a,m=this.js.nc.info,g=(m==null?void 0:m.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((ae=n.options)==null?void 0:ae.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:T}=this._checkNotEmpty(n.name);if(T)return Promise.reject(T);const z=ii.next(),M=this._chunkSubject(z),q=this._metaSubject(w),Q=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},I0(n)),ee=rt(),ne=[],fe=new Dr;try{const k=s?s.getReader():null,X=q0.create();for(;;){const{done:le,value:P}=k?await k.read():{done:!0,value:void 0};if(le){if(fe.size()>0){const ie=fe.drain();X.update(ie),Q.chunks++,Q.size+=ie.length,ne.push(this.js.publish(M,ie,{timeout:f}))}await Promise.all(ne),ne.length=0,Q.mtime=new Date().toISOString();const V=Nr.encode(X.digest());Q.digest=`${V0}${V}`,Q.deleted=!1;const I=ys();typeof d=="number"&&I.set(Yn.ExpectedLastSubjectSequenceHdr,`${d}`),I.set(Bt.RollupHdr,Bt.RollupValueSubject);const Z=await this.js.publish(q,zn().encode(Q),{headers:I,timeout:f});if(Q.revision=Z.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}ee.resolve(new Of(Q));break}if(P)for(fe.fill(P);fe.size()>y;){Q.chunks++,Q.size+=y;const V=fe.drain(n.options.max_chunk_size);X.update(V),ne.push(this.js.publish(M,V,{timeout:f}))}}}catch(k){await this.jsm.streams.purge(this.stream,{filter:M}),ee.reject(k)}return ee}putBlob(n,s,a){function o(f){return new ReadableStream({pull(d){d.enqueue(f),d.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const d=new Dr,m=f.getReader();for(;;){const{done:g,value:y}=await m.read();if(g)return d.drain();y&&y.length&&d.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Fa.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(V0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Yf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=rt(),f={info:new Of(s),error:o};if(s.size===0)return f.data=S_(),o.resolve(null),Promise.resolve(f);let d;const m=ti();m.orderedConsumer();const g=q0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,m);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),d.enqueue(w.data)),w.info.pending===0&&(f1(a,g.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{d.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){d=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Fa))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const d={name:o,options:{link:{bucket:a.name}}};return this._put(d,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:s.bucket,name:s.name},m={name:a,bucket:s.bucket,options:{link:d}};await this.js.publish(this._metaSubject(n),JSON.stringify(m));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=zn(),o=ys();return o.set(Bt.RollupHdr,Bt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const d=Object.assign({},a,I0(s)),m=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(m)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new jt,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=zn(),d=ti();d.orderedConsumer(),n.includeHistory?d.deliverLastPerSubject():(s=!0,d.deliverNew()),d.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const m=await this.js.subscribe(o,d);return a._data=m,a.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${Nr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=h_(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ja.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?ri.S2:ri.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new Fa(s,o,n);return await f.init(a),Promise.resolve(f)}}class E_{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_KV);return o?s.bindOnly?Xa.bind(this.js,n,s):Xa.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_OBJECTSTORE);return o?Fa.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class mh extends Wa{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new Io(s,a),this.streamAPI=new dh(s,a),this.consumers=new Xf(this.consumerAPI),this.streams=new w_(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new E_(this)}async publish(s,a=an,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||ys();o&&(o.msgID&&f.set(Yn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(Yn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(Yn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(Yn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(Yn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const d=o.timeout||this.timeout,m={};d&&(m.timeout=d),o&&(m.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let T=0;T<g;T++)try{E=await this.nc.request(s,a,m);break}catch(z){if(z.code==="503"&&T+1<g)await zr(y);else throw z}const w=this.parseJsResponse(E);if(w.stream==="")throw de.errorForCode(oe.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){zt(s),Tr(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:it(o);const d={batch:1,no_wait:o===0,expires:o},m=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(d),{noMux:!0,timeout:f}),g=kr(m);if(g)throw g;return Ka(m,this.timeout)}fetch(s,a,o={}){zt(s),Tr(a);let f=null;const d=(o.max_bytes??0)>0;let m=0;const g=d?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ne=this.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!ne.ok)throw new Error(`max_bytes is only supported on servers ${ne.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=it(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const T=o.idle_heartbeat||0;T&&(E.idle_heartbeat=it(T),o.delay_heartbeat===!0&&(E.idle_heartbeat=it(T*4)));const z=new jt,M=E.batch;let q=0;z.protocolFilterFn=(ne,fe=!1)=>Hf(ne.msg)?(y==null||y.work(),!1):!0,z.dispatchedFn=ne=>{if(ne){if(d&&(m+=ne.data.length),q++,f&&ne.info.pending===0)return;(z.getPending()===1&&ne.info.pending===0||M===q||g>0&&m>=g)&&z.stop()}};const Q=gs(this.nc.options.inboxPrefix),ee=this.nc.subscribe(Q,{max:o.batch,callback:(ne,fe)=>{ne===null&&(ne=kr(fe)),ne!==null?(f&&(f.cancel(),f=null),Fv(ne)?z.stop(Wg(ne)===null?void 0:ne):z.stop(ne)):(y==null||y.work(),z.received++,z.push(Ka(fe,this.timeout)))}});return w&&(f=Mr(w),f.catch(()=>{ee.isClosed()||(ee.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{T&&(y=new fh(T,ne=>(z.push(()=>{z.err=new de(`${_n.IdleHeartbeatMissed}: ${ne}`,oe.JetStreamIdleHeartBeat)}),!0)))}catch{}await ee.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),z.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:Q}),z}async pullSubscribe(s,a=ti()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===At.None||f===At.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(o),m=new T_(this,o.deliver,d);m.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw m.unsubscribe(),g}return m}async subscribe(s,a=ti()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),d=new Zg(this,o.deliver,f);d.info=o;try{await this._maybeCreateConsumer(o)}catch(m){throw d.unsubscribe(),m}return d._maybeSetupHbMonitoring(),d}async _processOptions(s,a=ti()){const o=M0(a)?a.getOpts():a;if(o.isBind=M0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==At.NotSet&&o.config.ack_policy!==At.None)throw new de("ordered consumer: ack_policy can only be set to 'none'",oe.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new de("ordered consumer: durable_name cannot be set",oe.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new de("ordered consumer: deliver_subject cannot be set",oe.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new de("ordered consumer: max_deliver cannot be set",oe.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new de("ordered consumer: deliver_group cannot be set",oe.ApiError);o.config.deliver_subject=gs(this.nc.options.inboxPrefix),o.config.ack_policy=At.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||it(5e3),o.config.ack_wait=it(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===At.NotSet&&(o.config.ack_policy=At.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const d=o.config.deliver_group??"";if(d===""&&f.push_bound===!0)throw new Error("duplicate subscription");const m=f.config.deliver_group??"";if(d!==m)throw m===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${m}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||gs(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=k_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=mh.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const d=o;return Lf(d.msg)?(f||d.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==At.None&&(a.dispatchedFn=M_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Rr.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const d=a;if(kr(d.msg)||(g=f.monitor)==null||g.work(),Hf(d.msg)){const y=s?f._checkHbOrderConsumer(d.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Lf(d.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class ph{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=I1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new ph(n);Qo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const d of f.status())o.listeners.forEach(m=>{m.push(d)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw de.errorForCode(oe.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw de.errorForCode(oe.ConnectionDraining);if(n=n||"",n.length===0)throw de.errorForCode(oe.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Jg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=an,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||Dn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new de("timeout",oe.InvalidOption));const f=new jt;function d(g){f.push(()=>{f.stop(g)})}function m(g,y){g||y===null?d(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(gs(this.options.inboxPrefix),{callback:(M,q)=>{var Q,ee;if(((Q=q==null?void 0:q.data)==null?void 0:Q.length)===0&&((ee=q==null?void 0:q.headers)==null?void 0:ee.status)===oe.NoResponders&&(M=de.errorForCode(oe.NoResponders)),M){g&&(M.stack+=`
|
|
48
|
+
|
|
49
|
+
${g}`),w(M);return}m(null,q),a.strategy===Dn.Count&&(y--,y===0&&w()),a.strategy===Dn.JitterTimer&&(z(),T=setTimeout(()=>{w()},300)),a.strategy===Dn.SentinelMsg&&q&&q.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{d()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),z(),E.drain().then(()=>{d()}).catch(q=>{d()})};f.iterClosed.then(()=>{z(),E==null||E.unsubscribe()}).catch(M=>{z(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let T=setTimeout(()=>{w()},a.maxWait);const z=()=>{T&&clearTimeout(T)}}else{const g=a;g.callback=m,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new h1(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(E){y.cancel(E)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new de("timeout",oe.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new de("reply can only be used with noMux",oe.InvalidOption));if(a.noMux){const f=a.reply?a.reply:gs(this.options.inboxPrefix),d=rt(),m=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(m&&y.code!==oe.Timeout&&(y.stack+=`
|
|
50
|
+
|
|
51
|
+
${m.stack}`),g.unsubscribe(),d.reject(y)):(y=Lg(E),y?(m&&(y.stack+=`
|
|
52
|
+
|
|
53
|
+
${m.stack}`),d.reject(y)):d.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),d}else{const f=new $g(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(m){f.cancel(m)}const d=Promise.race([f.timer,f.deferred]);return d.catch(()=>{f.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(de.errorForCode(oe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(de.errorForCode(oe.ConnectionClosed)):this.isDraining()?Promise.reject(de.errorForCode(oe.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new jt;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new __(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===oe.NoResponders&&(o.code=oe.JetStreamNotEnabled),o}return s}jetstream(n={}){return new mh(this,n)}getServerVersion(){const n=this.info;return n?Ci(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw de.errorForCode(oe.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new A_(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(de.errorForCode(oe.ConnectionClosed)):this.isDraining()?Promise.reject(de.errorForCode(oe.ConnectionDraining)):this.protocol.reconnect()}}class A_{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new el(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new i_(this.nc,n,s)}}class j_{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Xo)||"PUT"}get length(){const n=this.sm.header.get(Bt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class O_{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(ch(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Xo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Bt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Zg extends g1{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=gs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=ii.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=mt.StartSequence,f.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(m,d,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new de(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,oe.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(ch(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,d=m=>{var E,w,T,z;const g=Xv(409,`${_n.IdleHeartbeatMissed}: ${m}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((T=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:T.stream_seq)||0;return this._resetOrderedConsumer(M+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new fh(s,d,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Bt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Bt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class T_ extends Zg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,d={};if(d.batch=n.batch||1,d.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);d.max_bytes=n.max_bytes}let m=0;n.expires&&n.expires>0&&(m=n.expires,d.expires=it(m));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,d.idle_heartbeat=it(g)),g&&m===0)throw new Error("idle_heartbeat requires expires");if(g>m)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),m&&g&&(this.monitor?this.monitor._change(g,m):this._setupHbMonitoring(g,m));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(d),{reply:w})}}}function k_(i,n){return i?C_(n):N_(n)}function N_(i){return(n,s)=>n?[n,null]:(n=kr(s),n?[n,null]:[null,Ka(s,i)])}function C_(i){return(n,s)=>{if(n)return[n,null];const a=kr(s);return a!==null?[Wg(a),null]:[null,Ka(s,i)]}}function Wg(i){if(i!==null)switch(i.code){case oe.JetStream404NoMessages:case oe.JetStream408RequestTimeout:return null;case oe.JetStream409:return Kv(i)?i:null;default:return i}return null}function M_(i){i&&i.ack()}function R_(i){const n=i.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class D_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=R_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Da[0]&&n[1]===Da[1]&&n[2]===Da[2]&&n[3]===Da[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=rt();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,d=!((a=f.options)!=null&&a.noAsyncTraces),m=new $g(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},d);f.request(m);try{f.publish(this.msg.reply,F0,{reply:`${f.muxSubscriptions.baseInbox}${m.token}`})}catch(g){m.cancel(g)}try{await Promise.race([m.timer,m.deferred]),s.resolve(!0)}catch(g){m.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(F0)}nak(n){let s=m_;n&&(s=Uf().encode(`-NAK ${JSON.stringify({delay:it(n)})}`)),this.doAck(s)}working(){this.doAck(Da)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=it(s.expires));const o=zn().encode(a),f=Dr.concat(p_,y_,o),d=n?{reply:n}:void 0;this.msg.respond(f,d)}term(n=""){let s=g_;(n==null?void 0:n.length)>0&&(s=Uf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const z_="1.30.3",q_="nats.ws";class B_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=z_,this.lang=q_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=rt(),this.closedNotification=rt()}async connect(n,s){const a=rt();if(s.tls)return a.reject(new de("tls",oe.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:d}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=d}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const d=Dr.concat(...this.yields),m=w1(d);if(m!==""){const g=X1.exec(m);if(!g){s.debug&&console.error("!!!",Ao(d)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);J1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(f.wasClean||(d=new Error(f.reason)),this._closed(d))},this.socket.onerror=f=>{if(this.isDiscarded())return;const d=f,m=new de(d.message,oe.Unknown,new Error(d.error));a.reject(m)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await zr(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${Ao(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=rt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${Ao(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${Ao(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function U_(i,n){/^(.*:\/\/)(.*)/.test(i)||(typeof n=="boolean"?i=`${n===!0?"https":"http"}://${i}`:i=`https://${i}`);let a=new URL(i);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${i}`));let f,d;const m=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":d=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":d=a.port||"443",f="wss:";break;default:d=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${m}:${d}${g}${y}`}function L_(i={}){return y1({defaultPort:443,urlParseFn:U_,factory:()=>new B_}),ph.connect(i)}const H_=null,P_=null,$_="lt.events";function ey(i,n){const s=i.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const tl=O.createContext({connected:!1,subscribe:()=>()=>{}});function Y_(){const{connected:i}=O.useContext(tl);return{connected:i}}function G_(i,n){const{subscribe:s}=O.useContext(tl),a=O.useRef(n);a.current=n,O.useEffect(()=>s(i,f=>a.current(f)),[s,i])}const V_=O.createContext({connected:!1,subscribe:()=>()=>{}}),F_=Uf();function I_({children:i,url:n,token:s}){const a=O.useRef(null),o=O.useRef(null),[f,d]=O.useState(!1),m=O.useRef(null),g=O.useRef(new Map),y=O.useCallback((T,z)=>{const M=g.current;return M.has(T)||M.set(T,new Set),M.get(T).add(z),()=>{const q=M.get(T);q&&(q.delete(z),q.size===0&&M.delete(T))}},[]),E=O.useCallback((T,z)=>{for(const[M,q]of g.current)if(ey(T,M))for(const Q of q)try{Q(z)}catch{}},[]),w=O.useCallback(async()=>{try{if(a.current)return;const T=n||H_;if(!T){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const z=await L_({servers:T,token:s||P_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=z,d(!0);const M=z.subscribe("lt.>");o.current=M,(async()=>{for await(const q of M)try{const Q=JSON.parse(F_.decode(q.data));E(q.subject,Q)}catch{}})(),(async()=>{for await(const q of z.status())q.type==="disconnect"||q.type==="error"?d(!1):q.type==="reconnect"&&d(!0)})()}catch{d(!1),m.current=setTimeout(w,3e3)}},[E]);return O.useEffect(()=>(w(),()=>{m.current&&clearTimeout(m.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),d(!1)}),[w]),h.jsx(V_.Provider,{value:{connected:f,subscribe:y},children:h.jsx(tl.Provider,{value:{connected:f,subscribe:y},children:i})})}const Fn=Object.create(null);Fn.open="0";Fn.close="1";Fn.ping="2";Fn.pong="3";Fn.message="4";Fn.upgrade="5";Fn.noop="6";const Bo=Object.create(null);Object.keys(Fn).forEach(i=>{Bo[Fn[i]]=i});const Zf={type:"error",data:"parser error"},ty=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ny=typeof ArrayBuffer=="function",sy=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,gh=({type:i,data:n},s,a)=>ty&&n instanceof Blob?s?a(n):J0(n,a):ny&&(n instanceof ArrayBuffer||sy(n))?s?a(n):J0(new Blob([n]),a):a(Fn[i]+(n||"")),J0=(i,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(i)};function Q0(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Tf;function J_(i,n){if(ty&&i.data instanceof Blob)return i.data.arrayBuffer().then(Q0).then(n);if(ny&&(i.data instanceof ArrayBuffer||sy(i.data)))return n(Q0(i.data));gh(i,!1,s=>{Tf||(Tf=new TextEncoder),n(Tf.encode(s))})}const X0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<X0.length;i++)Pa[X0.charCodeAt(i)]=i;const Q_=i=>{let n=i.length*.75,s=i.length,a,o=0,f,d,m,g;i[i.length-1]==="="&&(n--,i[i.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Pa[i.charCodeAt(a)],d=Pa[i.charCodeAt(a+1)],m=Pa[i.charCodeAt(a+2)],g=Pa[i.charCodeAt(a+3)],E[o++]=f<<2|d>>4,E[o++]=(d&15)<<4|m>>2,E[o++]=(m&3)<<6|g&63;return y},X_=typeof ArrayBuffer=="function",yh=(i,n)=>{if(typeof i!="string")return{type:"message",data:iy(i,n)};const s=i.charAt(0);return s==="b"?{type:"message",data:K_(i.substring(1),n)}:Bo[s]?i.length>1?{type:Bo[s],data:i.substring(1)}:{type:Bo[s]}:Zf},K_=(i,n)=>{if(X_){const s=Q_(i);return iy(s,n)}else return{base64:!0,data:i}},iy=(i,n)=>{switch(n){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},ry="",Z_=(i,n)=>{const s=i.length,a=new Array(s);let o=0;i.forEach((f,d)=>{gh(f,!1,m=>{a[d]=m,++o===s&&n(a.join(ry))})})},W_=(i,n)=>{const s=i.split(ry),a=[];for(let o=0;o<s.length;o++){const f=yh(s[o],n);if(a.push(f),f.type==="error")break}return a};function ew(){return new TransformStream({transform(i,n){J_(i,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}i.data&&typeof i.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let kf;function ko(i){return i.reduce((n,s)=>n+s.length,0)}function No(i,n){if(i[0].length===n)return i.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=i[0][a++],a===i[0].length&&(i.shift(),a=0);return i.length&&a<i[0].length&&(i[0]=i[0].slice(a)),s}function tw(i,n){kf||(kf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(d,m){for(s.push(d);;){if(a===0){if(ko(s)<1)break;const g=No(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(ko(s)<2)break;const g=No(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(ko(s)<8)break;const g=No(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue(Zf);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(ko(s)<o)break;const g=No(s,o);m.enqueue(yh(f?g:kf.decode(g),n)),a=0}if(o===0||o>i){m.enqueue(Zf);break}}}})}const ay=4;function xt(i){if(i)return nw(i)}function nw(i){for(var n in xt.prototype)i[n]=xt.prototype[n];return i}xt.prototype.on=xt.prototype.addEventListener=function(i,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(n),this};xt.prototype.once=function(i,n){function s(){this.off(i,s),n.apply(this,arguments)}return s.fn=n,this.on(i,s),this};xt.prototype.off=xt.prototype.removeListener=xt.prototype.removeAllListeners=xt.prototype.removeEventListener=function(i,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+i];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+i],this};xt.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+i],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};xt.prototype.emitReserved=xt.prototype.emit;xt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};xt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const ic=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),wn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),sw="arraybuffer";function ly(i,...n){return n.reduce((s,a)=>(i.hasOwnProperty(a)&&(s[a]=i[a]),s),{})}const iw=wn.setTimeout,rw=wn.clearTimeout;function rc(i,n){n.useNativeTimers?(i.setTimeoutFn=iw.bind(wn),i.clearTimeoutFn=rw.bind(wn)):(i.setTimeoutFn=wn.setTimeout.bind(wn),i.clearTimeoutFn=wn.clearTimeout.bind(wn))}const aw=1.33;function lw(i){return typeof i=="string"?ow(i):Math.ceil((i.byteLength||i.size)*aw)}function ow(i){let n=0,s=0;for(let a=0,o=i.length;a<o;a++)n=i.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function oy(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function cw(i){let n="";for(let s in i)i.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(i[s]));return n}function uw(i){let n={},s=i.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class fw extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class bh extends xt{constructor(n){super(),this.writable=!1,rc(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new fw(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=yh(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=cw(n);return s.length?"?"+s:""}}class hw extends bh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};W_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,Z_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=oy()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let cy=!1;try{cy=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const dw=cy;function mw(){}class pw extends hw{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Vn extends xt{constructor(n,s,a){super(),this.createRequest=n,rc(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=ly(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Vn.requestsCount++,Vn.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=mw,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Vn.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Vn.requestsCount=0;Vn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",K0);else if(typeof addEventListener=="function"){const i="onpagehide"in wn?"pagehide":"unload";addEventListener(i,K0,!1)}}function K0(){for(let i in Vn.requests)Vn.requests.hasOwnProperty(i)&&Vn.requests[i].abort()}const gw=(function(){const i=uy({xdomain:!1});return i&&i.responseType!==null})();class yw extends pw{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=gw&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Vn(uy,this.uri(),n)}}function uy(i){const n=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||dw))return new XMLHttpRequest}catch{}if(!n)try{return new wn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const fy=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class bw extends bh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=fy?{}:ly(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;gh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&ic(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=oy()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const Nf=wn.WebSocket||wn.MozWebSocket;class xw extends bw{createSocket(n,s,a){return fy?new Nf(n,s,a):s?new Nf(n,s):new Nf(n)}doWrite(n,s){this.ws.send(s)}}class vw extends bh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=tw(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=ew();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:m,value:g})=>{m||(this.onPacket(g),f())}).catch(m=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&ic(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const _w={websocket:xw,webtransport:vw,polling:yw},ww=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Sw=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Wf(i){if(i.length>8e3)throw"URI too long";const n=i,s=i.indexOf("["),a=i.indexOf("]");s!=-1&&a!=-1&&(i=i.substring(0,s)+i.substring(s,a).replace(/:/g,";")+i.substring(a,i.length));let o=ww.exec(i||""),f={},d=14;for(;d--;)f[Sw[d]]=o[d]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=Ew(f,f.path),f.queryKey=Aw(f,f.query),f}function Ew(i,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function Aw(i,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const eh=typeof addEventListener=="function"&&typeof removeEventListener=="function",Uo=[];eh&&addEventListener("offline",()=>{Uo.forEach(i=>i())},!1);class ni extends xt{constructor(n,s){if(super(),this.binaryType=sw,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Wf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Wf(s.host).host);rc(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=uw(this.opts.query)),eh&&(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"})},Uo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=ay,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&ni.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",ni.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=lw(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,ic(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(ni.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),eh&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Uo.indexOf(this._offlineEventListener);a!==-1&&Uo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}ni.protocol=ay;class jw extends ni{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;ni.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;ni.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const T=new Error("probe error");T.transport=s.name,this.emitReserved("upgradeError",T)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const d=w=>{const T=new Error("probe error: "+w);T.transport=s.name,f(),this.emitReserved("upgradeError",T)};function m(){d("transport closed")}function g(){d("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",m),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",d),s.once("close",m),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let Ow=class extends jw{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>_w[o]).filter(o=>!!o)),super(n,a)}};function Tw(i,n="",s){let a=i;s=s||typeof location<"u"&&location,i==null&&(i=s.protocol+"//"+s.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=s.protocol+i:i=s.host+i),/^(https?|wss?):\/\//.test(i)||(typeof s<"u"?i=s.protocol+"//"+i:i="https://"+i),a=Wf(i)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const kw=typeof ArrayBuffer=="function",Nw=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,hy=Object.prototype.toString,Cw=typeof Blob=="function"||typeof Blob<"u"&&hy.call(Blob)==="[object BlobConstructor]",Mw=typeof File=="function"||typeof File<"u"&&hy.call(File)==="[object FileConstructor]";function xh(i){return kw&&(i instanceof ArrayBuffer||Nw(i))||Cw&&i instanceof Blob||Mw&&i instanceof File}function Lo(i,n){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let s=0,a=i.length;s<a;s++)if(Lo(i[s]))return!0;return!1}if(xh(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Lo(i.toJSON(),!0);for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&Lo(i[s]))return!0;return!1}function Rw(i){const n=[],s=i.data,a=i;return a.data=th(s,n),a.attachments=n.length,{packet:a,buffers:n}}function th(i,n){if(!i)return i;if(xh(i)){const s={_placeholder:!0,num:n.length};return n.push(i),s}else if(Array.isArray(i)){const s=new Array(i.length);for(let a=0;a<i.length;a++)s[a]=th(i[a],n);return s}else if(typeof i=="object"&&!(i instanceof Date)){const s={};for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=th(i[a],n));return s}return i}function Dw(i,n){return i.data=nh(i.data,n),delete i.attachments,i}function nh(i,n){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<n.length)return n[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let s=0;s<i.length;s++)i[s]=nh(i[s],n);else if(typeof i=="object")for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(i[s]=nh(i[s],n));return i}const zw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Be;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(Be||(Be={}));class qw{constructor(n){this.replacer=n}encode(n){return(n.type===Be.EVENT||n.type===Be.ACK)&&Lo(n)?this.encodeAsBinary({type:n.type===Be.EVENT?Be.BINARY_EVENT:Be.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===Be.BINARY_EVENT||n.type===Be.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=Rw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class vh extends xt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===Be.BINARY_EVENT;a||s.type===Be.BINARY_ACK?(s.type=a?Be.EVENT:Be.ACK,this.reconstructor=new Bw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(xh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(Be[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===Be.BINARY_EVENT||a.type===Be.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const d=n.substring(f,s);if(d!=Number(d)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(d);if(!Uw(m)||m<0)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=m}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const d=n.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(vh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case Be.CONNECT:return Z0(s);case Be.DISCONNECT:return s===void 0;case Be.CONNECT_ERROR:return typeof s=="string"||Z0(s);case Be.EVENT:case Be.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&zw.indexOf(s[0])===-1);case Be.ACK:case Be.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Bw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=Dw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Uw=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function Z0(i){return Object.prototype.toString.call(i)==="[object Object]"}const Lw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:vh,Encoder:qw,get PacketType(){return Be}},Symbol.toStringTag,{value:"Module"}));function Rn(i,n,s){return i.on(n,s),function(){i.off(n,s)}}const Hw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class dy extends xt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[Rn(n,"open",this.onopen.bind(this)),Rn(n,"packet",this.onpacket.bind(this)),Rn(n,"error",this.onerror.bind(this)),Rn(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(Hw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Be.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),d.id=E}const m=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===n&&this.sendBuffer.splice(m,1);s.call(this,new Error("operation has timed out"))},o),d=(...m)=>{this.io.clearTimeoutFn(f),s.apply(this,m)};d.withError=!0,this.acks[n]=d}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(d,m)=>d?o(d):a(m);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case Be.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Be.EVENT:case Be.BINARY_EVENT:this.onevent(n);break;case Be.ACK:case Be.BINARY_ACK:this.onack(n);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:Be.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function qr(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}qr.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*i);i=(Math.floor(n*10)&1)==0?i-s:i+s}return Math.min(i,this.max)|0};qr.prototype.reset=function(){this.attempts=0};qr.prototype.setMin=function(i){this.ms=i};qr.prototype.setMax=function(i){this.max=i};qr.prototype.setJitter=function(i){this.jitter=i};class sh extends xt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,rc(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new qr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||Lw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new Ow(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Rn(s,"open",function(){a.onopen(),n&&n()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},d=Rn(s,"error",f);if(this._timeout!==!1){const m=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},m);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(Rn(n,"ping",this.onping.bind(this)),Rn(n,"data",this.ondata.bind(this)),Rn(n,"error",this.onerror.bind(this)),Rn(n,"close",this.onclose.bind(this)),Rn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){ic(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new dy(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const za={};function Ho(i,n){typeof i=="object"&&(n=i,i=void 0),n=n||{};const s=Tw(i,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,d=za[o]&&f in za[o].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||d;let g;return m?g=new sh(a,n):(za[o]||(za[o]=new sh(a,n)),g=za[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(Ho,{Manager:sh,Socket:dy,io:Ho,connect:Ho});const Pw=O.createContext({connected:!1,subscribe:()=>()=>{}});function $w({children:i}){const n=O.useRef(null),[s,a]=O.useState(!1),o=O.useRef(new Map),f=O.useCallback((m,g)=>{const y=o.current;return y.has(m)||y.set(m,new Set),y.get(m).add(g),()=>{const E=y.get(m);E&&(E.delete(g),E.size===0&&y.delete(m))}},[]),d=O.useCallback((m,g)=>{for(const[y,E]of o.current)if(ey(m,y))for(const w of E)try{w(g)}catch{}},[]);return O.useEffect(()=>{const m=zg(),g=Ho({path:`${Vt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...m?{auth:{token:m}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;d(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[d]),h.jsx(Pw.Provider,{value:{connected:s,subscribe:f},children:h.jsx(tl.Provider,{value:{connected:s,subscribe:f},children:i})})}function Yw({children:i}){const[n,s]=O.useState(null),[a,o]=O.useState({url:null,token:null});return O.useEffect(()=>{let f=!1;async function d(){var m;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Vt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(m=y==null?void 0:y.events)==null?void 0:m.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,T=null;const z=zg();if(z)try{const M=await fetch(`${Vt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${z}`}});if(M.ok){const q=await M.json();w=q.natsWsUrl??w,T=q.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:T})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return d(),()=>{f=!0}},[]),n==="nats"?h.jsx(I_,{url:a.url,token:a.token,children:i}):n==="socketio"?h.jsx($w,{children:i}):h.jsx(h.Fragment,{children:i})}const _h="lt_view_as",wh="lt_ai_override";function my(){try{const i=localStorage.getItem(wh);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function Gw(i){try{localStorage.setItem(wh,String(i))}catch{}}function Vw(){try{localStorage.removeItem(wh)}catch{}}function py(){try{const i=localStorage.getItem(_h);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function Fw(i){try{localStorage.setItem(_h,i)}catch{}window.location.reload()}function gy(){try{localStorage.removeItem(_h)}catch{}window.location.reload()}function yy(){const{isSuperAdmin:i,hasRoleType:n,hasRole:s}=ai(),a=py(),o=i||s("engineer"),f=n("admin"),d=i||n("admin");return{isBuilder:a?!1:o,isOps:a?a==="admin"||a==="engineer":f,canBulk:a?!1:d,viewAs:a,realIsBuilder:o}}const Iw="lt_ai_override";function Jw(){return Ye("/settings")}function Qw(){try{if(localStorage.getItem(Iw)==="off")return!1}catch{}return null}function Br(){var s;const i=Sn({queryKey:["settings"],queryFn:Jw,staleTime:1/0}),n=Qw();return i.data&&n===!1&&((s=i.data.ai)!=null&&s.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}const by=O.createContext(null),W0="lt_sidebar_collapsed";function Xw({children:i}){const[n,s]=O.useState(()=>{try{return localStorage.getItem(W0)==="true"}catch{return!1}}),a=O.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(W0,String(f))}catch{}return f})},[]);return h.jsx(by.Provider,{value:{collapsed:n,toggle:a},children:i})}function xy(){const i=O.useContext(by);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}function vy(i,n){var s,a,o,f,d;n.facets&&Object.keys(n.facets).length&&i.set("facets",JSON.stringify(n.facets)),(s=n.block)!=null&&s.length&&i.set("block",JSON.stringify(n.block)),(a=n.range)!=null&&a.length&&i.set("range",JSON.stringify(n.range)),(o=n.exists)!=null&&o.length&&i.set("exists",JSON.stringify(n.exists)),(f=n.roles)!=null&&f.length&&i.set("roles",JSON.stringify(n.roles)),(d=n.orderBy)!=null&&d.length&&i.set("orderBy",JSON.stringify(n.orderBy)),n.available!==void 0&&i.set("available",String(n.available))}function BA(i,n){const s=i??"24h";return Sn({queryKey:["stationMetrics",s],queryFn:()=>Ye(`/escalations/station-metrics?period=${s}`),staleTime:5e3,enabled:(n==null?void 0:n.enabled)??!0})}function UA(i){const n=i?`?period=${i}`:"";return Sn({queryKey:["escalationStats",i],queryFn:()=>Ye(`/escalations/stats${n}`)})}function LA(){return Sn({queryKey:["escalationTypes"],queryFn:()=>Ye("/escalations/types")})}function HA(i=!0){return Sn({queryKey:["escalationFacetKeys"],queryFn:()=>Ye("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function Kw(i){const{enabled:n=!0,staleTime:s,...a}=i,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),vy(o,a),Sn({queryKey:["escalations",a],queryFn:()=>Ye(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function Zw(i){const{enabled:n=!0,staleTime:s,...a}=i,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),vy(o,a),Sn({queryKey:["escalations","available",a],queryFn:()=>Ye(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function PA(i){return Sn({queryKey:["escalations","by-workflow",i],queryFn:()=>Ye(`/escalations/by-workflow/${i}`),enabled:!!i})}function $A(i){return Sn({queryKey:["escalations",i],queryFn:()=>Ye(`/escalations/${i}`),enabled:!!i})}function YA(){const i=on();return En({mutationFn:({id:n,durationMinutes:s})=>Ye(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function GA(){const i=on();return En({mutationFn:n=>Ye(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function VA(){const i=on();return En({mutationFn:({id:n,resolverPayload:s})=>Ye(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]}),i.resetQueries({queryKey:["tasks"]}),i.resetQueries({queryKey:["jobs"]})}})}function FA(){const i=on();return En({mutationFn:({id:n,targetRole:s})=>Ye(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function IA(){const i=on();return En({mutationFn:({ids:n,priority:s})=>Ye("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function JA(){const i=on();return En({mutationFn:({ids:n,durationMinutes:s})=>Ye("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function QA(){const i=on();return En({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Ye("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function XA(){const i=on();return En({mutationFn:({ids:n,targetRole:s})=>Ye("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function KA(){const i=on();return En({mutationFn:({ids:n,hint:s})=>Ye("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function ZA(){const i=on();return En({mutationFn:n=>Ye(`/escalations/${n}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function WA(){const i=on();return En({mutationFn:({ids:n})=>Ye("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:n})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Ww(){const{user:i}=ai(),n=i==null?void 0:i.userId,s=on(),a=O.useRef(null),o=O.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);G_(`${$_}.system.escalation.>`,o);const{data:f}=Zw({limit:1}),{data:d}=Kw({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(d==null?void 0:d.total)??0}}function Sh({size:i="sm",hideLabel:n=!1,className:s="",appName:a="LongTail"}){const o=i==="lg",f=o?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",d=o?"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":a,className:`logo-mark shrink-0 z-0 ${f}`,style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${d} ${n?"opacity-0":""}`,children:a})]})}const e2=[{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"}],t2=["operator","engineer","admin","superadmin"];function eg(i){return t2.indexOf(i)}function n2(i,n){return eg(i)>=eg(n)}function s2(i){return i==="superadmin"?"superadmin":i==="admin"?"admin":i==="engineer"?"engineer":"operator"}function i2({onClose:i}){var fe,ae,k,X,le;const{isSuperAdmin:n,hasRoleType:s,hasRole:a}=ai(),{data:o}=Br(),f=py(),d=!!((fe=o==null?void 0:o.ai)!=null&&fe.enabled),m=my(),g=m!==null?m:d,[y,E]=O.useState(g),w=n?"superadmin":s("admin")?"admin":a("engineer")?"engineer":"operator",T=((ae=o==null?void 0:o.branding)==null?void 0:ae.appName)??"LongTail",z=(k=o==null?void 0:o.environment)==null?void 0:k.longTailVersion,M=(X=o==null?void 0:o.environment)==null?void 0:X.hotmeshVersion,q=(le=o==null?void 0:o.environment)==null?void 0:le.nodeEnv;O.useEffect(()=>{const P=V=>{V.key==="Escape"&&i()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[i]);const Q=e2.filter(P=>n2(w,P.minTier)),ee=Q.length>1,ne=P=>{P===null?gy():Fw(P)};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:P=>P.stopPropagation(),children:[h.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Mi,{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:T}),z&&h.jsxs("p",{className:"mt-1 text-[11px] text-text-tertiary",children:["v",z,M&&h.jsxs(h.Fragment,{children:[" · HotMesh v",M]}),q&&q!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:q})]})]})]}),ee&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/50 mb-6"}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),Q.map(P=>{const V=f===P.id,I=P.id===null?`Your view · ${s2(w)}`:P.label;return h.jsxs("button",{onClick:()=>ne(P.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 ${V?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:V&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${V?"text-accent":"text-text-primary group-hover:text-accent"}`,children:I}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:P.description})]})]},String(P.id))})]}),h.jsx("div",{className:"mt-6 mb-2"})]}),h.jsx("hr",{className:"border-surface-border/50 mt-4"}),h.jsxs("div",{className:"mt-6 mb-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:()=>{const P=!y;E(P),P===d?Vw():Gw(P),window.location.reload()},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:y?"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 ${y?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${y?"translate-x-4":"translate-x-0"}`})})]})]}),h.jsx("hr",{className:"border-surface-border/50 mt-4"}),h.jsx("p",{className:"mt-4 text-[10px] text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const _y=["violet","red","green","blue","rose","orange"],tg="blue",r2={violet:"#7B3BE0",red:"#DC382D",green:"#059669",blue:"#2563EB",rose:"#D6246E",orange:"#E85D04"},ng={violet:"Violet",red:"Brick",green:"Emerald",blue:"Electric",rose:"Raspberry",orange:"Harvest"},wy="lt.theme";function a2(i){return _y.includes(i)}function Sy(){try{const i=localStorage.getItem(wy);return a2(i)?i:tg}catch{return tg}}function Ey(i){document.documentElement.dataset.theme=i}function l2(i){try{localStorage.setItem(wy,i)}catch{}Ey(i)}function o2(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function c2(i){var n;return((n=i.title)==null?void 0:n.trim())||o2(i.role)}const Ay=800,jy=270,Er=40,u2=76,Eh=24,f2=72,Po=Ay-Er-u2,Oy=jy-Eh-f2,Cn=Eh+Oy,sg=Er+Po,Gt="0.5s cubic-bezier(0.4, 0, 0.2, 1)",ig=9;function h2(i){return`M ${(i.x-ig).toFixed(1)} ${i.y.toFixed(1)} L ${(i.x+ig).toFixed(1)} ${i.y.toFixed(1)}`}function Ar(i){if(i.length===0)return"";if(i.length===1)return h2(i[0]);const n=[];for(let s=0;s<i.length-1;s++){const a=i[Math.max(0,s-1)],o=i[s],f=i[s+1],d=i[Math.min(i.length-1,s+2)],m=(o.x+(f.x-a.x)/6).toFixed(1),g=(o.y+(f.y-a.y)/6).toFixed(1),y=(f.x-(d.x-o.x)/6).toFixed(1),E=(f.y-(d.y-o.y)/6).toFixed(1);s===0&&n.push(`M ${o.x.toFixed(1)} ${o.y.toFixed(1)}`),n.push(`C ${m} ${g}, ${y} ${E}, ${f.x.toFixed(1)} ${f.y.toFixed(1)}`)}return n.join(" ")}function d2(i,n){if(i.length<2||n.length<2)return"";const s=Ar(i),a=[...n].reverse(),o=Ar(a),f=o.slice(o.indexOf("C"));return`${s} L ${a[0].x.toFixed(1)} ${a[0].y.toFixed(1)} ${f} Z`}function m2(i){return i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${(i/1e3).toFixed(1)}k`:String(i)}function Co(i){return i.length>0?i[i.length-1]:void 0}const wr="#f97316",$a="#0ea5e9",vr="#16a34a",Mo="#94a3b8",p2="#b0e0e6",g2="#5b93ad",y2=13;function b2(i,n){const s=[...i].sort((d,m)=>d.y-m.y);let a=-1/0;const o=s.map(d=>{const m=Math.max(d.y+3,a+y2);return a=m,{...d,labelY:m}}),f=o.length>0?o[o.length-1].labelY-n:0;if(f>0)for(const d of o)d.labelY-=f;return o}function e3({stations:i,selectedRole:n,onSelect:s,onUpstreamSelect:a,onPrioritySelect:o,onCmdClick:f,periodHours:d}){const[m,g]=O.useState(null),y=i.length;if(y===0)return null;const E=G=>y===1?Er+Po/2:Er+G/(y-1)*Po,w=new Map(i.map((G,ge)=>[G.role,E(ge)])),T=i.map((G,ge)=>{var tt,St,at,lt;const xe=G.target_per_hour??null,Pe=xe!=null?xe*d:null;return{idx:ge,x:E(ge),expected:Pe,actual:((tt=G.metric)==null?void 0:tt.resolved)??0,active:((St=G.metric)==null?void 0:St.claimed)??0,pending:((at=G.metric)==null?void 0:at.pending)??0,priorityCount:((lt=G.metric)==null?void 0:lt.priority_count)??0}}),z=T.some(G=>G.expected!=null),q=Math.max(1,...T.map(G=>G.expected??0),...T.map(G=>G.actual),...T.map(G=>G.expected!=null?G.pending:0))*1.15,Q=G=>Eh+Oy*(1-Math.max(0,Math.min(G,q))/q),ee=T.filter(G=>G.expected!=null),ne=ee.map(G=>({...G,y:Q(G.expected)})),fe=ee.map(G=>({...G,y:Q(G.actual)})),ae=ee.map(G=>({...G,y:Q(G.active)})),k=ee.map(G=>({...G,y:Q(G.pending)})),X=Ar(ne),le=Ar(fe),P=Ar(ae),V=Ar(k),I=Co(fe),Z=Co(ne),ie=Co(ae),Ae=Co(k),Re=fe.length>=2&&I?`${le} L ${I.x.toFixed(1)} ${Cn} L ${fe[0].x.toFixed(1)} ${Cn} Z`:"",Oe=ee.some(G=>G.pending>0||G.active>0),$=Oe&&ae.length>=2&&ie?`${P} L ${ie.x.toFixed(1)} ${Cn} L ${ae[0].x.toFixed(1)} ${Cn} Z`:"",re=Oe?d2(k,ae):"",he=ee.some(G=>G.active>0),je=ee.some(G=>G.pending>G.active),ve=b2([Z?{key:"target",text:"Target",color:Mo,y:Z.y}:null,I?{key:"actual",text:"Resolved",color:vr,y:I.y}:null,he&&ie?{key:"active",text:"Claimed",color:wr,y:ie.y}:null,je&&Ae?{key:"queued",text:"Pending",color:$a,y:Ae.y}:null].filter(Boolean),Cn+4);return h.jsxs("svg",{viewBox:`0 0 ${Ay} ${jy}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",style:{display:"block"},children:[i.map(G=>{if(!G.parent_role)return null;const ge=w.get(G.parent_role);if(ge==null)return null;const xe=E(i.findIndex(Pe=>Pe.role===G.role));return h.jsx("line",{x1:ge,y1:Cn,x2:xe,y2:Cn,stroke:"#e2e8f0",strokeWidth:.75},`dep-${G.role}`)}),Re&&h.jsx("path",{d:Re,fill:vr,opacity:.05,style:{transition:`d ${Gt}`}}),$&&h.jsx("path",{d:$,fill:wr,opacity:.12,style:{transition:`d ${Gt}`}}),re&&h.jsx("path",{d:re,fill:$a,opacity:.12,style:{transition:`d ${Gt}`}}),X&&h.jsx("path",{d:X,fill:"none",stroke:Mo,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.7,style:{transition:`d ${Gt}`}}),ne.map(G=>h.jsxs("g",{transform:`translate(${G.x} ${G.y})`,style:{transition:`transform ${Gt}`},children:[h.jsx("circle",{r:2,fill:Mo,opacity:.8}),h.jsx("text",{y:-5,textAnchor:"middle",fontSize:6.5,fill:Mo,fontFamily:"ui-monospace, monospace",fontWeight:"500",opacity:.7,children:Math.round(G.expected)})]},`tval-${G.idx}`)),Oe&&V&&h.jsx("path",{d:V,fill:"none",stroke:$a,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.55,style:{transition:`d ${Gt}`}}),P&&h.jsx("path",{d:P,fill:"none",stroke:wr,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.5,style:{transition:`d ${Gt}`}}),le&&h.jsx("path",{d:le,fill:"none",stroke:vr,strokeWidth:.6,strokeLinejoin:"round",strokeLinecap:"round",opacity:.65,style:{transition:`d ${Gt}`}}),ae.map((G,ge)=>{if(G.pending<=0&&G.active<=0)return null;const xe=Math.max(2.5,Math.min(5,2.5+G.active/10)),Pe=G.pending>G.active,tt=Math.min(k[ge].y-4,G.y-xe-4);return h.jsxs("g",{children:[G.pending>0&&h.jsx("text",{x:G.x,y:tt,textAnchor:"middle",fontSize:7.5,fill:Pe?$a:"#64748b",fontFamily:"ui-monospace, monospace",fontWeight:"600",style:{transition:`y ${Gt}`},children:G.pending}),h.jsxs("g",{transform:`translate(${G.x} ${G.y})`,style:{transition:`transform ${Gt}`},children:[h.jsx("circle",{r:xe,fill:wr,opacity:.85}),G.active>0&&h.jsx("text",{y:xe+9,textAnchor:"middle",fontSize:7.5,fill:wr,fontFamily:"ui-monospace, monospace",fontWeight:"600",children:G.active})]})]},`active-${G.idx}`)}),T.map(G=>{var In;const ge=i[G.idx],xe=G.x,Pe=G.expected!=null?Q(G.actual):Cn,tt=Math.max(2.25,Math.min(4,2.25+G.actual/160)),St=ge.role===n,at=m===G.idx,lt=G.expected==null?"idle · set a target rate to plot pace":`${G.actual} resolved · target ${Math.round(G.expected)}`+(G.pending>G.active?` · ${G.pending-G.active} pending`:"")+(G.active>0?` · ${G.active} claimed`:"")+(G.priorityCount>0?` · ${G.priorityCount} priority`:""),Se=lt.length*5.5+20,vt=Math.max(Er+Se/2+4,Math.min(sg-Se/2-4,xe)),qn=Pe-tt-10;return h.jsxs("g",{onClick:Rt=>{Rt.metaKey||Rt.ctrlKey?(Rt.stopPropagation(),f==null||f(ge.role)):s(ge.role)},onMouseEnter:()=>g(G.idx),onMouseLeave:()=>g(null),style:{cursor:"pointer"},children:[h.jsxs("g",{transform:`translate(${xe} ${Pe})`,style:{transition:`transform ${Gt}`},children:[h.jsx("circle",{r:22,fill:"transparent"}),h.jsx("circle",{r:tt,fill:vr,opacity:.9,style:{transition:`r ${Gt}`}}),G.expected!=null&&h.jsx("text",{y:-tt-5,textAnchor:"middle",fontSize:9.5,fill:vr,fontFamily:"ui-monospace, monospace",fontWeight:"500",children:m2(G.actual)}),at&&!St&&h.jsx("circle",{r:tt+3,fill:"none",stroke:vr,strokeWidth:1,opacity:.4}),St&&h.jsx("circle",{r:tt+4,fill:"none",stroke:"#6366f1",strokeWidth:2})]}),G.priorityCount>0&&h.jsxs("g",{transform:`translate(${xe+15} ${Math.max(Pe-15,12)})`,onClick:Rt=>{Rt.stopPropagation(),o==null||o(ge.role)},style:{cursor:"pointer",transition:`transform ${Gt}`},children:[h.jsx("title",{children:`${G.priorityCount} past the priority threshold — click to pull oldest first`}),h.jsx("circle",{r:6.5+(String(G.priorityCount).length-1)*2,fill:p2,opacity:.9}),h.jsx("text",{y:2.5,textAnchor:"middle",fontSize:7,fill:g2,fontFamily:"ui-monospace, monospace",fontWeight:"700",children:G.priorityCount})]}),(((In=ge.upstream_roles)==null?void 0:In.length)??0)>0&&h.jsxs("g",{transform:`translate(${xe-20} ${Cn})`,onClick:Rt=>{Rt.stopPropagation(),a==null||a(ge.upstream_roles[0])},style:{cursor:"pointer"},children:[h.jsx("title",{children:`Fed by ${ge.upstream_roles.join(", ")} — click to view that sequence`}),h.jsx("circle",{r:9,cy:-6,fill:"transparent"}),h.jsx("path",{d:"M -7 -14 C -3 -14 -1 -9 0 -2",fill:"none",stroke:"#94a3b8",strokeWidth:1,strokeDasharray:"2 2",strokeLinecap:"round"}),h.jsx("path",{d:"M 0 -2 L 8 -2",stroke:"#94a3b8",strokeWidth:1,strokeLinecap:"round"}),h.jsx("path",{d:"M 8 -2 l -3.5 -2 v 4 z",fill:"#94a3b8"})]}),h.jsx("text",{x:xe,y:Cn+(G.idx%2===0?14:27),textAnchor:"middle",fontSize:9.5,fill:"#475569",fontFamily:"ui-sans-serif, sans-serif",fontWeight:"500",children:c2(ge)}),at&&h.jsxs("g",{children:[h.jsx("rect",{x:vt-Se/2,y:qn-16,width:Se,height:19,rx:3,fill:"#0f172a",opacity:.88}),h.jsx("text",{x:vt,y:qn-3,textAnchor:"middle",fontSize:8.5,fill:"white",fontFamily:"ui-monospace, monospace",children:lt})]})]},ge.role)}),!z&&h.jsx("text",{x:Er+Po/2,y:Cn+48,textAnchor:"middle",fontSize:8.5,fill:"#94a3b8",fontFamily:"ui-sans-serif, sans-serif",children:"Set target_per_hour on each role in Admin → Roles to enable the pace chart"}),ve.map(G=>h.jsx("text",{x:sg+6,y:G.labelY,fontSize:8,fill:G.color,fontFamily:"ui-sans-serif, sans-serif",fontWeight:G.key==="actual"?700:500,opacity:G.key==="active"?.85:1,style:{transition:`y ${Gt}`},children:G.text},G.key))]})}const Ty="lt:bookmarks";function x2(){try{const i=localStorage.getItem(Ty);if(!i)return[];const n=JSON.parse(i);return Array.isArray(n)?n:[]}catch{return[]}}function rg(i){try{localStorage.setItem(Ty,JSON.stringify(i))}catch{}}function v2({onToggleEventFeed:i,onToggleDocs:n}){var I;const{user:s,logout:a}=ai(),{isBuilder:o,isOps:f,viewAs:d,realIsBuilder:m}=yy(),{available:g,mine:y}=Ww(),{connected:E}=Y_(),{data:w}=Br(),T=xs(),[z,M]=O.useState(!1),[q,Q]=O.useState(!1),[ee,ne]=O.useState(Sy),[fe,ae]=O.useState(x2),k=O.useRef(null),X=(I=w==null?void 0:w.branding)==null?void 0:I.appName,le=Z=>{l2(Z),ne(Z)},P=()=>{const Z=window.prompt("Bookmark label:");if(!(Z!=null&&Z.trim()))return;const ie=T.pathname+T.search,Ae=[...fe,{label:Z.trim(),url:ie}].sort((Re,Oe)=>Re.label.localeCompare(Oe.label));ae(Ae),rg(Ae),M(!1)},V=Z=>{const ie=fe.filter(Ae=>!(Ae.label===Z.label&&Ae.url===Z.url));ae(ie),rg(ie)};return O.useEffect(()=>{if(!z)return;const Z=ie=>{k.current&&!k.current.contains(ie.target)&&M(!1)};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[z]),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 z-30",children:[h.jsx(Ni,{to:"/","aria-label":"Home",onClick:Z=>{(Z.ctrlKey||Z.metaKey)&&(Z.preventDefault(),Q(!0))},children:h.jsx(Sh,{appName:X})}),h.jsxs("div",{className:"flex items-center gap-5",children:[h.jsxs(Ni,{to:"/escalations/available",className:"flex items-center gap-1.5 text-[11px] transition-colors text-text-quaternary hover:text-text-secondary",style:g>0?{color:$a}:void 0,title:"All escalations",children:[h.jsx(Df,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"all",g>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),h.jsxs(Ni,{to:"/escalations/queue",className:"flex items-center gap-1.5 text-[11px] transition-colors text-text-quaternary hover:text-text-secondary",style:y>0?{color:wr}:void 0,title:"My escalation queue",children:[h.jsx(Df,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",y>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:y})]}),(o||f)&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-px h-4 bg-surface-border"}),h.jsxs("button",{type:"button",onClick:()=>{E?i==null||i():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${E?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:E?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[h.jsx(Ng,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]})]}),m&&h.jsx(h.Fragment,{children:h.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[h.jsx(Cg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})}),d&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-[10px] text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[d," View"]}),h.jsx("button",{onClick:gy,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Mi,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&h.jsxs("div",{className:"relative",ref:k,children:[h.jsxs("button",{onClick:()=>M(Z=>!Z),className:"btn-ghost text-xs flex items-center gap-1",children:[h.jsx(rv,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,h.jsx("svg",{className:"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"})})]}),z&&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-50",children:[h.jsx(Ni,{to:"/credentials",onClick:()=>M(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2",children:_y.map(Z=>h.jsx("button",{type:"button",onClick:()=>le(Z),title:ng[Z],"aria-label":`${ng[Z]} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${ee===Z?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:r2[Z]}},Z))})]}),h.jsx("button",{onClick:()=>{M(!1),a()},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:[fe.map(Z=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(Ni,{to:Z.url,onClick:()=>M(!1),title:Z.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:Z.label}),h.jsx("button",{type:"button",onClick:()=>V(Z),title:`Remove "${Z.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(Mi,{className:"w-3 h-3"})})]},`${Z.label}::${Z.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:P,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(av,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),q&&h.jsx(i2,{onClose:()=>Q(!1)})]})}function Ah({open:i,children:n}){const[s,a]=O.useState(i);return O.useEffect(()=>{i&&a(!0)},[i]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||a(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function ih(i){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function _2(){return({isActive:i})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${i?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function w2({group:i,collapsed:n}){const{pathname:s}=xs(),a=i.matchPaths.some(m=>s.startsWith(m)),[o,f]=O.useState(a),d=o||a;return n?h.jsx(h.Fragment,{children:i.items.map(m=>h.jsx($o,{to:m.to,className:ih(!0),title:m.label,children:m.icon&&h.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>f(m=>!m),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:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:i.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"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(Ah,{open:d,children:i.items.map(m=>h.jsxs($o,{to:m.to,end:m.end,className:_2(),children:[m.icon&&h.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:m.label})]},m.to))})]})}function S2(i){return i.kind==="group"}function E2({entry:i,collapsed:n}){const{pathname:s,search:a}=xs();if(i.to.includes("?")){const[f,d]=i.to.split("?"),m=s===f&&a===`?${d}`,g=ih(n)({isActive:m});return h.jsxs($o,{to:i.to,className:g,title:n?i.label:void 0,children:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&h.jsx("span",{children:i.label})]})}return h.jsxs($o,{to:i.to,end:i.end,className:ih(n),title:n?i.label:void 0,children:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&h.jsx("span",{children:i.label})]})}function si({heading:i,entries:n}){const{collapsed:s}=xy();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:i}),n.map(a=>S2(a)?h.jsx(w2,{group:a,collapsed:s},a.label):h.jsx(E2,{entry:a,collapsed:s},a.to))]})}const A2=[{to:"/escalations/queue",label:"My Queue",icon:Df},{to:"/escalations/available",label:"All",icon:zf}];function j2({aiEnabled:i=!1,isBuilder:n=!1,isOps:s=!1,viewAs:a=null}){if(!n&&(!s||a==="engineer"||a==="operator"))return h.jsx(si,{heading:"Work",entries:A2});if(!n)return h.jsx(si,{heading:"Monitor",entries:[{to:"/operations",label:"Pace Board",icon:m0}]});const o=[...s||n?[{to:"/operations",label:"Pace Board",icon:m0}]:[],{to:"/topics",label:"Event Topics",icon:Ng},{to:"/agents",label:i?"Agents":"Automations",icon:lv},{to:"/capabilities",label:"Capabilities",icon:ov}];return h.jsx(si,{heading:"Monitor",entries:o})}function O2(){const i=[{kind:"group",label:"Procedural",icon:cv,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Registry",icon:p0},{to:"/workflows/durable/invoke",label:"Invoke",icon:g0},{to:"/workflows/executions",label:"Executions",icon:zf}]},{kind:"group",label:"Graph",icon:rh,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:p0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:g0},{to:"/mcp/executions",label:"Executions",icon:zf}]}];return h.jsx(si,{heading:"Orchestrate",entries:i})}const T2=[{to:"/mcp/queries",label:"Designer",icon:uv},{to:"/mcp/servers",label:"Servers & Tools",icon:fv}];function k2(){return h.jsx(si,{heading:"Design",entries:T2})}const N2=[{to:"/files",label:"Files",icon:hv},{to:"/knowledge",label:"Knowledge",icon:dv}];function C2(){return h.jsx(si,{heading:"Storage",entries:N2})}function M2({isBuilder:i=!1,isOps:n=!1}){var d;const{data:s}=Br(),a=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:mv},...i||n?[{to:"/admin/roles",label:"Roles",icon:pv}]:[]],f=[{to:"/admin/controlplane",label:"Routers",icon:gv},{to:"/admin/streams",label:"Messages",icon:yv},...a?[{to:"/admin/maintenance",label:"DB Maintenance",icon:bv}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(si,{heading:"Identity & Access",entries:o}),i&&h.jsx(si,{heading:"Infrastructure",entries:f})]})}const ky="lt_event_feed_patterns";function R2(i){if(i.startsWith("/topics/")){const f=decodeURIComponent(i.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=i.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(i.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=i.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const o=i.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function D2(){try{const i=localStorage.getItem(ky);return i?JSON.parse(i):[]}catch{return[]}}function Cf(i){try{localStorage.setItem(ky,JSON.stringify(i))}catch{}}function z2(){const{pathname:i}=xs(),[n,s]=O.useState(D2),a=O.useMemo(()=>R2(i),[i]),o=O.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=O.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return Cf(w),w})},[]),d=O.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return Cf(E),E})},[]),m=O.useCallback(()=>{s([]),Cf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:d,clearUserPatterns:m}}function q2({children:i,className:n=""}){return h.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:i})}const Mf=280,ag="cubic-bezier(0.4, 0, 0.2, 1)",Ro=40;function B2(i){if(!i)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-Ro*2,o=s-Ro*2,f=i.width/a,d=i.height/o,m=i.left+i.width/2-(Ro+a/2),g=i.top+i.height/2-(Ro+o/2);return`translate(${m}px, ${g}px) scale(${f}, ${d})`}function Ny({open:i,onClose:n,sourceRef:s,children:a}){const[o,f]=O.useState(null),d=O.useRef(null),m=O.useRef(!1);O.useEffect(()=>{var T,z;i&&!m.current?(d.current=((T=s==null?void 0:s.current)==null?void 0:T.getBoundingClientRect())??null,f("entering")):!i&&m.current&&o==="open"&&(d.current=((z=s==null?void 0:s.current)==null?void 0:z.getBoundingClientRect())??null,f("exiting")),m.current=i},[i,s,o]),O.useEffect(()=>{if(o!=="entering")return;const T=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(T)},[o]),O.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),O.useEffect(()=>{if(!o)return;const T=z=>{z.key==="Escape"&&n()};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[o,n]);const g=O.useCallback(T=>{T.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(O.useEffect(()=>{if(o!=="exiting")return;const T=setTimeout(()=>f(null),Mf+50);return()=>clearTimeout(T)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?B2(d.current):"none",w=y?0:1;return Tg.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Mf}ms ${ag}, opacity ${Mf}ms ${ag}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function U2({className:i}){return h.jsx("svg",{className:i,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 L2({className:i}){return h.jsx("svg",{className:i,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 H2({className:i}){return h.jsx("svg",{className:i,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 P2({className:i}){return h.jsx("svg",{className:i,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 $2({className:i}){return h.jsx("svg",{className:i,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 Y2({className:i}){return h.jsx("svg",{className:i,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 G2(i){const n=i.trim().split(`
|
|
54
|
+
`);if(n.length<2)return i;const s=m=>m.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),o=n.slice(2),f=a.map(m=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${m}</th>`).join(""),d=o.map(m=>`<tr class="border-t border-surface-border">${s(m).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${d}</tbody></table>`}function Do(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function V2(i){const n=[];let s=i.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,w)=>G2(`${y}
|
|
55
|
+
${E}
|
|
56
|
+
${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${Do(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${Do(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${Do(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${Do(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",m=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let w=y,T;for(;(T=m.exec(w))!==null;){const z=T.index+T[0].length;E.push(w.slice(0,z)),w=w.slice(z).replace(/^<br\/>/,"").trim(),m.lastIndex=0}return w&&E.push(w),E.map(z=>{const M=z.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${d}">${M}</p>`:""}).join("")}).join(""),s}const F2=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function I2(i){return F2.test(i)}function jh({content:i,className:n,onClick:s}){const a=O.useMemo(()=>V2(i),[i]);return h.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Ko({data:i,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,d]=O.useState(o),[m,g]=O.useState(s);if(s!==void 0&&s!==m&&(g(s),d(s%2===0&&n>0)),i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',i,'"']});if(typeof i=="number"||typeof i=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",i.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:i.map((y,E)=>h.jsxs("div",{children:[h.jsx(Ko,{data:y,depth:n+1,generation:s}),E<i.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof i=="object"){const y=Object.entries(i);return y.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],T)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:E}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(Ko,{data:w,depth:n+1,generation:s}),T<y.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(i)})}function Ia({data:i,depth:n=0}){if(i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&I2(i)?h.jsx(jh,{content:i}):h.jsx("span",{className:"text-text-primary",children:i});if(typeof i=="number"||typeof i=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:i.map((s,a)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(Ia,{data:s,depth:n+1})})]},a))});if(typeof i=="object"){const s=Object.entries(i);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Ia,{data:o,depth:n+1})}):h.jsx(Ia,{data:o,depth:n+1})]},a)})})}return h.jsx("span",{children:String(i)})}function lg({mode:i,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:d,onClose:m,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[i==="json"&&h.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?h.jsx(Y2,{className:y}):h.jsx($2,{className:y})}),h.jsx("button",{onClick:()=>n(i==="json"?"tree":"json"),className:E,title:i==="json"?"Outline view":"JSON view",children:i==="json"?h.jsx(U2,{className:y}):h.jsx(L2,{className:y})}),h.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?h.jsx(P2,{className:`${y} text-status-success`}):h.jsx(H2,{className:y})}),d&&h.jsx("button",{onClick:d,className:E,title:"Fullscreen",children:h.jsx(Mg,{className:y})}),m&&h.jsx("button",{onClick:m,className:E,title:"Close (Esc)",children:h.jsx(Rg,{className:y})})]})}function J2({data:i,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=O.useRef(null),[d,m]=O.useState(o??"json"),[g,y]=O.useState(!1),[E,w]=O.useState(!1),[T,z]=O.useState(a?0:1),[M,q]=O.useState(1),Q=T%2===0,ee=M%2===0,ne=O.useCallback(()=>z(I=>I+1),[]),fe=O.useCallback(()=>q(I=>I+1),[]);let ae=i;if(typeof i=="string")try{ae=JSON.parse(i)}catch{}const k=async()=>{const I=typeof i=="string"?i:JSON.stringify(ae,null,2);await navigator.clipboard.writeText(I),y(!0),setTimeout(()=>y(!1),2e3)},X=O.useCallback(()=>{q(1),w(!0)},[]),le=s==="panel",P=le?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",V=le?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:P,children:[n&&h.jsx(q2,{children:n}),h.jsxs("div",{ref:f,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(lg,{mode:d,setMode:m,isCollapsed:Q,onToggleCollapse:ne,onCopy:k,copied:g,onFullscreen:X})}),h.jsx("div",{className:V,children:d==="json"?h.jsx(Ko,{data:ae,generation:T}):h.jsx(Ia,{data:ae})})]}),h.jsxs(Ny,{open:E,onClose:()=>w(!1),sourceRef:f,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(lg,{mode:d,setMode:m,isCollapsed:ee,onToggleCollapse:fe,onCopy:k,copied:g,onClose:()=>w(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(Ko,{data:ae,generation:M}):h.jsx(Ia,{data:ae})})]})]})}const Q2=100,og=500;let X2=0;const Cy={"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 My(i){const n=i.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:i}function cg({event:i,forceExpanded:n=!1}){var T,z;const[s,a]=O.useState(n),o=Cy[My(i.type)]||"text-text-tertiary";O.useEffect(()=>{a(n)},[n]);const f=n,d=f?"text-xs":"text-[9px]",m=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${d} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(i.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${m} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:i.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(T=i.data)!=null&&T.workflowId?String(i.data.workflowId):"",(z=i.data)!=null&&z.escalationId?` esc:${String(i.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Ah,{open:s,children:h.jsx("div",{className:w,children:h.jsx(J2,{data:i.data})})})]})}function K2({open:i,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=O.useState([]),[d,m]=O.useState(!1),[g,y]=O.useState(""),E=O.useRef(null),w=O.useRef(new Map),{subscribe:T}=O.useContext(tl),{patterns:z,pagePattern:M,userPatterns:q,addPattern:Q,removePattern:ee}=z2(),ne=O.useCallback(ae=>{const k=String(ae.type||"unknown");if(k.startsWith("mesh."))return;const X=`${k}:${ae.timestamp||""}:${ae.escalationId||ae.workflowId||ae.taskId||""}`,le=Date.now(),P=w.current.get(X);if(!(P&&le-P<og)){if(w.current.set(X,le),w.current.size>200)for(const[V,I]of w.current)le-I>og*2&&w.current.delete(V);f(V=>[{id:++X2,type:k,timestamp:ae.timestamp||new Date().toISOString(),data:ae},...V].slice(0,Q2))}},[]),fe=O.useRef(ne);return fe.current=ne,O.useEffect(()=>{const ae=z.map(k=>T(k,X=>fe.current(X)));return()=>ae.forEach(k=>k())},[T,z.join(",")]),O.useEffect(()=>{i&&E.current&&(E.current.scrollTop=0)},[o.length,i]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[i?h.jsx(xv,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(vv,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!i&&h.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Cy[My(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 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:ae=>{ae.stopPropagation(),a()},children:h.jsx(_v,{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:ae=>{ae.stopPropagation(),m(!0)},children:h.jsx(Mg,{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:ae=>{ae.stopPropagation(),f([])},children:h.jsx(wv,{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-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),q.map(ae=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[ae.replace("lt.events.",""),h.jsx("button",{onClick:()=>ee(ae),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Mi,{className:"w-2 h-2"})})]},ae))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:ae=>y(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&g.trim()&&(Q(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(Q(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(Sv,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Ah,{open:i,children:h.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(ae=>h.jsx(cg,{event:ae},ae.id))})}),h.jsxs(Ny,{open:d,onClose:()=>m(!1),sourceRef:E,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>m(!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(Rg,{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(ae=>h.jsx(cg,{event:ae,forceExpanded:!0},ae.id))]})]})}function Z2(){return Sn({queryKey:["docs"],queryFn:()=>Ye("/docs"),staleTime:5*6e4})}function W2(i){return Sn({queryKey:["docs",i],queryFn:()=>Ye(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function eS(){const[i,n]=O.useState([]),[s,a]=O.useState([]),[o,f]=O.useState(null),d=O.useRef(o),m=O.useRef(i),g=O.useRef(s);d.current=o,m.current=i,g.current=s;const y=O.useCallback((M,q)=>{var ee;const Q=d.current;if(Q){const ne=((ee=q==null?void 0:q.current)==null?void 0:ee.scrollTop)??0;n([...m.current,{...Q,scrollTop:ne}])}a([]),f({path:M,scrollTop:0})},[]),E=O.useCallback(M=>{var ne;const q=m.current;if(q.length===0)return;const Q=q[q.length-1],ee=d.current;if(ee){const fe=((ne=M==null?void 0:M.current)==null?void 0:ne.scrollTop)??0;a([...g.current,{...ee,scrollTop:fe}])}n(q.slice(0,-1)),f(Q),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=Q.scrollTop)})},[]),w=O.useCallback(M=>{var ne;const q=g.current;if(q.length===0)return;const Q=q[q.length-1],ee=d.current;if(ee){const fe=((ne=M==null?void 0:M.current)==null?void 0:ne.scrollTop)??0;n([...m.current,{...ee,scrollTop:fe}])}a(q.slice(0,-1)),f(Q),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=Q.scrollTop)})},[]),T=O.useCallback(M=>{var ee,ne;const q=d.current;if(!q)return;const Q=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...m.current,{...q,scrollTop:Q}]),a([]),f({...q,scrollTop:((ne=M==null?void 0:M.current)==null?void 0:ne.scrollTop)??0})},[]),z=O.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:i,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:T,reset:z}}function tS(i,n){const[s,a]=i.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),m=[];for(const g of d)g===".."?m.pop():g&&g!=="."&&m.push(g);o=m.join("/")}return{path:o,anchor:a}}function nS(i){if(!i.startsWith("#docs"))return null;const n=i.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function sS(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function iS({content:i,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const d=f.target,m=d.closest("[data-anchor]");if(m){f.preventDefault(),a();const E=m.dataset.anchor,w=(y=m.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=d.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=tS(g.dataset.docLink,n);s(E,w);return}};return h.jsx(jh,{content:i,className:"docs-content",onClick:o})}function rS(i){const n=[],s=new Map;for(const a of i){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let d=0;d<o.length-1;d++){const m=o[d];f.has(m)||f.set(m,{label:m,children:[],subdirs:new Map});const g=f.get(m);d===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function aS({docs:i,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=rS(i),f=m=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===m?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(m,g){return h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(Ev,{className:"w-3 h-3",strokeWidth:1.5}),m.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...m.subdirs.values()].map(y=>d(y)),m.children.map(y=>h.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},m.label)}return h.jsxs("div",{className:"space-y-0.5",children:[a.map(m=>h.jsx("button",{className:f(m.path),onClick:()=>s(m.path),children:m.title},m.path)),[...o.values()].map(m=>d(m))]})}function lS({open:i,onClose:n}){var le,P,V;const[s,a]=O.useState(!1),{data:o}=Z2(),f=eS(),{data:d,isLoading:m}=W2(((le=f.current)==null?void 0:le.path)??null),g=O.useRef(null),[y,E]=O.useState(null);O.useEffect(()=>{y&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var Z;const I=(Z=g.current)==null?void 0:Z.querySelector(`#${CSS.escape(y)}`);I==null||I.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,d]);const w=O.useCallback(()=>{var ie;const I=nS(window.location.hash),Z=(I==null?void 0:I.path)??"README.md";((ie=f.current)==null?void 0:ie.path)!==Z&&f.navigate(Z,g),I!=null&&I.anchor&&E(I.anchor)},[f]),T=O.useRef(!0);O.useEffect(()=>{if(!i||!f.current)return;if(T.current){T.current=!1;return}const I=sS(f.current.path);window.location.hash!==I&&window.history.replaceState(null,"",window.location.pathname+window.location.search+I)},[i,(P=f.current)==null?void 0:P.path]),O.useEffect(()=>{if(!i)return;const I=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",I),()=>window.removeEventListener("hashchange",I)},[i,w]);const z=O.useCallback((I,Z)=>{Z&&E(Z),f.navigate(I,g)},[f]),M=O.useCallback(I=>{f.navigate(I,g)},[f]),q=O.useCallback(()=>{f.goBack(g)},[f]),Q=O.useCallback(()=>{f.goForward(g)},[f]),ee=O.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(O.useEffect(()=>{if(i){T.current=!0,w();const I=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(I)}},[i]),!(i||s))return null;const fe=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},ae=((V=f.current)==null?void 0:V.path)??null,k=f.backStack.length>0,X=f.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&&i?"opacity-100":"opacity-0"}`,onClick:fe}),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&&i?"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:q,disabled:!k,className:`p-0.5 transition-colors ${k?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(Av,{className:"w-4 h-4"})}),h.jsx("button",{onClick:Q,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(y0,{className:"w-4 h-4"})}),h.jsx(Cg,{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:fe,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Mi,{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(aS,{docs:o.docs,selected:ae,onSelect:M}):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:ae?m?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"})]}):d!=null&&d.content?h.jsx(iS,{content:d.content,currentPath:ae,onNavigate:z,onAnchorClick:ee}):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(y0,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function oS(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const ug=2e3;function cS(i){const s=i.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
57
|
+
${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
58
|
+
`)}
|
|
59
|
+
[End prior conversation]
|
|
60
|
+
|
|
61
|
+
`}function uS(i){const n=i.summary,s=i.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof i=="string"?i:"Query completed.")}const Ry=O.createContext(null);function fS({children:i}){const n=xs(),[s,a]=O.useState(!1),[o,f]=O.useState([]),[d,m]=O.useState(null),[g,y]=O.useState({}),E=O.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??oS(n.pathname)};O.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const T=O.useCallback(()=>a(ee=>!ee),[]),z=O.useCallback(ee=>{y(ee)},[]),M=O.useCallback(()=>{f([]),m(null)},[]),q=O.useCallback(async ee=>{var P;const ne=new Date().toISOString(),fe={id:`user-${Date.now()}`,role:"user",content:ee,timestamp:ne},ae={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:ne,pending:!0};f(V=>[...V,fe,ae]);const k={...w};(P=k.entities)!=null&&P.yamlContent&&k.entities.yamlContent.length>ug&&(k.entities={...k.entities,yamlContent:k.entities.yamlContent.slice(0,ug)+`
|
|
62
|
+
... (truncated)`});const le=`${cS(o.concat(fe))}${ee}`;try{const I=(await Ye("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:le,tags:k.suggestedTags,context:k,wait:!1,direct:!0})})).workflow_id;m(I),f(Z=>Z.map(ie=>ie.id===ae.id?{...ie,workflowId:I}:ie)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var Z;try{const ie=await Ye(`/workflows/${I}/result`),Ae=(Z=ie==null?void 0:ie.result)==null?void 0:Z.data;if(Ae){E.current&&clearInterval(E.current),E.current=null,m(null);const Re=uS(Ae);let Oe;try{Oe=(await Ye(`/workflow-states/${I}/execution`)).duration_ms}catch{}f($=>$.map(re=>re.id===ae.id?{...re,content:Re,timestamp:new Date().toISOString(),pending:!1,durationMs:Oe}:re))}}catch{}},3e3)}catch{f(V=>V.map(I=>I.id===ae.id?{...I,content:"Failed to submit query. Please try again.",pending:!1}:I))}},[o,w]),Q=O.useCallback(async ee=>{const ne=o.find(k=>k.id===ee);if(!(ne!=null&&ne.workflowId)||ne.compilationStatus==="compiling"||ne.compilationStatus==="done")return;const fe=o.indexOf(ne),ae=o.slice(0,fe).reverse().find(k=>k.role==="user");if(ae){f(k=>k.map(X=>X.id===ee?{...X,compilationStatus:"compiling"}:X));try{const k=await Ye("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ae.content,summary:ne.content})}),X=await Ye("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ne.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:k.tool_name,description:k.description,tags:k.tags,app_id:""})});await Ye(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(le=>le.map(P=>P.id===ee?{...P,compilationStatus:"done"}:P))}catch(k){const X=k instanceof Error?k.message:"Compilation failed";f(le=>le.map(P=>P.id===ee?{...P,compilationStatus:"error",compilationError:X}:P))}}},[o]);return h.jsx(Ry.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:T,messages:o,sendMessage:q,pageContext:w,setPageContext:z,activeWorkflowId:d,clearMessages:M,compileMessage:Q},children:i})}function Dy(){const i=O.useContext(Ry);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function hS(){const{helpOpen:i,toggleHelp:n}=Dy();return h.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":i?"Close help":"Ask for help",children:i?h.jsx(Mi,{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)`}})})}const zy=6048e5,dS=864e5,fg=6e4,hg=525600,dg=43200,mg=1440,pg=Symbol.for("constructDateFrom");function bs(i,n){return typeof i=="function"?i(n):i&&typeof i=="object"&&pg in i?i[pg](n):i instanceof Date?new i.constructor(n):new Date(n)}function ln(i,n){return bs(n||i,i)}let mS={};function nl(){return mS}function Za(i,n){var m,g,y,E;const s=nl(),a=(n==null?void 0:n.weekStartsOn)??((g=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=ln(i,n==null?void 0:n.in),f=o.getDay(),d=(f<a?7:0)+f-a;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function Zo(i,n){return Za(i,{...n,weekStartsOn:1})}function qy(i,n){const s=ln(i,n==null?void 0:n.in),a=s.getFullYear(),o=bs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Zo(o),d=bs(s,0);d.setFullYear(a,0,4),d.setHours(0,0,0,0);const m=Zo(d);return s.getTime()>=f.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function Wo(i){const n=ln(i),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+i-+s}function By(i,...n){const s=bs.bind(null,i||n.find(a=>typeof a=="object"));return n.map(s)}function gg(i,n){const s=ln(i,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function pS(i,n,s){const[a,o]=By(s==null?void 0:s.in,i,n),f=gg(a),d=gg(o),m=+f-Wo(f),g=+d-Wo(d);return Math.round((m-g)/dS)}function gS(i,n){const s=qy(i,n),a=bs(i,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Zo(a)}function yS(i,n){const s=+ln(i)-+ln(n);return s<0?-1:s>0?1:s}function bS(i){return bs(i,Date.now())}function xS(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function vS(i){return!(!xS(i)&&typeof i!="number"||isNaN(+ln(i)))}function _S(i){return n=>{const a=(i?Math[i]:Math.trunc)(n);return a===0?0:a}}function wS(i,n){const s=ln(i,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const SS={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ES=(i,n,s)=>{let a;const o=SS[i];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Rf(i){return(n={})=>{const s=n.width?String(n.width):i.defaultWidth;return i.formats[s]||i.formats[i.defaultWidth]}}const AS={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},jS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},OS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},TS={date:Rf({formats:AS,defaultWidth:"full"}),time:Rf({formats:jS,defaultWidth:"full"}),dateTime:Rf({formats:OS,defaultWidth:"full"})},kS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},NS=(i,n,s,a)=>kS[i];function qa(i){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&i.formattingValues){const d=i.defaultFormattingWidth||i.defaultWidth,m=s!=null&&s.width?String(s.width):d;o=i.formattingValues[m]||i.formattingValues[d]}else{const d=i.defaultWidth,m=s!=null&&s.width?String(s.width):i.defaultWidth;o=i.values[m]||i.values[d]}const f=i.argumentCallback?i.argumentCallback(n):n;return o[f]}}const CS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},MS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},RS={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},DS={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},zS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},qS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},BS=(i,n)=>{const s=Number(i),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},US={ordinalNumber:BS,era:qa({values:CS,defaultWidth:"wide"}),quarter:qa({values:MS,defaultWidth:"wide",argumentCallback:i=>i-1}),month:qa({values:RS,defaultWidth:"wide"}),day:qa({values:DS,defaultWidth:"wide"}),dayPeriod:qa({values:zS,defaultWidth:"wide",formattingValues:qS,defaultFormattingWidth:"wide"})};function Ba(i){return(n,s={})=>{const a=s.width,o=a&&i.matchPatterns[a]||i.matchPatterns[i.defaultMatchWidth],f=n.match(o);if(!f)return null;const d=f[0],m=a&&i.parsePatterns[a]||i.parsePatterns[i.defaultParseWidth],g=Array.isArray(m)?HS(m,w=>w.test(d)):LS(m,w=>w.test(d));let y;y=i.valueCallback?i.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(d.length);return{value:y,rest:E}}}function LS(i,n){for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&n(i[s]))return s}function HS(i,n){for(let s=0;s<i.length;s++)if(n(i[s]))return s}function PS(i){return(n,s={})=>{const a=n.match(i.matchPattern);if(!a)return null;const o=a[0],f=n.match(i.parsePattern);if(!f)return null;let d=i.valueCallback?i.valueCallback(f[0]):f[0];d=s.valueCallback?s.valueCallback(d):d;const m=n.slice(o.length);return{value:d,rest:m}}}const $S=/^(\d+)(th|st|nd|rd)?/i,YS=/\d+/i,GS={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},VS={any:[/^b/i,/^(a|c)/i]},FS={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},IS={any:[/1/i,/2/i,/3/i,/4/i]},JS={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},QS={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},XS={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},KS={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ZS={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},WS={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},eE={ordinalNumber:PS({matchPattern:$S,parsePattern:YS,valueCallback:i=>parseInt(i,10)}),era:Ba({matchPatterns:GS,defaultMatchWidth:"wide",parsePatterns:VS,defaultParseWidth:"any"}),quarter:Ba({matchPatterns:FS,defaultMatchWidth:"wide",parsePatterns:IS,defaultParseWidth:"any",valueCallback:i=>i+1}),month:Ba({matchPatterns:JS,defaultMatchWidth:"wide",parsePatterns:QS,defaultParseWidth:"any"}),day:Ba({matchPatterns:XS,defaultMatchWidth:"wide",parsePatterns:KS,defaultParseWidth:"any"}),dayPeriod:Ba({matchPatterns:ZS,defaultMatchWidth:"any",parsePatterns:WS,defaultParseWidth:"any"})},Uy={code:"en-US",formatDistance:ES,formatLong:TS,formatRelative:NS,localize:US,match:eE,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tE(i,n){const s=ln(i,n==null?void 0:n.in);return pS(s,wS(s))+1}function nE(i,n){const s=ln(i,n==null?void 0:n.in),a=+Zo(s)-+gS(s);return Math.round(a/zy)+1}function Ly(i,n){var E,w,T,z;const s=ln(i,n==null?void 0:n.in),a=s.getFullYear(),o=nl(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((z=(T=o.locale)==null?void 0:T.options)==null?void 0:z.firstWeekContainsDate)??1,d=bs((n==null?void 0:n.in)||i,0);d.setFullYear(a+1,0,f),d.setHours(0,0,0,0);const m=Za(d,n),g=bs((n==null?void 0:n.in)||i,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Za(g,n);return+s>=+m?a+1:+s>=+y?a:a-1}function sE(i,n){var m,g,y,E;const s=nl(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=Ly(i,n),f=bs((n==null?void 0:n.in)||i,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Za(f,n)}function iE(i,n){const s=ln(i,n==null?void 0:n.in),a=+Za(s,n)-+sE(s,n);return Math.round(a/zy)+1}function Fe(i,n){const s=i<0?"-":"",a=Math.abs(i).toString().padStart(n,"0");return s+a}const Ks={y(i,n){const s=i.getFullYear(),a=s>0?s:1-s;return Fe(n==="yy"?a%100:a,n.length)},M(i,n){const s=i.getMonth();return n==="M"?String(s+1):Fe(s+1,2)},d(i,n){return Fe(i.getDate(),n.length)},a(i,n){const s=i.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(i,n){return Fe(i.getHours()%12||12,n.length)},H(i,n){return Fe(i.getHours(),n.length)},m(i,n){return Fe(i.getMinutes(),n.length)},s(i,n){return Fe(i.getSeconds(),n.length)},S(i,n){const s=n.length,a=i.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Fe(o,n.length)}},_r={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},yg={G:function(i,n,s){const a=i.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(i,n,s){if(n==="yo"){const a=i.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Ks.y(i,n)},Y:function(i,n,s,a){const o=Ly(i,a),f=o>0?o:1-o;if(n==="YY"){const d=f%100;return Fe(d,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Fe(f,n.length)},R:function(i,n){const s=qy(i);return Fe(s,n.length)},u:function(i,n){const s=i.getFullYear();return Fe(s,n.length)},Q:function(i,n,s){const a=Math.ceil((i.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Fe(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(i,n,s){const a=Math.ceil((i.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Fe(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(i,n,s){const a=i.getMonth();switch(n){case"M":case"MM":return Ks.M(i,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(i,n,s){const a=i.getMonth();switch(n){case"L":return String(a+1);case"LL":return Fe(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(i,n,s,a){const o=iE(i,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Fe(o,n.length)},I:function(i,n,s){const a=nE(i);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Fe(a,n.length)},d:function(i,n,s){return n==="do"?s.ordinalNumber(i.getDate(),{unit:"date"}):Ks.d(i,n)},D:function(i,n,s){const a=tE(i);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Fe(a,n.length)},E:function(i,n,s){const a=i.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(i,n,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Fe(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(i,n,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Fe(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(i,n,s){const a=i.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Fe(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(i,n,s){const o=i.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(i,n,s){const a=i.getHours();let o;switch(a===12?o=_r.noon:a===0?o=_r.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(i,n,s){const a=i.getHours();let o;switch(a>=17?o=_r.evening:a>=12?o=_r.afternoon:a>=4?o=_r.morning:o=_r.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(i,n,s){if(n==="ho"){let a=i.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Ks.h(i,n)},H:function(i,n,s){return n==="Ho"?s.ordinalNumber(i.getHours(),{unit:"hour"}):Ks.H(i,n)},K:function(i,n,s){const a=i.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Fe(a,n.length)},k:function(i,n,s){let a=i.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Fe(a,n.length)},m:function(i,n,s){return n==="mo"?s.ordinalNumber(i.getMinutes(),{unit:"minute"}):Ks.m(i,n)},s:function(i,n,s){return n==="so"?s.ordinalNumber(i.getSeconds(),{unit:"second"}):Ks.s(i,n)},S:function(i,n){return Ks.S(i,n)},X:function(i,n,s){const a=i.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return xg(a);case"XXXX":case"XX":return ki(a);case"XXXXX":case"XXX":default:return ki(a,":")}},x:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"x":return xg(a);case"xxxx":case"xx":return ki(a);case"xxxxx":case"xxx":default:return ki(a,":")}},O:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+bg(a,":");case"OOOO":default:return"GMT"+ki(a,":")}},z:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+bg(a,":");case"zzzz":default:return"GMT"+ki(a,":")}},t:function(i,n,s){const a=Math.trunc(+i/1e3);return Fe(a,n.length)},T:function(i,n,s){return Fe(+i,n.length)}};function bg(i,n=""){const s=i>0?"-":"+",a=Math.abs(i),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Fe(f,2)}function xg(i,n){return i%60===0?(i>0?"-":"+")+Fe(Math.abs(i)/60,2):ki(i,n)}function ki(i,n=""){const s=i>0?"-":"+",a=Math.abs(i),o=Fe(Math.trunc(a/60),2),f=Fe(a%60,2);return s+o+n+f}const vg=(i,n)=>{switch(i){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},Hy=(i,n)=>{switch(i){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},rE=(i,n)=>{const s=i.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return vg(i,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",vg(a,n)).replace("{{time}}",Hy(o,n))},aE={p:Hy,P:rE},lE=/^D+$/,oE=/^Y+$/,cE=["D","DD","YY","YYYY"];function uE(i){return lE.test(i)}function fE(i){return oE.test(i)}function hE(i,n,s){const a=dE(i,n,s);if(console.warn(a),cE.includes(i))throw new RangeError(a)}function dE(i,n,s){const a=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const mE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,pE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,gE=/^'([^]*?)'?$/,yE=/''/g,bE=/[a-zA-Z]/;function Oh(i,n,s){var E,w,T,z;const a=nl(),o=a.locale??Uy,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,d=a.weekStartsOn??((z=(T=a.locale)==null?void 0:T.options)==null?void 0:z.weekStartsOn)??0,m=ln(i,s==null?void 0:s.in);if(!vS(m))throw new RangeError("Invalid time value");let g=n.match(pE).map(M=>{const q=M[0];if(q==="p"||q==="P"){const Q=aE[q];return Q(M,o.formatLong)}return M}).join("").match(mE).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const q=M[0];if(q==="'")return{isToken:!1,value:xE(M)};if(yg[q])return{isToken:!0,value:M};if(q.match(bE))throw new RangeError("Format string contains an unescaped latin alphabet character `"+q+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(m,g));const y={firstWeekContainsDate:f,weekStartsOn:d,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const q=M.value;(fE(q)||uE(q))&&hE(q,n,String(i));const Q=yg[q[0]];return Q(m,q,o.localize,y)}).join("")}function xE(i){const n=i.match(gE);return n?n[1].replace(yE,"'"):i}function vE(i,n,s){const a=nl(),o=(s==null?void 0:s.locale)??a.locale??Uy,f=yS(i,n);if(isNaN(f))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[m,g]=By(s==null?void 0:s.in,...f>0?[n,i]:[i,n]),y=_S((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-m.getTime(),w=E/fg,T=Wo(g)-Wo(m),z=(E-T)/fg,M=s==null?void 0:s.unit;let q;if(M?q=M:w<1?q="second":w<60?q="minute":w<mg?q="hour":z<dg?q="day":z<hg?q="month":q="year",q==="second"){const Q=y(E/1e3);return o.formatDistance("xSeconds",Q,d)}else if(q==="minute"){const Q=y(w);return o.formatDistance("xMinutes",Q,d)}else if(q==="hour"){const Q=y(w/60);return o.formatDistance("xHours",Q,d)}else if(q==="day"){const Q=y(z/mg);return o.formatDistance("xDays",Q,d)}else if(q==="month"){const Q=y(z/dg);return Q===12&&M!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",Q,d)}else{const Q=y(z/hg);return o.formatDistance("xYears",Q,d)}}function _E(i,n){return vE(i,bS(i),n)}function t3(i){return i.toLocaleString()}function n3(i){return i>=1e9?`${(i/1e9).toFixed(1).replace(/\.0$/,"")}B`:i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}M`:i>=1e4?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}K`:i.toLocaleString()}function wE(i){const n=new Date(i);return n.getTime()>Date.now()?"just now":_E(n,{addSuffix:!0})}function s3(i){const n=Date.now()-new Date(i).getTime();if(n<0)return"now";const s=Math.floor(n/1e3);if(s<60)return`${s}s`;const a=Math.floor(s/60);if(a<60)return`${a}m`;const o=Math.floor(a/60);if(o<24)return`${o}h`;const f=Math.floor(o/24);return f<7?`${f}d`:f<30?`${Math.floor(f/7)}w`:f<365?`${Math.floor(f/30)}mo`:`${Math.floor(f/365)}y`}function i3(i){return i<=0?"Expired":Th(i)}function SE(i){return i==null?"--":Th(i)}function r3(i){return i?Oh(new Date(i),"MMM d, yyyy h:mm a"):"--"}function Th(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const d=i/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const n=Math.floor(i/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function a3(i,n){const s=new Date(i).getTime(),a=n?new Date(n).getTime():Date.now();return Th(a-s)}function Py({options:i,children:n,className:s=""}){const[a,o]=O.useState(!1),[f,d]=O.useState(null),[m,g]=O.useState(null),y=O.useRef(null),E=O.useRef(void 0),w=O.useRef(void 0),T=220,z=O.useCallback(()=>{if(!y.current)return;const ee=y.current.getBoundingClientRect(),ne=window.innerWidth-T-8,fe=Math.max(8,Math.min(ee.left,ne));g({top:ee.bottom+4,left:fe})},[]),M=O.useCallback(async(ee,ne)=>{try{await navigator.clipboard.writeText(ee),d(ne),clearTimeout(E.current),E.current=setTimeout(()=>d(null),1200)}catch{}},[]),q=O.useCallback(()=>{clearTimeout(w.current),z(),o(!0)},[z]),Q=O.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return O.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),h.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:q,onMouseLeave:Q,children:[n,a&&m&&Tg.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:m.top,left:m.left},onMouseEnter:q,onMouseLeave:Q,children:i.map(ee=>h.jsxs("button",{onClick:ne=>{ne.stopPropagation(),M(ee.value,ee.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-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ee.label}),h.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===ee.label?"✓":ee.value})]},ee.label))}),document.body)]})}function EE(i,n){const s=new Date(i);switch(n){case"relative":return wE(i);case"datetime":return Oh(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function AE(i){const n=new Date(i);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:Oh(n,"MMM d, yyyy h:mm:ss a")}]}function jE({date:i,format:n="relative",className:s=""}){const[,a]=O.useState(0);O.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(d=>d+1),3e4);return()=>clearInterval(f)},[n]);const o=O.useMemo(()=>AE(i),[i]);return h.jsx(Py,{options:o,children:h.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${s}`,children:EE(i,n)})})}function OE({ms:i,className:n=""}){const s=SE(i),a=O.useMemo(()=>i==null?[]:[{label:"ms",value:String(i)},{label:"sec",value:`${(i/1e3).toFixed(3)}s`},{label:"text",value:s}],[i,s]);return i==null?h.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):h.jsx(Py,{options:a,children:h.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const TE=["sm","md","lg","full"],_g={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"},wg={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function kE({which:i}){const n="stroke-current";switch(i){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:n,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:n,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:n,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:n,strokeWidth:"1.5"})})}}function NE({msg:i}){const[n,s]=O.useState(0);O.useEffect(()=>{const d=new Date(i.timestamp).getTime(),m=()=>s(Math.floor((Date.now()-d)/1e3));m();const g=setInterval(m,1e3);return()=>clearInterval(g)},[i.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}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:f})]}),i.workflowId&&h.jsxs(Ni,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[h.jsx(rh,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function CE({msg:i,compileMessage:n}){const s=i.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(jE,{date:i.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),i.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),h.jsx(OE,{ms:i.durationMs,className:"!text-[9px] text-text-muted/50"})]}),i.workflowId&&h.jsx(Ni,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(rh,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&i.workflowId&&!i.pending&&h.jsx("button",{onClick:()=>n(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(jv,{className:`w-2.5 h-2.5 ${i.compilationStatus==="done"?"text-status-success":i.compilationStatus==="error"?"text-status-error":i.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function ME(){const{helpOpen:i,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:d,compileMessage:m}=Dy(),[g,y]=O.useState(""),[E,w]=O.useState("md"),[T,z]=O.useState(!0),M=O.useRef(null),q=O.useRef(null);if(O.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),O.useEffect(()=>{i&&q.current&&q.current.focus()},[i]),O.useEffect(()=>{if(!i)return;const k=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i,E,n]),!i)return null;const Q=()=>{const k=g.trim();!k||f||(a(k),y(""),q.current&&(q.current.style.height="auto"))},ee=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),Q())},ne=E==="full",fe=o.page.replace(/-/g," "),ae=ne?{}:{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 ${ne?_g.full:`right-6 ${_g[E]}`} ${T?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ae,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!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 ${T?"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-[10px] text-text-tertiary truncate",children:fe})]}),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:TE.map(k=>h.jsx("button",{onClick:()=>w(k),className:`p-1 rounded transition-colors ${k===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":k===E,"aria-label":wg[k],title:wg[k],children:h.jsx(kE,{which:k})},k))}),s.length>0&&h.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(Ov,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Mi,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${T?"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(k=>h.jsxs("div",{className:`text-xs leading-relaxed ${k.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 ${k.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:k.pending?h.jsx(NE,{msg:k}):k.role==="assistant"?h.jsx(jh,{content:k.content}):k.content}),!k.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(CE,{msg:k,compileMessage:m})})]},k.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${T?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:q,value:g,onChange:k=>{y(k.target.value);const X=k.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:ee,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),h.jsx("button",{onClick:Q,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(Tv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function RE(){var Q;const{isBuilder:i,isOps:n,viewAs:s}=yy(),{data:a}=Br(),o=my(),f=o!==null?o:!!((Q=a==null?void 0:a.ai)!=null&&Q.enabled),{collapsed:d,toggle:m}=xy(),[g,y]=O.useState(!1),[E,w]=O.useState(!1),[T,z]=O.useState(()=>window.location.hash.startsWith("#docs")),M=xs(),q=O.useRef(null);return O.useEffect(()=>{const ee=q.current;ee&&(ee.classList.remove("animate-page-in"),ee.offsetWidth,ee.classList.add("animate-page-in"))},[M.pathname]),O.useEffect(()=>{const ee=()=>{window.location.hash.startsWith("#docs")&&z(!0)};return window.addEventListener("hashchange",ee),()=>window.removeEventListener("hashchange",ee)},[]),h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(v2,{onToggleEventFeed:()=>y(ee=>!ee),onToggleDocs:()=>z(ee=>!ee)}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsxs("aside",{className:`${d?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[h.jsx(j2,{aiEnabled:f,isBuilder:i,isOps:n,viewAs:s}),i&&h.jsx(O2,{}),i&&f&&h.jsx(k2,{}),i&&h.jsx(C2,{}),(i||n)&&h.jsx(M2,{isBuilder:i,isOps:n})]}),h.jsx("button",{onClick:m,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${d?"flex justify-center":"flex items-center px-7"}`,"aria-label":d?"Expand sidebar":"Collapse sidebar",children:d?h.jsx(kv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(Nv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!d&&(a==null?void 0:a.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-[10px] leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${a.environment.longTailVersion} · HotMesh v${a.environment.hotmeshVersion} · Node ${a.environment.nodeVersion} · ${a.environment.nodeEnv}`,children:["long-tail v",a.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",a.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 overflow-y-auto",children:h.jsx("div",{ref:q,className:"w-full px-10 py-10 pb-16 animate-page-in h-full flex flex-col",children:h.jsx(jr,{})})})]}),h.jsx(K2,{open:g,onToggle:()=>y(ee=>!ee),configOpen:E,onToggleConfig:()=>w(ee=>!ee)}),h.jsx(lS,{open:T,onClose:()=>{z(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),f&&h.jsx(hS,{}),f&&h.jsx(ME,{})]})}function DE(){const{isAuthenticated:i}=ai(),n=xs();return i?h.jsx(Xw,{children:h.jsx(fS,{children:h.jsx(RE,{})})}):h.jsx($n,{to:"/login",state:{from:n.pathname},replace:!0})}function $y({provider:i,className:n="w-5 h-5"}){switch(i){case"google":return h.jsxs("svg",{className:n,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:n,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:n,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:n,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:n,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 zE(){return Ye("/auth/oauth/providers")}async function qE(i,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Ye(`/auth/oauth/connections/${i}${s}`,{method:"DELETE"})}function l3(){return Sn({queryKey:["oauth-connections"],queryFn:()=>Ye("/auth/oauth/connections")})}function o3(){const i=on();return En({mutationFn:({provider:n,label:s})=>qE(n,s),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function BE(){var le;const{login:i,isAuthenticated:n}=ai(),s=kg(),a=xs(),o=new URLSearchParams(a.search),f=o.get("token"),d=o.get("error"),m=((le=a.state)==null?void 0:le.from)??o.get("returnTo")??"/",g=O.useRef(!1);f&&!g.current&&(g.current=!0,i(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=O.useState(""),[w,T]=O.useState(""),[z,M]=O.useState(d||""),[q,Q]=O.useState(!1),[ee,ne]=O.useState(!!f),[fe,ae]=O.useState([]),k=O.useRef(!1);if(O.useEffect(()=>{f||k.current||(k.current=!0,(async()=>{var P,V,I,Z;try{const ie=await fetch(`${Vt}/api/settings`);if(!ie.ok)return;const Ae=await ie.json();if(!((P=Ae.auth)!=null&&P.sso))return;const Re=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!Re.ok){M("Host authentication required — please log in to your organization first");return}const Oe=await Re.json();Oe.token&&((V=Ae.auth)!=null&&V.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",Ae.auth.ssoLogoutUrl),ne(!0),i(Oe.token,void 0,{displayName:(I=Oe.user)==null?void 0:I.display_name,username:(Z=Oe.user)==null?void 0:Z.external_id}))}catch{}})())},[]),O.useEffect(()=>{f||zE().then(ae).catch(()=>{})},[]),O.useEffect(()=>{if(!ee)return;const P=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(P)},[ee]),n&&!ee)return h.jsx($n,{to:m,replace:!0});const X=async P=>{var V,I;if(P.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}Q(!0);try{const Z=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ie=await Z.json();if(!Z.ok){M(ie.error||"Login failed");return}ne(!0),i(ie.token,{username:y.trim(),password:w},{displayName:(V=ie.user)==null?void 0:V.display_name,username:(I=ie.user)==null?void 0:I.external_id})}catch{M("Unable to connect to server")}finally{Q(!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 ${ee?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Sh,{size:"lg",hideLabel:ee})}),h.jsxs("form",{onSubmit:X,className:`space-y-5 transition-opacity duration-300 ${ee?"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:y,onChange:P=>E(P.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ee,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:w,onChange:P=>T(P.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),z&&h.jsx("p",{className:"text-sm text-status-error",children:z}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:q||ee,children:q?"Signing in...":"Sign In"}),fe.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:fe.filter(P=>P.provider!=="anthropic").map(P=>h.jsxs("a",{href:`${Vt}/api/auth/oauth/${P.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx($y,{provider:P.provider}),"Sign in with ",P.name]},P.provider))})]})]})]})})}function Sg(){const{isAuthenticated:i}=ai(),n=kg(),s=xs(),a=new URLSearchParams(s.search),o=a.get("state")||"";O.useEffect(()=>{i||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[i]);const[f,d]=O.useState(""),[m,g]=O.useState(a.get("label")||"default"),[y,E]=O.useState(""),[w,T]=O.useState(!1),z=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),q=Q=>{Q.preventDefault();const ee=f.trim();if(!ee){E("A token or API key is required");return}if(!ee.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}T(!0),E("");const ne=`${Vt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ee)}&state=${encodeURIComponent(o)}`;window.location.href=ne};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(Sh,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx($y,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"text-lg font-semibold text-text-primary",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:q,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:f,onChange:Q=>d(Q.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),z&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&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:m,onChange:Q=>g(Q.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").'})]}),y&&h.jsx("p",{className:"text-sm text-status-error",children:y}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"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-[11px]",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 Ua({roleTypes:i,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=ai();return a?h.jsx(jr,{}):i&&i.some(d=>f(d))?h.jsx(jr,{}):n&&n.some(d=>o(d))?h.jsx(jr,{}):h.jsx($n,{to:s,replace:!0})}function UE({redirectTo:i="/"}){var a;const{data:n,isLoading:s}=Br();return s||!n?null:(a=n.ai)!=null&&a.enabled?h.jsx(jr,{}):h.jsx($n,{to:i,replace:!0})}function LE({flag:i,redirectTo:n="/"}){var o;const{data:s,isLoading:a}=Br();return a||!s?null:((o=s.features)==null?void 0:o[i])===!1?h.jsx($n,{to:n,replace:!0}):h.jsx(jr,{})}const HE=O.lazy(()=>Ee(()=>import("./ProcessesListPage-kyRO3E9d.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(i=>({default:i.ProcessesListPage}))),PE=O.lazy(()=>Ee(()=>import("./ProcessDetailPage-BWVFB-nL.js"),__vite__mapDeps([18,1,2,4,19,15,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),$E=O.lazy(()=>Ee(()=>import("./McpOverview-DIenRt0e.js"),__vite__mapDeps([24,1,25,26,27,28,14,15,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),YE=O.lazy(()=>Ee(()=>import("./McpRunsPage-BWe6WVzw.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,15,32,14,13,12,16,33]),import.meta.url).then(i=>({default:i.McpRunsPage}))),GE=O.lazy(()=>Ee(()=>import("./McpRunDetailPage-DDiOtG5r.js"),__vite__mapDeps([34,1,26,20,14,15,35,6,36,37,13,38,39,16]),import.meta.url).then(i=>({default:i.McpRunDetailPage}))),VE=O.lazy(()=>Ee(()=>import("./McpQueryPage-CkT4A2c5.js"),__vite__mapDeps([40,1,14,15,9,10,13,12,16,8,11,32,17,33,5,6,4,41]),import.meta.url).then(i=>({default:i.McpQueryPage}))),FE=O.lazy(()=>Ee(()=>import("./McpQueryDetailPage-CxAR4Bpw.js"),__vite__mapDeps([42,1,14,15,20,41,6,27,4,43,36,26,3,2,44,45,46,47,48,49,35,50,38,39]),import.meta.url).then(i=>({default:i.McpQueryDetailPage}))),IE=O.lazy(()=>Ee(()=>import("./EscalationsOverview-2VRjFxPV.js"),__vite__mapDeps([51,1,4,14,15,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),JE=O.lazy(()=>Ee(()=>import("./AvailableEscalationsPage-qRf3tBYi.js"),__vite__mapDeps([52,1,6,4,53,54,55,56,20,57,15,5,7,8,9,10,12,14,23,58,13,59,21,17,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),QE=O.lazy(()=>Ee(()=>import("./OperatorDashboard-CVq7V7hE.js"),__vite__mapDeps([60,1,4,56,5,6,7,8,9,10,14,15,12,33,58,13,59,21,17,57,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),XE=O.lazy(()=>Ee(()=>import("./index-DWXhbO4b.js"),__vite__mapDeps([61,1,53,54,6,55,56,14,15,16,57,3,4,62,20,21,35,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),KE=O.lazy(()=>Ee(()=>import("./WorkflowsOverview-BFs-ZSTn.js"),__vite__mapDeps([63,1,3,4,14,15,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),ZE=O.lazy(()=>Ee(()=>import("./index-BFh7zbQF.js"),__vite__mapDeps([64,1,3,14,15,13,17,65,47,48,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),WE=O.lazy(()=>Ee(()=>import("./index-BFh7zbQF.js"),__vite__mapDeps([64,1,3,14,15,13,17,65,47,48,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),eA=O.lazy(()=>Ee(()=>import("./WorkflowsDashboard-DGtMG5vL.js"),__vite__mapDeps([66,1,32,3,31,28,6,4,5,8,9,10,17,15,14,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"durable"})}))),tA=O.lazy(()=>Ee(()=>import("./WorkflowsDashboard-DGtMG5vL.js"),__vite__mapDeps([66,1,32,3,31,28,6,4,5,8,9,10,17,15,14,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"all"})}))),nA=O.lazy(()=>Ee(()=>import("./YamlWorkflowsPage-0Moxrj_c.js"),__vite__mapDeps([67,1,27,5,6,14,15,13,10,49,65,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),sA=O.lazy(()=>Ee(()=>import("./GraphInvokePage-B6qAC8zt.js"),__vite__mapDeps([68,1,27,14,15,44,46,47,48,45,6,49,65]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),iA=O.lazy(()=>Ee(()=>import("./YamlWorkflowDetailPage-6FTLoVfO.js"),__vite__mapDeps([69,1,27,20,65,15,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),rA=O.lazy(()=>Ee(()=>import("./TasksListPage-PKscNTJs.js"),__vite__mapDeps([70,1,2,3,5,6,9,10,20,59,50,12,13,14,15,17]),import.meta.url).then(i=>({default:i.TasksListPage}))),aA=O.lazy(()=>Ee(()=>import("./TaskDetailPage-BVlCa-PR.js"),__vite__mapDeps([71,1,2,20,59,14,15,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),Eg=O.lazy(()=>Ee(()=>import("./WorkflowExecutionPage-DtC-71vO.js"),__vite__mapDeps([72,1,3,4,37,13,38,20,6,39,15,2,14,36,16,62,35]),import.meta.url).then(i=>({default:i.WorkflowExecutionPage}))),lA=O.lazy(()=>Ee(()=>import("./AdminDashboard-DmQG0fUK.js"),__vite__mapDeps([73,1,2,4,25,19,15,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),oA=O.lazy(()=>Ee(()=>import("./index-CTTxpoEl.js"),__vite__mapDeps([74,1,3,9,10,13,33,5,6,14,15,75,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),cA=O.lazy(()=>Ee(()=>import("./index-3ewF-RsR.js"),__vite__mapDeps([76,1,3,13,77,54,6,21,15,17,14,56,47,48,65]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),Ag=O.lazy(()=>Ee(()=>import("./index-3ewF-RsR.js"),__vite__mapDeps([76,1,3,13,77,54,6,21,15,17,14,56,47,48,65]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),uA=O.lazy(()=>Ee(()=>import("./index-BYpOpKoM.js"),__vite__mapDeps([78,1,25,10,77,54,6,14,15,13,12,5,79,46,47,48,49,45,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),jg=O.lazy(()=>Ee(()=>import("./index-Fc1qNrqI.js"),__vite__mapDeps([80,1,25,14,15,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),fA=O.lazy(()=>Ee(()=>import("./index-JQCy1mnu.js"),__vite__mapDeps([81,1,23,5,6,9,10,12,13,77,54,33,14,15,21,48,11,56,50]),import.meta.url).then(i=>({default:i.UsersPage}))),hA=O.lazy(()=>Ee(()=>import("./RolesPage-tT21PIEb.js"),__vite__mapDeps([82,1,56,14,15,54,6]),import.meta.url).then(i=>({default:i.RolesPage}))),dA=O.lazy(()=>Ee(()=>import("./RoleDetailPage-DrSlAQUQ.js"),__vite__mapDeps([83,1,56,77,54,6,23,15]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),mA=O.lazy(()=>Ee(()=>import("./EscalationSchemaPage-9NY4Q4ku.js"),__vite__mapDeps([84,1,56,15,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),pA=O.lazy(()=>Ee(()=>import("./EscalationListSchemaPage-BEi89A7y.js"),__vite__mapDeps([85,1,56,15,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),gA=O.lazy(()=>Ee(()=>import("./index-p85Oqfqc.js"),__vite__mapDeps([86,1,14,15,54,6,55]),import.meta.url).then(i=>({default:i.MaintenancePage}))),yA=O.lazy(()=>Ee(()=>import("./OperationsPage-CzJx-zxj.js").then(i=>i.O),__vite__mapDeps([87,1,56,4,14,15,6]),import.meta.url).then(i=>({default:i.OperationsPage}))),bA=O.lazy(()=>Ee(()=>import("./index-Dq5RU7sm.js"),__vite__mapDeps([88,1,19,15,13,5,6,31,28,54,36,75,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),xA=O.lazy(()=>Ee(()=>import("./index-Be9bw5cd.js"),__vite__mapDeps([89,1,62,15,39,5,6,31,28,8,9,10,12,13,14,16]),import.meta.url).then(i=>({default:i.StreamMessagesPage}))),vA=O.lazy(()=>Ee(()=>import("./CredentialsPage-CjBiPahB.js"),__vite__mapDeps([90,1,14,15,50,77,54,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),_A=O.lazy(()=>Ee(()=>import("./index-IHOuIqlt.js"),__vite__mapDeps([91,1,6,14,15,13,16,8,10,92,50]),import.meta.url).then(i=>({default:i.FilesPage}))),wA=O.lazy(()=>Ee(()=>import("./index-C42kzl9D.js"),__vite__mapDeps([93,1,14,15,13,16,12,10,92,50,94,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),SA=O.lazy(()=>Ee(()=>import("./HomePage-DDyQOu57.js"),__vite__mapDeps([95,1,56,3,26,28,4,21,15,17,16,87,14,6]),import.meta.url).then(i=>({default:i.HomePage}))),EA=O.lazy(()=>Ee(()=>import("./AgentsPage-GEYMgmez.js"),__vite__mapDeps([96,1,97,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(i=>({default:i.AgentsPage}))),AA=O.lazy(()=>Ee(()=>import("./AgentDetailPage-Cdinl7bx.js"),__vite__mapDeps([98,1,97,99,15,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),Og=O.lazy(()=>Ee(()=>import("./AgentConfigPage-BZ8g7Ml8.js"),__vite__mapDeps([100,1,97,99,15,14,94,46,47,48,3,27,101,102,17,6]),import.meta.url).then(i=>({default:i.AgentConfigPage}))),jA=O.lazy(()=>Ee(()=>import("./CapabilitiesPage-ARIQzRiq.js"),__vite__mapDeps([103,1,101,79,25,46,47,48,15,49,6,45,14,13]),import.meta.url).then(i=>({default:i.CapabilitiesPage}))),OA=O.lazy(()=>Ee(()=>import("./TopicsPage-bFjJUYmO.js"),__vite__mapDeps([104,1,102,14,15,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),TA=O.lazy(()=>Ee(()=>import("./TopicDetailPage-BaL3m3yb.js"),__vite__mapDeps([105,1,102,16,15,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function kA(){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 we({children:i}){return h.jsx(O.Suspense,{fallback:h.jsx(kA,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Yy=new ev({defaultOptions:{queries:{staleTime:1e4,retry:(i,n)=>n instanceof Error&&n.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Yy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",n=`${i}/login`;if(window.location.pathname!==n){const s=window.location.pathname+window.location.search,a=i&&s.startsWith(i)?s.slice(i.length)||"/":s;window.location.href=`${n}?returnTo=${encodeURIComponent(a)}`}});const NA=sv([{path:"/login",element:h.jsx(BE,{})},{path:"/connect/anthropic",element:h.jsx(Sg,{})},{path:"/connect/:provider",element:h.jsx(Sg,{})},{path:"/",element:h.jsx(DE,{}),children:[{index:!0,element:h.jsx(we,{children:h.jsx(SA,{})})},{path:"processes/all",element:h.jsx(we,{children:h.jsx(HE,{})})},{path:"processes/detail/:originId",element:h.jsx(we,{children:h.jsx(PE,{})})},{path:"credentials",element:h.jsx(we,{children:h.jsx(vA,{})})},{path:"connections",element:h.jsx($n,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(we,{children:h.jsx(IE,{})})},{path:"escalations/available",element:h.jsx(we,{children:h.jsx(JE,{})})},{path:"escalations/queue",element:h.jsx(we,{children:h.jsx(QE,{})})},{path:"escalations/detail/:id",element:h.jsx(we,{children:h.jsx(XE,{})})},{path:"capabilities",element:h.jsx(we,{children:h.jsx(jA,{})})},{path:"agents",element:h.jsx(we,{children:h.jsx(EA,{})})},{path:"agents/new",element:h.jsx(we,{children:h.jsx(Og,{})})},{path:"agents/:id",element:h.jsx(we,{children:h.jsx(AA,{})})},{path:"agents/:id/edit",element:h.jsx(we,{children:h.jsx(Og,{})})},{path:"topics",element:h.jsx(we,{children:h.jsx(OA,{})})},{path:"topics/:topic",element:h.jsx(we,{children:h.jsx(TA,{})})},{element:h.jsx(Ua,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(we,{children:h.jsx(KE,{})})},{path:"workflows/executions",element:h.jsx(we,{children:h.jsx(tA,{})})},{path:"workflows/durable/executions",element:h.jsx(we,{children:h.jsx(eA,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(we,{children:h.jsx(Eg,{})})},{path:"workflows/tasks",element:h.jsx(we,{children:h.jsx(rA,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(we,{children:h.jsx(aA,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(we,{children:h.jsx(Eg,{})})},{path:"workflows/start",element:h.jsx(we,{children:h.jsx(ZE,{})})},{path:"workflows/durable/invoke",element:h.jsx(we,{children:h.jsx(WE,{})})},{path:"workflows/cron",element:h.jsx($n,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(we,{children:h.jsx(oA,{})})},{path:"workflows/registry",element:h.jsx(we,{children:h.jsx(cA,{})})},{path:"workflows/registry/new",element:h.jsx(we,{children:h.jsx(Ag,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(we,{children:h.jsx(Ag,{})})}]},{element:h.jsx(Ua,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(we,{children:h.jsx(nA,{})})},{path:"mcp/workflows/invoke",element:h.jsx(we,{children:h.jsx(sA,{})})},{path:"mcp/workflows/:id",element:h.jsx(we,{children:h.jsx(iA,{})})},{path:"mcp/executions",element:h.jsx(we,{children:h.jsx(YE,{})})},{path:"mcp/executions/:jobId",element:h.jsx(we,{children:h.jsx(GE,{})})},{path:"files",element:h.jsx(we,{children:h.jsx(_A,{})})},{path:"knowledge",element:h.jsx(we,{children:h.jsx(wA,{})})},{element:h.jsx(UE,{}),children:[{path:"mcp",element:h.jsx(we,{children:h.jsx($E,{})})},{path:"mcp/queries",element:h.jsx(we,{children:h.jsx(VE,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(we,{children:h.jsx(FE,{})})},{path:"mcp/tools",element:h.jsx($n,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(we,{children:h.jsx(uA,{})})},{path:"mcp/servers/new",element:h.jsx(we,{children:h.jsx(jg,{})})},{path:"mcp/servers/:serverId",element:h.jsx(we,{children:h.jsx(jg,{})})}]}]},{element:h.jsx(Ua,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"operations",element:h.jsx(we,{children:h.jsx(yA,{})})}]},{element:h.jsx(Ua,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(we,{children:h.jsx(lA,{})})},{path:"admin/users",element:h.jsx(we,{children:h.jsx(fA,{})})},{path:"admin/escalation-chains",element:h.jsx($n,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(we,{children:h.jsx(hA,{})})},{path:"admin/roles/:role",element:h.jsx(we,{children:h.jsx(dA,{})})},{path:"admin/roles/:role/schema",element:h.jsx(we,{children:h.jsx(mA,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(we,{children:h.jsx(pA,{})})}]},{element:h.jsx(Ua,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx($n,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(LE,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(we,{children:h.jsx(gA,{})})}]},{path:"admin/controlplane",element:h.jsx(we,{children:h.jsx(bA,{})})},{path:"admin/streams",element:h.jsx(we,{children:h.jsx(xA,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function CA(){return h.jsx(tv,{client:Yy,children:h.jsx(Lv,{children:h.jsx(Yw,{children:h.jsx(iv,{router:NA})})})})}Ey(Sy());zv.createRoot(document.getElementById("root")).render(h.jsx(O.StrictMode,{children:h.jsx(CA,{})}));export{o3 as $,Th as A,$A as B,Ah as C,OE as D,FA as E,Ny as F,ZA as G,Oh as H,Py as I,J2 as J,i3 as K,t3 as L,jh as M,$_ as N,Vt as O,zg as P,BA as Q,c2 as R,q2 as S,g2 as T,e3 as U,Mo as V,$a as W,wr as X,vr as Y,p2 as Z,l3 as _,a3 as a,$y as a0,n3 as a1,jE as b,G_ as c,Ye as d,PA as e,SE as f,YA as g,VA as h,UA as i,Kw as j,my as k,ai as l,HA as m,yy as n,IA as o,JA as p,QA as q,XA as r,KA as s,WA as t,Br as u,LA as v,Zw as w,GA as x,r3 as y,s3 as z};
|
|
63
|
+
//# sourceMappingURL=index-DYcP4jyl.js.map
|